From 81bcef887e5432989915a91f6c85de128b9f7aa7 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 20 Oct 2023 17:56:18 +0000 Subject: [PATCH] CodeGen from PR 26325 in Azure/azure-rest-api-specs Merge 04c8aefe9907f0a8ab5c30608ceedbc49955caa1 into e6d90862a97c4f04f0c26a8869602bbfd8b10280 --- .../Azure.ResourceManager.Dashboard.sln | 65 ++ .../CHANGELOG.md | 17 + .../Directory.Build.props | 6 + .../Azure.ResourceManager.Dashboard/README.md | 80 ++ ...esourceManager.Dashboard.netstandard2.0.cs | 562 +++++++++++ .../assets.json | 6 + ...e.ResourceManager.Dashboard.Samples.csproj | 10 + ...oardPrivateEndpointConnectionCollection.cs | 203 ++++ ...hboardPrivateEndpointConnectionResource.cs | 114 +++ .../Sample_DashboardPrivateLinkResource.cs | 51 + ..._DashboardPrivateLinkResourceCollection.cs | 166 ++++ .../Sample_ManagedGrafanaCollection.cs | 244 +++++ .../Samples/Sample_ManagedGrafanaResource.cs | 268 +++++ ...e_ManagedPrivateEndpointModelCollection.cs | 213 ++++ ...ple_ManagedPrivateEndpointModelResource.cs | 121 +++ .../Azure.ResourceManager.Dashboard.csproj | 8 + .../src/Generated/ArmDashboardModelFactory.cs | 191 ++++ ...oardPrivateEndpointConnectionCollection.cs | 415 ++++++++ .../DashboardPrivateEndpointConnectionData.cs | 60 ++ ...hboardPrivateEndpointConnectionResource.cs | 297 ++++++ .../Generated/DashboardPrivateLinkResource.cs | 153 +++ .../DashboardPrivateLinkResourceCollection.cs | 333 +++++++ .../DashboardPrivateLinkResourceData.cs | 54 + .../Extensions/DashboardExtensions.cs | 226 +++++ .../ResourceGroupResourceExtensionClient.cs | 41 + .../SubscriptionResourceExtensionClient.cs | 88 ++ .../DashboardArmOperation.cs | 70 ++ .../DashboardArmOperationOfT.cs | 76 ++ ...rivateEndpointConnectionOperationSource.cs | 40 + .../ManagedGrafanaOperationSource.cs | 40 + ...agedPrivateEndpointModelOperationSource.cs | 40 + .../src/Generated/ManagedGrafanaCollection.cs | 416 ++++++++ .../src/Generated/ManagedGrafanaData.cs | 58 ++ .../src/Generated/ManagedGrafanaResource.cs | 935 ++++++++++++++++++ .../ManagedPrivateEndpointModelCollection.cs | 415 ++++++++ .../ManagedPrivateEndpointModelData.cs | 73 ++ .../ManagedPrivateEndpointModelResource.cs | 609 ++++++++++++ .../src/Generated/Models/ApiKey.cs | 51 + .../AutoGeneratedDomainNameLabelScope.cs | 48 + .../Generated/Models/AvailablePromotion.cs | 51 + ...nitorWorkspaceIntegration.Serialization.cs | 44 + .../AzureMonitorWorkspaceIntegration.cs | 28 + ...ateEndpointConnectionData.Serialization.cs | 145 +++ ...pointConnectionListResult.Serialization.cs | 50 + ...oardPrivateEndpointConnectionListResult.cs | 37 + ...vateEndpointConnectionProvisioningState.cs | 57 ++ ...dPrivateEndpointServiceConnectionStatus.cs | 54 + ...rdPrivateLinkResourceData.Serialization.cs | 135 +++ ...ateLinkResourceListResult.Serialization.cs | 50 + .../DashboardPrivateLinkResourceListResult.cs | 37 + ...inkServiceConnectionState.Serialization.cs | 70 ++ ...hboardPrivateLinkServiceConnectionState.cs | 36 + .../Models/DeterministicOutboundIP.cs | 51 + .../EnterpriseConfigurations.Serialization.cs | 59 ++ .../Models/EnterpriseConfigurations.cs | 32 + .../Models/EnterpriseDetails.Serialization.cs | 47 + .../src/Generated/Models/EnterpriseDetails.cs | 32 + .../GrafanaAvailablePlugin.Serialization.cs | 39 + .../Models/GrafanaAvailablePlugin.cs | 32 + ...ailablePluginListResponse.Serialization.cs | 49 + .../GrafanaAvailablePluginListResponse.cs | 36 + .../GrafanaConfigurations.Serialization.cs | 48 + .../Generated/Models/GrafanaConfigurations.cs | 34 + .../GrafanaIntegrations.Serialization.cs | 59 ++ .../Generated/Models/GrafanaIntegrations.cs | 32 + .../Models/GrafanaPlugin.Serialization.cs | 39 + .../src/Generated/Models/GrafanaPlugin.cs | 28 + .../ManagedGrafanaData.Serialization.cs | 145 +++ ...anagedGrafanaListResponse.Serialization.cs | 50 + .../Models/ManagedGrafanaListResponse.cs | 37 + .../ManagedGrafanaPatch.Serialization.cs | 49 + .../Generated/Models/ManagedGrafanaPatch.cs | 39 + .../ManagedGrafanaProperties.Serialization.cs | 244 +++++ .../Models/ManagedGrafanaProperties.cs | 117 +++ ...ropertiesUpdateParameters.Serialization.cs | 72 ++ ...anagedGrafanaPropertiesUpdateParameters.cs | 67 ++ ...teEndpointConnectionState.Serialization.cs | 43 + .../ManagedPrivateEndpointConnectionState.cs | 32 + .../ManagedPrivateEndpointConnectionStatus.cs | 57 ++ ...dPrivateEndpointModelData.Serialization.cs | 213 ++++ ...EndpointModelListResponse.Serialization.cs | 50 + ...ManagedPrivateEndpointModelListResponse.cs | 37 + ...PrivateEndpointModelPatch.Serialization.cs | 32 + .../ManagedPrivateEndpointModelPatch.cs | 25 + .../Generated/Models/MarketplaceAutoRenew.cs | 51 + .../MarketplaceTrialQuota.Serialization.cs | 68 ++ .../Generated/Models/MarketplaceTrialQuota.cs | 43 + .../src/Generated/Models/ProvisioningState.cs | 72 ++ .../Generated/Models/PublicNetworkAccess.cs | 51 + .../Models/ResourceSku.Serialization.cs | 41 + .../src/Generated/Models/ResourceSku.cs | 29 + .../SaasSubscriptionDetails.Serialization.cs | 55 ++ .../Models/SaasSubscriptionDetails.cs | 40 + .../Generated/Models/Smtp.Serialization.cs | 133 +++ .../src/Generated/Models/Smtp.cs | 83 ++ .../src/Generated/Models/StartTLSPolicy.cs | 57 ++ .../Models/SubscriptionTerm.Serialization.cs | 54 + .../src/Generated/Models/SubscriptionTerm.cs | 38 + .../src/Generated/Models/ZoneRedundancy.cs | 51 + .../src/Generated/ProviderConstants.cs | 16 + .../RestOperations/GrafanaRestOperations.cs | 796 +++++++++++++++ .../ManagedPrivateEndpointsRestOperations.cs | 600 +++++++++++ ...rivateEndpointConnectionsRestOperations.cs | 441 +++++++++ .../PrivateLinkResourcesRestOperations.cs | 283 ++++++ .../src/Properties/AssemblyInfo.cs | 9 + .../src/autorest.md | 55 ++ ...ure.ResourceManager.Dashboard.Tests.csproj | 5 + .../tests/dashboardManagementTestBase.cs | 43 + .../dashboardManagementTestEnvironment.cs | 11 + sdk/dashboard/ci.mgmt.yml | 24 + 110 files changed, 12732 insertions(+) create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/Azure.ResourceManager.Dashboard.sln create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/CHANGELOG.md create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/Directory.Build.props create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/README.md create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/api/Azure.ResourceManager.Dashboard.netstandard2.0.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/assets.json create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Azure.ResourceManager.Dashboard.Samples.csproj create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Generated/Samples/Sample_DashboardPrivateEndpointConnectionCollection.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Generated/Samples/Sample_DashboardPrivateEndpointConnectionResource.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Generated/Samples/Sample_DashboardPrivateLinkResource.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Generated/Samples/Sample_DashboardPrivateLinkResourceCollection.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Generated/Samples/Sample_ManagedGrafanaCollection.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Generated/Samples/Sample_ManagedGrafanaResource.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Generated/Samples/Sample_ManagedPrivateEndpointModelCollection.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Generated/Samples/Sample_ManagedPrivateEndpointModelResource.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Azure.ResourceManager.Dashboard.csproj create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/ArmDashboardModelFactory.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/DashboardPrivateEndpointConnectionCollection.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/DashboardPrivateEndpointConnectionData.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/DashboardPrivateEndpointConnectionResource.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/DashboardPrivateLinkResource.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/DashboardPrivateLinkResourceCollection.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/DashboardPrivateLinkResourceData.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Extensions/DashboardExtensions.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/LongRunningOperation/DashboardArmOperation.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/LongRunningOperation/DashboardArmOperationOfT.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/LongRunningOperation/DashboardPrivateEndpointConnectionOperationSource.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/LongRunningOperation/ManagedGrafanaOperationSource.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/LongRunningOperation/ManagedPrivateEndpointModelOperationSource.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/ManagedGrafanaCollection.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/ManagedGrafanaData.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/ManagedGrafanaResource.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/ManagedPrivateEndpointModelCollection.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/ManagedPrivateEndpointModelData.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/ManagedPrivateEndpointModelResource.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ApiKey.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/AutoGeneratedDomainNameLabelScope.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/AvailablePromotion.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/AzureMonitorWorkspaceIntegration.Serialization.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/AzureMonitorWorkspaceIntegration.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateEndpointConnectionData.Serialization.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateEndpointConnectionListResult.Serialization.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateEndpointConnectionListResult.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateEndpointConnectionProvisioningState.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateEndpointServiceConnectionStatus.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateLinkResourceData.Serialization.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateLinkResourceListResult.Serialization.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateLinkResourceListResult.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateLinkServiceConnectionState.Serialization.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateLinkServiceConnectionState.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DeterministicOutboundIP.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/EnterpriseConfigurations.Serialization.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/EnterpriseConfigurations.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/EnterpriseDetails.Serialization.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/EnterpriseDetails.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaAvailablePlugin.Serialization.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaAvailablePlugin.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaAvailablePluginListResponse.Serialization.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaAvailablePluginListResponse.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaConfigurations.Serialization.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaConfigurations.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaIntegrations.Serialization.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaIntegrations.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaPlugin.Serialization.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaPlugin.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaData.Serialization.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaListResponse.Serialization.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaListResponse.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaPatch.Serialization.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaPatch.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaProperties.Serialization.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaProperties.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaPropertiesUpdateParameters.Serialization.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaPropertiesUpdateParameters.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedPrivateEndpointConnectionState.Serialization.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedPrivateEndpointConnectionState.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedPrivateEndpointConnectionStatus.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedPrivateEndpointModelData.Serialization.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedPrivateEndpointModelListResponse.Serialization.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedPrivateEndpointModelListResponse.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedPrivateEndpointModelPatch.Serialization.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedPrivateEndpointModelPatch.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/MarketplaceAutoRenew.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/MarketplaceTrialQuota.Serialization.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/MarketplaceTrialQuota.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ProvisioningState.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/PublicNetworkAccess.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ResourceSku.Serialization.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ResourceSku.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/SaasSubscriptionDetails.Serialization.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/SaasSubscriptionDetails.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/Smtp.Serialization.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/Smtp.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/StartTLSPolicy.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/SubscriptionTerm.Serialization.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/SubscriptionTerm.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ZoneRedundancy.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/ProviderConstants.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/RestOperations/GrafanaRestOperations.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/RestOperations/ManagedPrivateEndpointsRestOperations.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/Properties/AssemblyInfo.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/src/autorest.md create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/tests/Azure.ResourceManager.Dashboard.Tests.csproj create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/tests/dashboardManagementTestBase.cs create mode 100644 sdk/dashboard/Azure.ResourceManager.Dashboard/tests/dashboardManagementTestEnvironment.cs create mode 100644 sdk/dashboard/ci.mgmt.yml diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/Azure.ResourceManager.Dashboard.sln b/sdk/dashboard/Azure.ResourceManager.Dashboard/Azure.ResourceManager.Dashboard.sln new file mode 100644 index 000000000000..cc14a6d049e2 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/Azure.ResourceManager.Dashboard.sln @@ -0,0 +1,65 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30309.148 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9ADA06F6-85A7-4F31-993B-99B16043CD8D}") = "Azure.ResourceManager.Dashboard", "src\Azure.ResourceManager.Dashboard.csproj", "{6C5CAC0C-9EB2-4C1C-AB3A-78ECB18661B0}" +EndProject +Project("{9ADA06F6-85A7-4F31-993B-99B16043CD8D}") = "Azure.ResourceManager.Dashboard.Tests", "tests\Azure.ResourceManager.Dashboard.Tests.csproj", "{629CC637-3D84-4E85-99BE-1BE4A3E3B205}" +EndProject +Project("{9ADA06F6-85A7-4F31-993B-99B16043CD8D}") = "Azure.ResourceManager.Dashboard.Samples", "samples\Azure.ResourceManager.Dashboard.Samples.csproj", "{D567C2CE-AF7E-45A4-87E0-6C59630165C3}" +EndProject +Global + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {E7D3BB78-F506-4170-A7F6-E1E8EAE9A3FF} + EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {6C5CAC0C-9EB2-4C1C-AB3A-78ECB18661B0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {6C5CAC0C-9EB2-4C1C-AB3A-78ECB18661B0}.Debug|Any CPU.Build.0 = Debug|Any CPU + {6C5CAC0C-9EB2-4C1C-AB3A-78ECB18661B0}.Debug|x64.ActiveCfg = Debug|Any CPU + {6C5CAC0C-9EB2-4C1C-AB3A-78ECB18661B0}.Debug|x64.Build.0 = Debug|Any CPU + {6C5CAC0C-9EB2-4C1C-AB3A-78ECB18661B0}.Debug|x86.ActiveCfg = Debug|Any CPU + {6C5CAC0C-9EB2-4C1C-AB3A-78ECB18661B0}.Debug|x86.Build.0 = Debug|Any CPU + {6C5CAC0C-9EB2-4C1C-AB3A-78ECB18661B0}.Release|Any CPU.ActiveCfg = Release|Any CPU + {6C5CAC0C-9EB2-4C1C-AB3A-78ECB18661B0}.Release|Any CPU.Build.0 = Release|Any CPU + {6C5CAC0C-9EB2-4C1C-AB3A-78ECB18661B0}.Release|x64.ActiveCfg = Release|Any CPU + {6C5CAC0C-9EB2-4C1C-AB3A-78ECB18661B0}.Release|x64.Build.0 = Release|Any CPU + {6C5CAC0C-9EB2-4C1C-AB3A-78ECB18661B0}.Release|x86.ActiveCfg = Release|Any CPU + {6C5CAC0C-9EB2-4C1C-AB3A-78ECB18661B0}.Release|x86.Build.0 = Release|Any CPU + {629CC637-3D84-4E85-99BE-1BE4A3E3B205}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {629CC637-3D84-4E85-99BE-1BE4A3E3B205}.Debug|Any CPU.Build.0 = Debug|Any CPU + {629CC637-3D84-4E85-99BE-1BE4A3E3B205}.Debug|x64.ActiveCfg = Debug|Any CPU + {629CC637-3D84-4E85-99BE-1BE4A3E3B205}.Debug|x64.Build.0 = Debug|Any CPU + {629CC637-3D84-4E85-99BE-1BE4A3E3B205}.Debug|x86.ActiveCfg = Debug|Any CPU + {629CC637-3D84-4E85-99BE-1BE4A3E3B205}.Debug|x86.Build.0 = Debug|Any CPU + {629CC637-3D84-4E85-99BE-1BE4A3E3B205}.Release|Any CPU.ActiveCfg = Release|Any CPU + {629CC637-3D84-4E85-99BE-1BE4A3E3B205}.Release|Any CPU.Build.0 = Release|Any CPU + {629CC637-3D84-4E85-99BE-1BE4A3E3B205}.Release|x64.ActiveCfg = Release|Any CPU + {629CC637-3D84-4E85-99BE-1BE4A3E3B205}.Release|x64.Build.0 = Release|Any CPU + {629CC637-3D84-4E85-99BE-1BE4A3E3B205}.Release|x86.ActiveCfg = Release|Any CPU + {629CC637-3D84-4E85-99BE-1BE4A3E3B205}.Release|x86.Build.0 = Release|Any CPU + {D567C2CE-AF7E-45A4-87E0-6C59630165C3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D567C2CE-AF7E-45A4-87E0-6C59630165C3}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D567C2CE-AF7E-45A4-87E0-6C59630165C3}.Debug|x64.ActiveCfg = Debug|Any CPU + {D567C2CE-AF7E-45A4-87E0-6C59630165C3}.Debug|x64.Build.0 = Debug|Any CPU + {D567C2CE-AF7E-45A4-87E0-6C59630165C3}.Debug|x86.ActiveCfg = Debug|Any CPU + {D567C2CE-AF7E-45A4-87E0-6C59630165C3}.Debug|x86.Build.0 = Debug|Any CPU + {D567C2CE-AF7E-45A4-87E0-6C59630165C3}.Release|Any CPU.ActiveCfg = Release|Any CPU + {D567C2CE-AF7E-45A4-87E0-6C59630165C3}.Release|Any CPU.Build.0 = Release|Any CPU + {D567C2CE-AF7E-45A4-87E0-6C59630165C3}.Release|x64.ActiveCfg = Release|Any CPU + {D567C2CE-AF7E-45A4-87E0-6C59630165C3}.Release|x64.Build.0 = Release|Any CPU + {D567C2CE-AF7E-45A4-87E0-6C59630165C3}.Release|x86.ActiveCfg = Release|Any CPU + {D567C2CE-AF7E-45A4-87E0-6C59630165C3}.Release|x86.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/CHANGELOG.md b/sdk/dashboard/Azure.ResourceManager.Dashboard/CHANGELOG.md new file mode 100644 index 000000000000..23f86d1e896e --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/CHANGELOG.md @@ -0,0 +1,17 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +### General New Features + +This package follows the [new Azure SDK guidelines](https://azure.github.io/azure-sdk/general_introduction.html), and provides many core capabilities: + + - Support MSAL.NET, Azure.Identity is out of box for supporting MSAL.NET. + - Support [OpenTelemetry](https://opentelemetry.io/) for distributed tracing. + - HTTP pipeline with custom policies. + - Better error-handling. + - Support uniform telemetry across all languages. + +This package is a Public Preview version, so expect incompatible changes in subsequent releases as we improve the product. To provide feedback, submit an issue in our [Azure SDK for .NET GitHub repo](https://github.com/Azure/azure-sdk-for-net/issues). + +> NOTE: For more information about unified authentication, please refer to [Microsoft Azure Identity documentation for .NET](https://docs.microsoft.com//dotnet/api/overview/azure/identity-readme?view=azure-dotnet). \ No newline at end of file diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/Directory.Build.props b/sdk/dashboard/Azure.ResourceManager.Dashboard/Directory.Build.props new file mode 100644 index 000000000000..1a9611bd4924 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/README.md b/sdk/dashboard/Azure.ResourceManager.Dashboard/README.md new file mode 100644 index 000000000000..e355e95e1542 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/README.md @@ -0,0 +1,80 @@ +# Microsoft Azure dashboard management client library for .NET + +**[Describe the service briefly first.]** + +This library follows the [new Azure SDK guidelines](https://azure.github.io/azure-sdk/general_introduction.html), and provides many core capabilities: + + - Support MSAL.NET, Azure.Identity is out of box for supporting MSAL.NET. + - Support [OpenTelemetry](https://opentelemetry.io/) for distributed tracing. + - HTTP pipeline with custom policies. + - Better error-handling. + - Support uniform telemetry across all languages. + +## Getting started + +### Install the package + +Install the Microsoft Azure dashboard management library for .NET with [NuGet](https://www.nuget.org/): + +```dotnetcli +dotnet add package Azure.ResourceManager.Dashboard --prerelease +``` + +### Prerequisites + +* You must have an [Microsoft Azure subscription](https://azure.microsoft.com/free/dotnet/). + +### Authenticate the Client + +To create an authenticated client and start interacting with Microsoft Azure resources, see the [quickstart guide here](https://github.com/Azure/azure-sdk-for-net/blob/main/doc/dev/mgmt_quickstart.md). + +## Key concepts + +Key concepts of the Microsoft Azure SDK for .NET can be found [here](https://azure.github.io/azure-sdk/dotnet_introduction.html) + +## Documentation + +Documentation is available to help you learn how to use this package: + +- [Quickstart](https://github.com/Azure/azure-sdk-for-net/blob/main/doc/dev/mgmt_quickstart.md). +- [API References](https://docs.microsoft.com/dotnet/api/?view=azure-dotnet). +- [Authentication](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/identity/Azure.Identity/README.md). + +## Examples + +Code samples for using the management library for .NET can be found in the following locations +- [.NET Management Library Code Samples](https://aka.ms/azuresdk-net-mgmt-samples) + +## Troubleshooting + +- File an issue via [GitHub Issues](https://github.com/Azure/azure-sdk-for-net/issues). +- Check [previous questions](https://stackoverflow.com/questions/tagged/azure+.net) or ask new ones on Stack Overflow using Azure and .NET tags. + +## Next steps + +For more information about Microsoft Azure SDK, see [this website](https://azure.github.io/azure-sdk/). + +## Contributing + +For details on contributing to this repository, see the [contributing +guide][cg]. + +This project welcomes contributions and suggestions. Most contributions +require you to agree to a Contributor License Agreement (CLA) declaring +that you have the right to, and actually do, grant us the rights to use +your contribution. For details, visit . + +When you submit a pull request, a CLA-bot will automatically determine +whether you need to provide a CLA and decorate the PR appropriately +(for example, label, comment). Follow the instructions provided by the +bot. You'll only need to do this action once across all repositories +using our CLA. + +This project has adopted the [Microsoft Open Source Code of Conduct][coc]. For +more information, see the [Code of Conduct FAQ][coc_faq] or contact + with any other questions or comments. + + +[cg]: https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/resourcemanager/Azure.ResourceManager/docs/CONTRIBUTING.md +[coc]: https://opensource.microsoft.com/codeofconduct/ +[coc_faq]: https://opensource.microsoft.com/codeofconduct/faq/ \ No newline at end of file diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/api/Azure.ResourceManager.Dashboard.netstandard2.0.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/api/Azure.ResourceManager.Dashboard.netstandard2.0.cs new file mode 100644 index 000000000000..e379db02436d --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/api/Azure.ResourceManager.Dashboard.netstandard2.0.cs @@ -0,0 +1,562 @@ +namespace Azure.ResourceManager.Dashboard +{ + public static partial class DashboardExtensions + { + public static Azure.ResourceManager.Dashboard.DashboardPrivateEndpointConnectionResource GetDashboardPrivateEndpointConnectionResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Dashboard.DashboardPrivateLinkResource GetDashboardPrivateLinkResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetManagedGrafana(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetManagedGrafanaAsync(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource, string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.Dashboard.ManagedGrafanaResource GetManagedGrafanaResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Dashboard.ManagedGrafanaCollection GetManagedGrafanas(this Azure.ResourceManager.Resources.ResourceGroupResource resourceGroupResource) { throw null; } + public static Azure.Pageable GetManagedGrafanas(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.AsyncPageable GetManagedGrafanasAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.Dashboard.ManagedPrivateEndpointModelResource GetManagedPrivateEndpointModelResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class DashboardPrivateEndpointConnectionCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DashboardPrivateEndpointConnectionCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string privateEndpointConnectionName, Azure.ResourceManager.Dashboard.DashboardPrivateEndpointConnectionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string privateEndpointConnectionName, Azure.ResourceManager.Dashboard.DashboardPrivateEndpointConnectionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class DashboardPrivateEndpointConnectionData : Azure.ResourceManager.Models.ResourceData + { + public DashboardPrivateEndpointConnectionData() { } + public Azure.ResourceManager.Dashboard.Models.DashboardPrivateLinkServiceConnectionState ConnectionState { get { throw null; } set { } } + public System.Collections.Generic.IList GroupIds { get { throw null; } } + public Azure.Core.ResourceIdentifier PrivateEndpointId { get { throw null; } } + public Azure.ResourceManager.Dashboard.Models.DashboardPrivateEndpointConnectionProvisioningState? ProvisioningState { get { throw null; } } + } + public partial class DashboardPrivateEndpointConnectionResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DashboardPrivateEndpointConnectionResource() { } + public virtual Azure.ResourceManager.Dashboard.DashboardPrivateEndpointConnectionData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.Dashboard.DashboardPrivateEndpointConnectionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Dashboard.DashboardPrivateEndpointConnectionData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DashboardPrivateLinkResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected DashboardPrivateLinkResource() { } + public virtual Azure.ResourceManager.Dashboard.DashboardPrivateLinkResourceData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string privateLinkResourceName) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class DashboardPrivateLinkResourceCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected DashboardPrivateLinkResourceCollection() { } + public virtual Azure.Response Exists(string privateLinkResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string privateLinkResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string privateLinkResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string privateLinkResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string privateLinkResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string privateLinkResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class DashboardPrivateLinkResourceData : Azure.ResourceManager.Models.ResourceData + { + public DashboardPrivateLinkResourceData() { } + public string GroupId { get { throw null; } } + public Azure.ResourceManager.Dashboard.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public System.Collections.Generic.IReadOnlyList RequiredMembers { get { throw null; } } + public System.Collections.Generic.IList RequiredZoneNames { get { throw null; } } + } + public partial class ManagedGrafanaCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected ManagedGrafanaCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string workspaceName, Azure.ResourceManager.Dashboard.ManagedGrafanaData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string workspaceName, Azure.ResourceManager.Dashboard.ManagedGrafanaData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string workspaceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class ManagedGrafanaData : Azure.ResourceManager.Models.TrackedResourceData + { + public ManagedGrafanaData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public Azure.ResourceManager.Dashboard.Models.ManagedGrafanaProperties Properties { get { throw null; } set { } } + public string SkuName { get { throw null; } set { } } + } + public partial class ManagedGrafanaResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected ManagedGrafanaResource() { } + public virtual Azure.ResourceManager.Dashboard.ManagedGrafanaData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CheckEnterpriseDetails(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CheckEnterpriseDetailsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable FetchAvailablePlugins(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable FetchAvailablePluginsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDashboardPrivateEndpointConnection(string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDashboardPrivateEndpointConnectionAsync(string privateEndpointConnectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Dashboard.DashboardPrivateEndpointConnectionCollection GetDashboardPrivateEndpointConnections() { throw null; } + public virtual Azure.Response GetDashboardPrivateLinkResource(string privateLinkResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetDashboardPrivateLinkResourceAsync(string privateLinkResourceName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Dashboard.DashboardPrivateLinkResourceCollection GetDashboardPrivateLinkResources() { throw null; } + public virtual Azure.Response GetManagedPrivateEndpointModel(string managedPrivateEndpointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetManagedPrivateEndpointModelAsync(string managedPrivateEndpointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Dashboard.ManagedPrivateEndpointModelCollection GetManagedPrivateEndpointModels() { throw null; } + public virtual Azure.ResourceManager.ArmOperation RefreshManagedPrivateEndpoint(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task RefreshManagedPrivateEndpointAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Update(Azure.ResourceManager.Dashboard.Models.ManagedGrafanaPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.Dashboard.Models.ManagedGrafanaPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ManagedPrivateEndpointModelCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected ManagedPrivateEndpointModelCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string managedPrivateEndpointName, Azure.ResourceManager.Dashboard.ManagedPrivateEndpointModelData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string managedPrivateEndpointName, Azure.ResourceManager.Dashboard.ManagedPrivateEndpointModelData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string managedPrivateEndpointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string managedPrivateEndpointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string managedPrivateEndpointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string managedPrivateEndpointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string managedPrivateEndpointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string managedPrivateEndpointName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + System.Collections.Generic.IAsyncEnumerator System.Collections.Generic.IAsyncEnumerable.GetAsyncEnumerator(System.Threading.CancellationToken cancellationToken) { throw null; } + System.Collections.Generic.IEnumerator System.Collections.Generic.IEnumerable.GetEnumerator() { throw null; } + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator() { throw null; } + } + public partial class ManagedPrivateEndpointModelData : Azure.ResourceManager.Models.TrackedResourceData + { + public ManagedPrivateEndpointModelData(Azure.Core.AzureLocation location) : base (default(Azure.Core.AzureLocation)) { } + public Azure.ResourceManager.Dashboard.Models.ManagedPrivateEndpointConnectionState ConnectionState { get { throw null; } } + public System.Collections.Generic.IList GroupIds { get { throw null; } } + public string PrivateLinkResourceId { get { throw null; } set { } } + public string PrivateLinkResourceRegion { get { throw null; } set { } } + public string PrivateLinkServicePrivateIP { get { throw null; } } + public System.Uri PrivateLinkServiceUri { get { throw null; } set { } } + public Azure.ResourceManager.Dashboard.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public string RequestMessage { get { throw null; } set { } } + } + public partial class ManagedPrivateEndpointModelResource : Azure.ResourceManager.ArmResource + { + public static readonly Azure.Core.ResourceType ResourceType; + protected ManagedPrivateEndpointModelResource() { } + public virtual Azure.ResourceManager.Dashboard.ManagedPrivateEndpointModelData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public virtual Azure.Response AddTag(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> AddTagAsync(string key, string value, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string managedPrivateEndpointName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response RemoveTag(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> RemoveTagAsync(string key, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetTags(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> SetTagsAsync(System.Collections.Generic.IDictionary tags, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.Dashboard.Models.ManagedPrivateEndpointModelPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Dashboard.Models.ManagedPrivateEndpointModelPatch patch, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.Dashboard.Models +{ + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ApiKey : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ApiKey(string value) { throw null; } + public static Azure.ResourceManager.Dashboard.Models.ApiKey Disabled { get { throw null; } } + public static Azure.ResourceManager.Dashboard.Models.ApiKey Enabled { get { throw null; } } + public bool Equals(Azure.ResourceManager.Dashboard.Models.ApiKey other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Dashboard.Models.ApiKey left, Azure.ResourceManager.Dashboard.Models.ApiKey right) { throw null; } + public static implicit operator Azure.ResourceManager.Dashboard.Models.ApiKey (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Dashboard.Models.ApiKey left, Azure.ResourceManager.Dashboard.Models.ApiKey right) { throw null; } + public override string ToString() { throw null; } + } + public static partial class ArmDashboardModelFactory + { + public static Azure.ResourceManager.Dashboard.DashboardPrivateEndpointConnectionData DashboardPrivateEndpointConnectionData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.Core.ResourceIdentifier privateEndpointId = null, Azure.ResourceManager.Dashboard.Models.DashboardPrivateLinkServiceConnectionState connectionState = null, System.Collections.Generic.IEnumerable groupIds = null, Azure.ResourceManager.Dashboard.Models.DashboardPrivateEndpointConnectionProvisioningState? provisioningState = default(Azure.ResourceManager.Dashboard.Models.DashboardPrivateEndpointConnectionProvisioningState?)) { throw null; } + public static Azure.ResourceManager.Dashboard.DashboardPrivateLinkResourceData DashboardPrivateLinkResourceData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Dashboard.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.Dashboard.Models.ProvisioningState?), string groupId = null, System.Collections.Generic.IEnumerable requiredMembers = null, System.Collections.Generic.IEnumerable requiredZoneNames = null) { throw null; } + public static Azure.ResourceManager.Dashboard.Models.EnterpriseDetails EnterpriseDetails(Azure.ResourceManager.Dashboard.Models.SaasSubscriptionDetails saasSubscriptionDetails = null, Azure.ResourceManager.Dashboard.Models.MarketplaceTrialQuota marketplaceTrialQuota = null) { throw null; } + public static Azure.ResourceManager.Dashboard.Models.GrafanaAvailablePlugin GrafanaAvailablePlugin(string pluginId = null, string name = null) { throw null; } + public static Azure.ResourceManager.Dashboard.Models.GrafanaPlugin GrafanaPlugin(string pluginId = null) { throw null; } + public static Azure.ResourceManager.Dashboard.ManagedGrafanaData ManagedGrafanaData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), string skuName = null, Azure.ResourceManager.Dashboard.Models.ManagedGrafanaProperties properties = null, Azure.ResourceManager.Models.ManagedServiceIdentity identity = null) { throw null; } + public static Azure.ResourceManager.Dashboard.Models.ManagedGrafanaProperties ManagedGrafanaProperties(Azure.ResourceManager.Dashboard.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.Dashboard.Models.ProvisioningState?), string grafanaVersion = null, string endpoint = null, Azure.ResourceManager.Dashboard.Models.PublicNetworkAccess? publicNetworkAccess = default(Azure.ResourceManager.Dashboard.Models.PublicNetworkAccess?), Azure.ResourceManager.Dashboard.Models.ZoneRedundancy? zoneRedundancy = default(Azure.ResourceManager.Dashboard.Models.ZoneRedundancy?), Azure.ResourceManager.Dashboard.Models.ApiKey? apiKey = default(Azure.ResourceManager.Dashboard.Models.ApiKey?), Azure.ResourceManager.Dashboard.Models.DeterministicOutboundIP? deterministicOutboundIP = default(Azure.ResourceManager.Dashboard.Models.DeterministicOutboundIP?), System.Collections.Generic.IEnumerable outboundIPs = null, System.Collections.Generic.IEnumerable privateEndpointConnections = null, Azure.ResourceManager.Dashboard.Models.AutoGeneratedDomainNameLabelScope? autoGeneratedDomainNameLabelScope = default(Azure.ResourceManager.Dashboard.Models.AutoGeneratedDomainNameLabelScope?), System.Collections.Generic.IEnumerable azureMonitorWorkspaceIntegrations = null, Azure.ResourceManager.Dashboard.Models.EnterpriseConfigurations enterpriseConfigurations = null, Azure.ResourceManager.Dashboard.Models.Smtp grafanaConfigurationsSmtp = null, System.Collections.Generic.IDictionary grafanaPlugins = null, string grafanaMajorVersion = null) { throw null; } + public static Azure.ResourceManager.Dashboard.Models.ManagedPrivateEndpointConnectionState ManagedPrivateEndpointConnectionState(Azure.ResourceManager.Dashboard.Models.ManagedPrivateEndpointConnectionStatus? status = default(Azure.ResourceManager.Dashboard.Models.ManagedPrivateEndpointConnectionStatus?), string description = null) { throw null; } + public static Azure.ResourceManager.Dashboard.ManagedPrivateEndpointModelData ManagedPrivateEndpointModelData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, System.Collections.Generic.IDictionary tags = null, Azure.Core.AzureLocation location = default(Azure.Core.AzureLocation), Azure.ResourceManager.Dashboard.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.Dashboard.Models.ProvisioningState?), string privateLinkResourceId = null, string privateLinkResourceRegion = null, System.Collections.Generic.IEnumerable groupIds = null, string requestMessage = null, Azure.ResourceManager.Dashboard.Models.ManagedPrivateEndpointConnectionState connectionState = null, System.Uri privateLinkServiceUri = null, string privateLinkServicePrivateIP = null) { throw null; } + public static Azure.ResourceManager.Dashboard.Models.MarketplaceTrialQuota MarketplaceTrialQuota(Azure.ResourceManager.Dashboard.Models.AvailablePromotion? availablePromotion = default(Azure.ResourceManager.Dashboard.Models.AvailablePromotion?), Azure.Core.ResourceIdentifier grafanaResourceId = null, System.DateTimeOffset? trialStartOn = default(System.DateTimeOffset?), System.DateTimeOffset? trialEndOn = default(System.DateTimeOffset?)) { throw null; } + public static Azure.ResourceManager.Dashboard.Models.SaasSubscriptionDetails SaasSubscriptionDetails(string planId = null, string offerId = null, string publisherId = null, Azure.ResourceManager.Dashboard.Models.SubscriptionTerm term = null) { throw null; } + public static Azure.ResourceManager.Dashboard.Models.SubscriptionTerm SubscriptionTerm(string termUnit = null, System.DateTimeOffset? startOn = default(System.DateTimeOffset?), System.DateTimeOffset? endOn = default(System.DateTimeOffset?)) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AutoGeneratedDomainNameLabelScope : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AutoGeneratedDomainNameLabelScope(string value) { throw null; } + public static Azure.ResourceManager.Dashboard.Models.AutoGeneratedDomainNameLabelScope TenantReuse { get { throw null; } } + public bool Equals(Azure.ResourceManager.Dashboard.Models.AutoGeneratedDomainNameLabelScope other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Dashboard.Models.AutoGeneratedDomainNameLabelScope left, Azure.ResourceManager.Dashboard.Models.AutoGeneratedDomainNameLabelScope right) { throw null; } + public static implicit operator Azure.ResourceManager.Dashboard.Models.AutoGeneratedDomainNameLabelScope (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Dashboard.Models.AutoGeneratedDomainNameLabelScope left, Azure.ResourceManager.Dashboard.Models.AutoGeneratedDomainNameLabelScope right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AvailablePromotion : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AvailablePromotion(string value) { throw null; } + public static Azure.ResourceManager.Dashboard.Models.AvailablePromotion FreeTrial { get { throw null; } } + public static Azure.ResourceManager.Dashboard.Models.AvailablePromotion None { get { throw null; } } + public bool Equals(Azure.ResourceManager.Dashboard.Models.AvailablePromotion other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Dashboard.Models.AvailablePromotion left, Azure.ResourceManager.Dashboard.Models.AvailablePromotion right) { throw null; } + public static implicit operator Azure.ResourceManager.Dashboard.Models.AvailablePromotion (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Dashboard.Models.AvailablePromotion left, Azure.ResourceManager.Dashboard.Models.AvailablePromotion right) { throw null; } + public override string ToString() { throw null; } + } + public partial class AzureMonitorWorkspaceIntegration + { + public AzureMonitorWorkspaceIntegration() { } + public string AzureMonitorWorkspaceResourceId { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DashboardPrivateEndpointConnectionProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DashboardPrivateEndpointConnectionProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.Dashboard.Models.DashboardPrivateEndpointConnectionProvisioningState Creating { get { throw null; } } + public static Azure.ResourceManager.Dashboard.Models.DashboardPrivateEndpointConnectionProvisioningState Deleting { get { throw null; } } + public static Azure.ResourceManager.Dashboard.Models.DashboardPrivateEndpointConnectionProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.Dashboard.Models.DashboardPrivateEndpointConnectionProvisioningState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.Dashboard.Models.DashboardPrivateEndpointConnectionProvisioningState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Dashboard.Models.DashboardPrivateEndpointConnectionProvisioningState left, Azure.ResourceManager.Dashboard.Models.DashboardPrivateEndpointConnectionProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.Dashboard.Models.DashboardPrivateEndpointConnectionProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Dashboard.Models.DashboardPrivateEndpointConnectionProvisioningState left, Azure.ResourceManager.Dashboard.Models.DashboardPrivateEndpointConnectionProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DashboardPrivateEndpointServiceConnectionStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DashboardPrivateEndpointServiceConnectionStatus(string value) { throw null; } + public static Azure.ResourceManager.Dashboard.Models.DashboardPrivateEndpointServiceConnectionStatus Approved { get { throw null; } } + public static Azure.ResourceManager.Dashboard.Models.DashboardPrivateEndpointServiceConnectionStatus Pending { get { throw null; } } + public static Azure.ResourceManager.Dashboard.Models.DashboardPrivateEndpointServiceConnectionStatus Rejected { get { throw null; } } + public bool Equals(Azure.ResourceManager.Dashboard.Models.DashboardPrivateEndpointServiceConnectionStatus other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Dashboard.Models.DashboardPrivateEndpointServiceConnectionStatus left, Azure.ResourceManager.Dashboard.Models.DashboardPrivateEndpointServiceConnectionStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.Dashboard.Models.DashboardPrivateEndpointServiceConnectionStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Dashboard.Models.DashboardPrivateEndpointServiceConnectionStatus left, Azure.ResourceManager.Dashboard.Models.DashboardPrivateEndpointServiceConnectionStatus right) { throw null; } + public override string ToString() { throw null; } + } + public partial class DashboardPrivateLinkServiceConnectionState + { + public DashboardPrivateLinkServiceConnectionState() { } + public string ActionsRequired { get { throw null; } set { } } + public string Description { get { throw null; } set { } } + public Azure.ResourceManager.Dashboard.Models.DashboardPrivateEndpointServiceConnectionStatus? Status { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct DeterministicOutboundIP : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public DeterministicOutboundIP(string value) { throw null; } + public static Azure.ResourceManager.Dashboard.Models.DeterministicOutboundIP Disabled { get { throw null; } } + public static Azure.ResourceManager.Dashboard.Models.DeterministicOutboundIP Enabled { get { throw null; } } + public bool Equals(Azure.ResourceManager.Dashboard.Models.DeterministicOutboundIP other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Dashboard.Models.DeterministicOutboundIP left, Azure.ResourceManager.Dashboard.Models.DeterministicOutboundIP right) { throw null; } + public static implicit operator Azure.ResourceManager.Dashboard.Models.DeterministicOutboundIP (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Dashboard.Models.DeterministicOutboundIP left, Azure.ResourceManager.Dashboard.Models.DeterministicOutboundIP right) { throw null; } + public override string ToString() { throw null; } + } + public partial class EnterpriseConfigurations + { + public EnterpriseConfigurations() { } + public Azure.ResourceManager.Dashboard.Models.MarketplaceAutoRenew? MarketplaceAutoRenew { get { throw null; } set { } } + public string MarketplacePlanId { get { throw null; } set { } } + } + public partial class EnterpriseDetails + { + internal EnterpriseDetails() { } + public Azure.ResourceManager.Dashboard.Models.MarketplaceTrialQuota MarketplaceTrialQuota { get { throw null; } } + public Azure.ResourceManager.Dashboard.Models.SaasSubscriptionDetails SaasSubscriptionDetails { get { throw null; } } + } + public partial class GrafanaAvailablePlugin + { + internal GrafanaAvailablePlugin() { } + public string Name { get { throw null; } } + public string PluginId { get { throw null; } } + } + public partial class GrafanaPlugin + { + public GrafanaPlugin() { } + public string PluginId { get { throw null; } } + } + public partial class ManagedGrafanaPatch + { + public ManagedGrafanaPatch() { } + public Azure.ResourceManager.Models.ManagedServiceIdentity Identity { get { throw null; } set { } } + public Azure.ResourceManager.Dashboard.Models.ManagedGrafanaPropertiesUpdateParameters Properties { get { throw null; } set { } } + public string SkuName { get { throw null; } set { } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + } + public partial class ManagedGrafanaProperties + { + public ManagedGrafanaProperties() { } + public Azure.ResourceManager.Dashboard.Models.ApiKey? ApiKey { get { throw null; } set { } } + public Azure.ResourceManager.Dashboard.Models.AutoGeneratedDomainNameLabelScope? AutoGeneratedDomainNameLabelScope { get { throw null; } set { } } + public System.Collections.Generic.IList AzureMonitorWorkspaceIntegrations { get { throw null; } } + public Azure.ResourceManager.Dashboard.Models.DeterministicOutboundIP? DeterministicOutboundIP { get { throw null; } set { } } + public string Endpoint { get { throw null; } } + public Azure.ResourceManager.Dashboard.Models.EnterpriseConfigurations EnterpriseConfigurations { get { throw null; } set { } } + public Azure.ResourceManager.Dashboard.Models.Smtp GrafanaConfigurationsSmtp { get { throw null; } set { } } + public string GrafanaMajorVersion { get { throw null; } set { } } + public System.Collections.Generic.IDictionary GrafanaPlugins { get { throw null; } } + public string GrafanaVersion { get { throw null; } } + public System.Collections.Generic.IReadOnlyList OutboundIPs { get { throw null; } } + public System.Collections.Generic.IReadOnlyList PrivateEndpointConnections { get { throw null; } } + public Azure.ResourceManager.Dashboard.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public Azure.ResourceManager.Dashboard.Models.PublicNetworkAccess? PublicNetworkAccess { get { throw null; } set { } } + public Azure.ResourceManager.Dashboard.Models.ZoneRedundancy? ZoneRedundancy { get { throw null; } set { } } + } + public partial class ManagedGrafanaPropertiesUpdateParameters + { + public ManagedGrafanaPropertiesUpdateParameters() { } + public Azure.ResourceManager.Dashboard.Models.ApiKey? ApiKey { get { throw null; } set { } } + public System.Collections.Generic.IList AzureMonitorWorkspaceIntegrations { get { throw null; } } + public Azure.ResourceManager.Dashboard.Models.DeterministicOutboundIP? DeterministicOutboundIP { get { throw null; } set { } } + public Azure.ResourceManager.Dashboard.Models.EnterpriseConfigurations EnterpriseConfigurations { get { throw null; } set { } } + public Azure.ResourceManager.Dashboard.Models.Smtp GrafanaConfigurationsSmtp { get { throw null; } set { } } + public string GrafanaMajorVersion { get { throw null; } set { } } + public System.Collections.Generic.IDictionary GrafanaPlugins { get { throw null; } } + public Azure.ResourceManager.Dashboard.Models.PublicNetworkAccess? PublicNetworkAccess { get { throw null; } set { } } + public Azure.ResourceManager.Dashboard.Models.ZoneRedundancy? ZoneRedundancy { get { throw null; } set { } } + } + public partial class ManagedPrivateEndpointConnectionState + { + internal ManagedPrivateEndpointConnectionState() { } + public string Description { get { throw null; } } + public Azure.ResourceManager.Dashboard.Models.ManagedPrivateEndpointConnectionStatus? Status { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ManagedPrivateEndpointConnectionStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ManagedPrivateEndpointConnectionStatus(string value) { throw null; } + public static Azure.ResourceManager.Dashboard.Models.ManagedPrivateEndpointConnectionStatus Approved { get { throw null; } } + public static Azure.ResourceManager.Dashboard.Models.ManagedPrivateEndpointConnectionStatus Disconnected { get { throw null; } } + public static Azure.ResourceManager.Dashboard.Models.ManagedPrivateEndpointConnectionStatus Pending { get { throw null; } } + public static Azure.ResourceManager.Dashboard.Models.ManagedPrivateEndpointConnectionStatus Rejected { get { throw null; } } + public bool Equals(Azure.ResourceManager.Dashboard.Models.ManagedPrivateEndpointConnectionStatus other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Dashboard.Models.ManagedPrivateEndpointConnectionStatus left, Azure.ResourceManager.Dashboard.Models.ManagedPrivateEndpointConnectionStatus right) { throw null; } + public static implicit operator Azure.ResourceManager.Dashboard.Models.ManagedPrivateEndpointConnectionStatus (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Dashboard.Models.ManagedPrivateEndpointConnectionStatus left, Azure.ResourceManager.Dashboard.Models.ManagedPrivateEndpointConnectionStatus right) { throw null; } + public override string ToString() { throw null; } + } + public partial class ManagedPrivateEndpointModelPatch + { + public ManagedPrivateEndpointModelPatch() { } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct MarketplaceAutoRenew : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public MarketplaceAutoRenew(string value) { throw null; } + public static Azure.ResourceManager.Dashboard.Models.MarketplaceAutoRenew Disabled { get { throw null; } } + public static Azure.ResourceManager.Dashboard.Models.MarketplaceAutoRenew Enabled { get { throw null; } } + public bool Equals(Azure.ResourceManager.Dashboard.Models.MarketplaceAutoRenew other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Dashboard.Models.MarketplaceAutoRenew left, Azure.ResourceManager.Dashboard.Models.MarketplaceAutoRenew right) { throw null; } + public static implicit operator Azure.ResourceManager.Dashboard.Models.MarketplaceAutoRenew (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Dashboard.Models.MarketplaceAutoRenew left, Azure.ResourceManager.Dashboard.Models.MarketplaceAutoRenew right) { throw null; } + public override string ToString() { throw null; } + } + public partial class MarketplaceTrialQuota + { + internal MarketplaceTrialQuota() { } + public Azure.ResourceManager.Dashboard.Models.AvailablePromotion? AvailablePromotion { get { throw null; } } + public Azure.Core.ResourceIdentifier GrafanaResourceId { get { throw null; } } + public System.DateTimeOffset? TrialEndOn { get { throw null; } } + public System.DateTimeOffset? TrialStartOn { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ProvisioningState : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ProvisioningState(string value) { throw null; } + public static Azure.ResourceManager.Dashboard.Models.ProvisioningState Accepted { get { throw null; } } + public static Azure.ResourceManager.Dashboard.Models.ProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.Dashboard.Models.ProvisioningState Creating { get { throw null; } } + public static Azure.ResourceManager.Dashboard.Models.ProvisioningState Deleted { get { throw null; } } + public static Azure.ResourceManager.Dashboard.Models.ProvisioningState Deleting { get { throw null; } } + public static Azure.ResourceManager.Dashboard.Models.ProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.Dashboard.Models.ProvisioningState NotSpecified { get { throw null; } } + public static Azure.ResourceManager.Dashboard.Models.ProvisioningState Succeeded { get { throw null; } } + public static Azure.ResourceManager.Dashboard.Models.ProvisioningState Updating { get { throw null; } } + public bool Equals(Azure.ResourceManager.Dashboard.Models.ProvisioningState other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Dashboard.Models.ProvisioningState left, Azure.ResourceManager.Dashboard.Models.ProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.Dashboard.Models.ProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Dashboard.Models.ProvisioningState left, Azure.ResourceManager.Dashboard.Models.ProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct PublicNetworkAccess : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public PublicNetworkAccess(string value) { throw null; } + public static Azure.ResourceManager.Dashboard.Models.PublicNetworkAccess Disabled { get { throw null; } } + public static Azure.ResourceManager.Dashboard.Models.PublicNetworkAccess Enabled { get { throw null; } } + public bool Equals(Azure.ResourceManager.Dashboard.Models.PublicNetworkAccess other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Dashboard.Models.PublicNetworkAccess left, Azure.ResourceManager.Dashboard.Models.PublicNetworkAccess right) { throw null; } + public static implicit operator Azure.ResourceManager.Dashboard.Models.PublicNetworkAccess (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Dashboard.Models.PublicNetworkAccess left, Azure.ResourceManager.Dashboard.Models.PublicNetworkAccess right) { throw null; } + public override string ToString() { throw null; } + } + public partial class SaasSubscriptionDetails + { + internal SaasSubscriptionDetails() { } + public string OfferId { get { throw null; } } + public string PlanId { get { throw null; } } + public string PublisherId { get { throw null; } } + public Azure.ResourceManager.Dashboard.Models.SubscriptionTerm Term { get { throw null; } } + } + public partial class Smtp + { + public Smtp() { } + public bool? Enabled { get { throw null; } set { } } + public string FromAddress { get { throw null; } set { } } + public string FromName { get { throw null; } set { } } + public string Host { get { throw null; } set { } } + public string Password { get { throw null; } set { } } + public bool? SkipVerify { get { throw null; } set { } } + public Azure.ResourceManager.Dashboard.Models.StartTLSPolicy? StartTLSPolicy { get { throw null; } set { } } + public string User { get { throw null; } set { } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct StartTLSPolicy : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public StartTLSPolicy(string value) { throw null; } + public static Azure.ResourceManager.Dashboard.Models.StartTLSPolicy MandatoryStartTLS { get { throw null; } } + public static Azure.ResourceManager.Dashboard.Models.StartTLSPolicy NoStartTLS { get { throw null; } } + public static Azure.ResourceManager.Dashboard.Models.StartTLSPolicy OpportunisticStartTLS { get { throw null; } } + public bool Equals(Azure.ResourceManager.Dashboard.Models.StartTLSPolicy other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Dashboard.Models.StartTLSPolicy left, Azure.ResourceManager.Dashboard.Models.StartTLSPolicy right) { throw null; } + public static implicit operator Azure.ResourceManager.Dashboard.Models.StartTLSPolicy (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Dashboard.Models.StartTLSPolicy left, Azure.ResourceManager.Dashboard.Models.StartTLSPolicy right) { throw null; } + public override string ToString() { throw null; } + } + public partial class SubscriptionTerm + { + internal SubscriptionTerm() { } + public System.DateTimeOffset? EndOn { get { throw null; } } + public System.DateTimeOffset? StartOn { get { throw null; } } + public string TermUnit { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ZoneRedundancy : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ZoneRedundancy(string value) { throw null; } + public static Azure.ResourceManager.Dashboard.Models.ZoneRedundancy Disabled { get { throw null; } } + public static Azure.ResourceManager.Dashboard.Models.ZoneRedundancy Enabled { get { throw null; } } + public bool Equals(Azure.ResourceManager.Dashboard.Models.ZoneRedundancy other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Dashboard.Models.ZoneRedundancy left, Azure.ResourceManager.Dashboard.Models.ZoneRedundancy right) { throw null; } + public static implicit operator Azure.ResourceManager.Dashboard.Models.ZoneRedundancy (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Dashboard.Models.ZoneRedundancy left, Azure.ResourceManager.Dashboard.Models.ZoneRedundancy right) { throw null; } + public override string ToString() { throw null; } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/assets.json b/sdk/dashboard/Azure.ResourceManager.Dashboard/assets.json new file mode 100644 index 000000000000..7645c272e3f8 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "net", + "TagPrefix": "net//Azure.ResourceManager.Dashboard", + "Tag": "" +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Azure.ResourceManager.Dashboard.Samples.csproj b/sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Azure.ResourceManager.Dashboard.Samples.csproj new file mode 100644 index 000000000000..eecb58b82b68 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Azure.ResourceManager.Dashboard.Samples.csproj @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Generated/Samples/Sample_DashboardPrivateEndpointConnectionCollection.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Generated/Samples/Sample_DashboardPrivateEndpointConnectionCollection.cs new file mode 100644 index 000000000000..7ce13ea9267b --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Generated/Samples/Sample_DashboardPrivateEndpointConnectionCollection.cs @@ -0,0 +1,203 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.Dashboard; + +namespace Azure.ResourceManager.Dashboard.Samples +{ + public partial class Sample_DashboardPrivateEndpointConnectionCollection + { + // PrivateEndpointConnections_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_PrivateEndpointConnectionsGet() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-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 DashboardPrivateEndpointConnectionResource + DashboardPrivateEndpointConnectionCollection collection = managedGrafana.GetDashboardPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "myConnection"; + DashboardPrivateEndpointConnectionResource result = await collection.GetAsync(privateEndpointConnectionName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DashboardPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // PrivateEndpointConnections_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_PrivateEndpointConnectionsGet() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-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 DashboardPrivateEndpointConnectionResource + DashboardPrivateEndpointConnectionCollection collection = managedGrafana.GetDashboardPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "myConnection"; + bool result = await collection.ExistsAsync(privateEndpointConnectionName); + + 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/2023-09-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 DashboardPrivateEndpointConnectionResource + DashboardPrivateEndpointConnectionCollection collection = managedGrafana.GetDashboardPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "myConnection"; + NullableResponse response = await collection.GetIfExistsAsync(privateEndpointConnectionName); + DashboardPrivateEndpointConnectionResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DashboardPrivateEndpointConnectionData 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")] + public async Task CreateOrUpdate_PrivateEndpointConnectionsApprove() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/PrivateEndpointConnections_Approve.json + // this example is just showing the usage of "PrivateEndpointConnections_Approve" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 DashboardPrivateEndpointConnectionResource + DashboardPrivateEndpointConnectionCollection collection = managedGrafana.GetDashboardPrivateEndpointConnections(); + + // invoke the operation + string privateEndpointConnectionName = "myConnection"; + DashboardPrivateEndpointConnectionData data = new DashboardPrivateEndpointConnectionData(); + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, privateEndpointConnectionName, data); + DashboardPrivateEndpointConnectionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DashboardPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // PrivateEndpointConnections_List + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_PrivateEndpointConnectionsList() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/PrivateEndpointConnections_List.json + // this example is just showing the usage of "PrivateEndpointConnections_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 DashboardPrivateEndpointConnectionResource + DashboardPrivateEndpointConnectionCollection collection = managedGrafana.GetDashboardPrivateEndpointConnections(); + + // invoke the operation and iterate over the result + await foreach (DashboardPrivateEndpointConnectionResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DashboardPrivateEndpointConnectionData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Generated/Samples/Sample_DashboardPrivateEndpointConnectionResource.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Generated/Samples/Sample_DashboardPrivateEndpointConnectionResource.cs new file mode 100644 index 000000000000..c11caf1c2720 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Generated/Samples/Sample_DashboardPrivateEndpointConnectionResource.cs @@ -0,0 +1,114 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.Dashboard; + +namespace Azure.ResourceManager.Dashboard.Samples +{ + public partial class Sample_DashboardPrivateEndpointConnectionResource + { + // PrivateEndpointConnections_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_PrivateEndpointConnectionsGet() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-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 DashboardPrivateEndpointConnectionResource created on azure + // for more information of creating DashboardPrivateEndpointConnectionResource, please refer to the document of DashboardPrivateEndpointConnectionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string workspaceName = "myWorkspace"; + string privateEndpointConnectionName = "myConnection"; + ResourceIdentifier dashboardPrivateEndpointConnectionResourceId = DashboardPrivateEndpointConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, privateEndpointConnectionName); + DashboardPrivateEndpointConnectionResource dashboardPrivateEndpointConnection = client.GetDashboardPrivateEndpointConnectionResource(dashboardPrivateEndpointConnectionResourceId); + + // invoke the operation + DashboardPrivateEndpointConnectionResource result = await dashboardPrivateEndpointConnection.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DashboardPrivateEndpointConnectionData 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")] + public async Task Update_PrivateEndpointConnectionsApprove() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/PrivateEndpointConnections_Approve.json + // this example is just showing the usage of "PrivateEndpointConnections_Approve" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DashboardPrivateEndpointConnectionResource created on azure + // for more information of creating DashboardPrivateEndpointConnectionResource, please refer to the document of DashboardPrivateEndpointConnectionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string workspaceName = "myWorkspace"; + string privateEndpointConnectionName = "myConnection"; + ResourceIdentifier dashboardPrivateEndpointConnectionResourceId = DashboardPrivateEndpointConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, privateEndpointConnectionName); + DashboardPrivateEndpointConnectionResource dashboardPrivateEndpointConnection = client.GetDashboardPrivateEndpointConnectionResource(dashboardPrivateEndpointConnectionResourceId); + + // invoke the operation + DashboardPrivateEndpointConnectionData data = new DashboardPrivateEndpointConnectionData(); + ArmOperation lro = await dashboardPrivateEndpointConnection.UpdateAsync(WaitUntil.Completed, data); + DashboardPrivateEndpointConnectionResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DashboardPrivateEndpointConnectionData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // PrivateEndpointConnections_Delete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_PrivateEndpointConnectionsDelete() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/PrivateEndpointConnections_Delete.json + // this example is just showing the usage of "PrivateEndpointConnections_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this DashboardPrivateEndpointConnectionResource created on azure + // for more information of creating DashboardPrivateEndpointConnectionResource, please refer to the document of DashboardPrivateEndpointConnectionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string workspaceName = "myWorkspace"; + string privateEndpointConnectionName = "myConnection"; + ResourceIdentifier dashboardPrivateEndpointConnectionResourceId = DashboardPrivateEndpointConnectionResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, privateEndpointConnectionName); + DashboardPrivateEndpointConnectionResource dashboardPrivateEndpointConnection = client.GetDashboardPrivateEndpointConnectionResource(dashboardPrivateEndpointConnectionResourceId); + + // invoke the operation + await dashboardPrivateEndpointConnection.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Generated/Samples/Sample_DashboardPrivateLinkResource.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Generated/Samples/Sample_DashboardPrivateLinkResource.cs new file mode 100644 index 000000000000..5a82fb2fa584 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Generated/Samples/Sample_DashboardPrivateLinkResource.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.Dashboard; + +namespace Azure.ResourceManager.Dashboard.Samples +{ + public partial class Sample_DashboardPrivateLinkResource + { + // PrivateLinkResources_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_PrivateLinkResourcesGet() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-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 DashboardPrivateLinkResource created on azure + // for more information of creating DashboardPrivateLinkResource, please refer to the document of DashboardPrivateLinkResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string workspaceName = "myWorkspace"; + string privateLinkResourceName = "grafana"; + ResourceIdentifier dashboardPrivateLinkResourceId = DashboardPrivateLinkResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, privateLinkResourceName); + DashboardPrivateLinkResource dashboardPrivateLinkResource = client.GetDashboardPrivateLinkResource(dashboardPrivateLinkResourceId); + + // invoke the operation + DashboardPrivateLinkResource result = await dashboardPrivateLinkResource.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DashboardPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Generated/Samples/Sample_DashboardPrivateLinkResourceCollection.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Generated/Samples/Sample_DashboardPrivateLinkResourceCollection.cs new file mode 100644 index 000000000000..40dac0671493 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Generated/Samples/Sample_DashboardPrivateLinkResourceCollection.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.Dashboard; + +namespace Azure.ResourceManager.Dashboard.Samples +{ + public partial class Sample_DashboardPrivateLinkResourceCollection + { + // PrivateLinkResources_List + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_PrivateLinkResourcesList() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/PrivateLinkResources_List.json + // this example is just showing the usage of "PrivateLinkResources_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 DashboardPrivateLinkResource + DashboardPrivateLinkResourceCollection collection = managedGrafana.GetDashboardPrivateLinkResources(); + + // invoke the operation and iterate over the result + await foreach (DashboardPrivateLinkResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DashboardPrivateLinkResourceData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // PrivateLinkResources_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_PrivateLinkResourcesGet() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-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 DashboardPrivateLinkResource + DashboardPrivateLinkResourceCollection collection = managedGrafana.GetDashboardPrivateLinkResources(); + + // invoke the operation + string privateLinkResourceName = "grafana"; + DashboardPrivateLinkResource result = await collection.GetAsync(privateLinkResourceName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DashboardPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // PrivateLinkResources_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_PrivateLinkResourcesGet() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-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 DashboardPrivateLinkResource + DashboardPrivateLinkResourceCollection collection = managedGrafana.GetDashboardPrivateLinkResources(); + + // invoke the operation + string privateLinkResourceName = "grafana"; + bool result = await collection.ExistsAsync(privateLinkResourceName); + + 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/2023-09-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 DashboardPrivateLinkResource + DashboardPrivateLinkResourceCollection collection = managedGrafana.GetDashboardPrivateLinkResources(); + + // invoke the operation + string privateLinkResourceName = "grafana"; + NullableResponse response = await collection.GetIfExistsAsync(privateLinkResourceName); + DashboardPrivateLinkResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + DashboardPrivateLinkResourceData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Generated/Samples/Sample_ManagedGrafanaCollection.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Generated/Samples/Sample_ManagedGrafanaCollection.cs new file mode 100644 index 000000000000..38325adb1e4d --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Generated/Samples/Sample_ManagedGrafanaCollection.cs @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.Dashboard; +using Azure.ResourceManager.Dashboard.Models; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.Dashboard.Samples +{ + public partial class Sample_ManagedGrafanaCollection + { + // Grafana_ListByResourceGroup + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_GrafanaListByResourceGroup() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/Grafana_ListByResourceGroup.json + // this example is just showing the usage of "Grafana_ListByResourceGroup" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "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 and iterate over the result + await foreach (ManagedGrafanaResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ManagedGrafanaData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Grafana_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GrafanaGet() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-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"; + ManagedGrafanaResource result = await collection.GetAsync(workspaceName); + + // the variable result is 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_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_GrafanaGet() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-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"; + bool result = await collection.ExistsAsync(workspaceName); + + 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/2023-09-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")] + public async Task CreateOrUpdate_GrafanaCreate() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/Grafana_Create.json + // this example is just showing the usage of "Grafana_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ResourceGroupResource created on azure + // for more information of creating ResourceGroupResource, please refer to the document of ResourceGroupResource + string subscriptionId = "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"; + ManagedGrafanaData data = new ManagedGrafanaData(new AzureLocation("West US")) + { + SkuName = "Standard", + Properties = new ManagedGrafanaProperties() + { + PublicNetworkAccess = PublicNetworkAccess.Enabled, + ZoneRedundancy = ZoneRedundancy.Enabled, + ApiKey = ApiKey.Enabled, + DeterministicOutboundIP = DeterministicOutboundIP.Enabled, + AzureMonitorWorkspaceIntegrations = +{ +new AzureMonitorWorkspaceIntegration() +{ +AzureMonitorWorkspaceResourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace", +} +}, + EnterpriseConfigurations = new EnterpriseConfigurations() + { + MarketplacePlanId = "myPlanId", + MarketplaceAutoRenew = MarketplaceAutoRenew.Enabled, + }, + GrafanaConfigurationsSmtp = new Smtp() + { + Enabled = true, + Host = "smtp.sendemail.com:587", + User = "username", + Password = "", + FromAddress = "test@sendemail.com", + FromName = "emailsender", + StartTLSPolicy = StartTLSPolicy.OpportunisticStartTLS, + SkipVerify = true, + }, + GrafanaPlugins = +{ +["sample-plugin-id"] = new GrafanaPlugin(), +}, + GrafanaMajorVersion = "9", + }, + Identity = new ManagedServiceIdentity("SystemAssigned"), + Tags = +{ +["Environment"] = "Dev", +}, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, workspaceName, data); + ManagedGrafanaResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ManagedGrafanaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Generated/Samples/Sample_ManagedGrafanaResource.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Generated/Samples/Sample_ManagedGrafanaResource.cs new file mode 100644 index 000000000000..bc365b7ae368 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Generated/Samples/Sample_ManagedGrafanaResource.cs @@ -0,0 +1,268 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.Dashboard; +using Azure.ResourceManager.Dashboard.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.Dashboard.Samples +{ + public partial class Sample_ManagedGrafanaResource + { + // Grafana_List + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetManagedGrafanas_GrafanaList() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/Grafana_List.json + // this example is just showing the usage of "Grafana_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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); + + // invoke the operation and iterate over the result + await foreach (ManagedGrafanaResource item in subscriptionResource.GetManagedGrafanasAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ManagedGrafanaData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // Grafana_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_GrafanaGet() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-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 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); + + // invoke the operation + ManagedGrafanaResource result = await managedGrafana.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ManagedGrafanaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Grafana_Update + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_GrafanaUpdate() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/Grafana_Update.json + // this example is just showing the usage of "Grafana_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this 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); + + // invoke the operation + ManagedGrafanaPatch patch = new ManagedGrafanaPatch() + { + SkuName = "Standard", + Tags = +{ +["Environment"] = "Dev 2", +}, + Properties = new ManagedGrafanaPropertiesUpdateParameters() + { + ApiKey = ApiKey.Enabled, + DeterministicOutboundIP = DeterministicOutboundIP.Enabled, + AzureMonitorWorkspaceIntegrations = +{ +new AzureMonitorWorkspaceIntegration() +{ +AzureMonitorWorkspaceResourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourcegroups/myResourceGroup/providers/microsoft.monitor/accounts/myAzureMonitorWorkspace", +} +}, + EnterpriseConfigurations = new EnterpriseConfigurations() + { + MarketplacePlanId = "myPlanId", + MarketplaceAutoRenew = MarketplaceAutoRenew.Enabled, + }, + GrafanaConfigurationsSmtp = new Smtp() + { + Enabled = true, + Host = "smtp.sendemail.com:587", + User = "username", + Password = "", + FromAddress = "test@sendemail.com", + FromName = "emailsender", + StartTLSPolicy = StartTLSPolicy.OpportunisticStartTLS, + SkipVerify = true, + }, + GrafanaPlugins = +{ +["sample-plugin-id"] = new GrafanaPlugin(), +}, + GrafanaMajorVersion = "9", + }, + }; + ManagedGrafanaResource result = await managedGrafana.UpdateAsync(patch); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ManagedGrafanaData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // Grafana_Delete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_GrafanaDelete() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/Grafana_Delete.json + // this example is just showing the usage of "Grafana_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this 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); + + // invoke the operation + await managedGrafana.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + + // EnterpriseDetails_Post + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CheckEnterpriseDetails_EnterpriseDetailsPost() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/EnterpriseDetails_Post.json + // this example is just showing the usage of "Grafana_CheckEnterpriseDetails" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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); + + // invoke the operation + EnterpriseDetails result = await managedGrafana.CheckEnterpriseDetailsAsync(); + + Console.WriteLine($"Succeeded: {result}"); + } + + // Grafana_FetchAvailablePlugins + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task FetchAvailablePlugins_GrafanaFetchAvailablePlugins() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/Grafana_FetchAvailablePlugins.json + // this example is just showing the usage of "Grafana_FetchAvailablePlugins" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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); + + // invoke the operation and iterate over the result + await foreach (GrafanaAvailablePlugin item in managedGrafana.FetchAvailablePluginsAsync()) + { + Console.WriteLine($"Succeeded: {item}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ManagedPrivateEndpoint_Refresh + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task RefreshManagedPrivateEndpoint_ManagedPrivateEndpointRefresh() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/ManagedPrivateEndpoints_Refresh.json + // this example is just showing the usage of "ManagedPrivateEndpoints_Refresh" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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); + + // invoke the operation + await managedGrafana.RefreshManagedPrivateEndpointAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Generated/Samples/Sample_ManagedPrivateEndpointModelCollection.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Generated/Samples/Sample_ManagedPrivateEndpointModelCollection.cs new file mode 100644 index 000000000000..23717a7b087f --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Generated/Samples/Sample_ManagedPrivateEndpointModelCollection.cs @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.Dashboard; + +namespace Azure.ResourceManager.Dashboard.Samples +{ + public partial class Sample_ManagedPrivateEndpointModelCollection + { + // ManagedPrivateEndpoint_List + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetAll_ManagedPrivateEndpointList() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/ManagedPrivateEndpoints_List.json + // this example is just showing the usage of "ManagedPrivateEndpoints_List" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 ManagedPrivateEndpointModelResource + ManagedPrivateEndpointModelCollection collection = managedGrafana.GetManagedPrivateEndpointModels(); + + // invoke the operation and iterate over the result + await foreach (ManagedPrivateEndpointModelResource item in collection.GetAllAsync()) + { + // the variable item is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ManagedPrivateEndpointModelData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine($"Succeeded"); + } + + // ManagedPrivateEndpoint_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ManagedPrivateEndpointGet() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-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 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 ManagedPrivateEndpointModelResource + ManagedPrivateEndpointModelCollection collection = managedGrafana.GetManagedPrivateEndpointModels(); + + // invoke the operation + string managedPrivateEndpointName = "myMPEName"; + ManagedPrivateEndpointModelResource result = await collection.GetAsync(managedPrivateEndpointName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ManagedPrivateEndpointModelData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ManagedPrivateEndpoint_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Exists_ManagedPrivateEndpointGet() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-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 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 ManagedPrivateEndpointModelResource + ManagedPrivateEndpointModelCollection collection = managedGrafana.GetManagedPrivateEndpointModels(); + + // invoke the operation + string managedPrivateEndpointName = "myMPEName"; + bool result = await collection.ExistsAsync(managedPrivateEndpointName); + + Console.WriteLine($"Succeeded: {result}"); + } + + // ManagedPrivateEndpoint_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task GetIfExists_ManagedPrivateEndpointGet() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-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 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 ManagedPrivateEndpointModelResource + ManagedPrivateEndpointModelCollection collection = managedGrafana.GetManagedPrivateEndpointModels(); + + // invoke the operation + string managedPrivateEndpointName = "myMPEName"; + NullableResponse response = await collection.GetIfExistsAsync(managedPrivateEndpointName); + ManagedPrivateEndpointModelResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine($"Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ManagedPrivateEndpointModelData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + // ManagedPrivateEndpoint_Create + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task CreateOrUpdate_ManagedPrivateEndpointCreate() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/ManagedPrivateEndpoints_Create.json + // this example is just showing the usage of "ManagedPrivateEndpoints_Create" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this 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 ManagedPrivateEndpointModelResource + ManagedPrivateEndpointModelCollection collection = managedGrafana.GetManagedPrivateEndpointModels(); + + // invoke the operation + string managedPrivateEndpointName = "myMPEName"; + ManagedPrivateEndpointModelData data = new ManagedPrivateEndpointModelData(new AzureLocation("West US")) + { + PrivateLinkResourceId = "/subscriptions/xxxxxxxx-xxxx-xxxx-xxxx-000000000000/resourceGroups/xx-rg/providers/Microsoft.Kusto/Clusters/sampleKustoResource", + PrivateLinkResourceRegion = "West US", + GroupIds = +{ +"grafana" +}, + RequestMessage = "Example Request Message", + PrivateLinkServiceUri = new Uri("my-self-hosted-influxdb.westus.mydomain.com"), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, managedPrivateEndpointName, data); + ManagedPrivateEndpointModelResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ManagedPrivateEndpointModelData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Generated/Samples/Sample_ManagedPrivateEndpointModelResource.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Generated/Samples/Sample_ManagedPrivateEndpointModelResource.cs new file mode 100644 index 000000000000..e9383090171c --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/samples/Generated/Samples/Sample_ManagedPrivateEndpointModelResource.cs @@ -0,0 +1,121 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager; +using Azure.ResourceManager.Dashboard; +using Azure.ResourceManager.Dashboard.Models; + +namespace Azure.ResourceManager.Dashboard.Samples +{ + public partial class Sample_ManagedPrivateEndpointModelResource + { + // ManagedPrivateEndpoint_Get + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Get_ManagedPrivateEndpointGet() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-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 ManagedPrivateEndpointModelResource created on azure + // for more information of creating ManagedPrivateEndpointModelResource, please refer to the document of ManagedPrivateEndpointModelResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string workspaceName = "myWorkspace"; + string managedPrivateEndpointName = "myMPEName"; + ResourceIdentifier managedPrivateEndpointModelResourceId = ManagedPrivateEndpointModelResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, managedPrivateEndpointName); + ManagedPrivateEndpointModelResource managedPrivateEndpointModel = client.GetManagedPrivateEndpointModelResource(managedPrivateEndpointModelResourceId); + + // invoke the operation + ManagedPrivateEndpointModelResource result = await managedPrivateEndpointModel.GetAsync(); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ManagedPrivateEndpointModelData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ManagedPrivateEndpoints_Patch + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Update_ManagedPrivateEndpointsPatch() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/ManagedPrivateEndpoints_Patch.json + // this example is just showing the usage of "ManagedPrivateEndpoints_Update" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ManagedPrivateEndpointModelResource created on azure + // for more information of creating ManagedPrivateEndpointModelResource, please refer to the document of ManagedPrivateEndpointModelResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string workspaceName = "myWorkspace"; + string managedPrivateEndpointName = "myMPEName"; + ResourceIdentifier managedPrivateEndpointModelResourceId = ManagedPrivateEndpointModelResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, managedPrivateEndpointName); + ManagedPrivateEndpointModelResource managedPrivateEndpointModel = client.GetManagedPrivateEndpointModelResource(managedPrivateEndpointModelResourceId); + + // invoke the operation + ManagedPrivateEndpointModelPatch patch = new ManagedPrivateEndpointModelPatch() + { + Tags = +{ +["Environment"] = "Dev 2", +}, + }; + ArmOperation lro = await managedPrivateEndpointModel.UpdateAsync(WaitUntil.Completed, patch); + ManagedPrivateEndpointModelResource result = lro.Value; + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ManagedPrivateEndpointModelData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + // ManagedPrivateEndpoint_Delete + [NUnit.Framework.Test] + [NUnit.Framework.Ignore("Only verifying that the sample builds")] + public async Task Delete_ManagedPrivateEndpointDelete() + { + // Generated from example definition: specification/dashboard/resource-manager/Microsoft.Dashboard/stable/2023-09-01/examples/ManagedPrivateEndpoints_Delete.json + // this example is just showing the usage of "ManagedPrivateEndpoints_Delete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ManagedPrivateEndpointModelResource created on azure + // for more information of creating ManagedPrivateEndpointModelResource, please refer to the document of ManagedPrivateEndpointModelResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string resourceGroupName = "myResourceGroup"; + string workspaceName = "myWorkspace"; + string managedPrivateEndpointName = "myMPEName"; + ResourceIdentifier managedPrivateEndpointModelResourceId = ManagedPrivateEndpointModelResource.CreateResourceIdentifier(subscriptionId, resourceGroupName, workspaceName, managedPrivateEndpointName); + ManagedPrivateEndpointModelResource managedPrivateEndpointModel = client.GetManagedPrivateEndpointModelResource(managedPrivateEndpointModelResourceId); + + // invoke the operation + await managedPrivateEndpointModel.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine($"Succeeded"); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Azure.ResourceManager.Dashboard.csproj b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Azure.ResourceManager.Dashboard.csproj new file mode 100644 index 000000000000..897ab6c3c39e --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Azure.ResourceManager.Dashboard.csproj @@ -0,0 +1,8 @@ + + + 1.0.0-beta.1 + Azure.ResourceManager.Dashboard + Azure Resource Manager client SDK for Azure resource provider dashboard. + azure;management;arm;resource manager;dashboard + + diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/ArmDashboardModelFactory.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/ArmDashboardModelFactory.cs new file mode 100644 index 000000000000..eeb2cb3560c1 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/ArmDashboardModelFactory.cs @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; +using Azure.Core; +using Azure.ResourceManager.Dashboard; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// Model factory for models. + public static partial class ArmDashboardModelFactory + { + /// Initializes a new instance of ManagedGrafanaData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The Sku of the grafana resource. + /// Properties specific to the grafana resource. + /// The managed identity of the grafana resource. + /// A new instance for mocking. + public static ManagedGrafanaData ManagedGrafanaData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, string skuName = null, ManagedGrafanaProperties properties = null, ManagedServiceIdentity identity = null) + { + tags ??= new Dictionary(); + + return new ManagedGrafanaData(id, name, resourceType, systemData, tags, location, skuName != null ? new ResourceSku(skuName) : null, properties, identity); + } + + /// Initializes a new instance of ManagedGrafanaProperties. + /// Provisioning state of the resource. + /// The Grafana software version. + /// The endpoint of the Grafana instance. + /// Indicate the state for enable or disable traffic over the public interface. + /// The zone redundancy setting of the Grafana instance. + /// The api key setting of the Grafana instance. + /// Whether a Grafana instance uses deterministic outbound IPs. + /// List of outbound IPs if deterministicOutboundIP is enabled. + /// The private endpoint connections of the Grafana instance. + /// Scope for dns deterministic name hash calculation. + /// GrafanaIntegrations is a bundled observability experience (e.g. pre-configured data source, tailored Grafana dashboards, alerting defaults) for common monitoring scenarios. + /// Enterprise settings of a Grafana instance. + /// Server configurations of a Grafana instance. + /// Installed plugin list of the Grafana instance. Key is plugin id, value is plugin definition. + /// The major Grafana software version to target. + /// A new instance for mocking. + public static ManagedGrafanaProperties ManagedGrafanaProperties(ProvisioningState? provisioningState = null, string grafanaVersion = null, string endpoint = null, PublicNetworkAccess? publicNetworkAccess = null, ZoneRedundancy? zoneRedundancy = null, ApiKey? apiKey = null, DeterministicOutboundIP? deterministicOutboundIP = null, IEnumerable outboundIPs = null, IEnumerable privateEndpointConnections = null, AutoGeneratedDomainNameLabelScope? autoGeneratedDomainNameLabelScope = null, IEnumerable azureMonitorWorkspaceIntegrations = null, EnterpriseConfigurations enterpriseConfigurations = null, Smtp grafanaConfigurationsSmtp = null, IDictionary grafanaPlugins = null, string grafanaMajorVersion = null) + { + outboundIPs ??= new List(); + privateEndpointConnections ??= new List(); + azureMonitorWorkspaceIntegrations ??= new List(); + grafanaPlugins ??= new Dictionary(); + + return new ManagedGrafanaProperties(provisioningState, grafanaVersion, endpoint, publicNetworkAccess, zoneRedundancy, apiKey, deterministicOutboundIP, outboundIPs?.ToList(), privateEndpointConnections?.ToList(), autoGeneratedDomainNameLabelScope, azureMonitorWorkspaceIntegrations != null ? new GrafanaIntegrations(azureMonitorWorkspaceIntegrations?.ToList()) : null, enterpriseConfigurations, grafanaConfigurationsSmtp != null ? new GrafanaConfigurations(grafanaConfigurationsSmtp) : null, grafanaPlugins, grafanaMajorVersion); + } + + /// Initializes a new instance of DashboardPrivateEndpointConnectionData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource of private end point. + /// A collection of information about the state of the connection between service consumer and provider. + /// The private endpoint connection group ids. + /// The provisioning state of the private endpoint connection resource. + /// A new instance for mocking. + public static DashboardPrivateEndpointConnectionData DashboardPrivateEndpointConnectionData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ResourceIdentifier privateEndpointId = null, DashboardPrivateLinkServiceConnectionState connectionState = null, IEnumerable groupIds = null, DashboardPrivateEndpointConnectionProvisioningState? provisioningState = null) + { + groupIds ??= new List(); + + return new DashboardPrivateEndpointConnectionData(id, name, resourceType, systemData, privateEndpointId != null ? ResourceManagerModelFactory.SubResource(privateEndpointId) : null, connectionState, groupIds?.ToList(), provisioningState); + } + + /// Initializes a new instance of GrafanaPlugin. + /// Grafana plugin id. + /// A new instance for mocking. + public static GrafanaPlugin GrafanaPlugin(string pluginId = null) + { + return new GrafanaPlugin(pluginId); + } + + /// Initializes a new instance of DashboardPrivateLinkResourceData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Provisioning state of the resource. + /// The private link resource group id. + /// The private link resource required member names. + /// The private link resource Private link DNS zone name. + /// A new instance for mocking. + public static DashboardPrivateLinkResourceData DashboardPrivateLinkResourceData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ProvisioningState? provisioningState = null, string groupId = null, IEnumerable requiredMembers = null, IEnumerable requiredZoneNames = null) + { + requiredMembers ??= new List(); + requiredZoneNames ??= new List(); + + return new DashboardPrivateLinkResourceData(id, name, resourceType, systemData, provisioningState, groupId, requiredMembers?.ToList(), requiredZoneNames?.ToList()); + } + + /// Initializes a new instance of EnterpriseDetails. + /// SaaS subscription details of a Grafana instance. + /// The allocation details of the per subscription free trial slot of the subscription. + /// A new instance for mocking. + public static EnterpriseDetails EnterpriseDetails(SaasSubscriptionDetails saasSubscriptionDetails = null, MarketplaceTrialQuota marketplaceTrialQuota = null) + { + return new EnterpriseDetails(saasSubscriptionDetails, marketplaceTrialQuota); + } + + /// Initializes a new instance of SaasSubscriptionDetails. + /// The plan Id of the SaaS subscription. + /// The offer Id of the SaaS subscription. + /// The publisher Id of the SaaS subscription. + /// The billing term of the SaaS Subscription. + /// A new instance for mocking. + public static SaasSubscriptionDetails SaasSubscriptionDetails(string planId = null, string offerId = null, string publisherId = null, SubscriptionTerm term = null) + { + return new SaasSubscriptionDetails(planId, offerId, publisherId, term); + } + + /// Initializes a new instance of SubscriptionTerm. + /// The unit of the billing term. + /// The date and time in UTC of when the billing term starts. + /// The date and time in UTC of when the billing term ends. + /// A new instance for mocking. + public static SubscriptionTerm SubscriptionTerm(string termUnit = null, DateTimeOffset? startOn = null, DateTimeOffset? endOn = null) + { + return new SubscriptionTerm(termUnit, startOn, endOn); + } + + /// Initializes a new instance of MarketplaceTrialQuota. + /// Available enterprise promotion for the subscription. + /// Resource Id of the Grafana resource which is doing the trial. + /// The date and time in UTC of when the trial starts. + /// The date and time in UTC of when the trial ends. + /// A new instance for mocking. + public static MarketplaceTrialQuota MarketplaceTrialQuota(AvailablePromotion? availablePromotion = null, ResourceIdentifier grafanaResourceId = null, DateTimeOffset? trialStartOn = null, DateTimeOffset? trialEndOn = null) + { + return new MarketplaceTrialQuota(availablePromotion, grafanaResourceId, trialStartOn, trialEndOn); + } + + /// Initializes a new instance of GrafanaAvailablePlugin. + /// Grafana plugin id. + /// Grafana plugin display name. + /// A new instance for mocking. + public static GrafanaAvailablePlugin GrafanaAvailablePlugin(string pluginId = null, string name = null) + { + return new GrafanaAvailablePlugin(pluginId, name); + } + + /// Initializes a new instance of ManagedPrivateEndpointModelData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Provisioning state of the resource. + /// The ARM resource ID of the resource for which the managed private endpoint is pointing to. + /// The region of the resource to which the managed private endpoint is pointing to. + /// The group Ids of the managed private endpoint. + /// User input request message of the managed private endpoint. + /// The state of managed private endpoint connection. + /// The URL of the data store behind the private link service. It would be the URL in the Grafana data source configuration page without the protocol and port. + /// The private IP of private endpoint after approval. This property is empty before connection is approved. + /// A new instance for mocking. + public static ManagedPrivateEndpointModelData ManagedPrivateEndpointModelData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, IDictionary tags = null, AzureLocation location = default, ProvisioningState? provisioningState = null, string privateLinkResourceId = null, string privateLinkResourceRegion = null, IEnumerable groupIds = null, string requestMessage = null, ManagedPrivateEndpointConnectionState connectionState = null, Uri privateLinkServiceUri = null, string privateLinkServicePrivateIP = null) + { + tags ??= new Dictionary(); + groupIds ??= new List(); + + return new ManagedPrivateEndpointModelData(id, name, resourceType, systemData, tags, location, provisioningState, privateLinkResourceId, privateLinkResourceRegion, groupIds?.ToList(), requestMessage, connectionState, privateLinkServiceUri, privateLinkServicePrivateIP); + } + + /// Initializes a new instance of ManagedPrivateEndpointConnectionState. + /// The approval/rejection status of managed private endpoint connection. + /// Gets or sets the reason for approval/rejection of the connection. + /// A new instance for mocking. + public static ManagedPrivateEndpointConnectionState ManagedPrivateEndpointConnectionState(ManagedPrivateEndpointConnectionStatus? status = null, string description = null) + { + return new ManagedPrivateEndpointConnectionState(status, description); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/DashboardPrivateEndpointConnectionCollection.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/DashboardPrivateEndpointConnectionCollection.cs new file mode 100644 index 000000000000..30933749f1d1 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/DashboardPrivateEndpointConnectionCollection.cs @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Dashboard +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetDashboardPrivateEndpointConnections method from an instance of . + /// + public partial class DashboardPrivateEndpointConnectionCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics; + private readonly PrivateEndpointConnectionsRestOperations _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsRestClient; + + /// Initializes a new instance of the class for mocking. + protected DashboardPrivateEndpointConnectionCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal DashboardPrivateEndpointConnectionCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Dashboard", DashboardPrivateEndpointConnectionResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DashboardPrivateEndpointConnectionResource.ResourceType, out string dashboardPrivateEndpointConnectionPrivateEndpointConnectionsApiVersion); + _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsRestClient = new PrivateEndpointConnectionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dashboardPrivateEndpointConnectionPrivateEndpointConnectionsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ManagedGrafanaResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ManagedGrafanaResource.ResourceType), nameof(id)); + } + + /// + /// Manual approve private endpoint connection + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Approve + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The private endpoint connection name of Azure Managed Grafana. + /// The DashboardPrivateEndpointConnection to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string privateEndpointConnectionName, DashboardPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("DashboardPrivateEndpointConnectionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.ApproveAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data, cancellationToken).ConfigureAwait(false); + var operation = new DashboardArmOperation(new DashboardPrivateEndpointConnectionOperationSource(Client), _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateApproveRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Manual approve private endpoint connection + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Approve + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The private endpoint connection name of Azure Managed Grafana. + /// The DashboardPrivateEndpointConnection to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string privateEndpointConnectionName, DashboardPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("DashboardPrivateEndpointConnectionCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Approve(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data, cancellationToken); + var operation = new DashboardArmOperation(new DashboardPrivateEndpointConnectionOperationSource(Client), _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateApproveRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get private endpoint connections. + /// + /// + /// 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> GetAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("DashboardPrivateEndpointConnectionCollection.Get"); + scope.Start(); + try + { + var response = await _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DashboardPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get private endpoint connections. + /// + /// + /// 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 Response Get(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("DashboardPrivateEndpointConnectionCollection.Get"); + scope.Start(); + try + { + var response = _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DashboardPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get private endpoint connection + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/privateEndpointConnections + /// + /// + /// Operation Id + /// PrivateEndpointConnections_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DashboardPrivateEndpointConnectionResource(Client, DashboardPrivateEndpointConnectionData.DeserializeDashboardPrivateEndpointConnectionData(e)), _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "DashboardPrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Get private endpoint connection + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/privateEndpointConnections + /// + /// + /// Operation Id + /// PrivateEndpointConnections_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DashboardPrivateEndpointConnectionResource(Client, DashboardPrivateEndpointConnectionData.DeserializeDashboardPrivateEndpointConnectionData(e)), _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, "DashboardPrivateEndpointConnectionCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// 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> ExistsAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("DashboardPrivateEndpointConnectionCollection.Exists"); + scope.Start(); + try + { + var response = await _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 Response Exists(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var scope = _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("DashboardPrivateEndpointConnectionCollection.Exists"); + scope.Start(); + try + { + var response = _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 = _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("DashboardPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.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 DashboardPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (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 = _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("DashboardPrivateEndpointConnectionCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateEndpointConnectionName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DashboardPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/DashboardPrivateEndpointConnectionData.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/DashboardPrivateEndpointConnectionData.cs new file mode 100644 index 000000000000..bd245a491d47 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/DashboardPrivateEndpointConnectionData.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Dashboard.Models; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.Dashboard +{ + /// + /// A class representing the DashboardPrivateEndpointConnection data model. + /// The Private Endpoint Connection resource. + /// + public partial class DashboardPrivateEndpointConnectionData : ResourceData + { + /// Initializes a new instance of DashboardPrivateEndpointConnectionData. + public DashboardPrivateEndpointConnectionData() + { + GroupIds = new ChangeTrackingList(); + } + + /// Initializes a new instance of DashboardPrivateEndpointConnectionData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource of private end point. + /// A collection of information about the state of the connection between service consumer and provider. + /// The private endpoint connection group ids. + /// The provisioning state of the private endpoint connection resource. + internal DashboardPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, SubResource privateEndpoint, DashboardPrivateLinkServiceConnectionState connectionState, IList groupIds, DashboardPrivateEndpointConnectionProvisioningState? provisioningState) : base(id, name, resourceType, systemData) + { + PrivateEndpoint = privateEndpoint; + ConnectionState = connectionState; + GroupIds = groupIds; + ProvisioningState = provisioningState; + } + + /// The resource of private end point. + internal SubResource PrivateEndpoint { get; set; } + /// Gets Id. + public ResourceIdentifier PrivateEndpointId + { + get => PrivateEndpoint is null ? default : PrivateEndpoint.Id; + } + + /// A collection of information about the state of the connection between service consumer and provider. + public DashboardPrivateLinkServiceConnectionState ConnectionState { get; set; } + /// The private endpoint connection group ids. + public IList GroupIds { get; } + /// The provisioning state of the private endpoint connection resource. + public DashboardPrivateEndpointConnectionProvisioningState? ProvisioningState { get; } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/DashboardPrivateEndpointConnectionResource.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/DashboardPrivateEndpointConnectionResource.cs new file mode 100644 index 000000000000..14ee52858cd7 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/DashboardPrivateEndpointConnectionResource.cs @@ -0,0 +1,297 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Dashboard +{ + /// + /// A Class representing a DashboardPrivateEndpointConnection along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetDashboardPrivateEndpointConnectionResource method. + /// Otherwise you can get one from its parent resource using the GetDashboardPrivateEndpointConnection method. + /// + public partial class DashboardPrivateEndpointConnectionResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics; + private readonly PrivateEndpointConnectionsRestOperations _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsRestClient; + private readonly DashboardPrivateEndpointConnectionData _data; + + /// Initializes a new instance of the class for mocking. + protected DashboardPrivateEndpointConnectionResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DashboardPrivateEndpointConnectionResource(ArmClient client, DashboardPrivateEndpointConnectionData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal DashboardPrivateEndpointConnectionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Dashboard", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string dashboardPrivateEndpointConnectionPrivateEndpointConnectionsApiVersion); + _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsRestClient = new PrivateEndpointConnectionsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dashboardPrivateEndpointConnectionPrivateEndpointConnectionsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Dashboard/grafana/privateEndpointConnections"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual DashboardPrivateEndpointConnectionData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get private endpoint connections. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("DashboardPrivateEndpointConnectionResource.Get"); + scope.Start(); + try + { + var response = await _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DashboardPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get private endpoint connections. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("DashboardPrivateEndpointConnectionResource.Get"); + scope.Start(); + try + { + var response = _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DashboardPrivateEndpointConnectionResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete private endpoint connection + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("DashboardPrivateEndpointConnectionResource.Delete"); + scope.Start(); + try + { + var response = await _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new DashboardArmOperation(_dashboardPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete private endpoint connection + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("DashboardPrivateEndpointConnectionResource.Delete"); + scope.Start(); + try + { + var response = _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new DashboardArmOperation(_dashboardPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Manual approve private endpoint connection + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Approve + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The DashboardPrivateEndpointConnection to use. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, DashboardPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("DashboardPrivateEndpointConnectionResource.Update"); + scope.Start(); + try + { + var response = await _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.ApproveAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new DashboardArmOperation(new DashboardPrivateEndpointConnectionOperationSource(Client), _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateApproveRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Manual approve private endpoint connection + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/privateEndpointConnections/{privateEndpointConnectionName} + /// + /// + /// Operation Id + /// PrivateEndpointConnections_Approve + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The DashboardPrivateEndpointConnection to use. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, DashboardPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics.CreateScope("DashboardPrivateEndpointConnectionResource.Update"); + scope.Start(); + try + { + var response = _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.Approve(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data, cancellationToken); + var operation = new DashboardArmOperation(new DashboardPrivateEndpointConnectionOperationSource(Client), _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsClientDiagnostics, Pipeline, _dashboardPrivateEndpointConnectionPrivateEndpointConnectionsRestClient.CreateApproveRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/DashboardPrivateLinkResource.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/DashboardPrivateLinkResource.cs new file mode 100644 index 000000000000..68e5a471d6ab --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/DashboardPrivateLinkResource.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Dashboard +{ + /// + /// A Class representing a DashboardPrivateLinkResource along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetDashboardPrivateLinkResource method. + /// Otherwise you can get one from its parent resource using the GetDashboardPrivateLinkResource method. + /// + public partial class DashboardPrivateLinkResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string privateLinkResourceName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/privateLinkResources/{privateLinkResourceName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _dashboardPrivateLinkResourcePrivateLinkResourcesClientDiagnostics; + private readonly PrivateLinkResourcesRestOperations _dashboardPrivateLinkResourcePrivateLinkResourcesRestClient; + private readonly DashboardPrivateLinkResourceData _data; + + /// Initializes a new instance of the class for mocking. + protected DashboardPrivateLinkResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal DashboardPrivateLinkResource(ArmClient client, DashboardPrivateLinkResourceData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal DashboardPrivateLinkResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dashboardPrivateLinkResourcePrivateLinkResourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Dashboard", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string dashboardPrivateLinkResourcePrivateLinkResourcesApiVersion); + _dashboardPrivateLinkResourcePrivateLinkResourcesRestClient = new PrivateLinkResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dashboardPrivateLinkResourcePrivateLinkResourcesApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Dashboard/grafana/privateLinkResources"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual DashboardPrivateLinkResourceData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get specific private link resource information for this grafana resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/privateLinkResources/{privateLinkResourceName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _dashboardPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("DashboardPrivateLinkResource.Get"); + scope.Start(); + try + { + var response = await _dashboardPrivateLinkResourcePrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DashboardPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get specific private link resource information for this grafana resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/privateLinkResources/{privateLinkResourceName} + /// + /// + /// Operation Id + /// PrivateLinkResources_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _dashboardPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("DashboardPrivateLinkResource.Get"); + scope.Start(); + try + { + var response = _dashboardPrivateLinkResourcePrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DashboardPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/DashboardPrivateLinkResourceCollection.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/DashboardPrivateLinkResourceCollection.cs new file mode 100644 index 000000000000..dceb0205ad23 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/DashboardPrivateLinkResourceCollection.cs @@ -0,0 +1,333 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Dashboard +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetDashboardPrivateLinkResources method from an instance of . + /// + public partial class DashboardPrivateLinkResourceCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _dashboardPrivateLinkResourcePrivateLinkResourcesClientDiagnostics; + private readonly PrivateLinkResourcesRestOperations _dashboardPrivateLinkResourcePrivateLinkResourcesRestClient; + + /// Initializes a new instance of the class for mocking. + protected DashboardPrivateLinkResourceCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal DashboardPrivateLinkResourceCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _dashboardPrivateLinkResourcePrivateLinkResourcesClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Dashboard", DashboardPrivateLinkResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(DashboardPrivateLinkResource.ResourceType, out string dashboardPrivateLinkResourcePrivateLinkResourcesApiVersion); + _dashboardPrivateLinkResourcePrivateLinkResourcesRestClient = new PrivateLinkResourcesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, dashboardPrivateLinkResourcePrivateLinkResourcesApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ManagedGrafanaResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ManagedGrafanaResource.ResourceType), nameof(id)); + } + + /// + /// Get specific private link resource information for this grafana resource + /// + /// + /// 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> GetAsync(string privateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkResourceName, nameof(privateLinkResourceName)); + + using var scope = _dashboardPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("DashboardPrivateLinkResourceCollection.Get"); + scope.Start(); + try + { + var response = await _dashboardPrivateLinkResourcePrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateLinkResourceName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DashboardPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get specific private link resource information for this grafana resource + /// + /// + /// 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 Response Get(string privateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkResourceName, nameof(privateLinkResourceName)); + + using var scope = _dashboardPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("DashboardPrivateLinkResourceCollection.Get"); + scope.Start(); + try + { + var response = _dashboardPrivateLinkResourcePrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateLinkResourceName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new DashboardPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List all private link resources information for this grafana resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/privateLinkResources + /// + /// + /// Operation Id + /// PrivateLinkResources_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dashboardPrivateLinkResourcePrivateLinkResourcesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dashboardPrivateLinkResourcePrivateLinkResourcesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new DashboardPrivateLinkResource(Client, DashboardPrivateLinkResourceData.DeserializeDashboardPrivateLinkResourceData(e)), _dashboardPrivateLinkResourcePrivateLinkResourcesClientDiagnostics, Pipeline, "DashboardPrivateLinkResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List all private link resources information for this grafana resource + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/privateLinkResources + /// + /// + /// Operation Id + /// PrivateLinkResources_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _dashboardPrivateLinkResourcePrivateLinkResourcesRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _dashboardPrivateLinkResourcePrivateLinkResourcesRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new DashboardPrivateLinkResource(Client, DashboardPrivateLinkResourceData.DeserializeDashboardPrivateLinkResourceData(e)), _dashboardPrivateLinkResourcePrivateLinkResourcesClientDiagnostics, Pipeline, "DashboardPrivateLinkResourceCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// 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> ExistsAsync(string privateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkResourceName, nameof(privateLinkResourceName)); + + using var scope = _dashboardPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("DashboardPrivateLinkResourceCollection.Exists"); + scope.Start(); + try + { + var response = await _dashboardPrivateLinkResourcePrivateLinkResourcesRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateLinkResourceName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 Response Exists(string privateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(privateLinkResourceName, nameof(privateLinkResourceName)); + + using var scope = _dashboardPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("DashboardPrivateLinkResourceCollection.Exists"); + scope.Start(); + try + { + var response = _dashboardPrivateLinkResourcePrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateLinkResourceName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 = _dashboardPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("DashboardPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _dashboardPrivateLinkResourcePrivateLinkResourcesRestClient.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 DashboardPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (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 = _dashboardPrivateLinkResourcePrivateLinkResourcesClientDiagnostics.CreateScope("DashboardPrivateLinkResourceCollection.GetIfExists"); + scope.Start(); + try + { + var response = _dashboardPrivateLinkResourcePrivateLinkResourcesRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, privateLinkResourceName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new DashboardPrivateLinkResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/DashboardPrivateLinkResourceData.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/DashboardPrivateLinkResourceData.cs new file mode 100644 index 000000000000..9a907c8d5c09 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/DashboardPrivateLinkResourceData.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Dashboard.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Dashboard +{ + /// + /// A class representing the DashboardPrivateLinkResource data model. + /// A private link resource + /// + public partial class DashboardPrivateLinkResourceData : ResourceData + { + /// Initializes a new instance of DashboardPrivateLinkResourceData. + public DashboardPrivateLinkResourceData() + { + RequiredMembers = new ChangeTrackingList(); + RequiredZoneNames = new ChangeTrackingList(); + } + + /// Initializes a new instance of DashboardPrivateLinkResourceData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// Provisioning state of the resource. + /// The private link resource group id. + /// The private link resource required member names. + /// The private link resource Private link DNS zone name. + internal DashboardPrivateLinkResourceData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ProvisioningState? provisioningState, string groupId, IReadOnlyList requiredMembers, IList requiredZoneNames) : base(id, name, resourceType, systemData) + { + ProvisioningState = provisioningState; + GroupId = groupId; + RequiredMembers = requiredMembers; + RequiredZoneNames = requiredZoneNames; + } + + /// Provisioning state of the resource. + public ProvisioningState? ProvisioningState { get; } + /// The private link resource group id. + public string GroupId { get; } + /// The private link resource required member names. + public IReadOnlyList RequiredMembers { get; } + /// The private link resource Private link DNS zone name. + public IList RequiredZoneNames { get; } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Extensions/DashboardExtensions.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Extensions/DashboardExtensions.cs new file mode 100644 index 000000000000..3118bb096832 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Extensions/DashboardExtensions.cs @@ -0,0 +1,226 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.Dashboard +{ + /// A class to add extension methods to Azure.ResourceManager.Dashboard. + public static partial class DashboardExtensions + { + private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmResource resource) + { + return resource.GetCachedClient(client => + { + return new ResourceGroupResourceExtensionClient(client, resource.Id); + }); + } + + private static ResourceGroupResourceExtensionClient GetResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + { + return client.GetResourceClient(() => + { + return new ResourceGroupResourceExtensionClient(client, scope); + }); + } + + private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmResource resource) + { + return resource.GetCachedClient(client => + { + return new SubscriptionResourceExtensionClient(client, resource.Id); + }); + } + + private static SubscriptionResourceExtensionClient GetSubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier scope) + { + return client.GetResourceClient(() => + { + return new SubscriptionResourceExtensionClient(client, scope); + }); + } + #region ManagedGrafanaResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ManagedGrafanaResource GetManagedGrafanaResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ManagedGrafanaResource.ValidateResourceId(id); + return new ManagedGrafanaResource(client, id); + } + ); + } + #endregion + + #region DashboardPrivateEndpointConnectionResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static DashboardPrivateEndpointConnectionResource GetDashboardPrivateEndpointConnectionResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + DashboardPrivateEndpointConnectionResource.ValidateResourceId(id); + return new DashboardPrivateEndpointConnectionResource(client, id); + } + ); + } + #endregion + + #region DashboardPrivateLinkResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static DashboardPrivateLinkResource GetDashboardPrivateLinkResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + DashboardPrivateLinkResource.ValidateResourceId(id); + return new DashboardPrivateLinkResource(client, id); + } + ); + } + #endregion + + #region ManagedPrivateEndpointModelResource + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// Returns a object. + public static ManagedPrivateEndpointModelResource GetManagedPrivateEndpointModelResource(this ArmClient client, ResourceIdentifier id) + { + return client.GetResourceClient(() => + { + ManagedPrivateEndpointModelResource.ValidateResourceId(id); + return new ManagedPrivateEndpointModelResource(client, id); + } + ); + } + #endregion + + /// Gets a collection of ManagedGrafanaResources in the ResourceGroupResource. + /// The instance the method will execute against. + /// An object representing collection of ManagedGrafanaResources and their operations over a ManagedGrafanaResource. + public static ManagedGrafanaCollection GetManagedGrafanas(this ResourceGroupResource resourceGroupResource) + { + return GetResourceGroupResourceExtensionClient(resourceGroupResource).GetManagedGrafanas(); + } + + /// + /// Get the properties of a specific workspace for Grafana resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName} + /// + /// + /// Operation Id + /// Grafana_Get + /// + /// + /// + /// The instance the method will execute against. + /// 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. + [ForwardsClientCalls] + public static async Task> GetManagedGrafanaAsync(this ResourceGroupResource resourceGroupResource, string workspaceName, CancellationToken cancellationToken = default) + { + return await resourceGroupResource.GetManagedGrafanas().GetAsync(workspaceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get the properties of a specific workspace for Grafana resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName} + /// + /// + /// Operation Id + /// Grafana_Get + /// + /// + /// + /// The instance the method will execute against. + /// 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. + [ForwardsClientCalls] + public static Response GetManagedGrafana(this ResourceGroupResource resourceGroupResource, string workspaceName, CancellationToken cancellationToken = default) + { + return resourceGroupResource.GetManagedGrafanas().Get(workspaceName, cancellationToken); + } + + /// + /// List all resources of workspaces for Grafana under the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Dashboard/grafana + /// + /// + /// Operation Id + /// Grafana_List + /// + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public static AsyncPageable GetManagedGrafanasAsync(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetManagedGrafanasAsync(cancellationToken); + } + + /// + /// List all resources of workspaces for Grafana under the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Dashboard/grafana + /// + /// + /// Operation Id + /// Grafana_List + /// + /// + /// + /// The instance the method will execute against. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public static Pageable GetManagedGrafanas(this SubscriptionResource subscriptionResource, CancellationToken cancellationToken = default) + { + return GetSubscriptionResourceExtensionClient(subscriptionResource).GetManagedGrafanas(cancellationToken); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs new file mode 100644 index 000000000000..7a5d6b3576f4 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Extensions/ResourceGroupResourceExtensionClient.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Dashboard +{ + /// A class to add extension methods to ResourceGroupResource. + internal partial class ResourceGroupResourceExtensionClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected ResourceGroupResourceExtensionClient() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ResourceGroupResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of ManagedGrafanaResources in the ResourceGroupResource. + /// An object representing collection of ManagedGrafanaResources and their operations over a ManagedGrafanaResource. + public virtual ManagedGrafanaCollection GetManagedGrafanas() + { + return GetCachedClient(Client => new ManagedGrafanaCollection(Client, Id)); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs new file mode 100644 index 000000000000..43eb82611c00 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Extensions/SubscriptionResourceExtensionClient.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Threading; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Dashboard +{ + /// A class to add extension methods to SubscriptionResource. + internal partial class SubscriptionResourceExtensionClient : ArmResource + { + private ClientDiagnostics _managedGrafanaGrafanaClientDiagnostics; + private GrafanaRestOperations _managedGrafanaGrafanaRestClient; + + /// Initializes a new instance of the class for mocking. + protected SubscriptionResourceExtensionClient() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal SubscriptionResourceExtensionClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private ClientDiagnostics ManagedGrafanaGrafanaClientDiagnostics => _managedGrafanaGrafanaClientDiagnostics ??= new ClientDiagnostics("Azure.ResourceManager.Dashboard", ManagedGrafanaResource.ResourceType.Namespace, Diagnostics); + private GrafanaRestOperations ManagedGrafanaGrafanaRestClient => _managedGrafanaGrafanaRestClient ??= new GrafanaRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, GetApiVersionOrNull(ManagedGrafanaResource.ResourceType)); + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// List all resources of workspaces for Grafana under the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Dashboard/grafana + /// + /// + /// Operation Id + /// Grafana_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetManagedGrafanasAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedGrafanaGrafanaRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedGrafanaGrafanaRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedGrafanaResource(Client, ManagedGrafanaData.DeserializeManagedGrafanaData(e)), ManagedGrafanaGrafanaClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedGrafanas", "value", "nextLink", cancellationToken); + } + + /// + /// List all resources of workspaces for Grafana under the specified subscription. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Dashboard/grafana + /// + /// + /// Operation Id + /// Grafana_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetManagedGrafanas(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => ManagedGrafanaGrafanaRestClient.CreateListRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => ManagedGrafanaGrafanaRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedGrafanaResource(Client, ManagedGrafanaData.DeserializeManagedGrafanaData(e)), ManagedGrafanaGrafanaClientDiagnostics, Pipeline, "SubscriptionResourceExtensionClient.GetManagedGrafanas", "value", "nextLink", cancellationToken); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/LongRunningOperation/DashboardArmOperation.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/LongRunningOperation/DashboardArmOperation.cs new file mode 100644 index 000000000000..392b19157a34 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/LongRunningOperation/DashboardArmOperation.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Dashboard +{ +#pragma warning disable SA1649 // File name should match first type name + internal class DashboardArmOperation : ArmOperation +#pragma warning restore SA1649 // File name should match first type name + { + private readonly OperationInternal _operation; + + /// Initializes a new instance of DashboardArmOperation for mocking. + protected DashboardArmOperation() + { + } + + internal DashboardArmOperation(Response response) + { + _operation = OperationInternal.Succeeded(response); + } + + internal DashboardArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) + { + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + _operation = new OperationInternal(nextLinkOperation, clientDiagnostics, response, "DashboardArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + /// +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.RawResponse; + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override Response WaitForCompletionResponse(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponse(cancellationToken); + + /// + public override Response WaitForCompletionResponse(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponse(pollingInterval, cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/LongRunningOperation/DashboardArmOperationOfT.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/LongRunningOperation/DashboardArmOperationOfT.cs new file mode 100644 index 000000000000..7e004cc2cddf --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/LongRunningOperation/DashboardArmOperationOfT.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Dashboard +{ +#pragma warning disable SA1649 // File name should match first type name + internal class DashboardArmOperation : ArmOperation +#pragma warning restore SA1649 // File name should match first type name + { + private readonly OperationInternal _operation; + + /// Initializes a new instance of DashboardArmOperation for mocking. + protected DashboardArmOperation() + { + } + + internal DashboardArmOperation(Response response) + { + _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); + } + + internal DashboardArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) + { + var nextLinkOperation = NextLinkOperationImplementation.Create(source, pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + _operation = new OperationInternal(nextLinkOperation, clientDiagnostics, response, "DashboardArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + /// +#pragma warning disable CA1822 + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + public override string Id => throw new NotImplementedException(); +#pragma warning restore CA1822 + + /// + public override T Value => _operation.Value; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.RawResponse; + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override Response WaitForCompletion(CancellationToken cancellationToken = default) => _operation.WaitForCompletion(cancellationToken); + + /// + public override Response WaitForCompletion(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletion(pollingInterval, cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/LongRunningOperation/DashboardPrivateEndpointConnectionOperationSource.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/LongRunningOperation/DashboardPrivateEndpointConnectionOperationSource.cs new file mode 100644 index 000000000000..de75443f400d --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/LongRunningOperation/DashboardPrivateEndpointConnectionOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Dashboard +{ + internal class DashboardPrivateEndpointConnectionOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal DashboardPrivateEndpointConnectionOperationSource(ArmClient client) + { + _client = client; + } + + DashboardPrivateEndpointConnectionResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = DashboardPrivateEndpointConnectionData.DeserializeDashboardPrivateEndpointConnectionData(document.RootElement); + return new DashboardPrivateEndpointConnectionResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = DashboardPrivateEndpointConnectionData.DeserializeDashboardPrivateEndpointConnectionData(document.RootElement); + return new DashboardPrivateEndpointConnectionResource(_client, data); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/LongRunningOperation/ManagedGrafanaOperationSource.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/LongRunningOperation/ManagedGrafanaOperationSource.cs new file mode 100644 index 000000000000..f1fb79b46b92 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/LongRunningOperation/ManagedGrafanaOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Dashboard +{ + internal class ManagedGrafanaOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ManagedGrafanaOperationSource(ArmClient client) + { + _client = client; + } + + ManagedGrafanaResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = ManagedGrafanaData.DeserializeManagedGrafanaData(document.RootElement); + return new ManagedGrafanaResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = ManagedGrafanaData.DeserializeManagedGrafanaData(document.RootElement); + return new ManagedGrafanaResource(_client, data); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/LongRunningOperation/ManagedPrivateEndpointModelOperationSource.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/LongRunningOperation/ManagedPrivateEndpointModelOperationSource.cs new file mode 100644 index 000000000000..e96035edbd40 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/LongRunningOperation/ManagedPrivateEndpointModelOperationSource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Dashboard +{ + internal class ManagedPrivateEndpointModelOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ManagedPrivateEndpointModelOperationSource(ArmClient client) + { + _client = client; + } + + ManagedPrivateEndpointModelResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = ManagedPrivateEndpointModelData.DeserializeManagedPrivateEndpointModelData(document.RootElement); + return new ManagedPrivateEndpointModelResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = ManagedPrivateEndpointModelData.DeserializeManagedPrivateEndpointModelData(document.RootElement); + return new ManagedPrivateEndpointModelResource(_client, data); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/ManagedGrafanaCollection.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/ManagedGrafanaCollection.cs new file mode 100644 index 000000000000..f7a996e98c35 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/ManagedGrafanaCollection.cs @@ -0,0 +1,416 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.Dashboard +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetManagedGrafanas method from an instance of . + /// + public partial class ManagedGrafanaCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _managedGrafanaGrafanaClientDiagnostics; + private readonly GrafanaRestOperations _managedGrafanaGrafanaRestClient; + + /// Initializes a new instance of the class for mocking. + protected ManagedGrafanaCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ManagedGrafanaCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _managedGrafanaGrafanaClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Dashboard", ManagedGrafanaResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ManagedGrafanaResource.ResourceType, out string managedGrafanaGrafanaApiVersion); + _managedGrafanaGrafanaRestClient = new GrafanaRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, managedGrafanaGrafanaApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceGroupResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceGroupResource.ResourceType), nameof(id)); + } + + /// + /// Create or update a workspace for Grafana resource. This API is idempotent, so user can either create a new grafana or update an existing grafana. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName} + /// + /// + /// Operation Id + /// Grafana_Create + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The workspace name of Azure Managed Grafana. + /// The ManagedGrafana to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string workspaceName, ManagedGrafanaData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _managedGrafanaGrafanaClientDiagnostics.CreateScope("ManagedGrafanaCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _managedGrafanaGrafanaRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, data, cancellationToken).ConfigureAwait(false); + var operation = new DashboardArmOperation(new ManagedGrafanaOperationSource(Client), _managedGrafanaGrafanaClientDiagnostics, Pipeline, _managedGrafanaGrafanaRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update a workspace for Grafana resource. This API is idempotent, so user can either create a new grafana or update an existing grafana. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName} + /// + /// + /// Operation Id + /// Grafana_Create + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The workspace name of Azure Managed Grafana. + /// The ManagedGrafana to use. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string workspaceName, ManagedGrafanaData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _managedGrafanaGrafanaClientDiagnostics.CreateScope("ManagedGrafanaCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _managedGrafanaGrafanaRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, data, cancellationToken); + var operation = new DashboardArmOperation(new ManagedGrafanaOperationSource(Client), _managedGrafanaGrafanaClientDiagnostics, Pipeline, _managedGrafanaGrafanaRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the properties of a specific workspace for Grafana resource. + /// + /// + /// 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> GetAsync(string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _managedGrafanaGrafanaClientDiagnostics.CreateScope("ManagedGrafanaCollection.Get"); + scope.Start(); + try + { + var response = await _managedGrafanaGrafanaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ManagedGrafanaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the properties of a specific workspace for Grafana resource. + /// + /// + /// 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 Response Get(string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _managedGrafanaGrafanaClientDiagnostics.CreateScope("ManagedGrafanaCollection.Get"); + scope.Start(); + try + { + var response = _managedGrafanaGrafanaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ManagedGrafanaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List all resources of workspaces for Grafana under the specified resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana + /// + /// + /// Operation Id + /// Grafana_ListByResourceGroup + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _managedGrafanaGrafanaRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _managedGrafanaGrafanaRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedGrafanaResource(Client, ManagedGrafanaData.DeserializeManagedGrafanaData(e)), _managedGrafanaGrafanaClientDiagnostics, Pipeline, "ManagedGrafanaCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List all resources of workspaces for Grafana under the specified resource group. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana + /// + /// + /// Operation Id + /// Grafana_ListByResourceGroup + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _managedGrafanaGrafanaRestClient.CreateListByResourceGroupRequest(Id.SubscriptionId, Id.ResourceGroupName); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _managedGrafanaGrafanaRestClient.CreateListByResourceGroupNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedGrafanaResource(Client, ManagedGrafanaData.DeserializeManagedGrafanaData(e)), _managedGrafanaGrafanaClientDiagnostics, Pipeline, "ManagedGrafanaCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// 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> ExistsAsync(string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _managedGrafanaGrafanaClientDiagnostics.CreateScope("ManagedGrafanaCollection.Exists"); + scope.Start(); + try + { + var response = await _managedGrafanaGrafanaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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 Response Exists(string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var scope = _managedGrafanaGrafanaClientDiagnostics.CreateScope("ManagedGrafanaCollection.Exists"); + scope.Start(); + try + { + var response = _managedGrafanaGrafanaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, workspaceName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.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(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/ManagedGrafanaData.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/ManagedGrafanaData.cs new file mode 100644 index 000000000000..40f6f0c43aa2 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/ManagedGrafanaData.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Dashboard.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Dashboard +{ + /// + /// A class representing the ManagedGrafana data model. + /// The grafana resource type. + /// + public partial class ManagedGrafanaData : TrackedResourceData + { + /// Initializes a new instance of ManagedGrafanaData. + /// The location. + public ManagedGrafanaData(AzureLocation location) : base(location) + { + } + + /// Initializes a new instance of ManagedGrafanaData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// The Sku of the grafana resource. + /// Properties specific to the grafana resource. + /// The managed identity of the grafana resource. + internal ManagedGrafanaData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ResourceSku sku, ManagedGrafanaProperties properties, ManagedServiceIdentity identity) : base(id, name, resourceType, systemData, tags, location) + { + Sku = sku; + Properties = properties; + Identity = identity; + } + + /// The Sku of the grafana resource. + internal ResourceSku Sku { get; set; } + /// Gets or sets the sku name. + public string SkuName + { + get => Sku is null ? default : Sku.Name; + set => Sku = new ResourceSku(value); + } + + /// Properties specific to the grafana resource. + public ManagedGrafanaProperties Properties { get; set; } + /// The managed identity of the grafana resource. + public ManagedServiceIdentity Identity { get; set; } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/ManagedGrafanaResource.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/ManagedGrafanaResource.cs new file mode 100644 index 000000000000..30ccc899fd58 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/ManagedGrafanaResource.cs @@ -0,0 +1,935 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Dashboard.Models; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.Dashboard +{ + /// + /// A Class representing a ManagedGrafana along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetManagedGrafanaResource method. + /// Otherwise you can get one from its parent resource using the GetManagedGrafana method. + /// + public partial class ManagedGrafanaResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _managedGrafanaGrafanaClientDiagnostics; + private readonly GrafanaRestOperations _managedGrafanaGrafanaRestClient; + private readonly ClientDiagnostics _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics; + private readonly ManagedPrivateEndpointsRestOperations _managedPrivateEndpointModelManagedPrivateEndpointsRestClient; + private readonly ManagedGrafanaData _data; + + /// Initializes a new instance of the class for mocking. + protected ManagedGrafanaResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ManagedGrafanaResource(ArmClient client, ManagedGrafanaData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ManagedGrafanaResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _managedGrafanaGrafanaClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Dashboard", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string managedGrafanaGrafanaApiVersion); + _managedGrafanaGrafanaRestClient = new GrafanaRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, managedGrafanaGrafanaApiVersion); + _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Dashboard", ManagedPrivateEndpointModelResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ManagedPrivateEndpointModelResource.ResourceType, out string managedPrivateEndpointModelManagedPrivateEndpointsApiVersion); + _managedPrivateEndpointModelManagedPrivateEndpointsRestClient = new ManagedPrivateEndpointsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, managedPrivateEndpointModelManagedPrivateEndpointsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Dashboard/grafana"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ManagedGrafanaData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// Gets a collection of DashboardPrivateEndpointConnectionResources in the ManagedGrafana. + /// An object representing collection of DashboardPrivateEndpointConnectionResources and their operations over a DashboardPrivateEndpointConnectionResource. + public virtual DashboardPrivateEndpointConnectionCollection GetDashboardPrivateEndpointConnections() + { + return GetCachedClient(Client => new DashboardPrivateEndpointConnectionCollection(Client, Id)); + } + + /// + /// Get private endpoint connections. + /// + /// + /// 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. + [ForwardsClientCalls] + public virtual async Task> GetDashboardPrivateEndpointConnectionAsync(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + return await GetDashboardPrivateEndpointConnections().GetAsync(privateEndpointConnectionName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get private endpoint connections. + /// + /// + /// 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. + [ForwardsClientCalls] + public virtual Response GetDashboardPrivateEndpointConnection(string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + return GetDashboardPrivateEndpointConnections().Get(privateEndpointConnectionName, cancellationToken); + } + + /// Gets a collection of DashboardPrivateLinkResources in the ManagedGrafana. + /// An object representing collection of DashboardPrivateLinkResources and their operations over a DashboardPrivateLinkResource. + public virtual DashboardPrivateLinkResourceCollection GetDashboardPrivateLinkResources() + { + return GetCachedClient(Client => new DashboardPrivateLinkResourceCollection(Client, Id)); + } + + /// + /// Get specific private link resource information for this grafana resource + /// + /// + /// 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. + [ForwardsClientCalls] + public virtual async Task> GetDashboardPrivateLinkResourceAsync(string privateLinkResourceName, CancellationToken cancellationToken = default) + { + return await GetDashboardPrivateLinkResources().GetAsync(privateLinkResourceName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get specific private link resource information for this grafana resource + /// + /// + /// 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. + [ForwardsClientCalls] + public virtual Response GetDashboardPrivateLinkResource(string privateLinkResourceName, CancellationToken cancellationToken = default) + { + return GetDashboardPrivateLinkResources().Get(privateLinkResourceName, cancellationToken); + } + + /// Gets a collection of ManagedPrivateEndpointModelResources in the ManagedGrafana. + /// An object representing collection of ManagedPrivateEndpointModelResources and their operations over a ManagedPrivateEndpointModelResource. + public virtual ManagedPrivateEndpointModelCollection GetManagedPrivateEndpointModels() + { + return GetCachedClient(Client => new ManagedPrivateEndpointModelCollection(Client, Id)); + } + + /// + /// Get a specific managed private endpoint of a grafana resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/managedPrivateEndpoints/{managedPrivateEndpointName} + /// + /// + /// Operation Id + /// ManagedPrivateEndpoints_Get + /// + /// + /// + /// The managed private endpoint name of Azure Managed Grafana. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual async Task> GetManagedPrivateEndpointModelAsync(string managedPrivateEndpointName, CancellationToken cancellationToken = default) + { + return await GetManagedPrivateEndpointModels().GetAsync(managedPrivateEndpointName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a specific managed private endpoint of a grafana resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/managedPrivateEndpoints/{managedPrivateEndpointName} + /// + /// + /// Operation Id + /// ManagedPrivateEndpoints_Get + /// + /// + /// + /// The managed private endpoint name of Azure Managed Grafana. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + [ForwardsClientCalls] + public virtual Response GetManagedPrivateEndpointModel(string managedPrivateEndpointName, CancellationToken cancellationToken = default) + { + return GetManagedPrivateEndpointModels().Get(managedPrivateEndpointName, cancellationToken); + } + + /// + /// Get the properties of a specific workspace for Grafana resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName} + /// + /// + /// Operation Id + /// Grafana_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _managedGrafanaGrafanaClientDiagnostics.CreateScope("ManagedGrafanaResource.Get"); + scope.Start(); + try + { + var response = await _managedGrafanaGrafanaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ManagedGrafanaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get the properties of a specific workspace for Grafana resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName} + /// + /// + /// Operation Id + /// Grafana_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _managedGrafanaGrafanaClientDiagnostics.CreateScope("ManagedGrafanaResource.Get"); + scope.Start(); + try + { + var response = _managedGrafanaGrafanaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ManagedGrafanaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a workspace for Grafana resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName} + /// + /// + /// Operation Id + /// Grafana_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _managedGrafanaGrafanaClientDiagnostics.CreateScope("ManagedGrafanaResource.Delete"); + scope.Start(); + try + { + var response = await _managedGrafanaGrafanaRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new DashboardArmOperation(_managedGrafanaGrafanaClientDiagnostics, Pipeline, _managedGrafanaGrafanaRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a workspace for Grafana resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName} + /// + /// + /// Operation Id + /// Grafana_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _managedGrafanaGrafanaClientDiagnostics.CreateScope("ManagedGrafanaResource.Delete"); + scope.Start(); + try + { + var response = _managedGrafanaGrafanaRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new DashboardArmOperation(_managedGrafanaGrafanaClientDiagnostics, Pipeline, _managedGrafanaGrafanaRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a workspace for Grafana resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName} + /// + /// + /// Operation Id + /// Grafana_Update + /// + /// + /// + /// The ManagedGrafanaPatch to use. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ManagedGrafanaPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _managedGrafanaGrafanaClientDiagnostics.CreateScope("ManagedGrafanaResource.Update"); + scope.Start(); + try + { + var response = await _managedGrafanaGrafanaRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ManagedGrafanaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a workspace for Grafana resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName} + /// + /// + /// Operation Id + /// Grafana_Update + /// + /// + /// + /// The ManagedGrafanaPatch to use. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ManagedGrafanaPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _managedGrafanaGrafanaClientDiagnostics.CreateScope("ManagedGrafanaResource.Update"); + scope.Start(); + try + { + var response = _managedGrafanaGrafanaRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, patch, cancellationToken); + return Response.FromValue(new ManagedGrafanaResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Retrieve enterprise add-on details information + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/checkEnterpriseDetails + /// + /// + /// Operation Id + /// Grafana_CheckEnterpriseDetails + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> CheckEnterpriseDetailsAsync(CancellationToken cancellationToken = default) + { + using var scope = _managedGrafanaGrafanaClientDiagnostics.CreateScope("ManagedGrafanaResource.CheckEnterpriseDetails"); + scope.Start(); + try + { + var response = await _managedGrafanaGrafanaRestClient.CheckEnterpriseDetailsAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Retrieve enterprise add-on details information + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/checkEnterpriseDetails + /// + /// + /// Operation Id + /// Grafana_CheckEnterpriseDetails + /// + /// + /// + /// The cancellation token to use. + public virtual Response CheckEnterpriseDetails(CancellationToken cancellationToken = default) + { + using var scope = _managedGrafanaGrafanaClientDiagnostics.CreateScope("ManagedGrafanaResource.CheckEnterpriseDetails"); + scope.Start(); + try + { + var response = _managedGrafanaGrafanaRestClient.CheckEnterpriseDetails(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/fetchAvailablePlugins + /// + /// + /// Operation Id + /// Grafana_FetchAvailablePlugins + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable FetchAvailablePluginsAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _managedGrafanaGrafanaRestClient.CreateFetchAvailablePluginsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, null, GrafanaAvailablePlugin.DeserializeGrafanaAvailablePlugin, _managedGrafanaGrafanaClientDiagnostics, Pipeline, "ManagedGrafanaResource.FetchAvailablePlugins", "value", null, cancellationToken); + } + + /// + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/fetchAvailablePlugins + /// + /// + /// Operation Id + /// Grafana_FetchAvailablePlugins + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable FetchAvailablePlugins(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _managedGrafanaGrafanaRestClient.CreateFetchAvailablePluginsRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, null, GrafanaAvailablePlugin.DeserializeGrafanaAvailablePlugin, _managedGrafanaGrafanaClientDiagnostics, Pipeline, "ManagedGrafanaResource.FetchAvailablePlugins", "value", null, cancellationToken); + } + + /// + /// Refresh and sync managed private endpoints of a grafana resource to latest state. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/refreshManagedPrivateEndpoints + /// + /// + /// Operation Id + /// ManagedPrivateEndpoints_Refresh + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task RefreshManagedPrivateEndpointAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics.CreateScope("ManagedGrafanaResource.RefreshManagedPrivateEndpoint"); + scope.Start(); + try + { + var response = await _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.RefreshAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new DashboardArmOperation(_managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics, Pipeline, _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.CreateRefreshRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Refresh and sync managed private endpoints of a grafana resource to latest state. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/refreshManagedPrivateEndpoints + /// + /// + /// Operation Id + /// ManagedPrivateEndpoints_Refresh + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation RefreshManagedPrivateEndpoint(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics.CreateScope("ManagedGrafanaResource.RefreshManagedPrivateEndpoint"); + scope.Start(); + try + { + var response = _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.Refresh(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + var operation = new DashboardArmOperation(_managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics, Pipeline, _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.CreateRefreshRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName} + /// + /// + /// Operation Id + /// Grafana_Get + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _managedGrafanaGrafanaClientDiagnostics.CreateScope("ManagedGrafanaResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _managedGrafanaGrafanaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ManagedGrafanaResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new ManagedGrafanaPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName} + /// + /// + /// Operation Id + /// Grafana_Get + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _managedGrafanaGrafanaClientDiagnostics.CreateScope("ManagedGrafanaResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _managedGrafanaGrafanaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new ManagedGrafanaResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new ManagedGrafanaPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName} + /// + /// + /// Operation Id + /// Grafana_Get + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _managedGrafanaGrafanaClientDiagnostics.CreateScope("ManagedGrafanaResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _managedGrafanaGrafanaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ManagedGrafanaResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new ManagedGrafanaPatch(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName} + /// + /// + /// Operation Id + /// Grafana_Get + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _managedGrafanaGrafanaClientDiagnostics.CreateScope("ManagedGrafanaResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _managedGrafanaGrafanaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new ManagedGrafanaResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new ManagedGrafanaPatch(); + patch.Tags.ReplaceWith(tags); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName} + /// + /// + /// Operation Id + /// Grafana_Get + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _managedGrafanaGrafanaClientDiagnostics.CreateScope("ManagedGrafanaResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _managedGrafanaGrafanaRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ManagedGrafanaResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new ManagedGrafanaPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName} + /// + /// + /// Operation Id + /// Grafana_Get + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _managedGrafanaGrafanaClientDiagnostics.CreateScope("ManagedGrafanaResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _managedGrafanaGrafanaRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, cancellationToken); + return Response.FromValue(new ManagedGrafanaResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new ManagedGrafanaPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(patch, cancellationToken: cancellationToken); + return result; + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/ManagedPrivateEndpointModelCollection.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/ManagedPrivateEndpointModelCollection.cs new file mode 100644 index 000000000000..efa08d090d28 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/ManagedPrivateEndpointModelCollection.cs @@ -0,0 +1,415 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; + +namespace Azure.ResourceManager.Dashboard +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get a instance call the GetManagedPrivateEndpointModels method from an instance of . + /// + public partial class ManagedPrivateEndpointModelCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics; + private readonly ManagedPrivateEndpointsRestOperations _managedPrivateEndpointModelManagedPrivateEndpointsRestClient; + + /// Initializes a new instance of the class for mocking. + protected ManagedPrivateEndpointModelCollection() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the parent resource that is the target of operations. + internal ManagedPrivateEndpointModelCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Dashboard", ManagedPrivateEndpointModelResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ManagedPrivateEndpointModelResource.ResourceType, out string managedPrivateEndpointModelManagedPrivateEndpointsApiVersion); + _managedPrivateEndpointModelManagedPrivateEndpointsRestClient = new ManagedPrivateEndpointsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, managedPrivateEndpointModelManagedPrivateEndpointsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ManagedGrafanaResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ManagedGrafanaResource.ResourceType), nameof(id)); + } + + /// + /// Create or update a managed private endpoint for a grafana resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/managedPrivateEndpoints/{managedPrivateEndpointName} + /// + /// + /// Operation Id + /// ManagedPrivateEndpoints_Create + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The managed private endpoint name of Azure Managed Grafana. + /// The managed private endpoint to be created or updated. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string managedPrivateEndpointName, ManagedPrivateEndpointModelData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedPrivateEndpointName, nameof(managedPrivateEndpointName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics.CreateScope("ManagedPrivateEndpointModelCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.CreateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, managedPrivateEndpointName, data, cancellationToken).ConfigureAwait(false); + var operation = new DashboardArmOperation(new ManagedPrivateEndpointModelOperationSource(Client), _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics, Pipeline, _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, managedPrivateEndpointName, data).Request, response, OperationFinalStateVia.OriginalUri); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create or update a managed private endpoint for a grafana resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/managedPrivateEndpoints/{managedPrivateEndpointName} + /// + /// + /// Operation Id + /// ManagedPrivateEndpoints_Create + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The managed private endpoint name of Azure Managed Grafana. + /// The managed private endpoint to be created or updated. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string managedPrivateEndpointName, ManagedPrivateEndpointModelData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedPrivateEndpointName, nameof(managedPrivateEndpointName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics.CreateScope("ManagedPrivateEndpointModelCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.Create(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, managedPrivateEndpointName, data, cancellationToken); + var operation = new DashboardArmOperation(new ManagedPrivateEndpointModelOperationSource(Client), _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics, Pipeline, _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.CreateCreateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, managedPrivateEndpointName, data).Request, response, OperationFinalStateVia.OriginalUri); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a specific managed private endpoint of a grafana resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/managedPrivateEndpoints/{managedPrivateEndpointName} + /// + /// + /// Operation Id + /// ManagedPrivateEndpoints_Get + /// + /// + /// + /// The managed private endpoint 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> GetAsync(string managedPrivateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedPrivateEndpointName, nameof(managedPrivateEndpointName)); + + using var scope = _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics.CreateScope("ManagedPrivateEndpointModelCollection.Get"); + scope.Start(); + try + { + var response = await _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, managedPrivateEndpointName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ManagedPrivateEndpointModelResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a specific managed private endpoint of a grafana resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/managedPrivateEndpoints/{managedPrivateEndpointName} + /// + /// + /// Operation Id + /// ManagedPrivateEndpoints_Get + /// + /// + /// + /// The managed private endpoint 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 Response Get(string managedPrivateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedPrivateEndpointName, nameof(managedPrivateEndpointName)); + + using var scope = _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics.CreateScope("ManagedPrivateEndpointModelCollection.Get"); + scope.Start(); + try + { + var response = _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, managedPrivateEndpointName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ManagedPrivateEndpointModelResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List all managed private endpoints of a grafana resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/managedPrivateEndpoints + /// + /// + /// Operation Id + /// ManagedPrivateEndpoints_List + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ManagedPrivateEndpointModelResource(Client, ManagedPrivateEndpointModelData.DeserializeManagedPrivateEndpointModelData(e)), _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics, Pipeline, "ManagedPrivateEndpointModelCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List all managed private endpoints of a grafana resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/managedPrivateEndpoints + /// + /// + /// Operation Id + /// ManagedPrivateEndpoints_List + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.CreateListRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.CreateListNextPageRequest(nextLink, Id.SubscriptionId, Id.ResourceGroupName, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ManagedPrivateEndpointModelResource(Client, ManagedPrivateEndpointModelData.DeserializeManagedPrivateEndpointModelData(e)), _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics, Pipeline, "ManagedPrivateEndpointModelCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/managedPrivateEndpoints/{managedPrivateEndpointName} + /// + /// + /// Operation Id + /// ManagedPrivateEndpoints_Get + /// + /// + /// + /// The managed private endpoint 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> ExistsAsync(string managedPrivateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedPrivateEndpointName, nameof(managedPrivateEndpointName)); + + using var scope = _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics.CreateScope("ManagedPrivateEndpointModelCollection.Exists"); + scope.Start(); + try + { + var response = await _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, managedPrivateEndpointName, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/managedPrivateEndpoints/{managedPrivateEndpointName} + /// + /// + /// Operation Id + /// ManagedPrivateEndpoints_Get + /// + /// + /// + /// The managed private endpoint 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 Response Exists(string managedPrivateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedPrivateEndpointName, nameof(managedPrivateEndpointName)); + + using var scope = _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics.CreateScope("ManagedPrivateEndpointModelCollection.Exists"); + scope.Start(); + try + { + var response = _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, managedPrivateEndpointName, cancellationToken: cancellationToken); + return Response.FromValue(response.Value != null, response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/managedPrivateEndpoints/{managedPrivateEndpointName} + /// + /// + /// Operation Id + /// ManagedPrivateEndpoints_Get + /// + /// + /// + /// The managed private endpoint 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 managedPrivateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedPrivateEndpointName, nameof(managedPrivateEndpointName)); + + using var scope = _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics.CreateScope("ManagedPrivateEndpointModelCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.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 ManagedPrivateEndpointModelResource(Client, response.Value), response.GetRawResponse()); + } + catch (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}/managedPrivateEndpoints/{managedPrivateEndpointName} + /// + /// + /// Operation Id + /// ManagedPrivateEndpoints_Get + /// + /// + /// + /// The managed private endpoint 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 managedPrivateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(managedPrivateEndpointName, nameof(managedPrivateEndpointName)); + + using var scope = _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics.CreateScope("ManagedPrivateEndpointModelCollection.GetIfExists"); + scope.Start(); + try + { + var response = _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Name, managedPrivateEndpointName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ManagedPrivateEndpointModelResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetAll().GetEnumerator(); + } + + IAsyncEnumerator IAsyncEnumerable.GetAsyncEnumerator(CancellationToken cancellationToken) + { + return GetAllAsync(cancellationToken: cancellationToken).GetAsyncEnumerator(cancellationToken); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/ManagedPrivateEndpointModelData.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/ManagedPrivateEndpointModelData.cs new file mode 100644 index 000000000000..59ecef3448d6 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/ManagedPrivateEndpointModelData.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Dashboard.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Dashboard +{ + /// + /// A class representing the ManagedPrivateEndpointModel data model. + /// The managed private endpoint resource type. + /// + public partial class ManagedPrivateEndpointModelData : TrackedResourceData + { + /// Initializes a new instance of ManagedPrivateEndpointModelData. + /// The location. + public ManagedPrivateEndpointModelData(AzureLocation location) : base(location) + { + GroupIds = new ChangeTrackingList(); + } + + /// Initializes a new instance of ManagedPrivateEndpointModelData. + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The tags. + /// The location. + /// Provisioning state of the resource. + /// The ARM resource ID of the resource for which the managed private endpoint is pointing to. + /// The region of the resource to which the managed private endpoint is pointing to. + /// The group Ids of the managed private endpoint. + /// User input request message of the managed private endpoint. + /// The state of managed private endpoint connection. + /// The URL of the data store behind the private link service. It would be the URL in the Grafana data source configuration page without the protocol and port. + /// The private IP of private endpoint after approval. This property is empty before connection is approved. + internal ManagedPrivateEndpointModelData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, IDictionary tags, AzureLocation location, ProvisioningState? provisioningState, string privateLinkResourceId, string privateLinkResourceRegion, IList groupIds, string requestMessage, ManagedPrivateEndpointConnectionState connectionState, Uri privateLinkServiceUri, string privateLinkServicePrivateIP) : base(id, name, resourceType, systemData, tags, location) + { + ProvisioningState = provisioningState; + PrivateLinkResourceId = privateLinkResourceId; + PrivateLinkResourceRegion = privateLinkResourceRegion; + GroupIds = groupIds; + RequestMessage = requestMessage; + ConnectionState = connectionState; + PrivateLinkServiceUri = privateLinkServiceUri; + PrivateLinkServicePrivateIP = privateLinkServicePrivateIP; + } + + /// Provisioning state of the resource. + public ProvisioningState? ProvisioningState { get; } + /// The ARM resource ID of the resource for which the managed private endpoint is pointing to. + public string PrivateLinkResourceId { get; set; } + /// The region of the resource to which the managed private endpoint is pointing to. + public string PrivateLinkResourceRegion { get; set; } + /// The group Ids of the managed private endpoint. + public IList GroupIds { get; } + /// User input request message of the managed private endpoint. + public string RequestMessage { get; set; } + /// The state of managed private endpoint connection. + public ManagedPrivateEndpointConnectionState ConnectionState { get; } + /// The URL of the data store behind the private link service. It would be the URL in the Grafana data source configuration page without the protocol and port. + public Uri PrivateLinkServiceUri { get; set; } + /// The private IP of private endpoint after approval. This property is empty before connection is approved. + public string PrivateLinkServicePrivateIP { get; } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/ManagedPrivateEndpointModelResource.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/ManagedPrivateEndpointModelResource.cs new file mode 100644 index 000000000000..62d31b70cf89 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/ManagedPrivateEndpointModelResource.cs @@ -0,0 +1,609 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager; +using Azure.ResourceManager.Dashboard.Models; + +namespace Azure.ResourceManager.Dashboard +{ + /// + /// A Class representing a ManagedPrivateEndpointModel along with the instance operations that can be performed on it. + /// If you have a you can construct a + /// from an instance of using the GetManagedPrivateEndpointModelResource method. + /// Otherwise you can get one from its parent resource using the GetManagedPrivateEndpointModel method. + /// + public partial class ManagedPrivateEndpointModelResource : ArmResource + { + /// Generate the resource identifier of a instance. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string resourceGroupName, string workspaceName, string managedPrivateEndpointName) + { + var resourceId = $"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/managedPrivateEndpoints/{managedPrivateEndpointName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics; + private readonly ManagedPrivateEndpointsRestOperations _managedPrivateEndpointModelManagedPrivateEndpointsRestClient; + private readonly ManagedPrivateEndpointModelData _data; + + /// Initializes a new instance of the class for mocking. + protected ManagedPrivateEndpointModelResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ManagedPrivateEndpointModelResource(ArmClient client, ManagedPrivateEndpointModelData data) : this(client, data.Id) + { + HasData = true; + _data = data; + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The identifier of the resource that is the target of operations. + internal ManagedPrivateEndpointModelResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Dashboard", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string managedPrivateEndpointModelManagedPrivateEndpointsApiVersion); + _managedPrivateEndpointModelManagedPrivateEndpointsRestClient = new ManagedPrivateEndpointsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, managedPrivateEndpointModelManagedPrivateEndpointsApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Dashboard/grafana/managedPrivateEndpoints"; + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ManagedPrivateEndpointModelData Data + { + get + { + if (!HasData) + throw new InvalidOperationException("The current instance does not have data, you must call Get first."); + return _data; + } + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, ResourceType), nameof(id)); + } + + /// + /// Get a specific managed private endpoint of a grafana resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/managedPrivateEndpoints/{managedPrivateEndpointName} + /// + /// + /// Operation Id + /// ManagedPrivateEndpoints_Get + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics.CreateScope("ManagedPrivateEndpointModelResource.Get"); + scope.Start(); + try + { + var response = await _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ManagedPrivateEndpointModelResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a specific managed private endpoint of a grafana resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/managedPrivateEndpoints/{managedPrivateEndpointName} + /// + /// + /// Operation Id + /// ManagedPrivateEndpoints_Get + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics.CreateScope("ManagedPrivateEndpointModelResource.Get"); + scope.Start(); + try + { + var response = _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ManagedPrivateEndpointModelResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a managed private endpoint for a grafana resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/managedPrivateEndpoints/{managedPrivateEndpointName} + /// + /// + /// Operation Id + /// ManagedPrivateEndpoints_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics.CreateScope("ManagedPrivateEndpointModelResource.Delete"); + scope.Start(); + try + { + var response = await _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.DeleteAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var operation = new DashboardArmOperation(_managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics, Pipeline, _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a managed private endpoint for a grafana resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/managedPrivateEndpoints/{managedPrivateEndpointName} + /// + /// + /// Operation Id + /// ManagedPrivateEndpoints_Delete + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics.CreateScope("ManagedPrivateEndpointModelResource.Delete"); + scope.Start(); + try + { + var response = _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.Delete(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + var operation = new DashboardArmOperation(_managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics, Pipeline, _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.CreateDeleteRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a managed private endpoint for an existing grafana resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/managedPrivateEndpoints/{managedPrivateEndpointName} + /// + /// + /// Operation Id + /// ManagedPrivateEndpoints_Update + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Properties that can be updated to an existing managed private endpoint. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, ManagedPrivateEndpointModelPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics.CreateScope("ManagedPrivateEndpointModelResource.Update"); + scope.Start(); + try + { + var response = await _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.UpdateAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken).ConfigureAwait(false); + var operation = new DashboardArmOperation(new ManagedPrivateEndpointModelOperationSource(Client), _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics, Pipeline, _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a managed private endpoint for an existing grafana resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/managedPrivateEndpoints/{managedPrivateEndpointName} + /// + /// + /// Operation Id + /// ManagedPrivateEndpoints_Update + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Properties that can be updated to an existing managed private endpoint. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, ManagedPrivateEndpointModelPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(patch, nameof(patch)); + + using var scope = _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics.CreateScope("ManagedPrivateEndpointModelResource.Update"); + scope.Start(); + try + { + var response = _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.Update(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch, cancellationToken); + var operation = new DashboardArmOperation(new ManagedPrivateEndpointModelOperationSource(Client), _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics, Pipeline, _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.CreateUpdateRequest(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, patch).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/managedPrivateEndpoints/{managedPrivateEndpointName} + /// + /// + /// Operation Id + /// ManagedPrivateEndpoints_Get + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual async Task> AddTagAsync(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics.CreateScope("ManagedPrivateEndpointModelResource.AddTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues[key] = value; + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ManagedPrivateEndpointModelResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new ManagedPrivateEndpointModelPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Add a tag to the current resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/managedPrivateEndpoints/{managedPrivateEndpointName} + /// + /// + /// Operation Id + /// ManagedPrivateEndpoints_Get + /// + /// + /// + /// The key for the tag. + /// The value for the tag. + /// The cancellation token to use. + /// or is null. + public virtual Response AddTag(string key, string value, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + Argument.AssertNotNull(value, nameof(value)); + + using var scope = _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics.CreateScope("ManagedPrivateEndpointModelResource.AddTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues[key] = value; + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new ManagedPrivateEndpointModelResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new ManagedPrivateEndpointModelPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags[key] = value; + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/managedPrivateEndpoints/{managedPrivateEndpointName} + /// + /// + /// Operation Id + /// ManagedPrivateEndpoints_Get + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual async Task> SetTagsAsync(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics.CreateScope("ManagedPrivateEndpointModelResource.SetTags"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + await GetTagResource().DeleteAsync(WaitUntil.Completed, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ManagedPrivateEndpointModelResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new ManagedPrivateEndpointModelPatch(); + patch.Tags.ReplaceWith(tags); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Replace the tags on the resource with the given set. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/managedPrivateEndpoints/{managedPrivateEndpointName} + /// + /// + /// Operation Id + /// ManagedPrivateEndpoints_Get + /// + /// + /// + /// The set of tags to use as replacement. + /// The cancellation token to use. + /// is null. + public virtual Response SetTags(IDictionary tags, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(tags, nameof(tags)); + + using var scope = _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics.CreateScope("ManagedPrivateEndpointModelResource.SetTags"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + GetTagResource().Delete(WaitUntil.Completed, cancellationToken: cancellationToken); + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.ReplaceWith(tags); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new ManagedPrivateEndpointModelResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new ManagedPrivateEndpointModelPatch(); + patch.Tags.ReplaceWith(tags); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/managedPrivateEndpoints/{managedPrivateEndpointName} + /// + /// + /// Operation Id + /// ManagedPrivateEndpoints_Get + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual async Task> RemoveTagAsync(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics.CreateScope("ManagedPrivateEndpointModelResource.RemoveTag"); + scope.Start(); + try + { + if (await CanUseTagResourceAsync(cancellationToken: cancellationToken).ConfigureAwait(false)) + { + var originalTags = await GetTagResource().GetAsync(cancellationToken).ConfigureAwait(false); + originalTags.Value.Data.TagValues.Remove(key); + await GetTagResource().CreateOrUpdateAsync(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken).ConfigureAwait(false); + var originalResponse = await _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.GetAsync(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ManagedPrivateEndpointModelResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = (await GetAsync(cancellationToken: cancellationToken).ConfigureAwait(false)).Value.Data; + var patch = new ManagedPrivateEndpointModelPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = await UpdateAsync(WaitUntil.Completed, patch, cancellationToken: cancellationToken).ConfigureAwait(false); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Removes a tag by key from the resource. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Dashboard/grafana/{workspaceName}/managedPrivateEndpoints/{managedPrivateEndpointName} + /// + /// + /// Operation Id + /// ManagedPrivateEndpoints_Get + /// + /// + /// + /// The key for the tag. + /// The cancellation token to use. + /// is null. + public virtual Response RemoveTag(string key, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(key, nameof(key)); + + using var scope = _managedPrivateEndpointModelManagedPrivateEndpointsClientDiagnostics.CreateScope("ManagedPrivateEndpointModelResource.RemoveTag"); + scope.Start(); + try + { + if (CanUseTagResource(cancellationToken: cancellationToken)) + { + var originalTags = GetTagResource().Get(cancellationToken); + originalTags.Value.Data.TagValues.Remove(key); + GetTagResource().CreateOrUpdate(WaitUntil.Completed, originalTags.Value.Data, cancellationToken: cancellationToken); + var originalResponse = _managedPrivateEndpointModelManagedPrivateEndpointsRestClient.Get(Id.SubscriptionId, Id.ResourceGroupName, Id.Parent.Name, Id.Name, cancellationToken); + return Response.FromValue(new ManagedPrivateEndpointModelResource(Client, originalResponse.Value), originalResponse.GetRawResponse()); + } + else + { + var current = Get(cancellationToken: cancellationToken).Value.Data; + var patch = new ManagedPrivateEndpointModelPatch(); + foreach (var tag in current.Tags) + { + patch.Tags.Add(tag); + } + patch.Tags.Remove(key); + var result = Update(WaitUntil.Completed, patch, cancellationToken: cancellationToken); + return Response.FromValue(result.Value, result.GetRawResponse()); + } + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ApiKey.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ApiKey.cs new file mode 100644 index 000000000000..6bedd8ec6a99 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ApiKey.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// The ApiKey. + public readonly partial struct ApiKey : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ApiKey(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DisabledValue = "Disabled"; + private const string EnabledValue = "Enabled"; + + /// Disabled. + public static ApiKey Disabled { get; } = new ApiKey(DisabledValue); + /// Enabled. + public static ApiKey Enabled { get; } = new ApiKey(EnabledValue); + /// Determines if two values are the same. + public static bool operator ==(ApiKey left, ApiKey right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ApiKey left, ApiKey right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ApiKey(string value) => new ApiKey(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ApiKey other && Equals(other); + /// + public bool Equals(ApiKey other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/AutoGeneratedDomainNameLabelScope.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/AutoGeneratedDomainNameLabelScope.cs new file mode 100644 index 000000000000..55afc20667aa --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/AutoGeneratedDomainNameLabelScope.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// Scope for dns deterministic name hash calculation. + public readonly partial struct AutoGeneratedDomainNameLabelScope : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AutoGeneratedDomainNameLabelScope(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TenantReuseValue = "TenantReuse"; + + /// TenantReuse. + public static AutoGeneratedDomainNameLabelScope TenantReuse { get; } = new AutoGeneratedDomainNameLabelScope(TenantReuseValue); + /// Determines if two values are the same. + public static bool operator ==(AutoGeneratedDomainNameLabelScope left, AutoGeneratedDomainNameLabelScope right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AutoGeneratedDomainNameLabelScope left, AutoGeneratedDomainNameLabelScope right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AutoGeneratedDomainNameLabelScope(string value) => new AutoGeneratedDomainNameLabelScope(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AutoGeneratedDomainNameLabelScope other && Equals(other); + /// + public bool Equals(AutoGeneratedDomainNameLabelScope other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/AvailablePromotion.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/AvailablePromotion.cs new file mode 100644 index 000000000000..a7626476c4f1 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/AvailablePromotion.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// The AvailablePromotion. + public readonly partial struct AvailablePromotion : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AvailablePromotion(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string NoneValue = "None"; + private const string FreeTrialValue = "FreeTrial"; + + /// None. + public static AvailablePromotion None { get; } = new AvailablePromotion(NoneValue); + /// FreeTrial. + public static AvailablePromotion FreeTrial { get; } = new AvailablePromotion(FreeTrialValue); + /// Determines if two values are the same. + public static bool operator ==(AvailablePromotion left, AvailablePromotion right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AvailablePromotion left, AvailablePromotion right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AvailablePromotion(string value) => new AvailablePromotion(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AvailablePromotion other && Equals(other); + /// + public bool Equals(AvailablePromotion other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/AzureMonitorWorkspaceIntegration.Serialization.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/AzureMonitorWorkspaceIntegration.Serialization.cs new file mode 100644 index 000000000000..9c9cc495ac69 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/AzureMonitorWorkspaceIntegration.Serialization.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Dashboard.Models +{ + public partial class AzureMonitorWorkspaceIntegration : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(AzureMonitorWorkspaceResourceId)) + { + writer.WritePropertyName("azureMonitorWorkspaceResourceId"u8); + writer.WriteStringValue(AzureMonitorWorkspaceResourceId); + } + writer.WriteEndObject(); + } + + internal static AzureMonitorWorkspaceIntegration DeserializeAzureMonitorWorkspaceIntegration(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional azureMonitorWorkspaceResourceId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("azureMonitorWorkspaceResourceId"u8)) + { + azureMonitorWorkspaceResourceId = property.Value.GetString(); + continue; + } + } + return new AzureMonitorWorkspaceIntegration(azureMonitorWorkspaceResourceId.Value); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/AzureMonitorWorkspaceIntegration.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/AzureMonitorWorkspaceIntegration.cs new file mode 100644 index 000000000000..d37a66aa1073 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/AzureMonitorWorkspaceIntegration.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// Integrations for Azure Monitor Workspace. + public partial class AzureMonitorWorkspaceIntegration + { + /// Initializes a new instance of AzureMonitorWorkspaceIntegration. + public AzureMonitorWorkspaceIntegration() + { + } + + /// Initializes a new instance of AzureMonitorWorkspaceIntegration. + /// The resource Id of the connected Azure Monitor Workspace. + internal AzureMonitorWorkspaceIntegration(string azureMonitorWorkspaceResourceId) + { + AzureMonitorWorkspaceResourceId = azureMonitorWorkspaceResourceId; + } + + /// The resource Id of the connected Azure Monitor Workspace. + public string AzureMonitorWorkspaceResourceId { get; set; } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateEndpointConnectionData.Serialization.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateEndpointConnectionData.Serialization.cs new file mode 100644 index 000000000000..547050ef7ff9 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateEndpointConnectionData.Serialization.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Dashboard.Models; +using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources.Models; + +namespace Azure.ResourceManager.Dashboard +{ + public partial class DashboardPrivateEndpointConnectionData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(PrivateEndpoint)) + { + writer.WritePropertyName("privateEndpoint"u8); + JsonSerializer.Serialize(writer, PrivateEndpoint); + } + if (Optional.IsDefined(ConnectionState)) + { + writer.WritePropertyName("privateLinkServiceConnectionState"u8); + writer.WriteObjectValue(ConnectionState); + } + if (Optional.IsCollectionDefined(GroupIds)) + { + writer.WritePropertyName("groupIds"u8); + writer.WriteStartArray(); + foreach (var item in GroupIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static DashboardPrivateEndpointConnectionData DeserializeDashboardPrivateEndpointConnectionData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional privateEndpoint = default; + Optional privateLinkServiceConnectionState = default; + Optional> groupIds = default; + Optional provisioningState = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("privateEndpoint"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + privateEndpoint = JsonSerializer.Deserialize(property0.Value.GetRawText()); + continue; + } + if (property0.NameEquals("privateLinkServiceConnectionState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + privateLinkServiceConnectionState = DashboardPrivateLinkServiceConnectionState.DeserializeDashboardPrivateLinkServiceConnectionState(property0.Value); + continue; + } + if (property0.NameEquals("groupIds"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + groupIds = array; + continue; + } + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new DashboardPrivateEndpointConnectionProvisioningState(property0.Value.GetString()); + continue; + } + } + continue; + } + } + return new DashboardPrivateEndpointConnectionData(id, name, type, systemData.Value, privateEndpoint, privateLinkServiceConnectionState.Value, Optional.ToList(groupIds), Optional.ToNullable(provisioningState)); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateEndpointConnectionListResult.Serialization.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateEndpointConnectionListResult.Serialization.cs new file mode 100644 index 000000000000..5af1d6789ca2 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateEndpointConnectionListResult.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Dashboard; + +namespace Azure.ResourceManager.Dashboard.Models +{ + internal partial class DashboardPrivateEndpointConnectionListResult + { + internal static DashboardPrivateEndpointConnectionListResult DeserializeDashboardPrivateEndpointConnectionListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DashboardPrivateEndpointConnectionData.DeserializeDashboardPrivateEndpointConnectionData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new DashboardPrivateEndpointConnectionListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateEndpointConnectionListResult.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateEndpointConnectionListResult.cs new file mode 100644 index 000000000000..4aa1e3932c85 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateEndpointConnectionListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Dashboard; + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// List of private endpoint connection associated with the specified storage account. + internal partial class DashboardPrivateEndpointConnectionListResult + { + /// Initializes a new instance of DashboardPrivateEndpointConnectionListResult. + internal DashboardPrivateEndpointConnectionListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of DashboardPrivateEndpointConnectionListResult. + /// Array of private endpoint connections. + /// URL to get the next set of operation list results (if there are any). + internal DashboardPrivateEndpointConnectionListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Array of private endpoint connections. + public IReadOnlyList Value { get; } + /// URL to get the next set of operation list results (if there are any). + public string NextLink { get; } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateEndpointConnectionProvisioningState.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateEndpointConnectionProvisioningState.cs new file mode 100644 index 000000000000..43ffad7988c5 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateEndpointConnectionProvisioningState.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// The current provisioning state. + public readonly partial struct DashboardPrivateEndpointConnectionProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DashboardPrivateEndpointConnectionProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string CreatingValue = "Creating"; + private const string DeletingValue = "Deleting"; + private const string FailedValue = "Failed"; + + /// Succeeded. + public static DashboardPrivateEndpointConnectionProvisioningState Succeeded { get; } = new DashboardPrivateEndpointConnectionProvisioningState(SucceededValue); + /// Creating. + public static DashboardPrivateEndpointConnectionProvisioningState Creating { get; } = new DashboardPrivateEndpointConnectionProvisioningState(CreatingValue); + /// Deleting. + public static DashboardPrivateEndpointConnectionProvisioningState Deleting { get; } = new DashboardPrivateEndpointConnectionProvisioningState(DeletingValue); + /// Failed. + public static DashboardPrivateEndpointConnectionProvisioningState Failed { get; } = new DashboardPrivateEndpointConnectionProvisioningState(FailedValue); + /// Determines if two values are the same. + public static bool operator ==(DashboardPrivateEndpointConnectionProvisioningState left, DashboardPrivateEndpointConnectionProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DashboardPrivateEndpointConnectionProvisioningState left, DashboardPrivateEndpointConnectionProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DashboardPrivateEndpointConnectionProvisioningState(string value) => new DashboardPrivateEndpointConnectionProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DashboardPrivateEndpointConnectionProvisioningState other && Equals(other); + /// + public bool Equals(DashboardPrivateEndpointConnectionProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateEndpointServiceConnectionStatus.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateEndpointServiceConnectionStatus.cs new file mode 100644 index 000000000000..ecf3d096dde7 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateEndpointServiceConnectionStatus.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// The private endpoint connection status. + public readonly partial struct DashboardPrivateEndpointServiceConnectionStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DashboardPrivateEndpointServiceConnectionStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PendingValue = "Pending"; + private const string ApprovedValue = "Approved"; + private const string RejectedValue = "Rejected"; + + /// Pending. + public static DashboardPrivateEndpointServiceConnectionStatus Pending { get; } = new DashboardPrivateEndpointServiceConnectionStatus(PendingValue); + /// Approved. + public static DashboardPrivateEndpointServiceConnectionStatus Approved { get; } = new DashboardPrivateEndpointServiceConnectionStatus(ApprovedValue); + /// Rejected. + public static DashboardPrivateEndpointServiceConnectionStatus Rejected { get; } = new DashboardPrivateEndpointServiceConnectionStatus(RejectedValue); + /// Determines if two values are the same. + public static bool operator ==(DashboardPrivateEndpointServiceConnectionStatus left, DashboardPrivateEndpointServiceConnectionStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DashboardPrivateEndpointServiceConnectionStatus left, DashboardPrivateEndpointServiceConnectionStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DashboardPrivateEndpointServiceConnectionStatus(string value) => new DashboardPrivateEndpointServiceConnectionStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DashboardPrivateEndpointServiceConnectionStatus other && Equals(other); + /// + public bool Equals(DashboardPrivateEndpointServiceConnectionStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateLinkResourceData.Serialization.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateLinkResourceData.Serialization.cs new file mode 100644 index 000000000000..1e540cc814a7 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateLinkResourceData.Serialization.cs @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Dashboard.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Dashboard +{ + public partial class DashboardPrivateLinkResourceData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(RequiredZoneNames)) + { + writer.WritePropertyName("requiredZoneNames"u8); + writer.WriteStartArray(); + foreach (var item in RequiredZoneNames) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static DashboardPrivateLinkResourceData DeserializeDashboardPrivateLinkResourceData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional provisioningState = default; + Optional groupId = default; + Optional> requiredMembers = default; + Optional> requiredZoneNames = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("groupId"u8)) + { + groupId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("requiredMembers"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + requiredMembers = array; + continue; + } + if (property0.NameEquals("requiredZoneNames"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + requiredZoneNames = array; + continue; + } + } + continue; + } + } + return new DashboardPrivateLinkResourceData(id, name, type, systemData.Value, Optional.ToNullable(provisioningState), groupId.Value, Optional.ToList(requiredMembers), Optional.ToList(requiredZoneNames)); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateLinkResourceListResult.Serialization.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateLinkResourceListResult.Serialization.cs new file mode 100644 index 000000000000..cd51e80b072e --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateLinkResourceListResult.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Dashboard; + +namespace Azure.ResourceManager.Dashboard.Models +{ + internal partial class DashboardPrivateLinkResourceListResult + { + internal static DashboardPrivateLinkResourceListResult DeserializeDashboardPrivateLinkResourceListResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DashboardPrivateLinkResourceData.DeserializeDashboardPrivateLinkResourceData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new DashboardPrivateLinkResourceListResult(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateLinkResourceListResult.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateLinkResourceListResult.cs new file mode 100644 index 000000000000..7e38e4f34315 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateLinkResourceListResult.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Dashboard; + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// A list of private link resources. + internal partial class DashboardPrivateLinkResourceListResult + { + /// Initializes a new instance of DashboardPrivateLinkResourceListResult. + internal DashboardPrivateLinkResourceListResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of DashboardPrivateLinkResourceListResult. + /// Array of private link resources. + /// URL to get the next set of operation list results (if there are any). + internal DashboardPrivateLinkResourceListResult(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Array of private link resources. + public IReadOnlyList Value { get; } + /// URL to get the next set of operation list results (if there are any). + public string NextLink { get; } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateLinkServiceConnectionState.Serialization.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateLinkServiceConnectionState.Serialization.cs new file mode 100644 index 000000000000..aa6f3db2d5b3 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateLinkServiceConnectionState.Serialization.cs @@ -0,0 +1,70 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Dashboard.Models +{ + public partial class DashboardPrivateLinkServiceConnectionState : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status.Value.ToString()); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(ActionsRequired)) + { + writer.WritePropertyName("actionsRequired"u8); + writer.WriteStringValue(ActionsRequired); + } + writer.WriteEndObject(); + } + + internal static DashboardPrivateLinkServiceConnectionState DeserializeDashboardPrivateLinkServiceConnectionState(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional status = default; + Optional description = default; + Optional actionsRequired = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new DashboardPrivateEndpointServiceConnectionStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("actionsRequired"u8)) + { + actionsRequired = property.Value.GetString(); + continue; + } + } + return new DashboardPrivateLinkServiceConnectionState(Optional.ToNullable(status), description.Value, actionsRequired.Value); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateLinkServiceConnectionState.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateLinkServiceConnectionState.cs new file mode 100644 index 000000000000..e59d484f9c1e --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DashboardPrivateLinkServiceConnectionState.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// A collection of information about the state of the connection between service consumer and provider. + public partial class DashboardPrivateLinkServiceConnectionState + { + /// Initializes a new instance of DashboardPrivateLinkServiceConnectionState. + public DashboardPrivateLinkServiceConnectionState() + { + } + + /// Initializes a new instance of DashboardPrivateLinkServiceConnectionState. + /// Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + /// The reason for approval/rejection of the connection. + /// A message indicating if changes on the service provider require any updates on the consumer. + internal DashboardPrivateLinkServiceConnectionState(DashboardPrivateEndpointServiceConnectionStatus? status, string description, string actionsRequired) + { + Status = status; + Description = description; + ActionsRequired = actionsRequired; + } + + /// Indicates whether the connection has been Approved/Rejected/Removed by the owner of the service. + public DashboardPrivateEndpointServiceConnectionStatus? Status { get; set; } + /// The reason for approval/rejection of the connection. + public string Description { get; set; } + /// A message indicating if changes on the service provider require any updates on the consumer. + public string ActionsRequired { get; set; } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DeterministicOutboundIP.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DeterministicOutboundIP.cs new file mode 100644 index 000000000000..0bc534013fb2 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/DeterministicOutboundIP.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// The DeterministicOutboundIP. + public readonly partial struct DeterministicOutboundIP : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DeterministicOutboundIP(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DisabledValue = "Disabled"; + private const string EnabledValue = "Enabled"; + + /// Disabled. + public static DeterministicOutboundIP Disabled { get; } = new DeterministicOutboundIP(DisabledValue); + /// Enabled. + public static DeterministicOutboundIP Enabled { get; } = new DeterministicOutboundIP(EnabledValue); + /// Determines if two values are the same. + public static bool operator ==(DeterministicOutboundIP left, DeterministicOutboundIP right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DeterministicOutboundIP left, DeterministicOutboundIP right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DeterministicOutboundIP(string value) => new DeterministicOutboundIP(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DeterministicOutboundIP other && Equals(other); + /// + public bool Equals(DeterministicOutboundIP other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/EnterpriseConfigurations.Serialization.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/EnterpriseConfigurations.Serialization.cs new file mode 100644 index 000000000000..489807716f80 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/EnterpriseConfigurations.Serialization.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Dashboard.Models +{ + public partial class EnterpriseConfigurations : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(MarketplacePlanId)) + { + writer.WritePropertyName("marketplacePlanId"u8); + writer.WriteStringValue(MarketplacePlanId); + } + if (Optional.IsDefined(MarketplaceAutoRenew)) + { + writer.WritePropertyName("marketplaceAutoRenew"u8); + writer.WriteStringValue(MarketplaceAutoRenew.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static EnterpriseConfigurations DeserializeEnterpriseConfigurations(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional marketplacePlanId = default; + Optional marketplaceAutoRenew = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("marketplacePlanId"u8)) + { + marketplacePlanId = property.Value.GetString(); + continue; + } + if (property.NameEquals("marketplaceAutoRenew"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + marketplaceAutoRenew = new MarketplaceAutoRenew(property.Value.GetString()); + continue; + } + } + return new EnterpriseConfigurations(marketplacePlanId.Value, Optional.ToNullable(marketplaceAutoRenew)); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/EnterpriseConfigurations.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/EnterpriseConfigurations.cs new file mode 100644 index 000000000000..7f82b27c0457 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/EnterpriseConfigurations.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// Enterprise settings of a Grafana instance. + public partial class EnterpriseConfigurations + { + /// Initializes a new instance of EnterpriseConfigurations. + public EnterpriseConfigurations() + { + } + + /// Initializes a new instance of EnterpriseConfigurations. + /// The Plan Id of the Azure Marketplace subscription for the Enterprise plugins. + /// The AutoRenew setting of the Enterprise subscription. + internal EnterpriseConfigurations(string marketplacePlanId, MarketplaceAutoRenew? marketplaceAutoRenew) + { + MarketplacePlanId = marketplacePlanId; + MarketplaceAutoRenew = marketplaceAutoRenew; + } + + /// The Plan Id of the Azure Marketplace subscription for the Enterprise plugins. + public string MarketplacePlanId { get; set; } + /// The AutoRenew setting of the Enterprise subscription. + public MarketplaceAutoRenew? MarketplaceAutoRenew { get; set; } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/EnterpriseDetails.Serialization.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/EnterpriseDetails.Serialization.cs new file mode 100644 index 000000000000..5df5a021cfdd --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/EnterpriseDetails.Serialization.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Dashboard.Models +{ + public partial class EnterpriseDetails + { + internal static EnterpriseDetails DeserializeEnterpriseDetails(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional saasSubscriptionDetails = default; + Optional marketplaceTrialQuota = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("saasSubscriptionDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + saasSubscriptionDetails = SaasSubscriptionDetails.DeserializeSaasSubscriptionDetails(property.Value); + continue; + } + if (property.NameEquals("marketplaceTrialQuota"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + marketplaceTrialQuota = MarketplaceTrialQuota.DeserializeMarketplaceTrialQuota(property.Value); + continue; + } + } + return new EnterpriseDetails(saasSubscriptionDetails.Value, marketplaceTrialQuota.Value); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/EnterpriseDetails.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/EnterpriseDetails.cs new file mode 100644 index 000000000000..df7caf2be4a0 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/EnterpriseDetails.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// Enterprise details of a Grafana instance. + public partial class EnterpriseDetails + { + /// Initializes a new instance of EnterpriseDetails. + internal EnterpriseDetails() + { + } + + /// Initializes a new instance of EnterpriseDetails. + /// SaaS subscription details of a Grafana instance. + /// The allocation details of the per subscription free trial slot of the subscription. + internal EnterpriseDetails(SaasSubscriptionDetails saasSubscriptionDetails, MarketplaceTrialQuota marketplaceTrialQuota) + { + SaasSubscriptionDetails = saasSubscriptionDetails; + MarketplaceTrialQuota = marketplaceTrialQuota; + } + + /// SaaS subscription details of a Grafana instance. + public SaasSubscriptionDetails SaasSubscriptionDetails { get; } + /// The allocation details of the per subscription free trial slot of the subscription. + public MarketplaceTrialQuota MarketplaceTrialQuota { get; } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaAvailablePlugin.Serialization.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaAvailablePlugin.Serialization.cs new file mode 100644 index 000000000000..ed00792674de --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaAvailablePlugin.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Dashboard.Models +{ + public partial class GrafanaAvailablePlugin + { + internal static GrafanaAvailablePlugin DeserializeGrafanaAvailablePlugin(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional pluginId = default; + Optional name = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("pluginId"u8)) + { + pluginId = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + } + return new GrafanaAvailablePlugin(pluginId.Value, name.Value); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaAvailablePlugin.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaAvailablePlugin.cs new file mode 100644 index 000000000000..406e3d5b042e --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaAvailablePlugin.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// Available plugins of grafana. + public partial class GrafanaAvailablePlugin + { + /// Initializes a new instance of GrafanaAvailablePlugin. + internal GrafanaAvailablePlugin() + { + } + + /// Initializes a new instance of GrafanaAvailablePlugin. + /// Grafana plugin id. + /// Grafana plugin display name. + internal GrafanaAvailablePlugin(string pluginId, string name) + { + PluginId = pluginId; + Name = name; + } + + /// Grafana plugin id. + public string PluginId { get; } + /// Grafana plugin display name. + public string Name { get; } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaAvailablePluginListResponse.Serialization.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaAvailablePluginListResponse.Serialization.cs new file mode 100644 index 000000000000..8888370c54fd --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaAvailablePluginListResponse.Serialization.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Dashboard.Models +{ + internal partial class GrafanaAvailablePluginListResponse + { + internal static GrafanaAvailablePluginListResponse DeserializeGrafanaAvailablePluginListResponse(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(GrafanaAvailablePlugin.DeserializeGrafanaAvailablePlugin(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new GrafanaAvailablePluginListResponse(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaAvailablePluginListResponse.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaAvailablePluginListResponse.cs new file mode 100644 index 000000000000..a599b1bcd0b1 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaAvailablePluginListResponse.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// The GrafanaAvailablePluginListResponse. + internal partial class GrafanaAvailablePluginListResponse + { + /// Initializes a new instance of GrafanaAvailablePluginListResponse. + internal GrafanaAvailablePluginListResponse() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of GrafanaAvailablePluginListResponse. + /// + /// + internal GrafanaAvailablePluginListResponse(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Gets the value. + public IReadOnlyList Value { get; } + /// Gets the next link. + public string NextLink { get; } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaConfigurations.Serialization.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaConfigurations.Serialization.cs new file mode 100644 index 000000000000..35df6a4b5059 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaConfigurations.Serialization.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Dashboard.Models +{ + internal partial class GrafanaConfigurations : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Smtp)) + { + writer.WritePropertyName("smtp"u8); + writer.WriteObjectValue(Smtp); + } + writer.WriteEndObject(); + } + + internal static GrafanaConfigurations DeserializeGrafanaConfigurations(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional smtp = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("smtp"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + smtp = Smtp.DeserializeSmtp(property.Value); + continue; + } + } + return new GrafanaConfigurations(smtp.Value); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaConfigurations.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaConfigurations.cs new file mode 100644 index 000000000000..c5d5d7ac87b6 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaConfigurations.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// Server configurations of a Grafana instance. + internal partial class GrafanaConfigurations + { + /// Initializes a new instance of GrafanaConfigurations. + public GrafanaConfigurations() + { + } + + /// Initializes a new instance of GrafanaConfigurations. + /// + /// Email server settings. + /// https://grafana.com/docs/grafana/v9.0/setup-grafana/configure-grafana/#smtp + /// + internal GrafanaConfigurations(Smtp smtp) + { + Smtp = smtp; + } + + /// + /// Email server settings. + /// https://grafana.com/docs/grafana/v9.0/setup-grafana/configure-grafana/#smtp + /// + public Smtp Smtp { get; set; } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaIntegrations.Serialization.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaIntegrations.Serialization.cs new file mode 100644 index 000000000000..87c928a1e531 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaIntegrations.Serialization.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Dashboard.Models +{ + internal partial class GrafanaIntegrations : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(AzureMonitorWorkspaceIntegrations)) + { + writer.WritePropertyName("azureMonitorWorkspaceIntegrations"u8); + writer.WriteStartArray(); + foreach (var item in AzureMonitorWorkspaceIntegrations) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static GrafanaIntegrations DeserializeGrafanaIntegrations(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> azureMonitorWorkspaceIntegrations = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("azureMonitorWorkspaceIntegrations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AzureMonitorWorkspaceIntegration.DeserializeAzureMonitorWorkspaceIntegration(item)); + } + azureMonitorWorkspaceIntegrations = array; + continue; + } + } + return new GrafanaIntegrations(Optional.ToList(azureMonitorWorkspaceIntegrations)); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaIntegrations.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaIntegrations.cs new file mode 100644 index 000000000000..f2b3a2504230 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaIntegrations.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// GrafanaIntegrations is a bundled observability experience (e.g. pre-configured data source, tailored Grafana dashboards, alerting defaults) for common monitoring scenarios. + internal partial class GrafanaIntegrations + { + /// Initializes a new instance of GrafanaIntegrations. + public GrafanaIntegrations() + { + AzureMonitorWorkspaceIntegrations = new ChangeTrackingList(); + } + + /// Initializes a new instance of GrafanaIntegrations. + /// + internal GrafanaIntegrations(IList azureMonitorWorkspaceIntegrations) + { + AzureMonitorWorkspaceIntegrations = azureMonitorWorkspaceIntegrations; + } + + /// Gets the azure monitor workspace integrations. + public IList AzureMonitorWorkspaceIntegrations { get; } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaPlugin.Serialization.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaPlugin.Serialization.cs new file mode 100644 index 000000000000..044bd5f73125 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaPlugin.Serialization.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Dashboard.Models +{ + public partial class GrafanaPlugin : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WriteEndObject(); + } + + internal static GrafanaPlugin DeserializeGrafanaPlugin(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional pluginId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("pluginId"u8)) + { + pluginId = property.Value.GetString(); + continue; + } + } + return new GrafanaPlugin(pluginId.Value); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaPlugin.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaPlugin.cs new file mode 100644 index 000000000000..016173da8137 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/GrafanaPlugin.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// Plugin of Grafana. + public partial class GrafanaPlugin + { + /// Initializes a new instance of GrafanaPlugin. + public GrafanaPlugin() + { + } + + /// Initializes a new instance of GrafanaPlugin. + /// Grafana plugin id. + internal GrafanaPlugin(string pluginId) + { + PluginId = pluginId; + } + + /// Grafana plugin id. + public string PluginId { get; } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaData.Serialization.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaData.Serialization.cs new file mode 100644 index 000000000000..8210c2344c36 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaData.Serialization.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Dashboard.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Dashboard +{ + public partial class ManagedGrafanaData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + JsonSerializer.Serialize(writer, Identity, serializeOptions); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + writer.WriteEndObject(); + } + + internal static ManagedGrafanaData DeserializeManagedGrafanaData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional sku = default; + Optional properties = default; + Optional identity = default; + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sku"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sku = ResourceSku.DeserializeResourceSku(property.Value); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ManagedGrafanaProperties.DeserializeManagedGrafanaProperties(property.Value); + continue; + } + if (property.NameEquals("identity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + identity = JsonSerializer.Deserialize(property.Value.GetRawText(), serializeOptions); + continue; + } + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + } + return new ManagedGrafanaData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, sku.Value, properties.Value, identity); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaListResponse.Serialization.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaListResponse.Serialization.cs new file mode 100644 index 000000000000..a3a8f890cfc6 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaListResponse.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Dashboard; + +namespace Azure.ResourceManager.Dashboard.Models +{ + internal partial class ManagedGrafanaListResponse + { + internal static ManagedGrafanaListResponse DeserializeManagedGrafanaListResponse(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ManagedGrafanaData.DeserializeManagedGrafanaData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ManagedGrafanaListResponse(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaListResponse.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaListResponse.cs new file mode 100644 index 000000000000..1ee19544ff61 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaListResponse.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Dashboard; + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// The ManagedGrafanaListResponse. + internal partial class ManagedGrafanaListResponse + { + /// Initializes a new instance of ManagedGrafanaListResponse. + internal ManagedGrafanaListResponse() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ManagedGrafanaListResponse. + /// + /// + internal ManagedGrafanaListResponse(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Gets the value. + public IReadOnlyList Value { get; } + /// Gets the next link. + public string NextLink { get; } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaPatch.Serialization.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaPatch.Serialization.cs new file mode 100644 index 000000000000..ffcbd153fc67 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaPatch.Serialization.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Dashboard.Models +{ + public partial class ManagedGrafanaPatch : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Sku)) + { + writer.WritePropertyName("sku"u8); + writer.WriteObjectValue(Sku); + } + if (Optional.IsDefined(Identity)) + { + writer.WritePropertyName("identity"u8); + var serializeOptions = new JsonSerializerOptions { Converters = { new ManagedServiceIdentityTypeV3Converter() } }; + JsonSerializer.Serialize(writer, Identity, serializeOptions); + } + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaPatch.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaPatch.cs new file mode 100644 index 000000000000..ba40ebb07b2a --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaPatch.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// The parameters for a PATCH request to a grafana resource. + public partial class ManagedGrafanaPatch + { + /// Initializes a new instance of ManagedGrafanaPatch. + public ManagedGrafanaPatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// Gets or sets the sku. + internal ResourceSku Sku { get; set; } + /// Gets or sets the sku name. + public string SkuName + { + get => Sku is null ? default : Sku.Name; + set => Sku = new ResourceSku(value); + } + + /// The managed identity of the grafana resource. + public ManagedServiceIdentity Identity { get; set; } + /// The new tags of the grafana resource. + public IDictionary Tags { get; } + /// Properties specific to the managed grafana resource. + public ManagedGrafanaPropertiesUpdateParameters Properties { get; set; } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaProperties.Serialization.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaProperties.Serialization.cs new file mode 100644 index 000000000000..262784e8cf60 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaProperties.Serialization.cs @@ -0,0 +1,244 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Dashboard; + +namespace Azure.ResourceManager.Dashboard.Models +{ + public partial class ManagedGrafanaProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(PublicNetworkAccess)) + { + writer.WritePropertyName("publicNetworkAccess"u8); + writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); + } + if (Optional.IsDefined(ZoneRedundancy)) + { + writer.WritePropertyName("zoneRedundancy"u8); + writer.WriteStringValue(ZoneRedundancy.Value.ToString()); + } + if (Optional.IsDefined(ApiKey)) + { + writer.WritePropertyName("apiKey"u8); + writer.WriteStringValue(ApiKey.Value.ToString()); + } + if (Optional.IsDefined(DeterministicOutboundIP)) + { + writer.WritePropertyName("deterministicOutboundIP"u8); + writer.WriteStringValue(DeterministicOutboundIP.Value.ToString()); + } + if (Optional.IsDefined(AutoGeneratedDomainNameLabelScope)) + { + writer.WritePropertyName("autoGeneratedDomainNameLabelScope"u8); + writer.WriteStringValue(AutoGeneratedDomainNameLabelScope.Value.ToString()); + } + if (Optional.IsDefined(GrafanaIntegrations)) + { + writer.WritePropertyName("grafanaIntegrations"u8); + writer.WriteObjectValue(GrafanaIntegrations); + } + if (Optional.IsDefined(EnterpriseConfigurations)) + { + writer.WritePropertyName("enterpriseConfigurations"u8); + writer.WriteObjectValue(EnterpriseConfigurations); + } + if (Optional.IsDefined(GrafanaConfigurations)) + { + writer.WritePropertyName("grafanaConfigurations"u8); + writer.WriteObjectValue(GrafanaConfigurations); + } + if (Optional.IsCollectionDefined(GrafanaPlugins)) + { + writer.WritePropertyName("grafanaPlugins"u8); + writer.WriteStartObject(); + foreach (var item in GrafanaPlugins) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(GrafanaMajorVersion)) + { + writer.WritePropertyName("grafanaMajorVersion"u8); + writer.WriteStringValue(GrafanaMajorVersion); + } + writer.WriteEndObject(); + } + + internal static ManagedGrafanaProperties DeserializeManagedGrafanaProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional provisioningState = default; + Optional grafanaVersion = default; + Optional endpoint = default; + Optional publicNetworkAccess = default; + Optional zoneRedundancy = default; + Optional apiKey = default; + Optional deterministicOutboundIP = default; + Optional> outboundIPs = default; + Optional> privateEndpointConnections = default; + Optional autoGeneratedDomainNameLabelScope = default; + Optional grafanaIntegrations = default; + Optional enterpriseConfigurations = default; + Optional grafanaConfigurations = default; + Optional> grafanaPlugins = default; + Optional grafanaMajorVersion = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("grafanaVersion"u8)) + { + grafanaVersion = property.Value.GetString(); + continue; + } + if (property.NameEquals("endpoint"u8)) + { + endpoint = property.Value.GetString(); + continue; + } + if (property.NameEquals("publicNetworkAccess"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + publicNetworkAccess = new PublicNetworkAccess(property.Value.GetString()); + continue; + } + if (property.NameEquals("zoneRedundancy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + zoneRedundancy = new ZoneRedundancy(property.Value.GetString()); + continue; + } + if (property.NameEquals("apiKey"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + apiKey = new ApiKey(property.Value.GetString()); + continue; + } + if (property.NameEquals("deterministicOutboundIP"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + deterministicOutboundIP = new DeterministicOutboundIP(property.Value.GetString()); + continue; + } + if (property.NameEquals("outboundIPs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + outboundIPs = array; + continue; + } + if (property.NameEquals("privateEndpointConnections"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DashboardPrivateEndpointConnectionData.DeserializeDashboardPrivateEndpointConnectionData(item)); + } + privateEndpointConnections = array; + continue; + } + if (property.NameEquals("autoGeneratedDomainNameLabelScope"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + autoGeneratedDomainNameLabelScope = new AutoGeneratedDomainNameLabelScope(property.Value.GetString()); + continue; + } + if (property.NameEquals("grafanaIntegrations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + grafanaIntegrations = GrafanaIntegrations.DeserializeGrafanaIntegrations(property.Value); + continue; + } + if (property.NameEquals("enterpriseConfigurations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enterpriseConfigurations = EnterpriseConfigurations.DeserializeEnterpriseConfigurations(property.Value); + continue; + } + if (property.NameEquals("grafanaConfigurations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + grafanaConfigurations = GrafanaConfigurations.DeserializeGrafanaConfigurations(property.Value); + continue; + } + if (property.NameEquals("grafanaPlugins"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, GrafanaPlugin.DeserializeGrafanaPlugin(property0.Value)); + } + grafanaPlugins = dictionary; + continue; + } + if (property.NameEquals("grafanaMajorVersion"u8)) + { + grafanaMajorVersion = property.Value.GetString(); + continue; + } + } + return new ManagedGrafanaProperties(Optional.ToNullable(provisioningState), grafanaVersion.Value, endpoint.Value, Optional.ToNullable(publicNetworkAccess), Optional.ToNullable(zoneRedundancy), Optional.ToNullable(apiKey), Optional.ToNullable(deterministicOutboundIP), Optional.ToList(outboundIPs), Optional.ToList(privateEndpointConnections), Optional.ToNullable(autoGeneratedDomainNameLabelScope), grafanaIntegrations.Value, enterpriseConfigurations.Value, grafanaConfigurations.Value, Optional.ToDictionary(grafanaPlugins), grafanaMajorVersion.Value); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaProperties.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaProperties.cs new file mode 100644 index 000000000000..1a33ff14055e --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaProperties.cs @@ -0,0 +1,117 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Dashboard; + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// Properties specific to the grafana resource. + public partial class ManagedGrafanaProperties + { + /// Initializes a new instance of ManagedGrafanaProperties. + public ManagedGrafanaProperties() + { + OutboundIPs = new ChangeTrackingList(); + PrivateEndpointConnections = new ChangeTrackingList(); + GrafanaPlugins = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of ManagedGrafanaProperties. + /// Provisioning state of the resource. + /// The Grafana software version. + /// The endpoint of the Grafana instance. + /// Indicate the state for enable or disable traffic over the public interface. + /// The zone redundancy setting of the Grafana instance. + /// The api key setting of the Grafana instance. + /// Whether a Grafana instance uses deterministic outbound IPs. + /// List of outbound IPs if deterministicOutboundIP is enabled. + /// The private endpoint connections of the Grafana instance. + /// Scope for dns deterministic name hash calculation. + /// GrafanaIntegrations is a bundled observability experience (e.g. pre-configured data source, tailored Grafana dashboards, alerting defaults) for common monitoring scenarios. + /// Enterprise settings of a Grafana instance. + /// Server configurations of a Grafana instance. + /// Installed plugin list of the Grafana instance. Key is plugin id, value is plugin definition. + /// The major Grafana software version to target. + internal ManagedGrafanaProperties(ProvisioningState? provisioningState, string grafanaVersion, string endpoint, PublicNetworkAccess? publicNetworkAccess, ZoneRedundancy? zoneRedundancy, ApiKey? apiKey, DeterministicOutboundIP? deterministicOutboundIP, IReadOnlyList outboundIPs, IReadOnlyList privateEndpointConnections, AutoGeneratedDomainNameLabelScope? autoGeneratedDomainNameLabelScope, GrafanaIntegrations grafanaIntegrations, EnterpriseConfigurations enterpriseConfigurations, GrafanaConfigurations grafanaConfigurations, IDictionary grafanaPlugins, string grafanaMajorVersion) + { + ProvisioningState = provisioningState; + GrafanaVersion = grafanaVersion; + Endpoint = endpoint; + PublicNetworkAccess = publicNetworkAccess; + ZoneRedundancy = zoneRedundancy; + ApiKey = apiKey; + DeterministicOutboundIP = deterministicOutboundIP; + OutboundIPs = outboundIPs; + PrivateEndpointConnections = privateEndpointConnections; + AutoGeneratedDomainNameLabelScope = autoGeneratedDomainNameLabelScope; + GrafanaIntegrations = grafanaIntegrations; + EnterpriseConfigurations = enterpriseConfigurations; + GrafanaConfigurations = grafanaConfigurations; + GrafanaPlugins = grafanaPlugins; + GrafanaMajorVersion = grafanaMajorVersion; + } + + /// Provisioning state of the resource. + public ProvisioningState? ProvisioningState { get; } + /// The Grafana software version. + public string GrafanaVersion { get; } + /// The endpoint of the Grafana instance. + public string Endpoint { get; } + /// Indicate the state for enable or disable traffic over the public interface. + public PublicNetworkAccess? PublicNetworkAccess { get; set; } + /// The zone redundancy setting of the Grafana instance. + public ZoneRedundancy? ZoneRedundancy { get; set; } + /// The api key setting of the Grafana instance. + public ApiKey? ApiKey { get; set; } + /// Whether a Grafana instance uses deterministic outbound IPs. + public DeterministicOutboundIP? DeterministicOutboundIP { get; set; } + /// List of outbound IPs if deterministicOutboundIP is enabled. + public IReadOnlyList OutboundIPs { get; } + /// The private endpoint connections of the Grafana instance. + public IReadOnlyList PrivateEndpointConnections { get; } + /// Scope for dns deterministic name hash calculation. + public AutoGeneratedDomainNameLabelScope? AutoGeneratedDomainNameLabelScope { get; set; } + /// GrafanaIntegrations is a bundled observability experience (e.g. pre-configured data source, tailored Grafana dashboards, alerting defaults) for common monitoring scenarios. + internal GrafanaIntegrations GrafanaIntegrations { get; set; } + /// Gets the azure monitor workspace integrations. + public IList AzureMonitorWorkspaceIntegrations + { + get + { + if (GrafanaIntegrations is null) + GrafanaIntegrations = new GrafanaIntegrations(); + return GrafanaIntegrations.AzureMonitorWorkspaceIntegrations; + } + } + + /// Enterprise settings of a Grafana instance. + public EnterpriseConfigurations EnterpriseConfigurations { get; set; } + /// Server configurations of a Grafana instance. + internal GrafanaConfigurations GrafanaConfigurations { get; set; } + /// + /// Email server settings. + /// https://grafana.com/docs/grafana/v9.0/setup-grafana/configure-grafana/#smtp + /// + public Smtp GrafanaConfigurationsSmtp + { + get => GrafanaConfigurations is null ? default : GrafanaConfigurations.Smtp; + set + { + if (GrafanaConfigurations is null) + GrafanaConfigurations = new GrafanaConfigurations(); + GrafanaConfigurations.Smtp = value; + } + } + + /// Installed plugin list of the Grafana instance. Key is plugin id, value is plugin definition. + public IDictionary GrafanaPlugins { get; } + /// The major Grafana software version to target. + public string GrafanaMajorVersion { get; set; } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaPropertiesUpdateParameters.Serialization.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaPropertiesUpdateParameters.Serialization.cs new file mode 100644 index 000000000000..422c9d669c9a --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaPropertiesUpdateParameters.Serialization.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Dashboard.Models +{ + public partial class ManagedGrafanaPropertiesUpdateParameters : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ZoneRedundancy)) + { + writer.WritePropertyName("zoneRedundancy"u8); + writer.WriteStringValue(ZoneRedundancy.Value.ToString()); + } + if (Optional.IsDefined(ApiKey)) + { + writer.WritePropertyName("apiKey"u8); + writer.WriteStringValue(ApiKey.Value.ToString()); + } + if (Optional.IsDefined(DeterministicOutboundIP)) + { + writer.WritePropertyName("deterministicOutboundIP"u8); + writer.WriteStringValue(DeterministicOutboundIP.Value.ToString()); + } + if (Optional.IsDefined(PublicNetworkAccess)) + { + writer.WritePropertyName("publicNetworkAccess"u8); + writer.WriteStringValue(PublicNetworkAccess.Value.ToString()); + } + if (Optional.IsDefined(GrafanaIntegrations)) + { + writer.WritePropertyName("grafanaIntegrations"u8); + writer.WriteObjectValue(GrafanaIntegrations); + } + if (Optional.IsDefined(EnterpriseConfigurations)) + { + writer.WritePropertyName("enterpriseConfigurations"u8); + writer.WriteObjectValue(EnterpriseConfigurations); + } + if (Optional.IsDefined(GrafanaConfigurations)) + { + writer.WritePropertyName("grafanaConfigurations"u8); + writer.WriteObjectValue(GrafanaConfigurations); + } + if (Optional.IsCollectionDefined(GrafanaPlugins)) + { + writer.WritePropertyName("grafanaPlugins"u8); + writer.WriteStartObject(); + foreach (var item in GrafanaPlugins) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(GrafanaMajorVersion)) + { + writer.WritePropertyName("grafanaMajorVersion"u8); + writer.WriteStringValue(GrafanaMajorVersion); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaPropertiesUpdateParameters.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaPropertiesUpdateParameters.cs new file mode 100644 index 000000000000..c441377eda60 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedGrafanaPropertiesUpdateParameters.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// The properties parameters for a PATCH request to a grafana resource. + public partial class ManagedGrafanaPropertiesUpdateParameters + { + /// Initializes a new instance of ManagedGrafanaPropertiesUpdateParameters. + public ManagedGrafanaPropertiesUpdateParameters() + { + GrafanaPlugins = new ChangeTrackingDictionary(); + } + + /// The zone redundancy setting of the Grafana instance. + public ZoneRedundancy? ZoneRedundancy { get; set; } + /// The api key setting of the Grafana instance. + public ApiKey? ApiKey { get; set; } + /// Whether a Grafana instance uses deterministic outbound IPs. + public DeterministicOutboundIP? DeterministicOutboundIP { get; set; } + /// Indicate the state for enable or disable traffic over the public interface. + public PublicNetworkAccess? PublicNetworkAccess { get; set; } + /// GrafanaIntegrations is a bundled observability experience (e.g. pre-configured data source, tailored Grafana dashboards, alerting defaults) for common monitoring scenarios. + internal GrafanaIntegrations GrafanaIntegrations { get; set; } + /// Gets the azure monitor workspace integrations. + public IList AzureMonitorWorkspaceIntegrations + { + get + { + if (GrafanaIntegrations is null) + GrafanaIntegrations = new GrafanaIntegrations(); + return GrafanaIntegrations.AzureMonitorWorkspaceIntegrations; + } + } + + /// Enterprise settings of a Grafana instance. + public EnterpriseConfigurations EnterpriseConfigurations { get; set; } + /// Server configurations of a Grafana instance. + internal GrafanaConfigurations GrafanaConfigurations { get; set; } + /// + /// Email server settings. + /// https://grafana.com/docs/grafana/v9.0/setup-grafana/configure-grafana/#smtp + /// + public Smtp GrafanaConfigurationsSmtp + { + get => GrafanaConfigurations is null ? default : GrafanaConfigurations.Smtp; + set + { + if (GrafanaConfigurations is null) + GrafanaConfigurations = new GrafanaConfigurations(); + GrafanaConfigurations.Smtp = value; + } + } + + /// Update of Grafana plugin. Key is plugin id, value is plugin definition. If plugin definition is null, plugin with given plugin id will be removed. Otherwise, given plugin will be installed. + public IDictionary GrafanaPlugins { get; } + /// The major Grafana software version to target. + public string GrafanaMajorVersion { get; set; } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedPrivateEndpointConnectionState.Serialization.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedPrivateEndpointConnectionState.Serialization.cs new file mode 100644 index 000000000000..69ce5f10c9af --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedPrivateEndpointConnectionState.Serialization.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Dashboard.Models +{ + public partial class ManagedPrivateEndpointConnectionState + { + internal static ManagedPrivateEndpointConnectionState DeserializeManagedPrivateEndpointConnectionState(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional status = default; + Optional description = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + status = new ManagedPrivateEndpointConnectionStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + } + return new ManagedPrivateEndpointConnectionState(Optional.ToNullable(status), description.Value); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedPrivateEndpointConnectionState.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedPrivateEndpointConnectionState.cs new file mode 100644 index 000000000000..61f0358b2c70 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedPrivateEndpointConnectionState.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// The state of managed private endpoint connection. + public partial class ManagedPrivateEndpointConnectionState + { + /// Initializes a new instance of ManagedPrivateEndpointConnectionState. + internal ManagedPrivateEndpointConnectionState() + { + } + + /// Initializes a new instance of ManagedPrivateEndpointConnectionState. + /// The approval/rejection status of managed private endpoint connection. + /// Gets or sets the reason for approval/rejection of the connection. + internal ManagedPrivateEndpointConnectionState(ManagedPrivateEndpointConnectionStatus? status, string description) + { + Status = status; + Description = description; + } + + /// The approval/rejection status of managed private endpoint connection. + public ManagedPrivateEndpointConnectionStatus? Status { get; } + /// Gets or sets the reason for approval/rejection of the connection. + public string Description { get; } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedPrivateEndpointConnectionStatus.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedPrivateEndpointConnectionStatus.cs new file mode 100644 index 000000000000..61afec1db990 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedPrivateEndpointConnectionStatus.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// The approval/rejection status of managed private endpoint connection. + public readonly partial struct ManagedPrivateEndpointConnectionStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ManagedPrivateEndpointConnectionStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PendingValue = "Pending"; + private const string ApprovedValue = "Approved"; + private const string RejectedValue = "Rejected"; + private const string DisconnectedValue = "Disconnected"; + + /// Pending. + public static ManagedPrivateEndpointConnectionStatus Pending { get; } = new ManagedPrivateEndpointConnectionStatus(PendingValue); + /// Approved. + public static ManagedPrivateEndpointConnectionStatus Approved { get; } = new ManagedPrivateEndpointConnectionStatus(ApprovedValue); + /// Rejected. + public static ManagedPrivateEndpointConnectionStatus Rejected { get; } = new ManagedPrivateEndpointConnectionStatus(RejectedValue); + /// Disconnected. + public static ManagedPrivateEndpointConnectionStatus Disconnected { get; } = new ManagedPrivateEndpointConnectionStatus(DisconnectedValue); + /// Determines if two values are the same. + public static bool operator ==(ManagedPrivateEndpointConnectionStatus left, ManagedPrivateEndpointConnectionStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ManagedPrivateEndpointConnectionStatus left, ManagedPrivateEndpointConnectionStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ManagedPrivateEndpointConnectionStatus(string value) => new ManagedPrivateEndpointConnectionStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ManagedPrivateEndpointConnectionStatus other && Equals(other); + /// + public bool Equals(ManagedPrivateEndpointConnectionStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedPrivateEndpointModelData.Serialization.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedPrivateEndpointModelData.Serialization.cs new file mode 100644 index 000000000000..9b1d6506ac26 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedPrivateEndpointModelData.Serialization.cs @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Dashboard.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Dashboard +{ + public partial class ManagedPrivateEndpointModelData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsDefined(PrivateLinkResourceId)) + { + writer.WritePropertyName("privateLinkResourceId"u8); + writer.WriteStringValue(PrivateLinkResourceId); + } + if (Optional.IsDefined(PrivateLinkResourceRegion)) + { + writer.WritePropertyName("privateLinkResourceRegion"u8); + writer.WriteStringValue(PrivateLinkResourceRegion); + } + if (Optional.IsCollectionDefined(GroupIds)) + { + writer.WritePropertyName("groupIds"u8); + writer.WriteStartArray(); + foreach (var item in GroupIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(RequestMessage)) + { + writer.WritePropertyName("requestMessage"u8); + writer.WriteStringValue(RequestMessage); + } + if (Optional.IsDefined(PrivateLinkServiceUri)) + { + writer.WritePropertyName("privateLinkServiceUrl"u8); + writer.WriteStringValue(PrivateLinkServiceUri.AbsoluteUri); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + + internal static ManagedPrivateEndpointModelData DeserializeManagedPrivateEndpointModelData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tags = default; + AzureLocation location = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + Optional systemData = default; + Optional provisioningState = default; + Optional privateLinkResourceId = default; + Optional privateLinkResourceRegion = default; + Optional> groupIds = default; + Optional requestMessage = default; + Optional connectionState = default; + Optional privateLinkServiceUrl = default; + Optional privateLinkServicePrivateIP = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tags"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetString()); + } + tags = dictionary; + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("provisioningState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("privateLinkResourceId"u8)) + { + privateLinkResourceId = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("privateLinkResourceRegion"u8)) + { + privateLinkResourceRegion = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("groupIds"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + groupIds = array; + continue; + } + if (property0.NameEquals("requestMessage"u8)) + { + requestMessage = property0.Value.GetString(); + continue; + } + if (property0.NameEquals("connectionState"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + connectionState = ManagedPrivateEndpointConnectionState.DeserializeManagedPrivateEndpointConnectionState(property0.Value); + continue; + } + if (property0.NameEquals("privateLinkServiceUrl"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + privateLinkServiceUrl = new Uri(property0.Value.GetString()); + continue; + } + if (property0.NameEquals("privateLinkServicePrivateIP"u8)) + { + privateLinkServicePrivateIP = property0.Value.GetString(); + continue; + } + } + continue; + } + } + return new ManagedPrivateEndpointModelData(id, name, type, systemData.Value, Optional.ToDictionary(tags), location, Optional.ToNullable(provisioningState), privateLinkResourceId.Value, privateLinkResourceRegion.Value, Optional.ToList(groupIds), requestMessage.Value, connectionState.Value, privateLinkServiceUrl.Value, privateLinkServicePrivateIP.Value); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedPrivateEndpointModelListResponse.Serialization.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedPrivateEndpointModelListResponse.Serialization.cs new file mode 100644 index 000000000000..b5b444dd67cb --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedPrivateEndpointModelListResponse.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Dashboard; + +namespace Azure.ResourceManager.Dashboard.Models +{ + internal partial class ManagedPrivateEndpointModelListResponse + { + internal static ManagedPrivateEndpointModelListResponse DeserializeManagedPrivateEndpointModelListResponse(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ManagedPrivateEndpointModelData.DeserializeManagedPrivateEndpointModelData(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new ManagedPrivateEndpointModelListResponse(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedPrivateEndpointModelListResponse.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedPrivateEndpointModelListResponse.cs new file mode 100644 index 000000000000..437c4c68bc75 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedPrivateEndpointModelListResponse.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Dashboard; + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// The list of managed private endpoints of a grafana resource. + internal partial class ManagedPrivateEndpointModelListResponse + { + /// Initializes a new instance of ManagedPrivateEndpointModelListResponse. + internal ManagedPrivateEndpointModelListResponse() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of ManagedPrivateEndpointModelListResponse. + /// + /// + internal ManagedPrivateEndpointModelListResponse(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Gets the value. + public IReadOnlyList Value { get; } + /// Gets the next link. + public string NextLink { get; } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedPrivateEndpointModelPatch.Serialization.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedPrivateEndpointModelPatch.Serialization.cs new file mode 100644 index 000000000000..f071a94dc3d5 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedPrivateEndpointModelPatch.Serialization.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Dashboard.Models +{ + public partial class ManagedPrivateEndpointModelPatch : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in Tags) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedPrivateEndpointModelPatch.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedPrivateEndpointModelPatch.cs new file mode 100644 index 000000000000..6f9879463a58 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ManagedPrivateEndpointModelPatch.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// The parameters for a PATCH request to a managed private endpoint. + public partial class ManagedPrivateEndpointModelPatch + { + /// Initializes a new instance of ManagedPrivateEndpointModelPatch. + public ManagedPrivateEndpointModelPatch() + { + Tags = new ChangeTrackingDictionary(); + } + + /// The new tags of the managed private endpoint. + public IDictionary Tags { get; } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/MarketplaceAutoRenew.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/MarketplaceAutoRenew.cs new file mode 100644 index 000000000000..a6690068e4ec --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/MarketplaceAutoRenew.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// The AutoRenew setting of the Enterprise subscription. + public readonly partial struct MarketplaceAutoRenew : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public MarketplaceAutoRenew(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DisabledValue = "Disabled"; + private const string EnabledValue = "Enabled"; + + /// Disabled. + public static MarketplaceAutoRenew Disabled { get; } = new MarketplaceAutoRenew(DisabledValue); + /// Enabled. + public static MarketplaceAutoRenew Enabled { get; } = new MarketplaceAutoRenew(EnabledValue); + /// Determines if two values are the same. + public static bool operator ==(MarketplaceAutoRenew left, MarketplaceAutoRenew right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(MarketplaceAutoRenew left, MarketplaceAutoRenew right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator MarketplaceAutoRenew(string value) => new MarketplaceAutoRenew(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is MarketplaceAutoRenew other && Equals(other); + /// + public bool Equals(MarketplaceAutoRenew other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/MarketplaceTrialQuota.Serialization.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/MarketplaceTrialQuota.Serialization.cs new file mode 100644 index 000000000000..d09d5d34af93 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/MarketplaceTrialQuota.Serialization.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Dashboard.Models +{ + public partial class MarketplaceTrialQuota + { + internal static MarketplaceTrialQuota DeserializeMarketplaceTrialQuota(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional availablePromotion = default; + Optional grafanaResourceId = default; + Optional trialStartAt = default; + Optional trialEndAt = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("availablePromotion"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + availablePromotion = new AvailablePromotion(property.Value.GetString()); + continue; + } + if (property.NameEquals("grafanaResourceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + grafanaResourceId = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("trialStartAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + trialStartAt = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("trialEndAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + trialEndAt = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new MarketplaceTrialQuota(Optional.ToNullable(availablePromotion), grafanaResourceId.Value, Optional.ToNullable(trialStartAt), Optional.ToNullable(trialEndAt)); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/MarketplaceTrialQuota.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/MarketplaceTrialQuota.cs new file mode 100644 index 000000000000..ad9866e0eceb --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/MarketplaceTrialQuota.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// The allocation details of the per subscription free trial slot of the subscription. + public partial class MarketplaceTrialQuota + { + /// Initializes a new instance of MarketplaceTrialQuota. + internal MarketplaceTrialQuota() + { + } + + /// Initializes a new instance of MarketplaceTrialQuota. + /// Available enterprise promotion for the subscription. + /// Resource Id of the Grafana resource which is doing the trial. + /// The date and time in UTC of when the trial starts. + /// The date and time in UTC of when the trial ends. + internal MarketplaceTrialQuota(AvailablePromotion? availablePromotion, ResourceIdentifier grafanaResourceId, DateTimeOffset? trialStartOn, DateTimeOffset? trialEndOn) + { + AvailablePromotion = availablePromotion; + GrafanaResourceId = grafanaResourceId; + TrialStartOn = trialStartOn; + TrialEndOn = trialEndOn; + } + + /// Available enterprise promotion for the subscription. + public AvailablePromotion? AvailablePromotion { get; } + /// Resource Id of the Grafana resource which is doing the trial. + public ResourceIdentifier GrafanaResourceId { get; } + /// The date and time in UTC of when the trial starts. + public DateTimeOffset? TrialStartOn { get; } + /// The date and time in UTC of when the trial ends. + public DateTimeOffset? TrialEndOn { get; } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ProvisioningState.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 000000000000..3f44f4f77748 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ProvisioningState.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// The ProvisioningState. + public readonly partial struct ProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AcceptedValue = "Accepted"; + private const string CreatingValue = "Creating"; + private const string UpdatingValue = "Updating"; + private const string DeletingValue = "Deleting"; + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + private const string DeletedValue = "Deleted"; + private const string NotSpecifiedValue = "NotSpecified"; + + /// Accepted. + public static ProvisioningState Accepted { get; } = new ProvisioningState(AcceptedValue); + /// Creating. + public static ProvisioningState Creating { get; } = new ProvisioningState(CreatingValue); + /// Updating. + public static ProvisioningState Updating { get; } = new ProvisioningState(UpdatingValue); + /// Deleting. + public static ProvisioningState Deleting { get; } = new ProvisioningState(DeletingValue); + /// Succeeded. + public static ProvisioningState Succeeded { get; } = new ProvisioningState(SucceededValue); + /// Failed. + public static ProvisioningState Failed { get; } = new ProvisioningState(FailedValue); + /// Canceled. + public static ProvisioningState Canceled { get; } = new ProvisioningState(CanceledValue); + /// Deleted. + public static ProvisioningState Deleted { get; } = new ProvisioningState(DeletedValue); + /// NotSpecified. + public static ProvisioningState NotSpecified { get; } = new ProvisioningState(NotSpecifiedValue); + /// Determines if two values are the same. + public static bool operator ==(ProvisioningState left, ProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ProvisioningState left, ProvisioningState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ProvisioningState(string value) => new ProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ProvisioningState other && Equals(other); + /// + public bool Equals(ProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/PublicNetworkAccess.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/PublicNetworkAccess.cs new file mode 100644 index 000000000000..623770b1943a --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/PublicNetworkAccess.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// Indicate the state for enable or disable traffic over the public interface. + public readonly partial struct PublicNetworkAccess : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PublicNetworkAccess(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string EnabledValue = "Enabled"; + private const string DisabledValue = "Disabled"; + + /// Enabled. + public static PublicNetworkAccess Enabled { get; } = new PublicNetworkAccess(EnabledValue); + /// Disabled. + public static PublicNetworkAccess Disabled { get; } = new PublicNetworkAccess(DisabledValue); + /// Determines if two values are the same. + public static bool operator ==(PublicNetworkAccess left, PublicNetworkAccess right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PublicNetworkAccess left, PublicNetworkAccess right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PublicNetworkAccess(string value) => new PublicNetworkAccess(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PublicNetworkAccess other && Equals(other); + /// + public bool Equals(PublicNetworkAccess other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ResourceSku.Serialization.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ResourceSku.Serialization.cs new file mode 100644 index 000000000000..ce6b11096ebc --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ResourceSku.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Dashboard.Models +{ + internal partial class ResourceSku : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WriteEndObject(); + } + + internal static ResourceSku DeserializeResourceSku(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + } + return new ResourceSku(name); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ResourceSku.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ResourceSku.cs new file mode 100644 index 000000000000..93e7093e5007 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ResourceSku.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// The ResourceSku. + internal partial class ResourceSku + { + /// Initializes a new instance of ResourceSku. + /// + /// is null. + public ResourceSku(string name) + { + Argument.AssertNotNull(name, nameof(name)); + + Name = name; + } + + /// Gets or sets the name. + public string Name { get; set; } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/SaasSubscriptionDetails.Serialization.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/SaasSubscriptionDetails.Serialization.cs new file mode 100644 index 000000000000..fa241b5a6833 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/SaasSubscriptionDetails.Serialization.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Dashboard.Models +{ + public partial class SaasSubscriptionDetails + { + internal static SaasSubscriptionDetails DeserializeSaasSubscriptionDetails(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional planId = default; + Optional offerId = default; + Optional publisherId = default; + Optional term = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("planId"u8)) + { + planId = property.Value.GetString(); + continue; + } + if (property.NameEquals("offerId"u8)) + { + offerId = property.Value.GetString(); + continue; + } + if (property.NameEquals("publisherId"u8)) + { + publisherId = property.Value.GetString(); + continue; + } + if (property.NameEquals("term"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + term = SubscriptionTerm.DeserializeSubscriptionTerm(property.Value); + continue; + } + } + return new SaasSubscriptionDetails(planId.Value, offerId.Value, publisherId.Value, term.Value); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/SaasSubscriptionDetails.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/SaasSubscriptionDetails.cs new file mode 100644 index 000000000000..d9a2f286c009 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/SaasSubscriptionDetails.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// SaaS subscription details of a Grafana instance. + public partial class SaasSubscriptionDetails + { + /// Initializes a new instance of SaasSubscriptionDetails. + internal SaasSubscriptionDetails() + { + } + + /// Initializes a new instance of SaasSubscriptionDetails. + /// The plan Id of the SaaS subscription. + /// The offer Id of the SaaS subscription. + /// The publisher Id of the SaaS subscription. + /// The billing term of the SaaS Subscription. + internal SaasSubscriptionDetails(string planId, string offerId, string publisherId, SubscriptionTerm term) + { + PlanId = planId; + OfferId = offerId; + PublisherId = publisherId; + Term = term; + } + + /// The plan Id of the SaaS subscription. + public string PlanId { get; } + /// The offer Id of the SaaS subscription. + public string OfferId { get; } + /// The publisher Id of the SaaS subscription. + public string PublisherId { get; } + /// The billing term of the SaaS Subscription. + public SubscriptionTerm Term { get; } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/Smtp.Serialization.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/Smtp.Serialization.cs new file mode 100644 index 000000000000..e952f53a7428 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/Smtp.Serialization.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Dashboard.Models +{ + public partial class Smtp : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Enabled)) + { + writer.WritePropertyName("enabled"u8); + writer.WriteBooleanValue(Enabled.Value); + } + if (Optional.IsDefined(Host)) + { + writer.WritePropertyName("host"u8); + writer.WriteStringValue(Host); + } + if (Optional.IsDefined(User)) + { + writer.WritePropertyName("user"u8); + writer.WriteStringValue(User); + } + if (Optional.IsDefined(Password)) + { + writer.WritePropertyName("password"u8); + writer.WriteStringValue(Password); + } + if (Optional.IsDefined(FromAddress)) + { + writer.WritePropertyName("fromAddress"u8); + writer.WriteStringValue(FromAddress); + } + if (Optional.IsDefined(FromName)) + { + writer.WritePropertyName("fromName"u8); + writer.WriteStringValue(FromName); + } + if (Optional.IsDefined(StartTLSPolicy)) + { + writer.WritePropertyName("startTLSPolicy"u8); + writer.WriteStringValue(StartTLSPolicy.Value.ToString()); + } + if (Optional.IsDefined(SkipVerify)) + { + writer.WritePropertyName("skipVerify"u8); + writer.WriteBooleanValue(SkipVerify.Value); + } + writer.WriteEndObject(); + } + + internal static Smtp DeserializeSmtp(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional enabled = default; + Optional host = default; + Optional user = default; + Optional password = default; + Optional fromAddress = default; + Optional fromName = default; + Optional startTLSPolicy = default; + Optional skipVerify = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("enabled"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + enabled = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("host"u8)) + { + host = property.Value.GetString(); + continue; + } + if (property.NameEquals("user"u8)) + { + user = property.Value.GetString(); + continue; + } + if (property.NameEquals("password"u8)) + { + password = property.Value.GetString(); + continue; + } + if (property.NameEquals("fromAddress"u8)) + { + fromAddress = property.Value.GetString(); + continue; + } + if (property.NameEquals("fromName"u8)) + { + fromName = property.Value.GetString(); + continue; + } + if (property.NameEquals("startTLSPolicy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startTLSPolicy = new StartTLSPolicy(property.Value.GetString()); + continue; + } + if (property.NameEquals("skipVerify"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + skipVerify = property.Value.GetBoolean(); + continue; + } + } + return new Smtp(Optional.ToNullable(enabled), host.Value, user.Value, password.Value, fromAddress.Value, fromName.Value, Optional.ToNullable(startTLSPolicy), Optional.ToNullable(skipVerify)); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/Smtp.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/Smtp.cs new file mode 100644 index 000000000000..27e474991c87 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/Smtp.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// + /// Email server settings. + /// https://grafana.com/docs/grafana/v9.0/setup-grafana/configure-grafana/#smtp + /// + public partial class Smtp + { + /// Initializes a new instance of Smtp. + public Smtp() + { + } + + /// Initializes a new instance of Smtp. + /// Enable this to allow Grafana to send email. Default is false. + /// SMTP server hostname with port, e.g. test.email.net:587. + /// User of SMTP auth. + /// Password of SMTP auth. If the password contains # or ;, then you have to wrap it with triple quotes. + /// + /// Address used when sending out emails + /// https://pkg.go.dev/net/mail#Address + /// + /// + /// Name to be used when sending out emails. Default is "Azure Managed Grafana Notification" + /// https://pkg.go.dev/net/mail#Address + /// + /// + /// The StartTLSPolicy setting of the SMTP configuration + /// https://pkg.go.dev/github.com/go-mail/mail#StartTLSPolicy + /// + /// + /// Verify SSL for SMTP server. Default is false + /// https://pkg.go.dev/crypto/tls#Config + /// + internal Smtp(bool? enabled, string host, string user, string password, string fromAddress, string fromName, StartTLSPolicy? startTLSPolicy, bool? skipVerify) + { + Enabled = enabled; + Host = host; + User = user; + Password = password; + FromAddress = fromAddress; + FromName = fromName; + StartTLSPolicy = startTLSPolicy; + SkipVerify = skipVerify; + } + + /// Enable this to allow Grafana to send email. Default is false. + public bool? Enabled { get; set; } + /// SMTP server hostname with port, e.g. test.email.net:587. + public string Host { get; set; } + /// User of SMTP auth. + public string User { get; set; } + /// Password of SMTP auth. If the password contains # or ;, then you have to wrap it with triple quotes. + public string Password { get; set; } + /// + /// Address used when sending out emails + /// https://pkg.go.dev/net/mail#Address + /// + public string FromAddress { get; set; } + /// + /// Name to be used when sending out emails. Default is "Azure Managed Grafana Notification" + /// https://pkg.go.dev/net/mail#Address + /// + public string FromName { get; set; } + /// + /// The StartTLSPolicy setting of the SMTP configuration + /// https://pkg.go.dev/github.com/go-mail/mail#StartTLSPolicy + /// + public StartTLSPolicy? StartTLSPolicy { get; set; } + /// + /// Verify SSL for SMTP server. Default is false + /// https://pkg.go.dev/crypto/tls#Config + /// + public bool? SkipVerify { get; set; } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/StartTLSPolicy.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/StartTLSPolicy.cs new file mode 100644 index 000000000000..bd11f61aca6b --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/StartTLSPolicy.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// + /// The StartTLSPolicy setting of the SMTP configuration + /// https://pkg.go.dev/github.com/go-mail/mail#StartTLSPolicy + /// + public readonly partial struct StartTLSPolicy : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public StartTLSPolicy(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string OpportunisticStartTLSValue = "OpportunisticStartTLS"; + private const string MandatoryStartTLSValue = "MandatoryStartTLS"; + private const string NoStartTLSValue = "NoStartTLS"; + + /// OpportunisticStartTLS. + public static StartTLSPolicy OpportunisticStartTLS { get; } = new StartTLSPolicy(OpportunisticStartTLSValue); + /// MandatoryStartTLS. + public static StartTLSPolicy MandatoryStartTLS { get; } = new StartTLSPolicy(MandatoryStartTLSValue); + /// NoStartTLS. + public static StartTLSPolicy NoStartTLS { get; } = new StartTLSPolicy(NoStartTLSValue); + /// Determines if two values are the same. + public static bool operator ==(StartTLSPolicy left, StartTLSPolicy right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(StartTLSPolicy left, StartTLSPolicy right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator StartTLSPolicy(string value) => new StartTLSPolicy(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is StartTLSPolicy other && Equals(other); + /// + public bool Equals(StartTLSPolicy other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/SubscriptionTerm.Serialization.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/SubscriptionTerm.Serialization.cs new file mode 100644 index 000000000000..9fb53262ff58 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/SubscriptionTerm.Serialization.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Dashboard.Models +{ + public partial class SubscriptionTerm + { + internal static SubscriptionTerm DeserializeSubscriptionTerm(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional termUnit = default; + Optional startDate = default; + Optional endDate = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("termUnit"u8)) + { + termUnit = property.Value.GetString(); + continue; + } + if (property.NameEquals("startDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("endDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endDate = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new SubscriptionTerm(termUnit.Value, Optional.ToNullable(startDate), Optional.ToNullable(endDate)); + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/SubscriptionTerm.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/SubscriptionTerm.cs new file mode 100644 index 000000000000..3367c817db32 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/SubscriptionTerm.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// The current billing term of the SaaS Subscription. + public partial class SubscriptionTerm + { + /// Initializes a new instance of SubscriptionTerm. + internal SubscriptionTerm() + { + } + + /// Initializes a new instance of SubscriptionTerm. + /// The unit of the billing term. + /// The date and time in UTC of when the billing term starts. + /// The date and time in UTC of when the billing term ends. + internal SubscriptionTerm(string termUnit, DateTimeOffset? startOn, DateTimeOffset? endOn) + { + TermUnit = termUnit; + StartOn = startOn; + EndOn = endOn; + } + + /// The unit of the billing term. + public string TermUnit { get; } + /// The date and time in UTC of when the billing term starts. + public DateTimeOffset? StartOn { get; } + /// The date and time in UTC of when the billing term ends. + public DateTimeOffset? EndOn { get; } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ZoneRedundancy.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ZoneRedundancy.cs new file mode 100644 index 000000000000..92919bdf921c --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/Models/ZoneRedundancy.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Dashboard.Models +{ + /// The ZoneRedundancy. + public readonly partial struct ZoneRedundancy : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ZoneRedundancy(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DisabledValue = "Disabled"; + private const string EnabledValue = "Enabled"; + + /// Disabled. + public static ZoneRedundancy Disabled { get; } = new ZoneRedundancy(DisabledValue); + /// Enabled. + public static ZoneRedundancy Enabled { get; } = new ZoneRedundancy(EnabledValue); + /// Determines if two values are the same. + public static bool operator ==(ZoneRedundancy left, ZoneRedundancy right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ZoneRedundancy left, ZoneRedundancy right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ZoneRedundancy(string value) => new ZoneRedundancy(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ZoneRedundancy other && Equals(other); + /// + public bool Equals(ZoneRedundancy other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/ProviderConstants.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/ProviderConstants.cs new file mode 100644 index 000000000000..6b632bfbf517 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/ProviderConstants.cs @@ -0,0 +1,16 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Dashboard +{ + internal static class ProviderConstants + { + public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/RestOperations/GrafanaRestOperations.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/RestOperations/GrafanaRestOperations.cs new file mode 100644 index 000000000000..4d807ec271cb --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/RestOperations/GrafanaRestOperations.cs @@ -0,0 +1,796 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Dashboard.Models; + +namespace Azure.ResourceManager.Dashboard +{ + internal partial class GrafanaRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of GrafanaRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public GrafanaRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListRequest(string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Dashboard/grafana", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all resources of workspaces for Grafana under the specified subscription. + /// The ID of the target subscription. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListRequest(subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedGrafanaListResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedGrafanaListResponse.DeserializeManagedGrafanaListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all resources of workspaces for Grafana under the specified subscription. + /// The ID of the target subscription. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListRequest(subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedGrafanaListResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedGrafanaListResponse.DeserializeManagedGrafanaListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByResourceGroupRequest(string subscriptionId, string resourceGroupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Dashboard/grafana", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all resources of workspaces for Grafana under the specified resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupAsync(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedGrafanaListResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedGrafanaListResponse.DeserializeManagedGrafanaListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all resources of workspaces for Grafana under the specified resource group. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroup(string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupRequest(subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedGrafanaListResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedGrafanaListResponse.DeserializeManagedGrafanaListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string workspaceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Dashboard/grafana/", false); + uri.AppendPath(workspaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get the properties of a specific workspace for Grafana resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, workspaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedGrafanaData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedGrafanaData.DeserializeManagedGrafanaData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ManagedGrafanaData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get the properties of a specific workspace for Grafana resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, workspaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedGrafanaData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedGrafanaData.DeserializeManagedGrafanaData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ManagedGrafanaData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string workspaceName, ManagedGrafanaData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Dashboard/grafana/", false); + uri.AppendPath(workspaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create or update a workspace for Grafana resource. This API is idempotent, so user can either create a new grafana or update an existing grafana. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The ManagedGrafana to use. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task CreateAsync(string subscriptionId, string resourceGroupName, string workspaceName, ManagedGrafanaData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, workspaceName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create or update a workspace for Grafana resource. This API is idempotent, so user can either create a new grafana or update an existing grafana. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The ManagedGrafana to use. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Create(string subscriptionId, string resourceGroupName, string workspaceName, ManagedGrafanaData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, workspaceName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string workspaceName, ManagedGrafanaPatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Dashboard/grafana/", false); + uri.AppendPath(workspaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update a workspace for Grafana resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The ManagedGrafanaPatch to use. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string resourceGroupName, string workspaceName, ManagedGrafanaPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, workspaceName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + { + ManagedGrafanaData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedGrafanaData.DeserializeManagedGrafanaData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a workspace for Grafana resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The ManagedGrafanaPatch to use. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string workspaceName, ManagedGrafanaPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, workspaceName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + { + ManagedGrafanaData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedGrafanaData.DeserializeManagedGrafanaData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string workspaceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Dashboard/grafana/", false); + uri.AppendPath(workspaceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a workspace for Grafana resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, workspaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a workspace for Grafana resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, workspaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCheckEnterpriseDetailsRequest(string subscriptionId, string resourceGroupName, string workspaceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Dashboard/grafana/", false); + uri.AppendPath(workspaceName, true); + uri.AppendPath("/checkEnterpriseDetails", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Retrieve enterprise add-on details information. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> CheckEnterpriseDetailsAsync(string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var message = CreateCheckEnterpriseDetailsRequest(subscriptionId, resourceGroupName, workspaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + EnterpriseDetails value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = EnterpriseDetails.DeserializeEnterpriseDetails(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Retrieve enterprise add-on details information. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response CheckEnterpriseDetails(string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var message = CreateCheckEnterpriseDetailsRequest(subscriptionId, resourceGroupName, workspaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + EnterpriseDetails value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = EnterpriseDetails.DeserializeEnterpriseDetails(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateFetchAvailablePluginsRequest(string subscriptionId, string resourceGroupName, string workspaceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Dashboard/grafana/", false); + uri.AppendPath(workspaceName, true); + uri.AppendPath("/fetchAvailablePlugins", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> FetchAvailablePluginsAsync(string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var message = CreateFetchAvailablePluginsRequest(subscriptionId, resourceGroupName, workspaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + GrafanaAvailablePluginListResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = GrafanaAvailablePluginListResponse.DeserializeGrafanaAvailablePluginListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response FetchAvailablePlugins(string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var message = CreateFetchAvailablePluginsRequest(subscriptionId, resourceGroupName, workspaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + GrafanaAvailablePluginListResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = GrafanaAvailablePluginListResponse.DeserializeGrafanaAvailablePluginListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all resources of workspaces for Grafana under the specified subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedGrafanaListResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedGrafanaListResponse.DeserializeManagedGrafanaListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all resources of workspaces for Grafana under the specified subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedGrafanaListResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedGrafanaListResponse.DeserializeManagedGrafanaListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListByResourceGroupNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all resources of workspaces for Grafana under the specified resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListByResourceGroupNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedGrafanaListResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedGrafanaListResponse.DeserializeManagedGrafanaListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all resources of workspaces for Grafana under the specified resource group. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListByResourceGroupNextPage(string nextLink, string subscriptionId, string resourceGroupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + + using var message = CreateListByResourceGroupNextPageRequest(nextLink, subscriptionId, resourceGroupName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedGrafanaListResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedGrafanaListResponse.DeserializeManagedGrafanaListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/RestOperations/ManagedPrivateEndpointsRestOperations.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/RestOperations/ManagedPrivateEndpointsRestOperations.cs new file mode 100644 index 000000000000..499111c40432 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/RestOperations/ManagedPrivateEndpointsRestOperations.cs @@ -0,0 +1,600 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Dashboard.Models; + +namespace Azure.ResourceManager.Dashboard +{ + internal partial class ManagedPrivateEndpointsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ManagedPrivateEndpointsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public ManagedPrivateEndpointsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string workspaceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Dashboard/grafana/", false); + uri.AppendPath(workspaceName, true); + uri.AppendPath("/managedPrivateEndpoints", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all managed private endpoints of a grafana resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, workspaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedPrivateEndpointModelListResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedPrivateEndpointModelListResponse.DeserializeManagedPrivateEndpointModelListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all managed private endpoints of a grafana resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, workspaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedPrivateEndpointModelListResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedPrivateEndpointModelListResponse.DeserializeManagedPrivateEndpointModelListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateRefreshRequest(string subscriptionId, string resourceGroupName, string workspaceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Dashboard/grafana/", false); + uri.AppendPath(workspaceName, true); + uri.AppendPath("/refreshManagedPrivateEndpoints", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Refresh and sync managed private endpoints of a grafana resource to latest state. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task RefreshAsync(string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var message = CreateRefreshRequest(subscriptionId, resourceGroupName, workspaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Refresh and sync managed private endpoints of a grafana resource to latest state. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Refresh(string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var message = CreateRefreshRequest(subscriptionId, resourceGroupName, workspaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string workspaceName, string managedPrivateEndpointName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Dashboard/grafana/", false); + uri.AppendPath(workspaceName, true); + uri.AppendPath("/managedPrivateEndpoints/", false); + uri.AppendPath(managedPrivateEndpointName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a specific managed private endpoint of a grafana resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The managed private endpoint name of Azure Managed Grafana. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string workspaceName, string managedPrivateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNullOrEmpty(managedPrivateEndpointName, nameof(managedPrivateEndpointName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, workspaceName, managedPrivateEndpointName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedPrivateEndpointModelData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedPrivateEndpointModelData.DeserializeManagedPrivateEndpointModelData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ManagedPrivateEndpointModelData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a specific managed private endpoint of a grafana resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The managed private endpoint name of Azure Managed Grafana. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string workspaceName, string managedPrivateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNullOrEmpty(managedPrivateEndpointName, nameof(managedPrivateEndpointName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, workspaceName, managedPrivateEndpointName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedPrivateEndpointModelData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedPrivateEndpointModelData.DeserializeManagedPrivateEndpointModelData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ManagedPrivateEndpointModelData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateCreateRequest(string subscriptionId, string resourceGroupName, string workspaceName, string managedPrivateEndpointName, ManagedPrivateEndpointModelData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Dashboard/grafana/", false); + uri.AppendPath(workspaceName, true); + uri.AppendPath("/managedPrivateEndpoints/", false); + uri.AppendPath(managedPrivateEndpointName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create or update a managed private endpoint for a grafana resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The managed private endpoint name of Azure Managed Grafana. + /// The managed private endpoint to be created or updated. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task CreateAsync(string subscriptionId, string resourceGroupName, string workspaceName, string managedPrivateEndpointName, ManagedPrivateEndpointModelData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNullOrEmpty(managedPrivateEndpointName, nameof(managedPrivateEndpointName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, workspaceName, managedPrivateEndpointName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create or update a managed private endpoint for a grafana resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The managed private endpoint name of Azure Managed Grafana. + /// The managed private endpoint to be created or updated. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Create(string subscriptionId, string resourceGroupName, string workspaceName, string managedPrivateEndpointName, ManagedPrivateEndpointModelData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNullOrEmpty(managedPrivateEndpointName, nameof(managedPrivateEndpointName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, resourceGroupName, workspaceName, managedPrivateEndpointName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string resourceGroupName, string workspaceName, string managedPrivateEndpointName, ManagedPrivateEndpointModelPatch patch) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Dashboard/grafana/", false); + uri.AppendPath(workspaceName, true); + uri.AppendPath("/managedPrivateEndpoints/", false); + uri.AppendPath(managedPrivateEndpointName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(patch); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update a managed private endpoint for an existing grafana resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The managed private endpoint name of Azure Managed Grafana. + /// Properties that can be updated to an existing managed private endpoint. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task UpdateAsync(string subscriptionId, string resourceGroupName, string workspaceName, string managedPrivateEndpointName, ManagedPrivateEndpointModelPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNullOrEmpty(managedPrivateEndpointName, nameof(managedPrivateEndpointName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, workspaceName, managedPrivateEndpointName, patch); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a managed private endpoint for an existing grafana resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The managed private endpoint name of Azure Managed Grafana. + /// Properties that can be updated to an existing managed private endpoint. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string resourceGroupName, string workspaceName, string managedPrivateEndpointName, ManagedPrivateEndpointModelPatch patch, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNullOrEmpty(managedPrivateEndpointName, nameof(managedPrivateEndpointName)); + Argument.AssertNotNull(patch, nameof(patch)); + + using var message = CreateUpdateRequest(subscriptionId, resourceGroupName, workspaceName, managedPrivateEndpointName, patch); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string workspaceName, string managedPrivateEndpointName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Dashboard/grafana/", false); + uri.AppendPath(workspaceName, true); + uri.AppendPath("/managedPrivateEndpoints/", false); + uri.AppendPath(managedPrivateEndpointName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a managed private endpoint for a grafana resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The managed private endpoint name of Azure Managed Grafana. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string workspaceName, string managedPrivateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNullOrEmpty(managedPrivateEndpointName, nameof(managedPrivateEndpointName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, workspaceName, managedPrivateEndpointName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a managed private endpoint for a grafana resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The managed private endpoint name of Azure Managed Grafana. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string workspaceName, string managedPrivateEndpointName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNullOrEmpty(managedPrivateEndpointName, nameof(managedPrivateEndpointName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, workspaceName, managedPrivateEndpointName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string workspaceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all managed private endpoints of a grafana resource. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, workspaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ManagedPrivateEndpointModelListResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ManagedPrivateEndpointModelListResponse.DeserializeManagedPrivateEndpointModelListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all managed private endpoints of a grafana resource. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, workspaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ManagedPrivateEndpointModelListResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ManagedPrivateEndpointModelListResponse.DeserializeManagedPrivateEndpointModelListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs new file mode 100644 index 000000000000..a539f34349de --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/RestOperations/PrivateEndpointConnectionsRestOperations.cs @@ -0,0 +1,441 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Dashboard.Models; + +namespace Azure.ResourceManager.Dashboard +{ + internal partial class PrivateEndpointConnectionsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of PrivateEndpointConnectionsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public PrivateEndpointConnectionsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Dashboard/grafana/", false); + uri.AppendPath(workspaceName, true); + uri.AppendPath("/privateEndpointConnections/", false); + uri.AppendPath(privateEndpointConnectionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get private endpoint connections. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The private endpoint connection name of Azure Managed Grafana. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, workspaceName, privateEndpointConnectionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DashboardPrivateEndpointConnectionData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DashboardPrivateEndpointConnectionData.DeserializeDashboardPrivateEndpointConnectionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DashboardPrivateEndpointConnectionData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get private endpoint connections. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The private endpoint connection name of Azure Managed Grafana. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, workspaceName, privateEndpointConnectionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DashboardPrivateEndpointConnectionData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DashboardPrivateEndpointConnectionData.DeserializeDashboardPrivateEndpointConnectionData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DashboardPrivateEndpointConnectionData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateApproveRequest(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, DashboardPrivateEndpointConnectionData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Dashboard/grafana/", false); + uri.AppendPath(workspaceName, true); + uri.AppendPath("/privateEndpointConnections/", false); + uri.AppendPath(privateEndpointConnectionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Manual approve private endpoint connection. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The private endpoint connection name of Azure Managed Grafana. + /// The DashboardPrivateEndpointConnection to use. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task ApproveAsync(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, DashboardPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateApproveRequest(subscriptionId, resourceGroupName, workspaceName, privateEndpointConnectionName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Manual approve private endpoint connection. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The private endpoint connection name of Azure Managed Grafana. + /// The DashboardPrivateEndpointConnection to use. + /// The cancellation token to use. + /// , , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Approve(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, DashboardPrivateEndpointConnectionData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateApproveRequest(subscriptionId, resourceGroupName, workspaceName, privateEndpointConnectionName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Dashboard/grafana/", false); + uri.AppendPath(workspaceName, true); + uri.AppendPath("/privateEndpointConnections/", false); + uri.AppendPath(privateEndpointConnectionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete private endpoint connection. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The private endpoint connection name of Azure Managed Grafana. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, workspaceName, privateEndpointConnectionName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete private endpoint connection. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The private endpoint connection name of Azure Managed Grafana. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string resourceGroupName, string workspaceName, string privateEndpointConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNullOrEmpty(privateEndpointConnectionName, nameof(privateEndpointConnectionName)); + + using var message = CreateDeleteRequest(subscriptionId, resourceGroupName, workspaceName, privateEndpointConnectionName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 202: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string workspaceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Dashboard/grafana/", false); + uri.AppendPath(workspaceName, true); + uri.AppendPath("/privateEndpointConnections", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get private endpoint connection. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, workspaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DashboardPrivateEndpointConnectionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DashboardPrivateEndpointConnectionListResult.DeserializeDashboardPrivateEndpointConnectionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get private endpoint connection. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, workspaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DashboardPrivateEndpointConnectionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DashboardPrivateEndpointConnectionListResult.DeserializeDashboardPrivateEndpointConnectionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string workspaceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get private endpoint connection. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, workspaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DashboardPrivateEndpointConnectionListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DashboardPrivateEndpointConnectionListResult.DeserializeDashboardPrivateEndpointConnectionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get private endpoint connection. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, workspaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DashboardPrivateEndpointConnectionListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DashboardPrivateEndpointConnectionListResult.DeserializeDashboardPrivateEndpointConnectionListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs new file mode 100644 index 000000000000..a5f7c786a042 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Generated/RestOperations/PrivateLinkResourcesRestOperations.cs @@ -0,0 +1,283 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Dashboard.Models; + +namespace Azure.ResourceManager.Dashboard +{ + internal partial class PrivateLinkResourcesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of PrivateLinkResourcesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public PrivateLinkResourcesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-09-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateListRequest(string subscriptionId, string resourceGroupName, string workspaceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Dashboard/grafana/", false); + uri.AppendPath(workspaceName, true); + uri.AppendPath("/privateLinkResources", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all private link resources information for this grafana resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListAsync(string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, workspaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DashboardPrivateLinkResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DashboardPrivateLinkResourceListResult.DeserializeDashboardPrivateLinkResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all private link resources information for this grafana resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The cancellation token to use. + /// , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response List(string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var message = CreateListRequest(subscriptionId, resourceGroupName, workspaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DashboardPrivateLinkResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DashboardPrivateLinkResourceListResult.DeserializeDashboardPrivateLinkResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string resourceGroupName, string workspaceName, string privateLinkResourceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/resourceGroups/", false); + uri.AppendPath(resourceGroupName, true); + uri.AppendPath("/providers/Microsoft.Dashboard/grafana/", false); + uri.AppendPath(workspaceName, true); + uri.AppendPath("/privateLinkResources/", false); + uri.AppendPath(privateLinkResourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get specific private link resource information for this grafana resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The String to use. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string resourceGroupName, string workspaceName, string privateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNullOrEmpty(privateLinkResourceName, nameof(privateLinkResourceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, workspaceName, privateLinkResourceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DashboardPrivateLinkResourceData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DashboardPrivateLinkResourceData.DeserializeDashboardPrivateLinkResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DashboardPrivateLinkResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get specific private link resource information for this grafana resource. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The String to use. + /// The cancellation token to use. + /// , , or is null. + /// , , or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string resourceGroupName, string workspaceName, string privateLinkResourceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNullOrEmpty(privateLinkResourceName, nameof(privateLinkResourceName)); + + using var message = CreateGetRequest(subscriptionId, resourceGroupName, workspaceName, privateLinkResourceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DashboardPrivateLinkResourceData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DashboardPrivateLinkResourceData.DeserializeDashboardPrivateLinkResourceData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((DashboardPrivateLinkResourceData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string subscriptionId, string resourceGroupName, string workspaceName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List all private link resources information for this grafana resource. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> ListNextPageAsync(string nextLink, string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, workspaceName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DashboardPrivateLinkResourceListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = DashboardPrivateLinkResourceListResult.DeserializeDashboardPrivateLinkResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List all private link resources information for this grafana resource. + /// The URL to the next page of results. + /// The ID of the target subscription. + /// The name of the resource group. The name is case insensitive. + /// The workspace name of Azure Managed Grafana. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response ListNextPage(string nextLink, string subscriptionId, string resourceGroupName, string workspaceName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + + using var message = CreateListNextPageRequest(nextLink, subscriptionId, resourceGroupName, workspaceName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DashboardPrivateLinkResourceListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = DashboardPrivateLinkResourceListResult.DeserializeDashboardPrivateLinkResourceListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Properties/AssemblyInfo.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..78a000daad71 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/Properties/AssemblyInfo.cs @@ -0,0 +1,9 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +[assembly: Azure.Core.AzureResourceProviderNamespace("dashboard")] + +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2, PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7")] +[assembly: InternalsVisibleTo("Azure.ResourceManager.Dashboard.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/src/autorest.md b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/autorest.md new file mode 100644 index 000000000000..4890fc7451d1 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/src/autorest.md @@ -0,0 +1,55 @@ +# Generated code configuration + +Run `dotnet build /t:GenerateCode` to generate code. + +``` yaml +azure-arm: true +csharp: true +library-name: dashboard +namespace: Azure.ResourceManager.dashboard +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/dashboard/resource-manager/readme.md +output-folder: $(this-folder)/Generated +clear-output-folder: true +sample-gen: + output-folder: $(this-folder)/../samples/Generated + clear-output-folder: true +skip-csproj: true +modelerfour: + flatten-payloads: false + +#mgmt-debug: +# show-serialized-names: true + + + +format-by-name-rules: + 'tenantId': 'uuid' + 'ETag': 'etag' + 'location': 'azure-location' + '*Uri': 'Uri' + '*Uris': 'Uri' + +acronym-mapping: + CPU: Cpu + CPUs: Cpus + Os: OS + Ip: IP + Ips: IPs|ips + ID: Id + IDs: Ids + VM: Vm + VMs: Vms + Vmos: VmOS + VMScaleSet: VmScaleSet + DNS: Dns + VPN: Vpn + NAT: Nat + WAN: Wan + Ipv4: IPv4|ipv4 + Ipv6: IPv6|ipv6 + Ipsec: IPsec|ipsec + SSO: Sso + URI: Uri + Etag: ETag|etag + +``` diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/tests/Azure.ResourceManager.Dashboard.Tests.csproj b/sdk/dashboard/Azure.ResourceManager.Dashboard/tests/Azure.ResourceManager.Dashboard.Tests.csproj new file mode 100644 index 000000000000..60b6f01df3e7 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/tests/Azure.ResourceManager.Dashboard.Tests.csproj @@ -0,0 +1,5 @@ + + + + + diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/tests/dashboardManagementTestBase.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/tests/dashboardManagementTestBase.cs new file mode 100644 index 000000000000..5230f8059857 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/tests/dashboardManagementTestBase.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core; +using Azure.Core.TestFramework; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.TestFramework; +using NUnit.Framework; +using System.Threading.Tasks; + +namespace Azure.ResourceManager.Dashboard.Tests +{ + public class dashboardManagementTestBase : ManagementRecordedTestBase + { + protected ArmClient Client { get; private set; } + protected SubscriptionResource DefaultSubscription { get; private set; } + + protected dashboardManagementTestBase(bool isAsync, RecordedTestMode mode) + : base(isAsync, mode) + { + } + + protected dashboardManagementTestBase(bool isAsync) + : base(isAsync) + { + } + + [SetUp] + public async Task CreateCommonClient() + { + Client = GetArmClient(); + DefaultSubscription = await Client.GetDefaultSubscriptionAsync().ConfigureAwait(false); + } + + protected async Task CreateResourceGroup(SubscriptionResource subscription, string rgNamePrefix, AzureLocation location) + { + string rgName = Recording.GenerateAssetName(rgNamePrefix); + ResourceGroupData input = new ResourceGroupData(location); + var lro = await subscription.GetResourceGroups().CreateOrUpdateAsync(WaitUntil.Completed, rgName, input); + return lro.Value; + } + } +} diff --git a/sdk/dashboard/Azure.ResourceManager.Dashboard/tests/dashboardManagementTestEnvironment.cs b/sdk/dashboard/Azure.ResourceManager.Dashboard/tests/dashboardManagementTestEnvironment.cs new file mode 100644 index 000000000000..68a9a746a231 --- /dev/null +++ b/sdk/dashboard/Azure.ResourceManager.Dashboard/tests/dashboardManagementTestEnvironment.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core.TestFramework; + +namespace Azure.ResourceManager.Dashboard.Tests +{ + public class dashboardManagementTestEnvironment : TestEnvironment + { + } +} \ No newline at end of file diff --git a/sdk/dashboard/ci.mgmt.yml b/sdk/dashboard/ci.mgmt.yml new file mode 100644 index 000000000000..661af42f8233 --- /dev/null +++ b/sdk/dashboard/ci.mgmt.yml @@ -0,0 +1,24 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: none + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/dashboard/ci.mgmt.yml + - sdk/dashboard/Azure.ResourceManager.Dashboard/ + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: dashboard + LimitForPullRequest: true + Artifacts: + - name: Azure.ResourceManager.Dashboard + safeName: AzureResourceManagerDashboard