From c002c79aa4a60253e33ebc510e7440c8b836cba5 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Fri, 24 Jan 2025 03:46:21 +0000 Subject: [PATCH] CodeGen from PR 32313 in Azure/azure-rest-api-specs Merge 27e0afa6b9bf9b52cffe36dc960720cc89341e36 into 6f6ff28362346bf0cbbe8affca9122cc9200c9e2 --- .../Azure.ResourceManager.Impact.sln | 56 ++ .../Azure.ResourceManager.Impact/CHANGELOG.md | 11 + .../Directory.Build.props | 6 + .../Azure.ResourceManager.Impact/README.md | 80 +++ .../Azure.ResourceManager.Impact.net8.0.cs | 608 ++++++++++++++++++ ...e.ResourceManager.Impact.netstandard2.0.cs | 608 ++++++++++++++++++ .../Azure.ResourceManager.Impact/assets.json | 7 + ...zure.ResourceManager.Impact.Samples.csproj | 13 + .../Samples/Sample_ConnectorCollection.cs | 191 ++++++ .../Samples/Sample_ConnectorResource.cs | 106 +++ .../Sample_ImpactCategoryCollection.cs | 154 +++++ .../Samples/Sample_ImpactCategoryResource.cs | 47 ++ .../Samples/Sample_InsightCollection.cs | 405 ++++++++++++ .../Samples/Sample_InsightResource.cs | 174 +++++ .../Sample_WorkloadImpactCollection.cs | 368 +++++++++++ .../Samples/Sample_WorkloadImpactResource.cs | 275 ++++++++ .../src/Azure.ResourceManager.Impact.csproj | 8 + .../src/Generated/ArmImpactModelFactory.cs | 213 ++++++ .../src/Generated/ConnectorCollection.cs | 494 ++++++++++++++ .../Generated/ConnectorData.Serialization.cs | 155 +++++ .../src/Generated/ConnectorData.cs | 75 +++ .../ConnectorResource.Serialization.cs | 26 + .../src/Generated/ConnectorResource.cs | 342 ++++++++++ .../Generated/Extensions/ImpactExtensions.cs | 385 +++++++++++ .../Extensions/MockableImpactArmClient.cs | 85 +++ .../MockableImpactSubscriptionResource.cs | 243 +++++++ .../src/Generated/ImpactCategoryCollection.cs | 400 ++++++++++++ .../ImpactCategoryData.Serialization.cs | 155 +++++ .../src/Generated/ImpactCategoryData.cs | 75 +++ .../ImpactCategoryResource.Serialization.cs | 26 + .../src/Generated/ImpactCategoryResource.cs | 170 +++++ .../src/Generated/InsightCollection.cs | 497 ++++++++++++++ .../Generated/InsightData.Serialization.cs | 155 +++++ .../src/Generated/InsightData.cs | 75 +++ .../InsightResource.Serialization.cs | 26 + .../src/Generated/InsightResource.cs | 354 ++++++++++ .../src/Generated/Internal/Argument.cs | 129 ++++ .../Internal/ChangeTrackingDictionary.cs | 167 +++++ .../Generated/Internal/ChangeTrackingList.cs | 153 +++++ .../Internal/ModelSerializationExtensions.cs | 398 ++++++++++++ .../src/Generated/Internal/Optional.cs | 51 ++ .../Internal/Utf8JsonRequestContent.cs | 55 ++ .../ConnectorOperationSource.cs | 38 ++ .../ImpactArmOperation.cs | 94 +++ .../ImpactArmOperationOfT.cs | 100 +++ .../WorkloadImpactOperationSource.cs | 38 ++ .../ClientIncidentDetails.Serialization.cs | 144 +++++ .../Generated/Models/ClientIncidentDetails.cs | 69 ++ .../src/Generated/Models/ConfidenceLevel.cs | 54 ++ .../Models/Connectivity.Serialization.cs | 178 +++++ .../src/Generated/Models/Connectivity.cs | 100 +++ .../ConnectorListResult.Serialization.cs | 151 +++++ .../Generated/Models/ConnectorListResult.cs | 80 +++ .../ConnectorProperties.Serialization.cs | 180 ++++++ .../Generated/Models/ConnectorProperties.cs | 94 +++ .../Generated/Models/Content.Serialization.cs | 134 ++++ .../src/Generated/Models/Content.cs | 82 +++ .../ErrorDetailProperties.Serialization.cs | 140 ++++ .../Generated/Models/ErrorDetailProperties.cs | 69 ++ .../ExpectedValueRange.Serialization.cs | 134 ++++ .../Generated/Models/ExpectedValueRange.cs | 78 +++ .../ImpactCategoryListResult.Serialization.cs | 151 +++++ .../Models/ImpactCategoryListResult.cs | 80 +++ .../ImpactCategoryProperties.Serialization.cs | 194 ++++++ .../Models/ImpactCategoryProperties.cs | 92 +++ .../Models/ImpactDetails.Serialization.cs | 157 +++++ .../src/Generated/Models/ImpactDetails.cs | 92 +++ .../src/Generated/Models/IncidentSource.cs | 60 ++ .../Models/InsightListResult.Serialization.cs | 151 +++++ .../src/Generated/Models/InsightListResult.cs | 80 +++ .../Models/InsightProperties.Serialization.cs | 239 +++++++ .../src/Generated/Models/InsightProperties.cs | 120 ++++ ...opertiesAdditionalDetails.Serialization.cs | 118 ++++ .../InsightPropertiesAdditionalDetails.cs | 60 ++ .../src/Generated/Models/MetricUnit.cs | 81 +++ .../Models/Performance.Serialization.cs | 195 ++++++ .../src/Generated/Models/Performance.cs | 81 +++ .../src/Generated/Models/Platform.cs | 48 ++ .../src/Generated/Models/Protocol.cs | 69 ++ .../src/Generated/Models/ProvisioningState.cs | 54 ++ .../RequiredImpactProperties.Serialization.cs | 151 +++++ .../Models/RequiredImpactProperties.cs | 80 +++ .../Models/SourceOrTarget.Serialization.cs | 129 ++++ .../src/Generated/Models/SourceOrTarget.cs | 65 ++ .../src/Generated/Models/Toolset.cs | 72 +++ .../Models/Workload.Serialization.cs | 144 +++++ .../src/Generated/Models/Workload.cs | 69 ++ .../WorkloadImpactListResult.Serialization.cs | 151 +++++ .../Models/WorkloadImpactListResult.cs | 80 +++ .../WorkloadImpactProperties.Serialization.cs | 378 +++++++++++ .../Models/WorkloadImpactProperties.cs | 146 +++++ ...rtiesAdditionalProperties.Serialization.cs | 118 ++++ ...oadImpactPropertiesAdditionalProperties.cs | 60 ++ .../src/Generated/ProviderConstants.cs | 16 + .../ConnectorsRestOperations.cs | 533 +++++++++++++++ .../ImpactCategoriesRestOperations.cs | 305 +++++++++ .../RestOperations/InsightsRestOperations.cs | 487 ++++++++++++++ .../WorkloadImpactsRestOperations.cs | 441 +++++++++++++ .../src/Generated/WorkloadImpactCollection.cs | 494 ++++++++++++++ .../WorkloadImpactData.Serialization.cs | 155 +++++ .../src/Generated/WorkloadImpactData.cs | 75 +++ .../WorkloadImpactResource.Serialization.cs | 26 + .../src/Generated/WorkloadImpactResource.cs | 419 ++++++++++++ .../src/Properties/AssemblyInfo.cs | 11 + .../Azure.ResourceManager.Impact.Tests.csproj | 8 + .../tests/ImpactManagementTestBase.cs | 45 ++ .../tests/ImpactManagementTestEnvironment.cs | 11 + .../tsp-location.yaml | 4 + sdk/impactreporting/ci.mgmt.yml | 26 + sdk/resourcemanager/ci.mgmt.yml | 2 + 110 files changed, 16801 insertions(+) create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/Azure.ResourceManager.Impact.sln create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/CHANGELOG.md create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/Directory.Build.props create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/README.md create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/api/Azure.ResourceManager.Impact.net8.0.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/api/Azure.ResourceManager.Impact.netstandard2.0.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/assets.json create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/samples/Azure.ResourceManager.Impact.Samples.csproj create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/samples/Generated/Samples/Sample_ConnectorCollection.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/samples/Generated/Samples/Sample_ConnectorResource.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/samples/Generated/Samples/Sample_ImpactCategoryCollection.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/samples/Generated/Samples/Sample_ImpactCategoryResource.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/samples/Generated/Samples/Sample_InsightCollection.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/samples/Generated/Samples/Sample_InsightResource.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/samples/Generated/Samples/Sample_WorkloadImpactCollection.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/samples/Generated/Samples/Sample_WorkloadImpactResource.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Azure.ResourceManager.Impact.csproj create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ArmImpactModelFactory.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ConnectorCollection.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ConnectorData.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ConnectorData.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ConnectorResource.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ConnectorResource.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Extensions/ImpactExtensions.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Extensions/MockableImpactArmClient.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Extensions/MockableImpactSubscriptionResource.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ImpactCategoryCollection.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ImpactCategoryData.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ImpactCategoryData.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ImpactCategoryResource.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ImpactCategoryResource.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/InsightCollection.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/InsightData.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/InsightData.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/InsightResource.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/InsightResource.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Internal/Argument.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Internal/ChangeTrackingDictionary.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Internal/ChangeTrackingList.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Internal/ModelSerializationExtensions.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Internal/Optional.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Internal/Utf8JsonRequestContent.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/LongRunningOperation/ConnectorOperationSource.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/LongRunningOperation/ImpactArmOperation.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/LongRunningOperation/ImpactArmOperationOfT.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/LongRunningOperation/WorkloadImpactOperationSource.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ClientIncidentDetails.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ClientIncidentDetails.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ConfidenceLevel.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Connectivity.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Connectivity.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ConnectorListResult.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ConnectorListResult.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ConnectorProperties.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ConnectorProperties.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Content.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Content.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ErrorDetailProperties.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ErrorDetailProperties.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ExpectedValueRange.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ExpectedValueRange.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ImpactCategoryListResult.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ImpactCategoryListResult.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ImpactCategoryProperties.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ImpactCategoryProperties.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ImpactDetails.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ImpactDetails.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/IncidentSource.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/InsightListResult.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/InsightListResult.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/InsightProperties.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/InsightProperties.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/InsightPropertiesAdditionalDetails.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/InsightPropertiesAdditionalDetails.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/MetricUnit.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Performance.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Performance.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Platform.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Protocol.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ProvisioningState.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/RequiredImpactProperties.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/RequiredImpactProperties.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/SourceOrTarget.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/SourceOrTarget.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Toolset.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Workload.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Workload.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/WorkloadImpactListResult.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/WorkloadImpactListResult.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/WorkloadImpactProperties.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/WorkloadImpactProperties.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/WorkloadImpactPropertiesAdditionalProperties.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/WorkloadImpactPropertiesAdditionalProperties.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ProviderConstants.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/RestOperations/ConnectorsRestOperations.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/RestOperations/ImpactCategoriesRestOperations.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/RestOperations/InsightsRestOperations.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/RestOperations/WorkloadImpactsRestOperations.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/WorkloadImpactCollection.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/WorkloadImpactData.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/WorkloadImpactData.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/WorkloadImpactResource.Serialization.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/WorkloadImpactResource.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/src/Properties/AssemblyInfo.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/tests/Azure.ResourceManager.Impact.Tests.csproj create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/tests/ImpactManagementTestBase.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/tests/ImpactManagementTestEnvironment.cs create mode 100644 sdk/impactreporting/Azure.ResourceManager.Impact/tsp-location.yaml create mode 100644 sdk/impactreporting/ci.mgmt.yml diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/Azure.ResourceManager.Impact.sln b/sdk/impactreporting/Azure.ResourceManager.Impact/Azure.ResourceManager.Impact.sln new file mode 100644 index 0000000000000..0ba686fd088c7 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/Azure.ResourceManager.Impact.sln @@ -0,0 +1,56 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29709.97 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.ResourceManager.Impact.Samples", "samples\Azure.ResourceManager.Impact.Samples.csproj", "{7A2DFF15-5746-49F4-BD0F-C6C35337088A}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.Impact", "src\Azure.ResourceManager.Impact.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.ResourceManager.Impact.Tests", "tests\Azure.ResourceManager.Impact.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU + {7A2DFF15-5746-49F4-BD0F-C6C35337088A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7A2DFF15-5746-49F4-BD0F-C6C35337088A}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7A2DFF15-5746-49F4-BD0F-C6C35337088A}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7A2DFF15-5746-49F4-BD0F-C6C35337088A}.Release|Any CPU.Build.0 = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE} + EndGlobalSection +EndGlobal diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/CHANGELOG.md b/sdk/impactreporting/Azure.ResourceManager.Impact/CHANGELOG.md new file mode 100644 index 0000000000000..8b33f0fedccc1 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes \ No newline at end of file diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/Directory.Build.props b/sdk/impactreporting/Azure.ResourceManager.Impact/Directory.Build.props new file mode 100644 index 0000000000000..63bd836ad44b7 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/README.md b/sdk/impactreporting/Azure.ResourceManager.Impact/README.md new file mode 100644 index 0000000000000..55d5d41cd2864 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/README.md @@ -0,0 +1,80 @@ +# Microsoft Azure Impact 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 Impact management library for .NET with [NuGet](https://www.nuget.org/): + +```dotnetcli +dotnet add package Azure.ResourceManager.Impact --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://learn.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/impactreporting/Azure.ResourceManager.Impact/api/Azure.ResourceManager.Impact.net8.0.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/api/Azure.ResourceManager.Impact.net8.0.cs new file mode 100644 index 0000000000000..5266ae8901b67 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/api/Azure.ResourceManager.Impact.net8.0.cs @@ -0,0 +1,608 @@ +namespace Azure.ResourceManager.Impact +{ + public partial class ConnectorCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected ConnectorCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string connectorName, Azure.ResourceManager.Impact.ConnectorData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string connectorName, Azure.ResourceManager.Impact.ConnectorData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string connectorName, 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 connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string connectorName, 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 ConnectorData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ConnectorData() { } + public Azure.ResourceManager.Impact.Models.ConnectorProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.ConnectorData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.ConnectorData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ConnectorResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected ConnectorResource() { } + public virtual Azure.ResourceManager.Impact.ConnectorData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string connectorName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.Impact.ConnectorData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.ConnectorData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.Response Update(Azure.ResourceManager.Impact.ConnectorData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.Impact.ConnectorData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ImpactCategoryCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected ImpactCategoryCollection() { } + public virtual Azure.Response Exists(string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(string categoryName = null, string resourceType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(string categoryName = null, string resourceType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string impactCategoryName, 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 ImpactCategoryData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ImpactCategoryData() { } + public Azure.ResourceManager.Impact.Models.ImpactCategoryProperties Properties { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.ImpactCategoryData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.ImpactCategoryData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ImpactCategoryResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected ImpactCategoryResource() { } + public virtual Azure.ResourceManager.Impact.ImpactCategoryData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string impactCategoryName) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.Impact.ImpactCategoryData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.ImpactCategoryData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public static partial class ImpactExtensions + { + public static Azure.Response GetConnector(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetConnectorAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.Impact.ConnectorResource GetConnectorResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Impact.ConnectorCollection GetConnectors(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource) { throw null; } + public static Azure.ResourceManager.Impact.ImpactCategoryCollection GetImpactCategories(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource) { throw null; } + public static Azure.Response GetImpactCategory(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetImpactCategoryAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.Impact.ImpactCategoryResource GetImpactCategoryResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Impact.InsightResource GetInsightResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetWorkloadImpact(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string workloadImpactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetWorkloadImpactAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string workloadImpactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.Impact.WorkloadImpactResource GetWorkloadImpactResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Impact.WorkloadImpactCollection GetWorkloadImpacts(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource) { throw null; } + } + public partial class InsightCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected InsightCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string insightName, Azure.ResourceManager.Impact.InsightData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string insightName, Azure.ResourceManager.Impact.InsightData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string insightName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string insightName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string insightName, 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 insightName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string insightName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string insightName, 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 InsightData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public InsightData() { } + public Azure.ResourceManager.Impact.Models.InsightProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.InsightData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.InsightData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class InsightResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected InsightResource() { } + public virtual Azure.ResourceManager.Impact.InsightData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string workloadImpactName, string insightName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.Impact.InsightData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.InsightData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.Impact.InsightData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Impact.InsightData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class WorkloadImpactCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected WorkloadImpactCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string workloadImpactName, Azure.ResourceManager.Impact.WorkloadImpactData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string workloadImpactName, Azure.ResourceManager.Impact.WorkloadImpactData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string workloadImpactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string workloadImpactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string workloadImpactName, 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 workloadImpactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string workloadImpactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string workloadImpactName, 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 WorkloadImpactData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public WorkloadImpactData() { } + public Azure.ResourceManager.Impact.Models.WorkloadImpactProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.WorkloadImpactData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.WorkloadImpactData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class WorkloadImpactResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected WorkloadImpactResource() { } + public virtual Azure.ResourceManager.Impact.WorkloadImpactData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string workloadImpactName) { 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 GetInsight(string insightName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetInsightAsync(string insightName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Impact.InsightCollection GetInsights() { throw null; } + Azure.ResourceManager.Impact.WorkloadImpactData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.WorkloadImpactData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.Impact.WorkloadImpactData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Impact.WorkloadImpactData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.Impact.Mocking +{ + public partial class MockableImpactArmClient : Azure.ResourceManager.ArmResource + { + protected MockableImpactArmClient() { } + public virtual Azure.ResourceManager.Impact.ConnectorResource GetConnectorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Impact.ImpactCategoryResource GetImpactCategoryResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Impact.InsightResource GetInsightResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Impact.WorkloadImpactResource GetWorkloadImpactResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableImpactSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableImpactSubscriptionResource() { } + public virtual Azure.Response GetConnector(string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetConnectorAsync(string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Impact.ConnectorCollection GetConnectors() { throw null; } + public virtual Azure.ResourceManager.Impact.ImpactCategoryCollection GetImpactCategories() { throw null; } + public virtual Azure.Response GetImpactCategory(string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetImpactCategoryAsync(string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetWorkloadImpact(string workloadImpactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetWorkloadImpactAsync(string workloadImpactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Impact.WorkloadImpactCollection GetWorkloadImpacts() { throw null; } + } +} +namespace Azure.ResourceManager.Impact.Models +{ + public static partial class ArmImpactModelFactory + { + public static Azure.ResourceManager.Impact.ConnectorData ConnectorData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Impact.Models.ConnectorProperties properties = null) { throw null; } + public static Azure.ResourceManager.Impact.Models.ConnectorProperties ConnectorProperties(Azure.ResourceManager.Impact.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.Impact.Models.ProvisioningState?), string connectorId = null, string tenantId = null, Azure.ResourceManager.Impact.Models.Platform connectorType = default(Azure.ResourceManager.Impact.Models.Platform), System.DateTimeOffset lastRunTimeStamp = default(System.DateTimeOffset)) { throw null; } + public static Azure.ResourceManager.Impact.ImpactCategoryData ImpactCategoryData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Impact.Models.ImpactCategoryProperties properties = null) { throw null; } + public static Azure.ResourceManager.Impact.Models.ImpactCategoryProperties ImpactCategoryProperties(Azure.ResourceManager.Impact.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.Impact.Models.ProvisioningState?), string categoryId = null, string parentCategoryId = null, string description = null, System.Collections.Generic.IEnumerable requiredImpactProperties = null) { throw null; } + public static Azure.ResourceManager.Impact.InsightData InsightData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Impact.Models.InsightProperties properties = null) { throw null; } + public static Azure.ResourceManager.Impact.Models.InsightProperties InsightProperties(Azure.ResourceManager.Impact.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.Impact.Models.ProvisioningState?), string category = null, string status = null, string eventId = null, string groupId = null, Azure.ResourceManager.Impact.Models.Content content = null, System.DateTimeOffset? eventOn = default(System.DateTimeOffset?), string insightUniqueId = null, Azure.ResourceManager.Impact.Models.ImpactDetails impact = null, Azure.ResourceManager.Impact.Models.InsightPropertiesAdditionalDetails additionalDetails = null) { throw null; } + public static Azure.ResourceManager.Impact.Models.RequiredImpactProperties RequiredImpactProperties(string name = null, System.Collections.Generic.IEnumerable allowedValues = null) { throw null; } + public static Azure.ResourceManager.Impact.WorkloadImpactData WorkloadImpactData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Impact.Models.WorkloadImpactProperties properties = null) { throw null; } + public static Azure.ResourceManager.Impact.Models.WorkloadImpactProperties WorkloadImpactProperties(Azure.ResourceManager.Impact.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.Impact.Models.ProvisioningState?), System.DateTimeOffset startOn = default(System.DateTimeOffset), System.DateTimeOffset? endOn = default(System.DateTimeOffset?), string impactedResourceId = null, string impactUniqueId = null, System.DateTimeOffset? reportedTimeUtc = default(System.DateTimeOffset?), string impactCategory = null, string impactDescription = null, System.Collections.Generic.IEnumerable armCorrelationIds = null, System.Collections.Generic.IEnumerable performance = null, Azure.ResourceManager.Impact.Models.Connectivity connectivity = null, Azure.ResourceManager.Impact.Models.WorkloadImpactPropertiesAdditionalProperties additionalProperties = null, Azure.ResourceManager.Impact.Models.ErrorDetailProperties errorDetails = null, Azure.ResourceManager.Impact.Models.Workload workload = null, string impactGroupId = null, Azure.ResourceManager.Impact.Models.ConfidenceLevel? confidenceLevel = default(Azure.ResourceManager.Impact.Models.ConfidenceLevel?), Azure.ResourceManager.Impact.Models.ClientIncidentDetails clientIncidentDetails = null) { throw null; } + } + public partial class ClientIncidentDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ClientIncidentDetails() { } + public string ClientIncidentId { get { throw null; } set { } } + public Azure.ResourceManager.Impact.Models.IncidentSource? ClientIncidentSource { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.ClientIncidentDetails System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.ClientIncidentDetails System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ConfidenceLevel : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ConfidenceLevel(string value) { throw null; } + public static Azure.ResourceManager.Impact.Models.ConfidenceLevel High { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.ConfidenceLevel Low { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.ConfidenceLevel Medium { get { throw null; } } + public bool Equals(Azure.ResourceManager.Impact.Models.ConfidenceLevel 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.Impact.Models.ConfidenceLevel left, Azure.ResourceManager.Impact.Models.ConfidenceLevel right) { throw null; } + public static implicit operator Azure.ResourceManager.Impact.Models.ConfidenceLevel (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Impact.Models.ConfidenceLevel left, Azure.ResourceManager.Impact.Models.ConfidenceLevel right) { throw null; } + public override string ToString() { throw null; } + } + public partial class Connectivity : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public Connectivity() { } + public int? Port { get { throw null; } set { } } + public Azure.ResourceManager.Impact.Models.Protocol? Protocol { get { throw null; } set { } } + public string SourceAzureResourceId { get { throw null; } set { } } + public string TargetAzureResourceId { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.Connectivity System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.Connectivity System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ConnectorProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ConnectorProperties(string connectorId, string tenantId, Azure.ResourceManager.Impact.Models.Platform connectorType, System.DateTimeOffset lastRunTimeStamp) { } + public string ConnectorId { get { throw null; } } + public Azure.ResourceManager.Impact.Models.Platform ConnectorType { get { throw null; } set { } } + public System.DateTimeOffset LastRunTimeStamp { get { throw null; } } + public Azure.ResourceManager.Impact.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public string TenantId { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.ConnectorProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.ConnectorProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class Content : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public Content(string title, string description) { } + public string Description { get { throw null; } set { } } + public string Title { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.Content System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.Content System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ErrorDetailProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ErrorDetailProperties() { } + public string ErrorCode { get { throw null; } set { } } + public string ErrorMessage { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.ErrorDetailProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.ErrorDetailProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ExpectedValueRange : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ExpectedValueRange(double min, double max) { } + public double Max { get { throw null; } set { } } + public double Min { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.ExpectedValueRange System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.ExpectedValueRange System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ImpactCategoryProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ImpactCategoryProperties() { } + public string CategoryId { get { throw null; } } + public string Description { get { throw null; } } + public string ParentCategoryId { get { throw null; } } + public Azure.ResourceManager.Impact.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public System.Collections.Generic.IReadOnlyList RequiredImpactProperties { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.ImpactCategoryProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.ImpactCategoryProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ImpactDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ImpactDetails(string impactedResourceId, System.DateTimeOffset startOn, string impactId) { } + public System.DateTimeOffset? EndOn { get { throw null; } set { } } + public string ImpactedResourceId { get { throw null; } set { } } + public string ImpactId { get { throw null; } set { } } + public System.DateTimeOffset StartOn { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.ImpactDetails System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.ImpactDetails System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct IncidentSource : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public IncidentSource(string value) { throw null; } + public static Azure.ResourceManager.Impact.Models.IncidentSource AzureDevops { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.IncidentSource ICM { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.IncidentSource Jira { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.IncidentSource Other { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.IncidentSource ServiceNow { get { throw null; } } + public bool Equals(Azure.ResourceManager.Impact.Models.IncidentSource 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.Impact.Models.IncidentSource left, Azure.ResourceManager.Impact.Models.IncidentSource right) { throw null; } + public static implicit operator Azure.ResourceManager.Impact.Models.IncidentSource (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Impact.Models.IncidentSource left, Azure.ResourceManager.Impact.Models.IncidentSource right) { throw null; } + public override string ToString() { throw null; } + } + public partial class InsightProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public InsightProperties(string category, Azure.ResourceManager.Impact.Models.Content content, string insightUniqueId, Azure.ResourceManager.Impact.Models.ImpactDetails impact) { } + public Azure.ResourceManager.Impact.Models.InsightPropertiesAdditionalDetails AdditionalDetails { get { throw null; } set { } } + public string Category { get { throw null; } set { } } + public Azure.ResourceManager.Impact.Models.Content Content { get { throw null; } set { } } + public string EventId { get { throw null; } set { } } + public System.DateTimeOffset? EventOn { get { throw null; } set { } } + public string GroupId { get { throw null; } set { } } + public Azure.ResourceManager.Impact.Models.ImpactDetails Impact { get { throw null; } set { } } + public string InsightUniqueId { get { throw null; } set { } } + public Azure.ResourceManager.Impact.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public string Status { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.InsightProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.InsightProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class InsightPropertiesAdditionalDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public InsightPropertiesAdditionalDetails() { } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.InsightPropertiesAdditionalDetails System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.InsightPropertiesAdditionalDetails System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct MetricUnit : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public MetricUnit(string value) { throw null; } + public static Azure.ResourceManager.Impact.Models.MetricUnit Bytes { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.MetricUnit ByteSeconds { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.MetricUnit BytesPerSecond { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.MetricUnit Cores { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.MetricUnit Count { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.MetricUnit CountPerSecond { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.MetricUnit MilliCores { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.MetricUnit MilliSeconds { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.MetricUnit NanoCores { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.MetricUnit Other { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.MetricUnit Percent { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.MetricUnit Seconds { get { throw null; } } + public bool Equals(Azure.ResourceManager.Impact.Models.MetricUnit 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.Impact.Models.MetricUnit left, Azure.ResourceManager.Impact.Models.MetricUnit right) { throw null; } + public static implicit operator Azure.ResourceManager.Impact.Models.MetricUnit (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Impact.Models.MetricUnit left, Azure.ResourceManager.Impact.Models.MetricUnit right) { throw null; } + public override string ToString() { throw null; } + } + public partial class Performance : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public Performance() { } + public double? Actual { get { throw null; } set { } } + public double? Expected { get { throw null; } set { } } + public Azure.ResourceManager.Impact.Models.ExpectedValueRange ExpectedValueRange { get { throw null; } set { } } + public string MetricName { get { throw null; } set { } } + public Azure.ResourceManager.Impact.Models.MetricUnit? Unit { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.Performance System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.Performance System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct Platform : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public Platform(string value) { throw null; } + public static Azure.ResourceManager.Impact.Models.Platform AzureMonitor { get { throw null; } } + public bool Equals(Azure.ResourceManager.Impact.Models.Platform 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.Impact.Models.Platform left, Azure.ResourceManager.Impact.Models.Platform right) { throw null; } + public static implicit operator Azure.ResourceManager.Impact.Models.Platform (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Impact.Models.Platform left, Azure.ResourceManager.Impact.Models.Platform right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct Protocol : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public Protocol(string value) { throw null; } + public static Azure.ResourceManager.Impact.Models.Protocol FTP { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.Protocol HTTP { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.Protocol HTTPS { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.Protocol Other { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.Protocol RDP { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.Protocol SSH { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.Protocol TCP { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.Protocol UDP { get { throw null; } } + public bool Equals(Azure.ResourceManager.Impact.Models.Protocol 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.Impact.Models.Protocol left, Azure.ResourceManager.Impact.Models.Protocol right) { throw null; } + public static implicit operator Azure.ResourceManager.Impact.Models.Protocol (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Impact.Models.Protocol left, Azure.ResourceManager.Impact.Models.Protocol right) { throw null; } + public override string ToString() { 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.Impact.Models.ProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.ProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.ProvisioningState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.Impact.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.Impact.Models.ProvisioningState left, Azure.ResourceManager.Impact.Models.ProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.Impact.Models.ProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Impact.Models.ProvisioningState left, Azure.ResourceManager.Impact.Models.ProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class RequiredImpactProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal RequiredImpactProperties() { } + public System.Collections.Generic.IReadOnlyList AllowedValues { get { throw null; } } + public string Name { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.RequiredImpactProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.RequiredImpactProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct Toolset : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public Toolset(string value) { throw null; } + public static Azure.ResourceManager.Impact.Models.Toolset Ansible { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.Toolset ARM { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.Toolset Chef { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.Toolset Other { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.Toolset Portal { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.Toolset Puppet { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.Toolset SDK { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.Toolset Shell { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.Toolset Terraform { get { throw null; } } + public bool Equals(Azure.ResourceManager.Impact.Models.Toolset 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.Impact.Models.Toolset left, Azure.ResourceManager.Impact.Models.Toolset right) { throw null; } + public static implicit operator Azure.ResourceManager.Impact.Models.Toolset (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Impact.Models.Toolset left, Azure.ResourceManager.Impact.Models.Toolset right) { throw null; } + public override string ToString() { throw null; } + } + public partial class Workload : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public Workload() { } + public string Context { get { throw null; } set { } } + public Azure.ResourceManager.Impact.Models.Toolset? Toolset { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.Workload System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.Workload System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class WorkloadImpactProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public WorkloadImpactProperties(System.DateTimeOffset startOn, string impactedResourceId, string impactCategory) { } + public Azure.ResourceManager.Impact.Models.WorkloadImpactPropertiesAdditionalProperties AdditionalProperties { get { throw null; } set { } } + public System.Collections.Generic.IList ArmCorrelationIds { get { throw null; } } + public Azure.ResourceManager.Impact.Models.ClientIncidentDetails ClientIncidentDetails { get { throw null; } set { } } + public Azure.ResourceManager.Impact.Models.ConfidenceLevel? ConfidenceLevel { get { throw null; } set { } } + public Azure.ResourceManager.Impact.Models.Connectivity Connectivity { get { throw null; } set { } } + public System.DateTimeOffset? EndOn { get { throw null; } set { } } + public Azure.ResourceManager.Impact.Models.ErrorDetailProperties ErrorDetails { get { throw null; } set { } } + public string ImpactCategory { get { throw null; } set { } } + public string ImpactDescription { get { throw null; } set { } } + public string ImpactedResourceId { get { throw null; } set { } } + public string ImpactGroupId { get { throw null; } set { } } + public string ImpactUniqueId { get { throw null; } } + public System.Collections.Generic.IList Performance { get { throw null; } } + public Azure.ResourceManager.Impact.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public System.DateTimeOffset? ReportedTimeUtc { get { throw null; } } + public System.DateTimeOffset StartOn { get { throw null; } set { } } + public Azure.ResourceManager.Impact.Models.Workload Workload { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.WorkloadImpactProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.WorkloadImpactProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class WorkloadImpactPropertiesAdditionalProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public WorkloadImpactPropertiesAdditionalProperties() { } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.WorkloadImpactPropertiesAdditionalProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.WorkloadImpactPropertiesAdditionalProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/api/Azure.ResourceManager.Impact.netstandard2.0.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/api/Azure.ResourceManager.Impact.netstandard2.0.cs new file mode 100644 index 0000000000000..5266ae8901b67 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/api/Azure.ResourceManager.Impact.netstandard2.0.cs @@ -0,0 +1,608 @@ +namespace Azure.ResourceManager.Impact +{ + public partial class ConnectorCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected ConnectorCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string connectorName, Azure.ResourceManager.Impact.ConnectorData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string connectorName, Azure.ResourceManager.Impact.ConnectorData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string connectorName, 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 connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string connectorName, 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 ConnectorData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ConnectorData() { } + public Azure.ResourceManager.Impact.Models.ConnectorProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.ConnectorData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.ConnectorData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ConnectorResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected ConnectorResource() { } + public virtual Azure.ResourceManager.Impact.ConnectorData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string connectorName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.Impact.ConnectorData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.ConnectorData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.Response Update(Azure.ResourceManager.Impact.ConnectorData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.ResourceManager.Impact.ConnectorData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class ImpactCategoryCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected ImpactCategoryCollection() { } + public virtual Azure.Response Exists(string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetAll(string categoryName = null, string resourceType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetAllAsync(string categoryName = null, string resourceType = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string impactCategoryName, 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 ImpactCategoryData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ImpactCategoryData() { } + public Azure.ResourceManager.Impact.Models.ImpactCategoryProperties Properties { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.ImpactCategoryData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.ImpactCategoryData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ImpactCategoryResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected ImpactCategoryResource() { } + public virtual Azure.ResourceManager.Impact.ImpactCategoryData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string impactCategoryName) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.Impact.ImpactCategoryData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.ImpactCategoryData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public static partial class ImpactExtensions + { + public static Azure.Response GetConnector(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetConnectorAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.Impact.ConnectorResource GetConnectorResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Impact.ConnectorCollection GetConnectors(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource) { throw null; } + public static Azure.ResourceManager.Impact.ImpactCategoryCollection GetImpactCategories(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource) { throw null; } + public static Azure.Response GetImpactCategory(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetImpactCategoryAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.Impact.ImpactCategoryResource GetImpactCategoryResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Impact.InsightResource GetInsightResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.Response GetWorkloadImpact(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string workloadImpactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static System.Threading.Tasks.Task> GetWorkloadImpactAsync(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource, string workloadImpactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public static Azure.ResourceManager.Impact.WorkloadImpactResource GetWorkloadImpactResource(this Azure.ResourceManager.ArmClient client, Azure.Core.ResourceIdentifier id) { throw null; } + public static Azure.ResourceManager.Impact.WorkloadImpactCollection GetWorkloadImpacts(this Azure.ResourceManager.Resources.SubscriptionResource subscriptionResource) { throw null; } + } + public partial class InsightCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected InsightCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string insightName, Azure.ResourceManager.Impact.InsightData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string insightName, Azure.ResourceManager.Impact.InsightData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string insightName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string insightName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string insightName, 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 insightName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string insightName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string insightName, 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 InsightData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public InsightData() { } + public Azure.ResourceManager.Impact.Models.InsightProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.InsightData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.InsightData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class InsightResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected InsightResource() { } + public virtual Azure.ResourceManager.Impact.InsightData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string workloadImpactName, string insightName) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Delete(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeleteAsync(Azure.WaitUntil waitUntil, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + Azure.ResourceManager.Impact.InsightData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.InsightData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.Impact.InsightData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Impact.InsightData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } + public partial class WorkloadImpactCollection : Azure.ResourceManager.ArmCollection, System.Collections.Generic.IAsyncEnumerable, System.Collections.Generic.IEnumerable, System.Collections.IEnumerable + { + protected WorkloadImpactCollection() { } + public virtual Azure.ResourceManager.ArmOperation CreateOrUpdate(Azure.WaitUntil waitUntil, string workloadImpactName, Azure.ResourceManager.Impact.WorkloadImpactData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateOrUpdateAsync(Azure.WaitUntil waitUntil, string workloadImpactName, Azure.ResourceManager.Impact.WorkloadImpactData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Exists(string workloadImpactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> ExistsAsync(string workloadImpactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response Get(string workloadImpactName, 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 workloadImpactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.NullableResponse GetIfExists(string workloadImpactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string workloadImpactName, 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 WorkloadImpactData : Azure.ResourceManager.Models.ResourceData, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public WorkloadImpactData() { } + public Azure.ResourceManager.Impact.Models.WorkloadImpactProperties Properties { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.WorkloadImpactData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.WorkloadImpactData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class WorkloadImpactResource : Azure.ResourceManager.ArmResource, System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public static readonly Azure.Core.ResourceType ResourceType; + protected WorkloadImpactResource() { } + public virtual Azure.ResourceManager.Impact.WorkloadImpactData Data { get { throw null; } } + public virtual bool HasData { get { throw null; } } + public static Azure.Core.ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string workloadImpactName) { 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 GetInsight(string insightName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetInsightAsync(string insightName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Impact.InsightCollection GetInsights() { throw null; } + Azure.ResourceManager.Impact.WorkloadImpactData System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.WorkloadImpactData System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.Impact.WorkloadImpactData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Impact.WorkloadImpactData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + } +} +namespace Azure.ResourceManager.Impact.Mocking +{ + public partial class MockableImpactArmClient : Azure.ResourceManager.ArmResource + { + protected MockableImpactArmClient() { } + public virtual Azure.ResourceManager.Impact.ConnectorResource GetConnectorResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Impact.ImpactCategoryResource GetImpactCategoryResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Impact.InsightResource GetInsightResource(Azure.Core.ResourceIdentifier id) { throw null; } + public virtual Azure.ResourceManager.Impact.WorkloadImpactResource GetWorkloadImpactResource(Azure.Core.ResourceIdentifier id) { throw null; } + } + public partial class MockableImpactSubscriptionResource : Azure.ResourceManager.ArmResource + { + protected MockableImpactSubscriptionResource() { } + public virtual Azure.Response GetConnector(string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetConnectorAsync(string connectorName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Impact.ConnectorCollection GetConnectors() { throw null; } + public virtual Azure.ResourceManager.Impact.ImpactCategoryCollection GetImpactCategories() { throw null; } + public virtual Azure.Response GetImpactCategory(string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetImpactCategoryAsync(string impactCategoryName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetWorkloadImpact(string workloadImpactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> GetWorkloadImpactAsync(string workloadImpactName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.ResourceManager.Impact.WorkloadImpactCollection GetWorkloadImpacts() { throw null; } + } +} +namespace Azure.ResourceManager.Impact.Models +{ + public static partial class ArmImpactModelFactory + { + public static Azure.ResourceManager.Impact.ConnectorData ConnectorData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Impact.Models.ConnectorProperties properties = null) { throw null; } + public static Azure.ResourceManager.Impact.Models.ConnectorProperties ConnectorProperties(Azure.ResourceManager.Impact.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.Impact.Models.ProvisioningState?), string connectorId = null, string tenantId = null, Azure.ResourceManager.Impact.Models.Platform connectorType = default(Azure.ResourceManager.Impact.Models.Platform), System.DateTimeOffset lastRunTimeStamp = default(System.DateTimeOffset)) { throw null; } + public static Azure.ResourceManager.Impact.ImpactCategoryData ImpactCategoryData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Impact.Models.ImpactCategoryProperties properties = null) { throw null; } + public static Azure.ResourceManager.Impact.Models.ImpactCategoryProperties ImpactCategoryProperties(Azure.ResourceManager.Impact.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.Impact.Models.ProvisioningState?), string categoryId = null, string parentCategoryId = null, string description = null, System.Collections.Generic.IEnumerable requiredImpactProperties = null) { throw null; } + public static Azure.ResourceManager.Impact.InsightData InsightData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Impact.Models.InsightProperties properties = null) { throw null; } + public static Azure.ResourceManager.Impact.Models.InsightProperties InsightProperties(Azure.ResourceManager.Impact.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.Impact.Models.ProvisioningState?), string category = null, string status = null, string eventId = null, string groupId = null, Azure.ResourceManager.Impact.Models.Content content = null, System.DateTimeOffset? eventOn = default(System.DateTimeOffset?), string insightUniqueId = null, Azure.ResourceManager.Impact.Models.ImpactDetails impact = null, Azure.ResourceManager.Impact.Models.InsightPropertiesAdditionalDetails additionalDetails = null) { throw null; } + public static Azure.ResourceManager.Impact.Models.RequiredImpactProperties RequiredImpactProperties(string name = null, System.Collections.Generic.IEnumerable allowedValues = null) { throw null; } + public static Azure.ResourceManager.Impact.WorkloadImpactData WorkloadImpactData(Azure.Core.ResourceIdentifier id = null, string name = null, Azure.Core.ResourceType resourceType = default(Azure.Core.ResourceType), Azure.ResourceManager.Models.SystemData systemData = null, Azure.ResourceManager.Impact.Models.WorkloadImpactProperties properties = null) { throw null; } + public static Azure.ResourceManager.Impact.Models.WorkloadImpactProperties WorkloadImpactProperties(Azure.ResourceManager.Impact.Models.ProvisioningState? provisioningState = default(Azure.ResourceManager.Impact.Models.ProvisioningState?), System.DateTimeOffset startOn = default(System.DateTimeOffset), System.DateTimeOffset? endOn = default(System.DateTimeOffset?), string impactedResourceId = null, string impactUniqueId = null, System.DateTimeOffset? reportedTimeUtc = default(System.DateTimeOffset?), string impactCategory = null, string impactDescription = null, System.Collections.Generic.IEnumerable armCorrelationIds = null, System.Collections.Generic.IEnumerable performance = null, Azure.ResourceManager.Impact.Models.Connectivity connectivity = null, Azure.ResourceManager.Impact.Models.WorkloadImpactPropertiesAdditionalProperties additionalProperties = null, Azure.ResourceManager.Impact.Models.ErrorDetailProperties errorDetails = null, Azure.ResourceManager.Impact.Models.Workload workload = null, string impactGroupId = null, Azure.ResourceManager.Impact.Models.ConfidenceLevel? confidenceLevel = default(Azure.ResourceManager.Impact.Models.ConfidenceLevel?), Azure.ResourceManager.Impact.Models.ClientIncidentDetails clientIncidentDetails = null) { throw null; } + } + public partial class ClientIncidentDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ClientIncidentDetails() { } + public string ClientIncidentId { get { throw null; } set { } } + public Azure.ResourceManager.Impact.Models.IncidentSource? ClientIncidentSource { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.ClientIncidentDetails System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.ClientIncidentDetails System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct ConfidenceLevel : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public ConfidenceLevel(string value) { throw null; } + public static Azure.ResourceManager.Impact.Models.ConfidenceLevel High { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.ConfidenceLevel Low { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.ConfidenceLevel Medium { get { throw null; } } + public bool Equals(Azure.ResourceManager.Impact.Models.ConfidenceLevel 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.Impact.Models.ConfidenceLevel left, Azure.ResourceManager.Impact.Models.ConfidenceLevel right) { throw null; } + public static implicit operator Azure.ResourceManager.Impact.Models.ConfidenceLevel (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Impact.Models.ConfidenceLevel left, Azure.ResourceManager.Impact.Models.ConfidenceLevel right) { throw null; } + public override string ToString() { throw null; } + } + public partial class Connectivity : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public Connectivity() { } + public int? Port { get { throw null; } set { } } + public Azure.ResourceManager.Impact.Models.Protocol? Protocol { get { throw null; } set { } } + public string SourceAzureResourceId { get { throw null; } set { } } + public string TargetAzureResourceId { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.Connectivity System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.Connectivity System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ConnectorProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ConnectorProperties(string connectorId, string tenantId, Azure.ResourceManager.Impact.Models.Platform connectorType, System.DateTimeOffset lastRunTimeStamp) { } + public string ConnectorId { get { throw null; } } + public Azure.ResourceManager.Impact.Models.Platform ConnectorType { get { throw null; } set { } } + public System.DateTimeOffset LastRunTimeStamp { get { throw null; } } + public Azure.ResourceManager.Impact.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public string TenantId { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.ConnectorProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.ConnectorProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class Content : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public Content(string title, string description) { } + public string Description { get { throw null; } set { } } + public string Title { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.Content System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.Content System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ErrorDetailProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ErrorDetailProperties() { } + public string ErrorCode { get { throw null; } set { } } + public string ErrorMessage { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.ErrorDetailProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.ErrorDetailProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ExpectedValueRange : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ExpectedValueRange(double min, double max) { } + public double Max { get { throw null; } set { } } + public double Min { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.ExpectedValueRange System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.ExpectedValueRange System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ImpactCategoryProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal ImpactCategoryProperties() { } + public string CategoryId { get { throw null; } } + public string Description { get { throw null; } } + public string ParentCategoryId { get { throw null; } } + public Azure.ResourceManager.Impact.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public System.Collections.Generic.IReadOnlyList RequiredImpactProperties { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.ImpactCategoryProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.ImpactCategoryProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class ImpactDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public ImpactDetails(string impactedResourceId, System.DateTimeOffset startOn, string impactId) { } + public System.DateTimeOffset? EndOn { get { throw null; } set { } } + public string ImpactedResourceId { get { throw null; } set { } } + public string ImpactId { get { throw null; } set { } } + public System.DateTimeOffset StartOn { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.ImpactDetails System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.ImpactDetails System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct IncidentSource : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public IncidentSource(string value) { throw null; } + public static Azure.ResourceManager.Impact.Models.IncidentSource AzureDevops { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.IncidentSource ICM { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.IncidentSource Jira { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.IncidentSource Other { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.IncidentSource ServiceNow { get { throw null; } } + public bool Equals(Azure.ResourceManager.Impact.Models.IncidentSource 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.Impact.Models.IncidentSource left, Azure.ResourceManager.Impact.Models.IncidentSource right) { throw null; } + public static implicit operator Azure.ResourceManager.Impact.Models.IncidentSource (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Impact.Models.IncidentSource left, Azure.ResourceManager.Impact.Models.IncidentSource right) { throw null; } + public override string ToString() { throw null; } + } + public partial class InsightProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public InsightProperties(string category, Azure.ResourceManager.Impact.Models.Content content, string insightUniqueId, Azure.ResourceManager.Impact.Models.ImpactDetails impact) { } + public Azure.ResourceManager.Impact.Models.InsightPropertiesAdditionalDetails AdditionalDetails { get { throw null; } set { } } + public string Category { get { throw null; } set { } } + public Azure.ResourceManager.Impact.Models.Content Content { get { throw null; } set { } } + public string EventId { get { throw null; } set { } } + public System.DateTimeOffset? EventOn { get { throw null; } set { } } + public string GroupId { get { throw null; } set { } } + public Azure.ResourceManager.Impact.Models.ImpactDetails Impact { get { throw null; } set { } } + public string InsightUniqueId { get { throw null; } set { } } + public Azure.ResourceManager.Impact.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public string Status { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.InsightProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.InsightProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class InsightPropertiesAdditionalDetails : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public InsightPropertiesAdditionalDetails() { } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.InsightPropertiesAdditionalDetails System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.InsightPropertiesAdditionalDetails System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct MetricUnit : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public MetricUnit(string value) { throw null; } + public static Azure.ResourceManager.Impact.Models.MetricUnit Bytes { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.MetricUnit ByteSeconds { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.MetricUnit BytesPerSecond { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.MetricUnit Cores { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.MetricUnit Count { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.MetricUnit CountPerSecond { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.MetricUnit MilliCores { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.MetricUnit MilliSeconds { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.MetricUnit NanoCores { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.MetricUnit Other { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.MetricUnit Percent { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.MetricUnit Seconds { get { throw null; } } + public bool Equals(Azure.ResourceManager.Impact.Models.MetricUnit 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.Impact.Models.MetricUnit left, Azure.ResourceManager.Impact.Models.MetricUnit right) { throw null; } + public static implicit operator Azure.ResourceManager.Impact.Models.MetricUnit (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Impact.Models.MetricUnit left, Azure.ResourceManager.Impact.Models.MetricUnit right) { throw null; } + public override string ToString() { throw null; } + } + public partial class Performance : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public Performance() { } + public double? Actual { get { throw null; } set { } } + public double? Expected { get { throw null; } set { } } + public Azure.ResourceManager.Impact.Models.ExpectedValueRange ExpectedValueRange { get { throw null; } set { } } + public string MetricName { get { throw null; } set { } } + public Azure.ResourceManager.Impact.Models.MetricUnit? Unit { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.Performance System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.Performance System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct Platform : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public Platform(string value) { throw null; } + public static Azure.ResourceManager.Impact.Models.Platform AzureMonitor { get { throw null; } } + public bool Equals(Azure.ResourceManager.Impact.Models.Platform 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.Impact.Models.Platform left, Azure.ResourceManager.Impact.Models.Platform right) { throw null; } + public static implicit operator Azure.ResourceManager.Impact.Models.Platform (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Impact.Models.Platform left, Azure.ResourceManager.Impact.Models.Platform right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct Protocol : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public Protocol(string value) { throw null; } + public static Azure.ResourceManager.Impact.Models.Protocol FTP { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.Protocol HTTP { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.Protocol HTTPS { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.Protocol Other { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.Protocol RDP { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.Protocol SSH { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.Protocol TCP { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.Protocol UDP { get { throw null; } } + public bool Equals(Azure.ResourceManager.Impact.Models.Protocol 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.Impact.Models.Protocol left, Azure.ResourceManager.Impact.Models.Protocol right) { throw null; } + public static implicit operator Azure.ResourceManager.Impact.Models.Protocol (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Impact.Models.Protocol left, Azure.ResourceManager.Impact.Models.Protocol right) { throw null; } + public override string ToString() { 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.Impact.Models.ProvisioningState Canceled { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.ProvisioningState Failed { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.ProvisioningState Succeeded { get { throw null; } } + public bool Equals(Azure.ResourceManager.Impact.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.Impact.Models.ProvisioningState left, Azure.ResourceManager.Impact.Models.ProvisioningState right) { throw null; } + public static implicit operator Azure.ResourceManager.Impact.Models.ProvisioningState (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Impact.Models.ProvisioningState left, Azure.ResourceManager.Impact.Models.ProvisioningState right) { throw null; } + public override string ToString() { throw null; } + } + public partial class RequiredImpactProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + internal RequiredImpactProperties() { } + public System.Collections.Generic.IReadOnlyList AllowedValues { get { throw null; } } + public string Name { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.RequiredImpactProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.RequiredImpactProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct Toolset : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public Toolset(string value) { throw null; } + public static Azure.ResourceManager.Impact.Models.Toolset Ansible { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.Toolset ARM { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.Toolset Chef { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.Toolset Other { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.Toolset Portal { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.Toolset Puppet { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.Toolset SDK { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.Toolset Shell { get { throw null; } } + public static Azure.ResourceManager.Impact.Models.Toolset Terraform { get { throw null; } } + public bool Equals(Azure.ResourceManager.Impact.Models.Toolset 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.Impact.Models.Toolset left, Azure.ResourceManager.Impact.Models.Toolset right) { throw null; } + public static implicit operator Azure.ResourceManager.Impact.Models.Toolset (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Impact.Models.Toolset left, Azure.ResourceManager.Impact.Models.Toolset right) { throw null; } + public override string ToString() { throw null; } + } + public partial class Workload : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public Workload() { } + public string Context { get { throw null; } set { } } + public Azure.ResourceManager.Impact.Models.Toolset? Toolset { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.Workload System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.Workload System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class WorkloadImpactProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public WorkloadImpactProperties(System.DateTimeOffset startOn, string impactedResourceId, string impactCategory) { } + public Azure.ResourceManager.Impact.Models.WorkloadImpactPropertiesAdditionalProperties AdditionalProperties { get { throw null; } set { } } + public System.Collections.Generic.IList ArmCorrelationIds { get { throw null; } } + public Azure.ResourceManager.Impact.Models.ClientIncidentDetails ClientIncidentDetails { get { throw null; } set { } } + public Azure.ResourceManager.Impact.Models.ConfidenceLevel? ConfidenceLevel { get { throw null; } set { } } + public Azure.ResourceManager.Impact.Models.Connectivity Connectivity { get { throw null; } set { } } + public System.DateTimeOffset? EndOn { get { throw null; } set { } } + public Azure.ResourceManager.Impact.Models.ErrorDetailProperties ErrorDetails { get { throw null; } set { } } + public string ImpactCategory { get { throw null; } set { } } + public string ImpactDescription { get { throw null; } set { } } + public string ImpactedResourceId { get { throw null; } set { } } + public string ImpactGroupId { get { throw null; } set { } } + public string ImpactUniqueId { get { throw null; } } + public System.Collections.Generic.IList Performance { get { throw null; } } + public Azure.ResourceManager.Impact.Models.ProvisioningState? ProvisioningState { get { throw null; } } + public System.DateTimeOffset? ReportedTimeUtc { get { throw null; } } + public System.DateTimeOffset StartOn { get { throw null; } set { } } + public Azure.ResourceManager.Impact.Models.Workload Workload { get { throw null; } set { } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.WorkloadImpactProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.WorkloadImpactProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } + public partial class WorkloadImpactPropertiesAdditionalProperties : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel + { + public WorkloadImpactPropertiesAdditionalProperties() { } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.WorkloadImpactPropertiesAdditionalProperties System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } + Azure.ResourceManager.Impact.Models.WorkloadImpactPropertiesAdditionalProperties System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + string System.ClientModel.Primitives.IPersistableModel.GetFormatFromOptions(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + System.BinaryData System.ClientModel.Primitives.IPersistableModel.Write(System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/assets.json b/sdk/impactreporting/Azure.ResourceManager.Impact/assets.json new file mode 100644 index 0000000000000..34ad9690fd302 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/assets.json @@ -0,0 +1,7 @@ + +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "net", + "TagPrefix": "net/impact/Azure.ResourceManager.Impact", + "Tag": "" +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/samples/Azure.ResourceManager.Impact.Samples.csproj b/sdk/impactreporting/Azure.ResourceManager.Impact/samples/Azure.ResourceManager.Impact.Samples.csproj new file mode 100644 index 0000000000000..d569bb1965f2d --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/samples/Azure.ResourceManager.Impact.Samples.csproj @@ -0,0 +1,13 @@ + + + + + + + + + + + + + diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/samples/Generated/Samples/Sample_ConnectorCollection.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/samples/Generated/Samples/Sample_ConnectorCollection.cs new file mode 100644 index 0000000000000..6a23e721d0db1 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/samples/Generated/Samples/Sample_ConnectorCollection.cs @@ -0,0 +1,191 @@ +// 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.Impact.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.Impact.Samples +{ + public partial class Sample_ConnectorCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_ConnectorsCreateOrUpdate() + { + // Generated from example definition: 2024-05-01-preview/Connectors_CreateOrUpdate.json + // this example is just showing the usage of "Connector_CreateOrUpdate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "74f5e23f-d4d9-410a-bb4d-8f0608adb10d"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ConnectorResource + ConnectorCollection collection = subscriptionResource.GetConnectors(); + + // invoke the operation + string connectorName = "testconnector1"; + ConnectorData data = new ConnectorData + { + Properties = new ConnectorProperties(null, null, Platform.AzureMonitor, default), + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, connectorName, data); + ConnectorResource 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 + ConnectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_ConnectorsGet() + { + // Generated from example definition: 2024-05-01-preview/Connectors_Get.json + // this example is just showing the usage of "Connector_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "74f5e23f-d4d9-410a-bb4d-8f0608adb10d"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ConnectorResource + ConnectorCollection collection = subscriptionResource.GetConnectors(); + + // invoke the operation + string connectorName = "testconnector1"; + ConnectorResource result = await collection.GetAsync(connectorName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ConnectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_ConnectorsListBySubscription() + { + // Generated from example definition: 2024-05-01-preview/Connectors_ListBySubscription.json + // this example is just showing the usage of "Connector_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "74f5e23f-d4d9-410a-bb4d-8f0608adb10d"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ConnectorResource + ConnectorCollection collection = subscriptionResource.GetConnectors(); + + // invoke the operation and iterate over the result + await foreach (ConnectorResource 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 + ConnectorData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_ConnectorsGet() + { + // Generated from example definition: 2024-05-01-preview/Connectors_Get.json + // this example is just showing the usage of "Connector_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "74f5e23f-d4d9-410a-bb4d-8f0608adb10d"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ConnectorResource + ConnectorCollection collection = subscriptionResource.GetConnectors(); + + // invoke the operation + string connectorName = "testconnector1"; + bool result = await collection.ExistsAsync(connectorName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_ConnectorsGet() + { + // Generated from example definition: 2024-05-01-preview/Connectors_Get.json + // this example is just showing the usage of "Connector_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/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 = "74f5e23f-d4d9-410a-bb4d-8f0608adb10d"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ConnectorResource + ConnectorCollection collection = subscriptionResource.GetConnectors(); + + // invoke the operation + string connectorName = "testconnector1"; + NullableResponse response = await collection.GetIfExistsAsync(connectorName); + ConnectorResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ConnectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/samples/Generated/Samples/Sample_ConnectorResource.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/samples/Generated/Samples/Sample_ConnectorResource.cs new file mode 100644 index 0000000000000..bd352eae7db48 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/samples/Generated/Samples/Sample_ConnectorResource.cs @@ -0,0 +1,106 @@ +// 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.Impact.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.Impact.Samples +{ + public partial class Sample_ConnectorResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_ConnectorsGet() + { + // Generated from example definition: 2024-05-01-preview/Connectors_Get.json + // this example is just showing the usage of "Connector_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ConnectorResource created on azure + // for more information of creating ConnectorResource, please refer to the document of ConnectorResource + string subscriptionId = "74f5e23f-d4d9-410a-bb4d-8f0608adb10d"; + string connectorName = "testconnector1"; + ResourceIdentifier connectorResourceId = ConnectorResource.CreateResourceIdentifier(subscriptionId, connectorName); + ConnectorResource connector = client.GetConnectorResource(connectorResourceId); + + // invoke the operation + ConnectorResource result = await connector.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 + ConnectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Delete_ConnectorsDelete() + { + // Generated from example definition: 2024-05-01-preview/Connectors_Delete.json + // this example is just showing the usage of "Connector_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 ConnectorResource created on azure + // for more information of creating ConnectorResource, please refer to the document of ConnectorResource + string subscriptionId = "8F74B371-8573-4773-9BDA-D546505BDB3A"; + string connectorName = "testconnector1"; + ResourceIdentifier connectorResourceId = ConnectorResource.CreateResourceIdentifier(subscriptionId, connectorName); + ConnectorResource connector = client.GetConnectorResource(connectorResourceId); + + // invoke the operation + await connector.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_ConnectorsUpdate() + { + // Generated from example definition: 2024-05-01-preview/Connectors_Update.json + // this example is just showing the usage of "Connector_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 ConnectorResource created on azure + // for more information of creating ConnectorResource, please refer to the document of ConnectorResource + string subscriptionId = "74f5e23f-d4d9-410a-bb4d-8f0608adb10d"; + string connectorName = "testconnector1"; + ResourceIdentifier connectorResourceId = ConnectorResource.CreateResourceIdentifier(subscriptionId, connectorName); + ConnectorResource connector = client.GetConnectorResource(connectorResourceId); + + // invoke the operation + ConnectorData data = new ConnectorData + { + Properties = new ConnectorProperties(null, null, Platform.AzureMonitor, default), + }; + ConnectorResource result = await connector.UpdateAsync(data); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ConnectorData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/samples/Generated/Samples/Sample_ImpactCategoryCollection.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/samples/Generated/Samples/Sample_ImpactCategoryCollection.cs new file mode 100644 index 0000000000000..085df2e642b29 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/samples/Generated/Samples/Sample_ImpactCategoryCollection.cs @@ -0,0 +1,154 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.Impact.Samples +{ + public partial class Sample_ImpactCategoryCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetWorkloadImpactResourceByName() + { + // Generated from example definition: 2024-05-01-preview/ImpactCategories_Get.json + // this example is just showing the usage of "ImpactCategory_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ImpactCategoryResource + ImpactCategoryCollection collection = subscriptionResource.GetImpactCategories(); + + // invoke the operation + string impactCategoryName = "ARMOperation.Create"; + ImpactCategoryResource result = await collection.GetAsync(impactCategoryName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ImpactCategoryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_GetImpactCategoriesListBySubscription() + { + // Generated from example definition: 2024-05-01-preview/ImpactCategories_ListBySubscription.json + // this example is just showing the usage of "ImpactCategory_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ImpactCategoryResource + ImpactCategoryCollection collection = subscriptionResource.GetImpactCategories(); + + // invoke the operation and iterate over the result + string resourceType = "microsoft.compute/virtualmachines"; + await foreach (ImpactCategoryResource item in collection.GetAllAsync(resourceType: resourceType)) + { + // 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 + ImpactCategoryData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_GetWorkloadImpactResourceByName() + { + // Generated from example definition: 2024-05-01-preview/ImpactCategories_Get.json + // this example is just showing the usage of "ImpactCategory_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ImpactCategoryResource + ImpactCategoryCollection collection = subscriptionResource.GetImpactCategories(); + + // invoke the operation + string impactCategoryName = "ARMOperation.Create"; + bool result = await collection.ExistsAsync(impactCategoryName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetWorkloadImpactResourceByName() + { + // Generated from example definition: 2024-05-01-preview/ImpactCategories_Get.json + // this example is just showing the usage of "ImpactCategory_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this ImpactCategoryResource + ImpactCategoryCollection collection = subscriptionResource.GetImpactCategories(); + + // invoke the operation + string impactCategoryName = "ARMOperation.Create"; + NullableResponse response = await collection.GetIfExistsAsync(impactCategoryName); + ImpactCategoryResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + ImpactCategoryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/samples/Generated/Samples/Sample_ImpactCategoryResource.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/samples/Generated/Samples/Sample_ImpactCategoryResource.cs new file mode 100644 index 0000000000000..5985954439c80 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/samples/Generated/Samples/Sample_ImpactCategoryResource.cs @@ -0,0 +1,47 @@ +// 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 NUnit.Framework; + +namespace Azure.ResourceManager.Impact.Samples +{ + public partial class Sample_ImpactCategoryResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetWorkloadImpactResourceByName() + { + // Generated from example definition: 2024-05-01-preview/ImpactCategories_Get.json + // this example is just showing the usage of "ImpactCategory_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this ImpactCategoryResource created on azure + // for more information of creating ImpactCategoryResource, please refer to the document of ImpactCategoryResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string impactCategoryName = "ARMOperation.Create"; + ResourceIdentifier impactCategoryResourceId = ImpactCategoryResource.CreateResourceIdentifier(subscriptionId, impactCategoryName); + ImpactCategoryResource impactCategory = client.GetImpactCategoryResource(impactCategoryResourceId); + + // invoke the operation + ImpactCategoryResource result = await impactCategory.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 + ImpactCategoryData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/samples/Generated/Samples/Sample_InsightCollection.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/samples/Generated/Samples/Sample_InsightCollection.cs new file mode 100644 index 0000000000000..2d13dded6e211 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/samples/Generated/Samples/Sample_InsightCollection.cs @@ -0,0 +1,405 @@ +// 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.Impact.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.Impact.Samples +{ + public partial class Sample_InsightCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_CreatingAnInsight() + { + // Generated from example definition: 2024-05-01-preview/Insights_Create.json + // this example is just showing the usage of "Insight_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 WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impactid22"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // get the collection of this InsightResource + InsightCollection collection = workloadImpact.GetInsights(); + + // invoke the operation + string insightName = "insightId12"; + InsightData data = new InsightData + { + Properties = new InsightProperties("repair", new Content("Impact Has been correlated to an outage", "At 2018-11-08T00:00:00Z UTC, your services dependent on these resources VM1 may have experienced an issue.
We have identified an outage that affected these resources(s). You can look at outage information on NL2W-VCZ link.
"), "00000000-0000-0000-0000-000000000000", new ImpactDetails("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-rg/providers/Microsoft.Sql/sqlserver/dbservername", DateTimeOffset.Parse("2023-06-15T01:00:00.009223Z"), "/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.Impact/workloadImpacts/impactid22")) + { + Status = "resolved", + EventOn = DateTimeOffset.Parse("2023-06-15T04:00:00.009223Z"), + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, insightName, data); + InsightResource 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 + InsightData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetInsightSampleForDiagnosticsCategory() + { + // Generated from example definition: 2024-05-01-preview/Insights_Get_diagnostics.json + // this example is just showing the usage of "Insight_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impactid"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // get the collection of this InsightResource + InsightCollection collection = workloadImpact.GetInsights(); + + // invoke the operation + string insightName = "insight1"; + InsightResource result = await collection.GetAsync(insightName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + InsightData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetInsightSampleForMitigationActionCategory() + { + // Generated from example definition: 2024-05-01-preview/Insights_Get_mitigationAction.json + // this example is just showing the usage of "Insight_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impactId"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // get the collection of this InsightResource + InsightCollection collection = workloadImpact.GetInsights(); + + // invoke the operation + string insightName = "HPCUASucceeded"; + InsightResource result = await collection.GetAsync(insightName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + InsightData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetInsightSampleForServiceHealthCategory() + { + // Generated from example definition: 2024-05-01-preview/Insights_Get_servicehealth.json + // this example is just showing the usage of "Insight_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impactid"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // get the collection of this InsightResource + InsightCollection collection = workloadImpact.GetInsights(); + + // invoke the operation + string insightName = "insightname"; + InsightResource result = await collection.GetAsync(insightName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + InsightData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_ListInsightResourcesByWorkloadImpactName() + { + // Generated from example definition: 2024-05-01-preview/Insights_ListBySubscription.json + // this example is just showing the usage of "Insight_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impactid22"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // get the collection of this InsightResource + InsightCollection collection = workloadImpact.GetInsights(); + + // invoke the operation and iterate over the result + await foreach (InsightResource 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 + InsightData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_GetInsightSampleForDiagnosticsCategory() + { + // Generated from example definition: 2024-05-01-preview/Insights_Get_diagnostics.json + // this example is just showing the usage of "Insight_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impactid"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // get the collection of this InsightResource + InsightCollection collection = workloadImpact.GetInsights(); + + // invoke the operation + string insightName = "insight1"; + bool result = await collection.ExistsAsync(insightName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_GetInsightSampleForMitigationActionCategory() + { + // Generated from example definition: 2024-05-01-preview/Insights_Get_mitigationAction.json + // this example is just showing the usage of "Insight_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impactId"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // get the collection of this InsightResource + InsightCollection collection = workloadImpact.GetInsights(); + + // invoke the operation + string insightName = "HPCUASucceeded"; + bool result = await collection.ExistsAsync(insightName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_GetInsightSampleForServiceHealthCategory() + { + // Generated from example definition: 2024-05-01-preview/Insights_Get_servicehealth.json + // this example is just showing the usage of "Insight_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impactid"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // get the collection of this InsightResource + InsightCollection collection = workloadImpact.GetInsights(); + + // invoke the operation + string insightName = "insightname"; + bool result = await collection.ExistsAsync(insightName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetInsightSampleForDiagnosticsCategory() + { + // Generated from example definition: 2024-05-01-preview/Insights_Get_diagnostics.json + // this example is just showing the usage of "Insight_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impactid"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // get the collection of this InsightResource + InsightCollection collection = workloadImpact.GetInsights(); + + // invoke the operation + string insightName = "insight1"; + NullableResponse response = await collection.GetIfExistsAsync(insightName); + InsightResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + InsightData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetInsightSampleForMitigationActionCategory() + { + // Generated from example definition: 2024-05-01-preview/Insights_Get_mitigationAction.json + // this example is just showing the usage of "Insight_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impactId"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // get the collection of this InsightResource + InsightCollection collection = workloadImpact.GetInsights(); + + // invoke the operation + string insightName = "HPCUASucceeded"; + NullableResponse response = await collection.GetIfExistsAsync(insightName); + InsightResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + InsightData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetInsightSampleForServiceHealthCategory() + { + // Generated from example definition: 2024-05-01-preview/Insights_Get_servicehealth.json + // this example is just showing the usage of "Insight_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impactid"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // get the collection of this InsightResource + InsightCollection collection = workloadImpact.GetInsights(); + + // invoke the operation + string insightName = "insightname"; + NullableResponse response = await collection.GetIfExistsAsync(insightName); + InsightResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + InsightData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/samples/Generated/Samples/Sample_InsightResource.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/samples/Generated/Samples/Sample_InsightResource.cs new file mode 100644 index 0000000000000..ca8aab17bdd29 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/samples/Generated/Samples/Sample_InsightResource.cs @@ -0,0 +1,174 @@ +// 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.Impact.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.Impact.Samples +{ + public partial class Sample_InsightResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetInsightSampleForDiagnosticsCategory() + { + // Generated from example definition: 2024-05-01-preview/Insights_Get_diagnostics.json + // this example is just showing the usage of "Insight_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this InsightResource created on azure + // for more information of creating InsightResource, please refer to the document of InsightResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impactid"; + string insightName = "insight1"; + ResourceIdentifier insightResourceId = InsightResource.CreateResourceIdentifier(subscriptionId, workloadImpactName, insightName); + InsightResource insight = client.GetInsightResource(insightResourceId); + + // invoke the operation + InsightResource result = await insight.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 + InsightData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetInsightSampleForMitigationActionCategory() + { + // Generated from example definition: 2024-05-01-preview/Insights_Get_mitigationAction.json + // this example is just showing the usage of "Insight_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this InsightResource created on azure + // for more information of creating InsightResource, please refer to the document of InsightResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impactId"; + string insightName = "HPCUASucceeded"; + ResourceIdentifier insightResourceId = InsightResource.CreateResourceIdentifier(subscriptionId, workloadImpactName, insightName); + InsightResource insight = client.GetInsightResource(insightResourceId); + + // invoke the operation + InsightResource result = await insight.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 + InsightData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetInsightSampleForServiceHealthCategory() + { + // Generated from example definition: 2024-05-01-preview/Insights_Get_servicehealth.json + // this example is just showing the usage of "Insight_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this InsightResource created on azure + // for more information of creating InsightResource, please refer to the document of InsightResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impactid"; + string insightName = "insightname"; + ResourceIdentifier insightResourceId = InsightResource.CreateResourceIdentifier(subscriptionId, workloadImpactName, insightName); + InsightResource insight = client.GetInsightResource(insightResourceId); + + // invoke the operation + InsightResource result = await insight.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 + InsightData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Delete_DeleteAnInsight() + { + // Generated from example definition: 2024-05-01-preview/Insights_Delete.json + // this example is just showing the usage of "Insight_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 InsightResource created on azure + // for more information of creating InsightResource, please refer to the document of InsightResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impactid22"; + string insightName = "insightId12"; + ResourceIdentifier insightResourceId = InsightResource.CreateResourceIdentifier(subscriptionId, workloadImpactName, insightName); + InsightResource insight = client.GetInsightResource(insightResourceId); + + // invoke the operation + await insight.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_CreatingAnInsight() + { + // Generated from example definition: 2024-05-01-preview/Insights_Create.json + // this example is just showing the usage of "Insight_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 InsightResource created on azure + // for more information of creating InsightResource, please refer to the document of InsightResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impactid22"; + string insightName = "insightId12"; + ResourceIdentifier insightResourceId = InsightResource.CreateResourceIdentifier(subscriptionId, workloadImpactName, insightName); + InsightResource insight = client.GetInsightResource(insightResourceId); + + // invoke the operation + InsightData data = new InsightData + { + Properties = new InsightProperties("repair", new Content("Impact Has been correlated to an outage", "At 2018-11-08T00:00:00Z UTC, your services dependent on these resources VM1 may have experienced an issue.
We have identified an outage that affected these resources(s). You can look at outage information on NL2W-VCZ link.
"), "00000000-0000-0000-0000-000000000000", new ImpactDetails("/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-rg/providers/Microsoft.Sql/sqlserver/dbservername", DateTimeOffset.Parse("2023-06-15T01:00:00.009223Z"), "/subscriptions/00000000-0000-0000-0000-000000000000/providers/microsoft.Impact/workloadImpacts/impactid22")) + { + Status = "resolved", + EventOn = DateTimeOffset.Parse("2023-06-15T04:00:00.009223Z"), + }, + }; + ArmOperation lro = await insight.UpdateAsync(WaitUntil.Completed, data); + InsightResource 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 + InsightData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/samples/Generated/Samples/Sample_WorkloadImpactCollection.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/samples/Generated/Samples/Sample_WorkloadImpactCollection.cs new file mode 100644 index 0000000000000..3f26fccea7bce --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/samples/Generated/Samples/Sample_WorkloadImpactCollection.cs @@ -0,0 +1,368 @@ +// 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.Impact.Models; +using Azure.ResourceManager.Resources; +using NUnit.Framework; + +namespace Azure.ResourceManager.Impact.Samples +{ + public partial class Sample_WorkloadImpactCollection + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_ReportingArmOperationFailure() + { + // Generated from example definition: 2024-05-01-preview/WorkloadArmOperation_create.json + // this example is just showing the usage of "WorkloadImpact_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this WorkloadImpactResource + WorkloadImpactCollection collection = subscriptionResource.GetWorkloadImpacts(); + + // invoke the operation + string workloadImpactName = "impact-002"; + WorkloadImpactData data = new WorkloadImpactData + { + Properties = new WorkloadImpactProperties(DateTimeOffset.Parse("2022-06-15T05:59:46.6517821Z"), "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-rg/providers/Microsoft.Sql/sqlserver/dbservercontext", "ArmOperation") + { + ImpactDescription = "deletion of resource failed", + ArmCorrelationIds = { "00000000-0000-0000-0000-000000000000" }, + Workload = new Workload + { + Context = "webapp/scenario1", + Toolset = Toolset.Other, + }, + ClientIncidentDetails = new ClientIncidentDetails + { + ClientIncidentId = "AA123", + ClientIncidentSource = IncidentSource.Jira, + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, workloadImpactName, data); + WorkloadImpactResource 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 + WorkloadImpactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_ReportingAvailabilityRelatedImpact() + { + // Generated from example definition: 2024-05-01-preview/WorkloadAvailability_Create.json + // this example is just showing the usage of "WorkloadImpact_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this WorkloadImpactResource + WorkloadImpactCollection collection = subscriptionResource.GetWorkloadImpacts(); + + // invoke the operation + string workloadImpactName = "impact-002"; + WorkloadImpactData data = new WorkloadImpactData + { + Properties = new WorkloadImpactProperties(DateTimeOffset.Parse("2022-06-15T05:59:46.6517821Z"), "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-rg/providers/Microsoft.Sql/sqlserver/dbservercontext", "Availability") + { + ImpactDescription = "read calls failed", + Workload = new Workload + { + Context = "webapp/scenario1", + Toolset = Toolset.Other, + }, + ClientIncidentDetails = new ClientIncidentDetails + { + ClientIncidentId = "AA123", + ClientIncidentSource = IncidentSource.Jira, + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, workloadImpactName, data); + WorkloadImpactResource 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 + WorkloadImpactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_ReportingAConnectivityImpact() + { + // Generated from example definition: 2024-05-01-preview/WorkloadConnectivityImpact_Create.json + // this example is just showing the usage of "WorkloadImpact_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this WorkloadImpactResource + WorkloadImpactCollection collection = subscriptionResource.GetWorkloadImpacts(); + + // invoke the operation + string workloadImpactName = "impact-001"; + WorkloadImpactData data = new WorkloadImpactData + { + Properties = new WorkloadImpactProperties(DateTimeOffset.Parse("2022-06-15T05:59:46.6517821Z"), "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-rg/providers/Microsoft.Sql/sqlserver/dbservercontext", "Resource.Connectivity") + { + ImpactDescription = "conection failure", + Connectivity = new Connectivity + { + Protocol = Protocol.TCP, + Port = 1443, + SourceAzureResourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceSub/providers/Microsoft.compute/virtualmachines/vm1", + TargetAzureResourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceSub/providers/Microsoft.compute/virtualmachines/vm2", + }, + Workload = new Workload + { + Context = "webapp/scenario1", + Toolset = Toolset.Other, + }, + ClientIncidentDetails = new ClientIncidentDetails + { + ClientIncidentId = "AA123", + ClientIncidentSource = IncidentSource.Jira, + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, workloadImpactName, data); + WorkloadImpactResource 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 + WorkloadImpactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CreateOrUpdate_ReportingPerformanceRelatedImpact() + { + // Generated from example definition: 2024-05-01-preview/WorkloadPerformance_Create.json + // this example is just showing the usage of "WorkloadImpact_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 SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this WorkloadImpactResource + WorkloadImpactCollection collection = subscriptionResource.GetWorkloadImpacts(); + + // invoke the operation + string workloadImpactName = "impact-002"; + WorkloadImpactData data = new WorkloadImpactData + { + Properties = new WorkloadImpactProperties(DateTimeOffset.Parse("2022-06-15T05:59:46.6517821Z"), "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-rg/providers/Microsoft.Sql/sqlserver/dbservercontext", "Resource.Performance") + { + ImpactDescription = "high cpu utilization", + Performance = {new Performance +{ +MetricName = "CPU", +Expected = 60, +Actual = 90, +}}, + Workload = new Workload + { + Context = "webapp/scenario1", + Toolset = Toolset.Other, + }, + ClientIncidentDetails = new ClientIncidentDetails + { + ClientIncidentId = "AA123", + ClientIncidentSource = IncidentSource.Jira, + }, + }, + }; + ArmOperation lro = await collection.CreateOrUpdateAsync(WaitUntil.Completed, workloadImpactName, data); + WorkloadImpactResource 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 + WorkloadImpactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetWorkloadImpactResourceByNameExample() + { + // Generated from example definition: 2024-05-01-preview/WorkloadImpact_Get.json + // this example is just showing the usage of "WorkloadImpact_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this WorkloadImpactResource + WorkloadImpactCollection collection = subscriptionResource.GetWorkloadImpacts(); + + // invoke the operation + string workloadImpactName = "impact-001"; + WorkloadImpactResource result = await collection.GetAsync(workloadImpactName); + + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkloadImpactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetAll_ListWorkloadImpactResourcesBySubscription() + { + // Generated from example definition: 2024-05-01-preview/WorkloadImpacts_ListBySubscription.json + // this example is just showing the usage of "WorkloadImpact_ListBySubscription" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this WorkloadImpactResource + WorkloadImpactCollection collection = subscriptionResource.GetWorkloadImpacts(); + + // invoke the operation and iterate over the result + await foreach (WorkloadImpactResource 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 + WorkloadImpactData resourceData = item.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Exists_GetWorkloadImpactResourceByNameExample() + { + // Generated from example definition: 2024-05-01-preview/WorkloadImpact_Get.json + // this example is just showing the usage of "WorkloadImpact_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this WorkloadImpactResource + WorkloadImpactCollection collection = subscriptionResource.GetWorkloadImpacts(); + + // invoke the operation + string workloadImpactName = "impact-001"; + bool result = await collection.ExistsAsync(workloadImpactName); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetIfExists_GetWorkloadImpactResourceByNameExample() + { + // Generated from example definition: 2024-05-01-preview/WorkloadImpact_Get.json + // this example is just showing the usage of "WorkloadImpact_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // get the collection of this WorkloadImpactResource + WorkloadImpactCollection collection = subscriptionResource.GetWorkloadImpacts(); + + // invoke the operation + string workloadImpactName = "impact-001"; + NullableResponse response = await collection.GetIfExistsAsync(workloadImpactName); + WorkloadImpactResource result = response.HasValue ? response.Value : null; + + if (result == null) + { + Console.WriteLine("Succeeded with null as result"); + } + else + { + // the variable result is a resource, you could call other operations on this instance as well + // but just for demo, we get its data from this resource instance + WorkloadImpactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/samples/Generated/Samples/Sample_WorkloadImpactResource.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/samples/Generated/Samples/Sample_WorkloadImpactResource.cs new file mode 100644 index 0000000000000..ae3f4a42f4a8c --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/samples/Generated/Samples/Sample_WorkloadImpactResource.cs @@ -0,0 +1,275 @@ +// 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.Impact.Models; +using NUnit.Framework; + +namespace Azure.ResourceManager.Impact.Samples +{ + public partial class Sample_WorkloadImpactResource + { + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Get_GetWorkloadImpactResourceByNameExample() + { + // Generated from example definition: 2024-05-01-preview/WorkloadImpact_Get.json + // this example is just showing the usage of "WorkloadImpact_Get" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impact-001"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // invoke the operation + WorkloadImpactResource result = await workloadImpact.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 + WorkloadImpactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Delete_DeleteWorkloadImpactResourceByNameExample() + { + // Generated from example definition: 2024-05-01-preview/WorkloadImpact_Delete.json + // this example is just showing the usage of "WorkloadImpact_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 WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impact-001"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // invoke the operation + await workloadImpact.DeleteAsync(WaitUntil.Completed); + + Console.WriteLine("Succeeded"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_ReportingArmOperationFailure() + { + // Generated from example definition: 2024-05-01-preview/WorkloadArmOperation_create.json + // this example is just showing the usage of "WorkloadImpact_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 WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impact-002"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // invoke the operation + WorkloadImpactData data = new WorkloadImpactData + { + Properties = new WorkloadImpactProperties(DateTimeOffset.Parse("2022-06-15T05:59:46.6517821Z"), "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-rg/providers/Microsoft.Sql/sqlserver/dbservercontext", "ArmOperation") + { + ImpactDescription = "deletion of resource failed", + ArmCorrelationIds = { "00000000-0000-0000-0000-000000000000" }, + Workload = new Workload + { + Context = "webapp/scenario1", + Toolset = Toolset.Other, + }, + ClientIncidentDetails = new ClientIncidentDetails + { + ClientIncidentId = "AA123", + ClientIncidentSource = IncidentSource.Jira, + }, + }, + }; + ArmOperation lro = await workloadImpact.UpdateAsync(WaitUntil.Completed, data); + WorkloadImpactResource 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 + WorkloadImpactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_ReportingAvailabilityRelatedImpact() + { + // Generated from example definition: 2024-05-01-preview/WorkloadAvailability_Create.json + // this example is just showing the usage of "WorkloadImpact_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 WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impact-002"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // invoke the operation + WorkloadImpactData data = new WorkloadImpactData + { + Properties = new WorkloadImpactProperties(DateTimeOffset.Parse("2022-06-15T05:59:46.6517821Z"), "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-rg/providers/Microsoft.Sql/sqlserver/dbservercontext", "Availability") + { + ImpactDescription = "read calls failed", + Workload = new Workload + { + Context = "webapp/scenario1", + Toolset = Toolset.Other, + }, + ClientIncidentDetails = new ClientIncidentDetails + { + ClientIncidentId = "AA123", + ClientIncidentSource = IncidentSource.Jira, + }, + }, + }; + ArmOperation lro = await workloadImpact.UpdateAsync(WaitUntil.Completed, data); + WorkloadImpactResource 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 + WorkloadImpactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_ReportingAConnectivityImpact() + { + // Generated from example definition: 2024-05-01-preview/WorkloadConnectivityImpact_Create.json + // this example is just showing the usage of "WorkloadImpact_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 WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impact-001"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // invoke the operation + WorkloadImpactData data = new WorkloadImpactData + { + Properties = new WorkloadImpactProperties(DateTimeOffset.Parse("2022-06-15T05:59:46.6517821Z"), "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-rg/providers/Microsoft.Sql/sqlserver/dbservercontext", "Resource.Connectivity") + { + ImpactDescription = "conection failure", + Connectivity = new Connectivity + { + Protocol = Protocol.TCP, + Port = 1443, + SourceAzureResourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceSub/providers/Microsoft.compute/virtualmachines/vm1", + TargetAzureResourceId = "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resourceSub/providers/Microsoft.compute/virtualmachines/vm2", + }, + Workload = new Workload + { + Context = "webapp/scenario1", + Toolset = Toolset.Other, + }, + ClientIncidentDetails = new ClientIncidentDetails + { + ClientIncidentId = "AA123", + ClientIncidentSource = IncidentSource.Jira, + }, + }, + }; + ArmOperation lro = await workloadImpact.UpdateAsync(WaitUntil.Completed, data); + WorkloadImpactResource 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 + WorkloadImpactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Update_ReportingPerformanceRelatedImpact() + { + // Generated from example definition: 2024-05-01-preview/WorkloadPerformance_Create.json + // this example is just showing the usage of "WorkloadImpact_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 WorkloadImpactResource created on azure + // for more information of creating WorkloadImpactResource, please refer to the document of WorkloadImpactResource + string subscriptionId = "00000000-0000-0000-0000-000000000000"; + string workloadImpactName = "impact-002"; + ResourceIdentifier workloadImpactResourceId = WorkloadImpactResource.CreateResourceIdentifier(subscriptionId, workloadImpactName); + WorkloadImpactResource workloadImpact = client.GetWorkloadImpactResource(workloadImpactResourceId); + + // invoke the operation + WorkloadImpactData data = new WorkloadImpactData + { + Properties = new WorkloadImpactProperties(DateTimeOffset.Parse("2022-06-15T05:59:46.6517821Z"), "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/resource-rg/providers/Microsoft.Sql/sqlserver/dbservercontext", "Resource.Performance") + { + ImpactDescription = "high cpu utilization", + Performance = {new Performance +{ +MetricName = "CPU", +Expected = 60, +Actual = 90, +}}, + Workload = new Workload + { + Context = "webapp/scenario1", + Toolset = Toolset.Other, + }, + ClientIncidentDetails = new ClientIncidentDetails + { + ClientIncidentId = "AA123", + ClientIncidentSource = IncidentSource.Jira, + }, + }, + }; + ArmOperation lro = await workloadImpact.UpdateAsync(WaitUntil.Completed, data); + WorkloadImpactResource 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 + WorkloadImpactData resourceData = result.Data; + // for demo we just print out the id + Console.WriteLine($"Succeeded on id: {resourceData.Id}"); + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Azure.ResourceManager.Impact.csproj b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Azure.ResourceManager.Impact.csproj new file mode 100644 index 0000000000000..94fd448276530 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Azure.ResourceManager.Impact.csproj @@ -0,0 +1,8 @@ + + + Azure Resource Manager client SDK for Azure resource provider Impact. + 1.0.0-beta.1 + azure;management;arm;resource manager;impact + Azure.ResourceManager.Impact + + diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ArmImpactModelFactory.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ArmImpactModelFactory.cs new file mode 100644 index 0000000000000..3f9f1f8ab6895 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ArmImpactModelFactory.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.Linq; +using Azure.Core; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Impact.Models +{ + /// Model factory for models. + public static partial class ArmImpactModelFactory + { + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static ConnectorData ConnectorData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ConnectorProperties properties = null) + { + return new ConnectorData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Resource provisioning state. + /// unique id of the connector. + /// tenant id of this connector. + /// connector type. + /// last run time stamp of this connector in UTC time zone. + /// A new instance for mocking. + public static ConnectorProperties ConnectorProperties(ProvisioningState? provisioningState = null, string connectorId = null, string tenantId = null, Platform connectorType = default, DateTimeOffset lastRunTimeStamp = default) + { + return new ConnectorProperties( + provisioningState, + connectorId, + tenantId, + connectorType, + lastRunTimeStamp, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static InsightData InsightData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, InsightProperties properties = null) + { + return new InsightData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Resource provisioning state. + /// category of the insight. + /// status of the insight. example resolved, repaired, other. + /// Identifier of the event that has been correlated with this insight. This can be used to aggregate insights for the same event. + /// Identifier that can be used to group similar insights. + /// Contains title & description for the insight. + /// Time of the event, which has been correlated the impact. + /// unique id of the insight. + /// details of of the impact for which insight has been generated. + /// additional details of the insight. + /// A new instance for mocking. + public static InsightProperties InsightProperties(ProvisioningState? provisioningState = null, string category = null, string status = null, string eventId = null, string groupId = null, Content content = null, DateTimeOffset? eventOn = null, string insightUniqueId = null, ImpactDetails impact = null, InsightPropertiesAdditionalDetails additionalDetails = null) + { + return new InsightProperties( + provisioningState, + category, + status, + eventId, + groupId, + content, + eventOn, + insightUniqueId, + impact, + additionalDetails, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static ImpactCategoryData ImpactCategoryData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, ImpactCategoryProperties properties = null) + { + return new ImpactCategoryData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Resource provisioning state. + /// Unique ID of the category. + /// Unique ID of the parent category. + /// Description of the category. + /// The workloadImpact properties which are required when reporting with the impact category. + /// A new instance for mocking. + public static ImpactCategoryProperties ImpactCategoryProperties(ProvisioningState? provisioningState = null, string categoryId = null, string parentCategoryId = null, string description = null, IEnumerable requiredImpactProperties = null) + { + requiredImpactProperties ??= new List(); + + return new ImpactCategoryProperties( + provisioningState, + categoryId, + parentCategoryId, + description, + requiredImpactProperties?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Name of the property. + /// Allowed values values for the property. + /// A new instance for mocking. + public static RequiredImpactProperties RequiredImpactProperties(string name = null, IEnumerable allowedValues = null) + { + allowedValues ??= new List(); + + return new RequiredImpactProperties(name, allowedValues?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// A new instance for mocking. + public static WorkloadImpactData WorkloadImpactData(ResourceIdentifier id = null, string name = null, ResourceType resourceType = default, SystemData systemData = null, WorkloadImpactProperties properties = null) + { + return new WorkloadImpactData( + id, + name, + resourceType, + systemData, + properties, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Resource provisioning state. + /// Time at which impact was observed. + /// Time at which impact has ended. + /// Azure resource id of the impacted resource. + /// Unique ID of the impact (UUID). + /// Time at which impact is reported. + /// Category of the impact, details can found from /impactCategories API. + /// A detailed description of the impact. + /// The ARM correlation ids, this is important field for control plane related impacts. + /// Details about performance issue. Applicable for performance impacts. + /// Details about connectivity issue. Applicable when root resource causing the issue is not identified. For example, when a VM is impacted due to a network issue, the impacted resource is identified as the VM, but the root cause is the network. In such cases, the connectivity field will have the details about the network issue. + /// Additional fields related to impact, applicable fields per resource type are list under /impactCategories API. + /// ARM error code and error message associated with the impact. + /// Information about the impacted workload. + /// Use this field to group impacts. + /// Degree of confidence on the impact being a platform issue. + /// Client incident details ex: incidentId , incident source. + /// A new instance for mocking. + public static WorkloadImpactProperties WorkloadImpactProperties(ProvisioningState? provisioningState = null, DateTimeOffset startOn = default, DateTimeOffset? endOn = null, string impactedResourceId = null, string impactUniqueId = null, DateTimeOffset? reportedTimeUtc = null, string impactCategory = null, string impactDescription = null, IEnumerable armCorrelationIds = null, IEnumerable performance = null, Connectivity connectivity = null, WorkloadImpactPropertiesAdditionalProperties additionalProperties = null, ErrorDetailProperties errorDetails = null, Workload workload = null, string impactGroupId = null, ConfidenceLevel? confidenceLevel = null, ClientIncidentDetails clientIncidentDetails = null) + { + armCorrelationIds ??= new List(); + performance ??= new List(); + + return new WorkloadImpactProperties( + provisioningState, + startOn, + endOn, + impactedResourceId, + impactUniqueId, + reportedTimeUtc, + impactCategory, + impactDescription, + armCorrelationIds?.ToList(), + performance?.ToList(), + connectivity, + additionalProperties, + errorDetails, + workload, + impactGroupId, + confidenceLevel, + clientIncidentDetails, + serializedAdditionalRawData: null); + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ConnectorCollection.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ConnectorCollection.cs new file mode 100644 index 0000000000000..5be1d52fbd6d9 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ConnectorCollection.cs @@ -0,0 +1,494 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.Impact +{ + /// + /// 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 GetConnectors method from an instance of . + /// + public partial class ConnectorCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _connectorClientDiagnostics; + private readonly ConnectorsRestOperations _connectorRestClient; + + /// Initializes a new instance of the class for mocking. + protected ConnectorCollection() + { + } + + /// 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 ConnectorCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _connectorClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Impact", ConnectorResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ConnectorResource.ResourceType, out string connectorApiVersion); + _connectorRestClient = new ConnectorsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, connectorApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != SubscriptionResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, SubscriptionResource.ResourceType), nameof(id)); + } + + /// + /// Create a Connector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the connector. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string connectorName, ConnectorData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _connectorClientDiagnostics.CreateScope("ConnectorCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _connectorRestClient.CreateOrUpdateAsync(Id.SubscriptionId, connectorName, data, cancellationToken).ConfigureAwait(false); + var operation = new ImpactArmOperation(new ConnectorOperationSource(Client), _connectorClientDiagnostics, Pipeline, _connectorRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, connectorName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a Connector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_CreateOrUpdate + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The name of the connector. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string connectorName, ConnectorData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _connectorClientDiagnostics.CreateScope("ConnectorCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _connectorRestClient.CreateOrUpdate(Id.SubscriptionId, connectorName, data, cancellationToken); + var operation = new ImpactArmOperation(new ConnectorOperationSource(Client), _connectorClientDiagnostics, Pipeline, _connectorRestClient.CreateCreateOrUpdateRequest(Id.SubscriptionId, connectorName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Connector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the connector. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var scope = _connectorClientDiagnostics.CreateScope("ConnectorCollection.Get"); + scope.Start(); + try + { + var response = await _connectorRestClient.GetAsync(Id.SubscriptionId, connectorName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Connector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the connector. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var scope = _connectorClientDiagnostics.CreateScope("ConnectorCollection.Get"); + scope.Start(); + try + { + var response = _connectorRestClient.Get(Id.SubscriptionId, connectorName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List Connector resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors + /// + /// + /// Operation Id + /// Connector_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _connectorRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _connectorRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ConnectorResource(Client, ConnectorData.DeserializeConnectorData(e)), _connectorClientDiagnostics, Pipeline, "ConnectorCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List Connector resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors + /// + /// + /// Operation Id + /// Connector_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _connectorRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _connectorRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ConnectorResource(Client, ConnectorData.DeserializeConnectorData(e)), _connectorClientDiagnostics, Pipeline, "ConnectorCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the connector. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var scope = _connectorClientDiagnostics.CreateScope("ConnectorCollection.Exists"); + scope.Start(); + try + { + var response = await _connectorRestClient.GetAsync(Id.SubscriptionId, connectorName, 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}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the connector. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var scope = _connectorClientDiagnostics.CreateScope("ConnectorCollection.Exists"); + scope.Start(); + try + { + var response = _connectorRestClient.Get(Id.SubscriptionId, connectorName, 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}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the connector. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var scope = _connectorClientDiagnostics.CreateScope("ConnectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _connectorRestClient.GetAsync(Id.SubscriptionId, connectorName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the connector. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var scope = _connectorClientDiagnostics.CreateScope("ConnectorCollection.GetIfExists"); + scope.Start(); + try + { + var response = _connectorRestClient.Get(Id.SubscriptionId, connectorName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ConnectorResource(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/impactreporting/Azure.ResourceManager.Impact/src/Generated/ConnectorData.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ConnectorData.Serialization.cs new file mode 100644 index 0000000000000..58d7d8050827a --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ConnectorData.Serialization.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Impact.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Impact +{ + public partial class ConnectorData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConnectorData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + ConnectorData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConnectorData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConnectorData(document.RootElement, options); + } + + internal static ConnectorData DeserializeConnectorData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ConnectorProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ConnectorProperties.DeserializeConnectorProperties(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConnectorData( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ConnectorData)} does not support writing '{options.Format}' format."); + } + } + + ConnectorData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeConnectorData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConnectorData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ConnectorData.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ConnectorData.cs new file mode 100644 index 0000000000000..3b1de33efdfb9 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ConnectorData.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Impact.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Impact +{ + /// + /// A class representing the Connector data model. + /// A connector is a resource that can be used to proactively report impacts against workloads in Azure to Microsoft. + /// + public partial class ConnectorData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ConnectorData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal ConnectorData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ConnectorProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public ConnectorProperties Properties { get; set; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ConnectorResource.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ConnectorResource.Serialization.cs new file mode 100644 index 0000000000000..43320c77d8ff5 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ConnectorResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.Impact +{ + public partial class ConnectorResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + ConnectorData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + ConnectorData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ConnectorResource.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ConnectorResource.cs new file mode 100644 index 0000000000000..8ec8a003ec19d --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ConnectorResource.cs @@ -0,0 +1,342 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.Impact +{ + /// + /// A Class representing a Connector 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 GetConnectorResource method. + /// Otherwise you can get one from its parent resource using the GetConnector method. + /// + public partial class ConnectorResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The connectorName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string connectorName) + { + var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _connectorClientDiagnostics; + private readonly ConnectorsRestOperations _connectorRestClient; + private readonly ConnectorData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Impact/connectors"; + + /// Initializes a new instance of the class for mocking. + protected ConnectorResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ConnectorResource(ArmClient client, ConnectorData 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 ConnectorResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _connectorClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Impact", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string connectorApiVersion); + _connectorRestClient = new ConnectorsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, connectorApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ConnectorData 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 Connector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _connectorClientDiagnostics.CreateScope("ConnectorResource.Get"); + scope.Start(); + try + { + var response = await _connectorRestClient.GetAsync(Id.SubscriptionId, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a Connector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _connectorClientDiagnostics.CreateScope("ConnectorResource.Get"); + scope.Start(); + try + { + var response = _connectorRestClient.Get(Id.SubscriptionId, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Connector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Delete + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _connectorClientDiagnostics.CreateScope("ConnectorResource.Delete"); + scope.Start(); + try + { + var response = await _connectorRestClient.DeleteAsync(Id.SubscriptionId, Id.Name, cancellationToken).ConfigureAwait(false); + var uri = _connectorRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new ImpactArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a Connector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Delete + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _connectorClientDiagnostics.CreateScope("ConnectorResource.Delete"); + scope.Start(); + try + { + var response = _connectorRestClient.Delete(Id.SubscriptionId, Id.Name, cancellationToken); + var uri = _connectorRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new ImpactArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a Connector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Update + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(ConnectorData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _connectorClientDiagnostics.CreateScope("ConnectorResource.Update"); + scope.Start(); + try + { + var response = await _connectorRestClient.UpdateAsync(Id.SubscriptionId, Id.Name, data, cancellationToken).ConfigureAwait(false); + return Response.FromValue(new ConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Update a Connector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Update + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The resource properties to be updated. + /// The cancellation token to use. + /// is null. + public virtual Response Update(ConnectorData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _connectorClientDiagnostics.CreateScope("ConnectorResource.Update"); + scope.Start(); + try + { + var response = _connectorRestClient.Update(Id.SubscriptionId, Id.Name, data, cancellationToken); + return Response.FromValue(new ConnectorResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Extensions/ImpactExtensions.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Extensions/ImpactExtensions.cs new file mode 100644 index 0000000000000..de9ae479406fc --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Extensions/ImpactExtensions.cs @@ -0,0 +1,385 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.ResourceManager.Impact.Mocking; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.Impact +{ + /// A class to add extension methods to Azure.ResourceManager.Impact. + public static partial class ImpactExtensions + { + private static MockableImpactArmClient GetMockableImpactArmClient(ArmClient client) + { + return client.GetCachedClient(client0 => new MockableImpactArmClient(client0)); + } + + private static MockableImpactSubscriptionResource GetMockableImpactSubscriptionResource(ArmResource resource) + { + return resource.GetCachedClient(client => new MockableImpactSubscriptionResource(client, resource.Id)); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static WorkloadImpactResource GetWorkloadImpactResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableImpactArmClient(client).GetWorkloadImpactResource(id); + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ImpactCategoryResource GetImpactCategoryResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableImpactArmClient(client).GetImpactCategoryResource(id); + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static InsightResource GetInsightResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableImpactArmClient(client).GetInsightResource(id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The resource ID of the resource to get. + /// is null. + /// Returns a object. + public static ConnectorResource GetConnectorResource(this ArmClient client, ResourceIdentifier id) + { + Argument.AssertNotNull(client, nameof(client)); + + return GetMockableImpactArmClient(client).GetConnectorResource(id); + } + + /// + /// Gets a collection of WorkloadImpactResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// is null. + /// An object representing collection of WorkloadImpactResources and their operations over a WorkloadImpactResource. + public static WorkloadImpactCollection GetWorkloadImpacts(this SubscriptionResource subscriptionResource) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableImpactSubscriptionResource(subscriptionResource).GetWorkloadImpacts(); + } + + /// + /// Get a WorkloadImpact + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// workloadImpact resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetWorkloadImpactAsync(this SubscriptionResource subscriptionResource, string workloadImpactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return await GetMockableImpactSubscriptionResource(subscriptionResource).GetWorkloadImpactAsync(workloadImpactName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a WorkloadImpact + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// workloadImpact resource. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetWorkloadImpact(this SubscriptionResource subscriptionResource, string workloadImpactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableImpactSubscriptionResource(subscriptionResource).GetWorkloadImpact(workloadImpactName, cancellationToken); + } + + /// + /// Gets a collection of ImpactCategoryResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// is null. + /// An object representing collection of ImpactCategoryResources and their operations over a ImpactCategoryResource. + public static ImpactCategoryCollection GetImpactCategories(this SubscriptionResource subscriptionResource) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableImpactSubscriptionResource(subscriptionResource).GetImpactCategories(); + } + + /// + /// Get a ImpactCategory + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/impactCategories/{impactCategoryName} + /// + /// + /// Operation Id + /// ImpactCategory_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Name of the impact category. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetImpactCategoryAsync(this SubscriptionResource subscriptionResource, string impactCategoryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return await GetMockableImpactSubscriptionResource(subscriptionResource).GetImpactCategoryAsync(impactCategoryName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a ImpactCategory + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/impactCategories/{impactCategoryName} + /// + /// + /// Operation Id + /// ImpactCategory_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// Name of the impact category. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetImpactCategory(this SubscriptionResource subscriptionResource, string impactCategoryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableImpactSubscriptionResource(subscriptionResource).GetImpactCategory(impactCategoryName, cancellationToken); + } + + /// + /// Gets a collection of ConnectorResources in the SubscriptionResource. + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// is null. + /// An object representing collection of ConnectorResources and their operations over a ConnectorResource. + public static ConnectorCollection GetConnectors(this SubscriptionResource subscriptionResource) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableImpactSubscriptionResource(subscriptionResource).GetConnectors(); + } + + /// + /// Get a Connector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the connector. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static async Task> GetConnectorAsync(this SubscriptionResource subscriptionResource, string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return await GetMockableImpactSubscriptionResource(subscriptionResource).GetConnectorAsync(connectorName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Connector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The name of the connector. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public static Response GetConnector(this SubscriptionResource subscriptionResource, string connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableImpactSubscriptionResource(subscriptionResource).GetConnector(connectorName, cancellationToken); + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Extensions/MockableImpactArmClient.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Extensions/MockableImpactArmClient.cs new file mode 100644 index 0000000000000..2e56e12a71998 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Extensions/MockableImpactArmClient.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using Azure.Core; + +namespace Azure.ResourceManager.Impact.Mocking +{ + /// A class to add extension methods to ArmClient. + public partial class MockableImpactArmClient : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableImpactArmClient() + { + } + + /// 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 MockableImpactArmClient(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + internal MockableImpactArmClient(ArmClient client) : this(client, ResourceIdentifier.Root) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual WorkloadImpactResource GetWorkloadImpactResource(ResourceIdentifier id) + { + WorkloadImpactResource.ValidateResourceId(id); + return new WorkloadImpactResource(Client, id); + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ImpactCategoryResource GetImpactCategoryResource(ResourceIdentifier id) + { + ImpactCategoryResource.ValidateResourceId(id); + return new ImpactCategoryResource(Client, id); + } + + /// + /// Gets an object representing an along with the instance operations that can be performed on it but with no data. + /// You can use to create an from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual InsightResource GetInsightResource(ResourceIdentifier id) + { + InsightResource.ValidateResourceId(id); + return new InsightResource(Client, id); + } + + /// + /// Gets an object representing a along with the instance operations that can be performed on it but with no data. + /// You can use to create a from its components. + /// + /// The resource ID of the resource to get. + /// Returns a object. + public virtual ConnectorResource GetConnectorResource(ResourceIdentifier id) + { + ConnectorResource.ValidateResourceId(id); + return new ConnectorResource(Client, id); + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Extensions/MockableImpactSubscriptionResource.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Extensions/MockableImpactSubscriptionResource.cs new file mode 100644 index 0000000000000..69b1746fa748c --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Extensions/MockableImpactSubscriptionResource.cs @@ -0,0 +1,243 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.Impact.Mocking +{ + /// A class to add extension methods to SubscriptionResource. + public partial class MockableImpactSubscriptionResource : ArmResource + { + /// Initializes a new instance of the class for mocking. + protected MockableImpactSubscriptionResource() + { + } + + /// 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 MockableImpactSubscriptionResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + } + + private string GetApiVersionOrNull(ResourceType resourceType) + { + TryGetApiVersion(resourceType, out string apiVersion); + return apiVersion; + } + + /// Gets a collection of WorkloadImpactResources in the SubscriptionResource. + /// An object representing collection of WorkloadImpactResources and their operations over a WorkloadImpactResource. + public virtual WorkloadImpactCollection GetWorkloadImpacts() + { + return GetCachedClient(client => new WorkloadImpactCollection(client, Id)); + } + + /// + /// Get a WorkloadImpact + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// workloadImpact resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetWorkloadImpactAsync(string workloadImpactName, CancellationToken cancellationToken = default) + { + return await GetWorkloadImpacts().GetAsync(workloadImpactName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a WorkloadImpact + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// workloadImpact resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetWorkloadImpact(string workloadImpactName, CancellationToken cancellationToken = default) + { + return GetWorkloadImpacts().Get(workloadImpactName, cancellationToken); + } + + /// Gets a collection of ImpactCategoryResources in the SubscriptionResource. + /// An object representing collection of ImpactCategoryResources and their operations over a ImpactCategoryResource. + public virtual ImpactCategoryCollection GetImpactCategories() + { + return GetCachedClient(client => new ImpactCategoryCollection(client, Id)); + } + + /// + /// Get a ImpactCategory + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/impactCategories/{impactCategoryName} + /// + /// + /// Operation Id + /// ImpactCategory_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the impact category. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetImpactCategoryAsync(string impactCategoryName, CancellationToken cancellationToken = default) + { + return await GetImpactCategories().GetAsync(impactCategoryName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a ImpactCategory + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/impactCategories/{impactCategoryName} + /// + /// + /// Operation Id + /// ImpactCategory_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the impact category. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetImpactCategory(string impactCategoryName, CancellationToken cancellationToken = default) + { + return GetImpactCategories().Get(impactCategoryName, cancellationToken); + } + + /// Gets a collection of ConnectorResources in the SubscriptionResource. + /// An object representing collection of ConnectorResources and their operations over a ConnectorResource. + public virtual ConnectorCollection GetConnectors() + { + return GetCachedClient(client => new ConnectorCollection(client, Id)); + } + + /// + /// Get a Connector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the connector. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetConnectorAsync(string connectorName, CancellationToken cancellationToken = default) + { + return await GetConnectors().GetAsync(connectorName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get a Connector + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/connectors/{connectorName} + /// + /// + /// Operation Id + /// Connector_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The name of the connector. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetConnector(string connectorName, CancellationToken cancellationToken = default) + { + return GetConnectors().Get(connectorName, cancellationToken); + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ImpactCategoryCollection.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ImpactCategoryCollection.cs new file mode 100644 index 0000000000000..7861d978224cc --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ImpactCategoryCollection.cs @@ -0,0 +1,400 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.Impact +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetImpactCategories method from an instance of . + /// + public partial class ImpactCategoryCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _impactCategoryClientDiagnostics; + private readonly ImpactCategoriesRestOperations _impactCategoryRestClient; + + /// Initializes a new instance of the class for mocking. + protected ImpactCategoryCollection() + { + } + + /// 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 ImpactCategoryCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _impactCategoryClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Impact", ImpactCategoryResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ImpactCategoryResource.ResourceType, out string impactCategoryApiVersion); + _impactCategoryRestClient = new ImpactCategoriesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, impactCategoryApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != SubscriptionResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, SubscriptionResource.ResourceType), nameof(id)); + } + + /// + /// Get a ImpactCategory + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/impactCategories/{impactCategoryName} + /// + /// + /// Operation Id + /// ImpactCategory_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the impact category. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string impactCategoryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(impactCategoryName, nameof(impactCategoryName)); + + using var scope = _impactCategoryClientDiagnostics.CreateScope("ImpactCategoryCollection.Get"); + scope.Start(); + try + { + var response = await _impactCategoryRestClient.GetAsync(Id.SubscriptionId, impactCategoryName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ImpactCategoryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a ImpactCategory + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/impactCategories/{impactCategoryName} + /// + /// + /// Operation Id + /// ImpactCategory_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the impact category. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string impactCategoryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(impactCategoryName, nameof(impactCategoryName)); + + using var scope = _impactCategoryClientDiagnostics.CreateScope("ImpactCategoryCollection.Get"); + scope.Start(); + try + { + var response = _impactCategoryRestClient.Get(Id.SubscriptionId, impactCategoryName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ImpactCategoryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List ImpactCategory resources by subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/impactCategories + /// + /// + /// Operation Id + /// ImpactCategory_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Filter by category name. + /// Filter by resource type. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(string categoryName = null, string resourceType = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _impactCategoryRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, categoryName, resourceType); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _impactCategoryRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, categoryName, resourceType); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new ImpactCategoryResource(Client, ImpactCategoryData.DeserializeImpactCategoryData(e)), _impactCategoryClientDiagnostics, Pipeline, "ImpactCategoryCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List ImpactCategory resources by subscription + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/impactCategories + /// + /// + /// Operation Id + /// ImpactCategory_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Filter by category name. + /// Filter by resource type. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(string categoryName = null, string resourceType = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _impactCategoryRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, categoryName, resourceType); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _impactCategoryRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, categoryName, resourceType); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new ImpactCategoryResource(Client, ImpactCategoryData.DeserializeImpactCategoryData(e)), _impactCategoryClientDiagnostics, Pipeline, "ImpactCategoryCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/impactCategories/{impactCategoryName} + /// + /// + /// Operation Id + /// ImpactCategory_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the impact category. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string impactCategoryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(impactCategoryName, nameof(impactCategoryName)); + + using var scope = _impactCategoryClientDiagnostics.CreateScope("ImpactCategoryCollection.Exists"); + scope.Start(); + try + { + var response = await _impactCategoryRestClient.GetAsync(Id.SubscriptionId, impactCategoryName, 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}/providers/Microsoft.Impact/impactCategories/{impactCategoryName} + /// + /// + /// Operation Id + /// ImpactCategory_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the impact category. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string impactCategoryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(impactCategoryName, nameof(impactCategoryName)); + + using var scope = _impactCategoryClientDiagnostics.CreateScope("ImpactCategoryCollection.Exists"); + scope.Start(); + try + { + var response = _impactCategoryRestClient.Get(Id.SubscriptionId, impactCategoryName, 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}/providers/Microsoft.Impact/impactCategories/{impactCategoryName} + /// + /// + /// Operation Id + /// ImpactCategory_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the impact category. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string impactCategoryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(impactCategoryName, nameof(impactCategoryName)); + + using var scope = _impactCategoryClientDiagnostics.CreateScope("ImpactCategoryCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _impactCategoryRestClient.GetAsync(Id.SubscriptionId, impactCategoryName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ImpactCategoryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/impactCategories/{impactCategoryName} + /// + /// + /// Operation Id + /// ImpactCategory_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the impact category. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string impactCategoryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(impactCategoryName, nameof(impactCategoryName)); + + using var scope = _impactCategoryClientDiagnostics.CreateScope("ImpactCategoryCollection.GetIfExists"); + scope.Start(); + try + { + var response = _impactCategoryRestClient.Get(Id.SubscriptionId, impactCategoryName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new ImpactCategoryResource(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/impactreporting/Azure.ResourceManager.Impact/src/Generated/ImpactCategoryData.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ImpactCategoryData.Serialization.cs new file mode 100644 index 0000000000000..fd0a0fc166a52 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ImpactCategoryData.Serialization.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Impact.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Impact +{ + public partial class ImpactCategoryData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ImpactCategoryData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + ImpactCategoryData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ImpactCategoryData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeImpactCategoryData(document.RootElement, options); + } + + internal static ImpactCategoryData DeserializeImpactCategoryData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ImpactCategoryProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = ImpactCategoryProperties.DeserializeImpactCategoryProperties(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ImpactCategoryData( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ImpactCategoryData)} does not support writing '{options.Format}' format."); + } + } + + ImpactCategoryData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeImpactCategoryData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ImpactCategoryData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ImpactCategoryData.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ImpactCategoryData.cs new file mode 100644 index 0000000000000..4aa994ebe8618 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ImpactCategoryData.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Impact.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Impact +{ + /// + /// A class representing the ImpactCategory data model. + /// ImpactCategory resource + /// + public partial class ImpactCategoryData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + internal ImpactCategoryData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal ImpactCategoryData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, ImpactCategoryProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public ImpactCategoryProperties Properties { get; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ImpactCategoryResource.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ImpactCategoryResource.Serialization.cs new file mode 100644 index 0000000000000..e0702dae041aa --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ImpactCategoryResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.Impact +{ + public partial class ImpactCategoryResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + ImpactCategoryData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + ImpactCategoryData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ImpactCategoryResource.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ImpactCategoryResource.cs new file mode 100644 index 0000000000000..5622fdc69967e --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ImpactCategoryResource.cs @@ -0,0 +1,170 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.Impact +{ + /// + /// A Class representing an ImpactCategory along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetImpactCategoryResource method. + /// Otherwise you can get one from its parent resource using the GetImpactCategory method. + /// + public partial class ImpactCategoryResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The impactCategoryName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string impactCategoryName) + { + var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Impact/impactCategories/{impactCategoryName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _impactCategoryClientDiagnostics; + private readonly ImpactCategoriesRestOperations _impactCategoryRestClient; + private readonly ImpactCategoryData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Impact/impactCategories"; + + /// Initializes a new instance of the class for mocking. + protected ImpactCategoryResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal ImpactCategoryResource(ArmClient client, ImpactCategoryData 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 ImpactCategoryResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _impactCategoryClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Impact", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string impactCategoryApiVersion); + _impactCategoryRestClient = new ImpactCategoriesRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, impactCategoryApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual ImpactCategoryData 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 ImpactCategory + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/impactCategories/{impactCategoryName} + /// + /// + /// Operation Id + /// ImpactCategory_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _impactCategoryClientDiagnostics.CreateScope("ImpactCategoryResource.Get"); + scope.Start(); + try + { + var response = await _impactCategoryRestClient.GetAsync(Id.SubscriptionId, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ImpactCategoryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a ImpactCategory + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/impactCategories/{impactCategoryName} + /// + /// + /// Operation Id + /// ImpactCategory_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _impactCategoryClientDiagnostics.CreateScope("ImpactCategoryResource.Get"); + scope.Start(); + try + { + var response = _impactCategoryRestClient.Get(Id.SubscriptionId, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new ImpactCategoryResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/InsightCollection.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/InsightCollection.cs new file mode 100644 index 0000000000000..c06e4d983b756 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/InsightCollection.cs @@ -0,0 +1,497 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Impact +{ + /// + /// A class representing a collection of and their operations. + /// Each in the collection will belong to the same instance of . + /// To get an instance call the GetInsights method from an instance of . + /// + public partial class InsightCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _insightClientDiagnostics; + private readonly InsightsRestOperations _insightRestClient; + + /// Initializes a new instance of the class for mocking. + protected InsightCollection() + { + } + + /// 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 InsightCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _insightClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Impact", InsightResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(InsightResource.ResourceType, out string insightApiVersion); + _insightRestClient = new InsightsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, insightApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != WorkloadImpactResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, WorkloadImpactResource.ResourceType), nameof(id)); + } + + /// + /// Create Insight resource, This is Admin only operation + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName} + /// + /// + /// Operation Id + /// Insight_Create + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of the insight. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string insightName, InsightData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(insightName, nameof(insightName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _insightClientDiagnostics.CreateScope("InsightCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _insightRestClient.CreateAsync(Id.SubscriptionId, Id.Name, insightName, data, cancellationToken).ConfigureAwait(false); + var uri = _insightRestClient.CreateCreateRequestUri(Id.SubscriptionId, Id.Name, insightName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new ImpactArmOperation(Response.FromValue(new InsightResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create Insight resource, This is Admin only operation + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName} + /// + /// + /// Operation Id + /// Insight_Create + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Name of the insight. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string insightName, InsightData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(insightName, nameof(insightName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _insightClientDiagnostics.CreateScope("InsightCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _insightRestClient.Create(Id.SubscriptionId, Id.Name, insightName, data, cancellationToken); + var uri = _insightRestClient.CreateCreateRequestUri(Id.SubscriptionId, Id.Name, insightName, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new ImpactArmOperation(Response.FromValue(new InsightResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get Insight resources by workloadImpactName and insightName + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName} + /// + /// + /// Operation Id + /// Insight_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the insight. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string insightName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(insightName, nameof(insightName)); + + using var scope = _insightClientDiagnostics.CreateScope("InsightCollection.Get"); + scope.Start(); + try + { + var response = await _insightRestClient.GetAsync(Id.SubscriptionId, Id.Name, insightName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new InsightResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get Insight resources by workloadImpactName and insightName + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName} + /// + /// + /// Operation Id + /// Insight_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the insight. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string insightName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(insightName, nameof(insightName)); + + using var scope = _insightClientDiagnostics.CreateScope("InsightCollection.Get"); + scope.Start(); + try + { + var response = _insightRestClient.Get(Id.SubscriptionId, Id.Name, insightName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new InsightResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List Insight resources by workloadImpactName + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights + /// + /// + /// Operation Id + /// Insight_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _insightRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _insightRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, Id.Name); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new InsightResource(Client, InsightData.DeserializeInsightData(e)), _insightClientDiagnostics, Pipeline, "InsightCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List Insight resources by workloadImpactName + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights + /// + /// + /// Operation Id + /// Insight_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _insightRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId, Id.Name); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _insightRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId, Id.Name); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new InsightResource(Client, InsightData.DeserializeInsightData(e)), _insightClientDiagnostics, Pipeline, "InsightCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName} + /// + /// + /// Operation Id + /// Insight_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the insight. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string insightName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(insightName, nameof(insightName)); + + using var scope = _insightClientDiagnostics.CreateScope("InsightCollection.Exists"); + scope.Start(); + try + { + var response = await _insightRestClient.GetAsync(Id.SubscriptionId, Id.Name, insightName, 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}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName} + /// + /// + /// Operation Id + /// Insight_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the insight. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string insightName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(insightName, nameof(insightName)); + + using var scope = _insightClientDiagnostics.CreateScope("InsightCollection.Exists"); + scope.Start(); + try + { + var response = _insightRestClient.Get(Id.SubscriptionId, Id.Name, insightName, 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}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName} + /// + /// + /// Operation Id + /// Insight_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the insight. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string insightName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(insightName, nameof(insightName)); + + using var scope = _insightClientDiagnostics.CreateScope("InsightCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _insightRestClient.GetAsync(Id.SubscriptionId, Id.Name, insightName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new InsightResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName} + /// + /// + /// Operation Id + /// Insight_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the insight. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string insightName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(insightName, nameof(insightName)); + + using var scope = _insightClientDiagnostics.CreateScope("InsightCollection.GetIfExists"); + scope.Start(); + try + { + var response = _insightRestClient.Get(Id.SubscriptionId, Id.Name, insightName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new InsightResource(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/impactreporting/Azure.ResourceManager.Impact/src/Generated/InsightData.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/InsightData.Serialization.cs new file mode 100644 index 0000000000000..f4d1d161cc6b6 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/InsightData.Serialization.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Impact.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Impact +{ + public partial class InsightData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InsightData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + InsightData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InsightData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInsightData(document.RootElement, options); + } + + internal static InsightData DeserializeInsightData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + InsightProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = InsightProperties.DeserializeInsightProperties(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InsightData( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InsightData)} does not support writing '{options.Format}' format."); + } + } + + InsightData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeInsightData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InsightData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/InsightData.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/InsightData.cs new file mode 100644 index 0000000000000..2673af771de82 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/InsightData.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Impact.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Impact +{ + /// + /// A class representing the Insight data model. + /// Insight resource + /// + public partial class InsightData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public InsightData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal InsightData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, InsightProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public InsightProperties Properties { get; set; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/InsightResource.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/InsightResource.Serialization.cs new file mode 100644 index 0000000000000..85b523c0e1c6c --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/InsightResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.Impact +{ + public partial class InsightResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + InsightData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + InsightData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/InsightResource.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/InsightResource.cs new file mode 100644 index 0000000000000..8e4d8e8a98015 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/InsightResource.cs @@ -0,0 +1,354 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Impact +{ + /// + /// A Class representing an Insight along with the instance operations that can be performed on it. + /// If you have a you can construct an + /// from an instance of using the GetInsightResource method. + /// Otherwise you can get one from its parent resource using the GetInsight method. + /// + public partial class InsightResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The workloadImpactName. + /// The insightName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string workloadImpactName, string insightName) + { + var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _insightClientDiagnostics; + private readonly InsightsRestOperations _insightRestClient; + private readonly InsightData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Impact/workloadImpacts/insights"; + + /// Initializes a new instance of the class for mocking. + protected InsightResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal InsightResource(ArmClient client, InsightData 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 InsightResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _insightClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Impact", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string insightApiVersion); + _insightRestClient = new InsightsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, insightApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual InsightData 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 Insight resources by workloadImpactName and insightName + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName} + /// + /// + /// Operation Id + /// Insight_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _insightClientDiagnostics.CreateScope("InsightResource.Get"); + scope.Start(); + try + { + var response = await _insightRestClient.GetAsync(Id.SubscriptionId, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new InsightResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get Insight resources by workloadImpactName and insightName + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName} + /// + /// + /// Operation Id + /// Insight_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _insightClientDiagnostics.CreateScope("InsightResource.Get"); + scope.Start(); + try + { + var response = _insightRestClient.Get(Id.SubscriptionId, Id.Parent.Name, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new InsightResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete Insight resource, This is Admin only operation + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName} + /// + /// + /// Operation Id + /// Insight_Delete + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _insightClientDiagnostics.CreateScope("InsightResource.Delete"); + scope.Start(); + try + { + var response = await _insightRestClient.DeleteAsync(Id.SubscriptionId, Id.Parent.Name, Id.Name, cancellationToken).ConfigureAwait(false); + var uri = _insightRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.Parent.Name, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new ImpactArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete Insight resource, This is Admin only operation + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName} + /// + /// + /// Operation Id + /// Insight_Delete + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _insightClientDiagnostics.CreateScope("InsightResource.Delete"); + scope.Start(); + try + { + var response = _insightRestClient.Delete(Id.SubscriptionId, Id.Parent.Name, Id.Name, cancellationToken); + var uri = _insightRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.Parent.Name, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new ImpactArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create Insight resource, This is Admin only operation + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName} + /// + /// + /// Operation Id + /// Insight_Create + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, InsightData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _insightClientDiagnostics.CreateScope("InsightResource.Update"); + scope.Start(); + try + { + var response = await _insightRestClient.CreateAsync(Id.SubscriptionId, Id.Parent.Name, Id.Name, data, cancellationToken).ConfigureAwait(false); + var uri = _insightRestClient.CreateCreateRequestUri(Id.SubscriptionId, Id.Parent.Name, Id.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new ImpactArmOperation(Response.FromValue(new InsightResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create Insight resource, This is Admin only operation + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName} + /// + /// + /// Operation Id + /// Insight_Create + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, InsightData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _insightClientDiagnostics.CreateScope("InsightResource.Update"); + scope.Start(); + try + { + var response = _insightRestClient.Create(Id.SubscriptionId, Id.Parent.Name, Id.Name, data, cancellationToken); + var uri = _insightRestClient.CreateCreateRequestUri(Id.SubscriptionId, Id.Parent.Name, Id.Name, data); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Put, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new ImpactArmOperation(Response.FromValue(new InsightResource(Client, response), response.GetRawResponse()), rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Internal/Argument.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Internal/Argument.cs new file mode 100644 index 0000000000000..13f9c5410ea11 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Internal/Argument.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Impact +{ + internal static class Argument + { + public static void AssertNotNull(T value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNull(T? value, string name) + where T : struct + { + if (!value.HasValue) + { + throw new ArgumentNullException(name); + } + } + + public static void AssertNotNullOrEmpty(IEnumerable value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value is ICollection collectionOfT && collectionOfT.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + if (value is ICollection collection && collection.Count == 0) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + using IEnumerator e = value.GetEnumerator(); + if (!e.MoveNext()) + { + throw new ArgumentException("Value cannot be an empty collection.", name); + } + } + + public static void AssertNotNullOrEmpty(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (value.Length == 0) + { + throw new ArgumentException("Value cannot be an empty string.", name); + } + } + + public static void AssertNotNullOrWhiteSpace(string value, string name) + { + if (value is null) + { + throw new ArgumentNullException(name); + } + if (string.IsNullOrWhiteSpace(value)) + { + throw new ArgumentException("Value cannot be empty or contain only white-space characters.", name); + } + } + + public static void AssertNotDefault(ref T value, string name) + where T : struct, IEquatable + { + if (value.Equals(default)) + { + throw new ArgumentException("Value cannot be empty.", name); + } + } + + public static void AssertInRange(T value, T minimum, T maximum, string name) + where T : notnull, IComparable + { + if (minimum.CompareTo(value) > 0) + { + throw new ArgumentOutOfRangeException(name, "Value is less than the minimum allowed."); + } + if (maximum.CompareTo(value) < 0) + { + throw new ArgumentOutOfRangeException(name, "Value is greater than the maximum allowed."); + } + } + + public static void AssertEnumDefined(Type enumType, object value, string name) + { + if (!Enum.IsDefined(enumType, value)) + { + throw new ArgumentException($"Value not defined for {enumType.FullName}.", name); + } + } + + public static T CheckNotNull(T value, string name) + where T : class + { + AssertNotNull(value, name); + return value; + } + + public static string CheckNotNullOrEmpty(string value, string name) + { + AssertNotNullOrEmpty(value, name); + return value; + } + + public static void AssertNull(T value, string name, string message = null) + { + if (value != null) + { + throw new ArgumentException(message ?? "Value must be null.", name); + } + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Internal/ChangeTrackingDictionary.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Internal/ChangeTrackingDictionary.cs new file mode 100644 index 0000000000000..e39ce81e83302 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Internal/ChangeTrackingDictionary.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Impact +{ + internal class ChangeTrackingDictionary : IDictionary, IReadOnlyDictionary where TKey : notnull + { + private IDictionary _innerDictionary; + + public ChangeTrackingDictionary() + { + } + + public ChangeTrackingDictionary(IDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(dictionary); + } + + public ChangeTrackingDictionary(IReadOnlyDictionary dictionary) + { + if (dictionary == null) + { + return; + } + _innerDictionary = new Dictionary(); + foreach (var pair in dictionary) + { + _innerDictionary.Add(pair); + } + } + + public bool IsUndefined => _innerDictionary == null; + + public int Count => IsUndefined ? 0 : EnsureDictionary().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureDictionary().IsReadOnly; + + public ICollection Keys => IsUndefined ? Array.Empty() : EnsureDictionary().Keys; + + public ICollection Values => IsUndefined ? Array.Empty() : EnsureDictionary().Values; + + public TValue this[TKey key] + { + get + { + if (IsUndefined) + { + throw new KeyNotFoundException(nameof(key)); + } + return EnsureDictionary()[key]; + } + set + { + EnsureDictionary()[key] = value; + } + } + + IEnumerable IReadOnlyDictionary.Keys => Keys; + + IEnumerable IReadOnlyDictionary.Values => Values; + + public IEnumerator> GetEnumerator() + { + if (IsUndefined) + { + IEnumerator> enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureDictionary().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(KeyValuePair item) + { + EnsureDictionary().Add(item); + } + + public void Clear() + { + EnsureDictionary().Clear(); + } + + public bool Contains(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Contains(item); + } + + public void CopyTo(KeyValuePair[] array, int index) + { + if (IsUndefined) + { + return; + } + EnsureDictionary().CopyTo(array, index); + } + + public bool Remove(KeyValuePair item) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(item); + } + + public void Add(TKey key, TValue value) + { + EnsureDictionary().Add(key, value); + } + + public bool ContainsKey(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().ContainsKey(key); + } + + public bool Remove(TKey key) + { + if (IsUndefined) + { + return false; + } + return EnsureDictionary().Remove(key); + } + + public bool TryGetValue(TKey key, out TValue value) + { + if (IsUndefined) + { + value = default; + return false; + } + return EnsureDictionary().TryGetValue(key, out value); + } + + public IDictionary EnsureDictionary() + { + return _innerDictionary ??= new Dictionary(); + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Internal/ChangeTrackingList.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Internal/ChangeTrackingList.cs new file mode 100644 index 0000000000000..8f5f803a95b1d --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Internal/ChangeTrackingList.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.Impact +{ + internal class ChangeTrackingList : IList, IReadOnlyList + { + private IList _innerList; + + public ChangeTrackingList() + { + } + + public ChangeTrackingList(IList innerList) + { + if (innerList != null) + { + _innerList = innerList; + } + } + + public ChangeTrackingList(IReadOnlyList innerList) + { + if (innerList != null) + { + _innerList = innerList.ToList(); + } + } + + public bool IsUndefined => _innerList == null; + + public int Count => IsUndefined ? 0 : EnsureList().Count; + + public bool IsReadOnly => IsUndefined ? false : EnsureList().IsReadOnly; + + public T this[int index] + { + get + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + return EnsureList()[index]; + } + set + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList()[index] = value; + } + } + + public void Reset() + { + _innerList = null; + } + + public IEnumerator GetEnumerator() + { + if (IsUndefined) + { + IEnumerator enumerateEmpty() + { + yield break; + } + return enumerateEmpty(); + } + return EnsureList().GetEnumerator(); + } + + IEnumerator IEnumerable.GetEnumerator() + { + return GetEnumerator(); + } + + public void Add(T item) + { + EnsureList().Add(item); + } + + public void Clear() + { + EnsureList().Clear(); + } + + public bool Contains(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Contains(item); + } + + public void CopyTo(T[] array, int arrayIndex) + { + if (IsUndefined) + { + return; + } + EnsureList().CopyTo(array, arrayIndex); + } + + public bool Remove(T item) + { + if (IsUndefined) + { + return false; + } + return EnsureList().Remove(item); + } + + public int IndexOf(T item) + { + if (IsUndefined) + { + return -1; + } + return EnsureList().IndexOf(item); + } + + public void Insert(int index, T item) + { + EnsureList().Insert(index, item); + } + + public void RemoveAt(int index) + { + if (IsUndefined) + { + throw new ArgumentOutOfRangeException(nameof(index)); + } + EnsureList().RemoveAt(index); + } + + public IList EnsureList() + { + return _innerList ??= new List(); + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Internal/ModelSerializationExtensions.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Internal/ModelSerializationExtensions.cs new file mode 100644 index 0000000000000..fc447bcd1f19c --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Internal/ModelSerializationExtensions.cs @@ -0,0 +1,398 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Diagnostics; +using System.Globalization; +using System.Text.Json; +using System.Xml; +using Azure.Core; + +namespace Azure.ResourceManager.Impact +{ + internal static class ModelSerializationExtensions + { + internal static readonly ModelReaderWriterOptions WireOptions = new ModelReaderWriterOptions("W"); + + public static object GetObject(this JsonElement element) + { + switch (element.ValueKind) + { + case JsonValueKind.String: + return element.GetString(); + case JsonValueKind.Number: + if (element.TryGetInt32(out int intValue)) + { + return intValue; + } + if (element.TryGetInt64(out long longValue)) + { + return longValue; + } + return element.GetDouble(); + case JsonValueKind.True: + return true; + case JsonValueKind.False: + return false; + case JsonValueKind.Undefined: + case JsonValueKind.Null: + return null; + case JsonValueKind.Object: + var dictionary = new Dictionary(); + foreach (var jsonProperty in element.EnumerateObject()) + { + dictionary.Add(jsonProperty.Name, jsonProperty.Value.GetObject()); + } + return dictionary; + case JsonValueKind.Array: + var list = new List(); + foreach (var item in element.EnumerateArray()) + { + list.Add(item.GetObject()); + } + return list.ToArray(); + default: + throw new NotSupportedException($"Not supported value kind {element.ValueKind}"); + } + } + + public static byte[] GetBytesFromBase64(this JsonElement element, string format) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + + return format switch + { + "U" => TypeFormatters.FromBase64UrlString(element.GetRequiredString()), + "D" => element.GetBytesFromBase64(), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + } + + public static DateTimeOffset GetDateTimeOffset(this JsonElement element, string format) => format switch + { + "U" when element.ValueKind == JsonValueKind.Number => DateTimeOffset.FromUnixTimeSeconds(element.GetInt64()), + _ => TypeFormatters.ParseDateTimeOffset(element.GetString(), format) + }; + + public static TimeSpan GetTimeSpan(this JsonElement element, string format) => TypeFormatters.ParseTimeSpan(element.GetString(), format); + + public static char GetChar(this JsonElement element) + { + if (element.ValueKind == JsonValueKind.String) + { + var text = element.GetString(); + if (text == null || text.Length != 1) + { + throw new NotSupportedException($"Cannot convert \"{text}\" to a char"); + } + return text[0]; + } + else + { + throw new NotSupportedException($"Cannot convert {element.ValueKind} to a char"); + } + } + + [Conditional("DEBUG")] + public static void ThrowNonNullablePropertyIsNull(this JsonProperty property) + { + throw new JsonException($"A property '{property.Name}' defined as non-nullable but received as null from the service. This exception only happens in DEBUG builds of the library and would be ignored in the release build"); + } + + public static string GetRequiredString(this JsonElement element) + { + var value = element.GetString(); + if (value == null) + { + throw new InvalidOperationException($"The requested operation requires an element of type 'String', but the target element has type '{element.ValueKind}'."); + } + return value; + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, DateTime value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, TimeSpan value, string format) + { + writer.WriteStringValue(TypeFormatters.ToString(value, format)); + } + + public static void WriteStringValue(this Utf8JsonWriter writer, char value) + { + writer.WriteStringValue(value.ToString(CultureInfo.InvariantCulture)); + } + + public static void WriteBase64StringValue(this Utf8JsonWriter writer, byte[] value, string format) + { + if (value == null) + { + writer.WriteNullValue(); + return; + } + switch (format) + { + case "U": + writer.WriteStringValue(TypeFormatters.ToBase64UrlString(value)); + break; + case "D": + writer.WriteBase64StringValue(value); + break; + default: + throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)); + } + } + + public static void WriteNumberValue(this Utf8JsonWriter writer, DateTimeOffset value, string format) + { + if (format != "U") + { + throw new ArgumentOutOfRangeException(nameof(format), "Only 'U' format is supported when writing a DateTimeOffset as a Number."); + } + writer.WriteNumberValue(value.ToUnixTimeSeconds()); + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, T value, ModelReaderWriterOptions options = null) + { + switch (value) + { + case null: + writer.WriteNullValue(); + break; + case IJsonModel jsonModel: + jsonModel.Write(writer, options ?? WireOptions); + break; + case IUtf8JsonSerializable serializable: + serializable.Write(writer); + break; + case byte[] bytes: + writer.WriteBase64StringValue(bytes); + break; + case BinaryData bytes0: + writer.WriteBase64StringValue(bytes0); + break; + case JsonElement json: + json.WriteTo(writer); + break; + case int i: + writer.WriteNumberValue(i); + break; + case decimal d: + writer.WriteNumberValue(d); + break; + case double d0: + if (double.IsNaN(d0)) + { + writer.WriteStringValue("NaN"); + } + else + { + writer.WriteNumberValue(d0); + } + break; + case float f: + writer.WriteNumberValue(f); + break; + case long l: + writer.WriteNumberValue(l); + break; + case string s: + writer.WriteStringValue(s); + break; + case bool b: + writer.WriteBooleanValue(b); + break; + case Guid g: + writer.WriteStringValue(g); + break; + case DateTimeOffset dateTimeOffset: + writer.WriteStringValue(dateTimeOffset, "O"); + break; + case DateTime dateTime: + writer.WriteStringValue(dateTime, "O"); + break; + case IEnumerable> enumerable: + writer.WriteStartObject(); + foreach (var pair in enumerable) + { + writer.WritePropertyName(pair.Key); + writer.WriteObjectValue(pair.Value, options); + } + writer.WriteEndObject(); + break; + case IEnumerable objectEnumerable: + writer.WriteStartArray(); + foreach (var item in objectEnumerable) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + break; + case TimeSpan timeSpan: + writer.WriteStringValue(timeSpan, "P"); + break; + default: + throw new NotSupportedException($"Not supported type {value.GetType()}"); + } + } + + public static void WriteObjectValue(this Utf8JsonWriter writer, object value, ModelReaderWriterOptions options = null) + { + writer.WriteObjectValue(value, options); + } + + internal static class TypeFormatters + { + private const string RoundtripZFormat = "yyyy-MM-ddTHH:mm:ss.fffffffZ"; + public const string DefaultNumberFormat = "G"; + + public static string ToString(bool value) => value ? "true" : "false"; + + public static string ToString(DateTime value, string format) => value.Kind switch + { + DateTimeKind.Utc => ToString((DateTimeOffset)value, format), + _ => throw new NotSupportedException($"DateTime {value} has a Kind of {value.Kind}. Azure SDK requires it to be UTC. You can call DateTime.SpecifyKind to change Kind property value to DateTimeKind.Utc.") + }; + + public static string ToString(DateTimeOffset value, string format) => format switch + { + "D" => value.ToString("yyyy-MM-dd", CultureInfo.InvariantCulture), + "U" => value.ToUnixTimeSeconds().ToString(CultureInfo.InvariantCulture), + "O" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "o" => value.ToUniversalTime().ToString(RoundtripZFormat, CultureInfo.InvariantCulture), + "R" => value.ToString("r", CultureInfo.InvariantCulture), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(TimeSpan value, string format) => format switch + { + "P" => XmlConvert.ToString(value), + _ => value.ToString(format, CultureInfo.InvariantCulture) + }; + + public static string ToString(byte[] value, string format) => format switch + { + "U" => ToBase64UrlString(value), + "D" => Convert.ToBase64String(value), + _ => throw new ArgumentException($"Format is not supported: '{format}'", nameof(format)) + }; + + public static string ToBase64UrlString(byte[] value) + { + int numWholeOrPartialInputBlocks = checked(value.Length + 2) / 3; + int size = checked(numWholeOrPartialInputBlocks * 4); + char[] output = new char[size]; + + int numBase64Chars = Convert.ToBase64CharArray(value, 0, value.Length, output, 0); + + int i = 0; + for (; i < numBase64Chars; i++) + { + char ch = output[i]; + if (ch == '+') + { + output[i] = '-'; + } + else + { + if (ch == '/') + { + output[i] = '_'; + } + else + { + if (ch == '=') + { + break; + } + } + } + } + + return new string(output, 0, i); + } + + public static byte[] FromBase64UrlString(string value) + { + int paddingCharsToAdd = (value.Length % 4) switch + { + 0 => 0, + 2 => 2, + 3 => 1, + _ => throw new InvalidOperationException("Malformed input") + }; + char[] output = new char[(value.Length + paddingCharsToAdd)]; + int i = 0; + for (; i < value.Length; i++) + { + char ch = value[i]; + if (ch == '-') + { + output[i] = '+'; + } + else + { + if (ch == '_') + { + output[i] = '/'; + } + else + { + output[i] = ch; + } + } + } + + for (; i < output.Length; i++) + { + output[i] = '='; + } + + return Convert.FromBase64CharArray(output, 0, output.Length); + } + + public static DateTimeOffset ParseDateTimeOffset(string value, string format) => format switch + { + "U" => DateTimeOffset.FromUnixTimeSeconds(long.Parse(value, CultureInfo.InvariantCulture)), + _ => DateTimeOffset.Parse(value, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal) + }; + + public static TimeSpan ParseTimeSpan(string value, string format) => format switch + { + "P" => XmlConvert.ToTimeSpan(value), + _ => TimeSpan.ParseExact(value, format, CultureInfo.InvariantCulture) + }; + + public static string ConvertToString(object value, string format = null) => value switch + { + null => "null", + string s => s, + bool b => ToString(b), + int or float or double or long or decimal => ((IFormattable)value).ToString(DefaultNumberFormat, CultureInfo.InvariantCulture), + byte[] b0 when format != null => ToString(b0, format), + IEnumerable s0 => string.Join(",", s0), + DateTimeOffset dateTime when format != null => ToString(dateTime, format), + TimeSpan timeSpan when format != null => ToString(timeSpan, format), + TimeSpan timeSpan0 => XmlConvert.ToString(timeSpan0), + Guid guid => guid.ToString(), + BinaryData binaryData => ConvertToString(binaryData.ToArray(), format), + _ => value.ToString() + }; + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Internal/Optional.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Internal/Optional.cs new file mode 100644 index 0000000000000..ba8bed99564ed --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Internal/Optional.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; + +namespace Azure.ResourceManager.Impact +{ + internal static class Optional + { + public static bool IsCollectionDefined(IEnumerable collection) + { + return !(collection is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined); + } + + public static bool IsCollectionDefined(IDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsCollectionDefined(IReadOnlyDictionary collection) + { + return !(collection is ChangeTrackingDictionary changeTrackingDictionary && changeTrackingDictionary.IsUndefined); + } + + public static bool IsDefined(T? value) + where T : struct + { + return value.HasValue; + } + + public static bool IsDefined(object value) + { + return value != null; + } + + public static bool IsDefined(JsonElement value) + { + return value.ValueKind != JsonValueKind.Undefined; + } + + public static bool IsDefined(string value) + { + return value != null; + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Internal/Utf8JsonRequestContent.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Internal/Utf8JsonRequestContent.cs new file mode 100644 index 0000000000000..ed8be8d6604af --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Internal/Utf8JsonRequestContent.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.IO; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.Impact +{ + internal class Utf8JsonRequestContent : RequestContent + { + private readonly MemoryStream _stream; + private readonly RequestContent _content; + + public Utf8JsonRequestContent() + { + _stream = new MemoryStream(); + _content = Create(_stream); + JsonWriter = new Utf8JsonWriter(_stream); + } + + public Utf8JsonWriter JsonWriter { get; } + + public override async Task WriteToAsync(Stream stream, CancellationToken cancellationToken = default) + { + await JsonWriter.FlushAsync().ConfigureAwait(false); + await _content.WriteToAsync(stream, cancellationToken).ConfigureAwait(false); + } + + public override void WriteTo(Stream stream, CancellationToken cancellationToken = default) + { + JsonWriter.Flush(); + _content.WriteTo(stream, cancellationToken); + } + + public override bool TryComputeLength(out long length) + { + length = JsonWriter.BytesCommitted + JsonWriter.BytesPending; + return true; + } + + public override void Dispose() + { + JsonWriter.Dispose(); + _content.Dispose(); + _stream.Dispose(); + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/LongRunningOperation/ConnectorOperationSource.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/LongRunningOperation/ConnectorOperationSource.cs new file mode 100644 index 0000000000000..6b0e49715cb5b --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/LongRunningOperation/ConnectorOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.Impact +{ + internal class ConnectorOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal ConnectorOperationSource(ArmClient client) + { + _client = client; + } + + ConnectorResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = ConnectorData.DeserializeConnectorData(document.RootElement); + return new ConnectorResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = ConnectorData.DeserializeConnectorData(document.RootElement); + return new ConnectorResource(_client, data); + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/LongRunningOperation/ImpactArmOperation.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/LongRunningOperation/ImpactArmOperation.cs new file mode 100644 index 0000000000000..f7dd63cf8fb8f --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/LongRunningOperation/ImpactArmOperation.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Impact +{ +#pragma warning disable SA1649 // File name should match first type name + internal class ImpactArmOperation : ArmOperation +#pragma warning restore SA1649 // File name should match first type name + { + private readonly OperationInternal _operation; + private readonly RehydrationToken? _completeRehydrationToken; + private readonly NextLinkOperationImplementation _nextLinkOperation; + private readonly string _operationId; + + /// Initializes a new instance of ImpactArmOperation for mocking. + protected ImpactArmOperation() + { + } + + internal ImpactArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal ImpactArmOperation(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) + { + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationValue) + { + _nextLinkOperation = nextLinkOperationValue; + _operationId = _nextLinkOperation.OperationId; + } + else + { + _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); + _operationId = GetOperationId(_completeRehydrationToken); + } + _operation = new OperationInternal(nextLinkOperation, clientDiagnostics, response, "ImpactArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + private string GetOperationId(RehydrationToken? rehydrationToken) + { + if (rehydrationToken is null) + { + return null; + } + var lroDetails = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json).ToObjectFromJson>(); + return lroDetails["id"]; + } + /// + public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; + + /// + public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.RawResponse; + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override Response WaitForCompletionResponse(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponse(cancellationToken); + + /// + public override Response WaitForCompletionResponse(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponse(pollingInterval, cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(cancellationToken); + + /// + public override ValueTask WaitForCompletionResponseAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionResponseAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/LongRunningOperation/ImpactArmOperationOfT.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/LongRunningOperation/ImpactArmOperationOfT.cs new file mode 100644 index 0000000000000..2e7bbf3c2b80f --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/LongRunningOperation/ImpactArmOperationOfT.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.ResourceManager.Impact +{ +#pragma warning disable SA1649 // File name should match first type name + internal class ImpactArmOperation : ArmOperation +#pragma warning restore SA1649 // File name should match first type name + { + private readonly OperationInternal _operation; + private readonly RehydrationToken? _completeRehydrationToken; + private readonly NextLinkOperationImplementation _nextLinkOperation; + private readonly string _operationId; + + /// Initializes a new instance of ImpactArmOperation for mocking. + protected ImpactArmOperation() + { + } + + internal ImpactArmOperation(Response response, RehydrationToken? rehydrationToken = null) + { + _operation = OperationInternal.Succeeded(response.GetRawResponse(), response.Value); + _completeRehydrationToken = rehydrationToken; + _operationId = GetOperationId(rehydrationToken); + } + + internal ImpactArmOperation(IOperationSource source, ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, Request request, Response response, OperationFinalStateVia finalStateVia, bool skipApiVersionOverride = false, string apiVersionOverrideValue = null) + { + var nextLinkOperation = NextLinkOperationImplementation.Create(pipeline, request.Method, request.Uri.ToUri(), response, finalStateVia, skipApiVersionOverride, apiVersionOverrideValue); + if (nextLinkOperation is NextLinkOperationImplementation nextLinkOperationValue) + { + _nextLinkOperation = nextLinkOperationValue; + _operationId = _nextLinkOperation.OperationId; + } + else + { + _completeRehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(request.Method, request.Uri.ToUri(), response, finalStateVia); + _operationId = GetOperationId(_completeRehydrationToken); + } + _operation = new OperationInternal(NextLinkOperationImplementation.Create(source, nextLinkOperation), clientDiagnostics, response, "ImpactArmOperation", fallbackStrategy: new SequentialDelayStrategy()); + } + + private string GetOperationId(RehydrationToken? rehydrationToken) + { + if (rehydrationToken is null) + { + return null; + } + var lroDetails = ModelReaderWriter.Write(rehydrationToken, ModelReaderWriterOptions.Json).ToObjectFromJson>(); + return lroDetails["id"]; + } + /// + public override string Id => _operationId ?? NextLinkOperationImplementation.NotSet; + + /// + public override RehydrationToken? GetRehydrationToken() => _nextLinkOperation?.GetRehydrationToken() ?? _completeRehydrationToken; + + /// + public override T Value => _operation.Value; + + /// + public override bool HasValue => _operation.HasValue; + + /// + public override bool HasCompleted => _operation.HasCompleted; + + /// + public override Response GetRawResponse() => _operation.RawResponse; + + /// + public override Response UpdateStatus(CancellationToken cancellationToken = default) => _operation.UpdateStatus(cancellationToken); + + /// + public override ValueTask UpdateStatusAsync(CancellationToken cancellationToken = default) => _operation.UpdateStatusAsync(cancellationToken); + + /// + public override Response WaitForCompletion(CancellationToken cancellationToken = default) => _operation.WaitForCompletion(cancellationToken); + + /// + public override Response WaitForCompletion(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletion(pollingInterval, cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(cancellationToken); + + /// + public override ValueTask> WaitForCompletionAsync(TimeSpan pollingInterval, CancellationToken cancellationToken = default) => _operation.WaitForCompletionAsync(pollingInterval, cancellationToken); + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/LongRunningOperation/WorkloadImpactOperationSource.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/LongRunningOperation/WorkloadImpactOperationSource.cs new file mode 100644 index 0000000000000..6379498e350f4 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/LongRunningOperation/WorkloadImpactOperationSource.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; + +namespace Azure.ResourceManager.Impact +{ + internal class WorkloadImpactOperationSource : IOperationSource + { + private readonly ArmClient _client; + + internal WorkloadImpactOperationSource(ArmClient client) + { + _client = client; + } + + WorkloadImpactResource IOperationSource.CreateResult(Response response, CancellationToken cancellationToken) + { + using var document = JsonDocument.Parse(response.ContentStream); + var data = WorkloadImpactData.DeserializeWorkloadImpactData(document.RootElement); + return new WorkloadImpactResource(_client, data); + } + + async ValueTask IOperationSource.CreateResultAsync(Response response, CancellationToken cancellationToken) + { + using var document = await JsonDocument.ParseAsync(response.ContentStream, default, cancellationToken).ConfigureAwait(false); + var data = WorkloadImpactData.DeserializeWorkloadImpactData(document.RootElement); + return new WorkloadImpactResource(_client, data); + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ClientIncidentDetails.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ClientIncidentDetails.Serialization.cs new file mode 100644 index 0000000000000..62798d21938c6 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ClientIncidentDetails.Serialization.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Impact.Models +{ + public partial class ClientIncidentDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ClientIncidentDetails)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ClientIncidentId)) + { + writer.WritePropertyName("clientIncidentId"u8); + writer.WriteStringValue(ClientIncidentId); + } + if (Optional.IsDefined(ClientIncidentSource)) + { + writer.WritePropertyName("clientIncidentSource"u8); + writer.WriteStringValue(ClientIncidentSource.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ClientIncidentDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ClientIncidentDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeClientIncidentDetails(document.RootElement, options); + } + + internal static ClientIncidentDetails DeserializeClientIncidentDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string clientIncidentId = default; + IncidentSource? clientIncidentSource = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("clientIncidentId"u8)) + { + clientIncidentId = property.Value.GetString(); + continue; + } + if (property.NameEquals("clientIncidentSource"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + clientIncidentSource = new IncidentSource(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ClientIncidentDetails(clientIncidentId, clientIncidentSource, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ClientIncidentDetails)} does not support writing '{options.Format}' format."); + } + } + + ClientIncidentDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeClientIncidentDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ClientIncidentDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ClientIncidentDetails.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ClientIncidentDetails.cs new file mode 100644 index 0000000000000..e335bed73f2d5 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ClientIncidentDetails.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Impact.Models +{ + /// Client incident details ex: incidentId , incident source. + public partial class ClientIncidentDetails + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ClientIncidentDetails() + { + } + + /// Initializes a new instance of . + /// Client incident id. ex : id of the incident created to investigate and address the impact if any. + /// Client incident source. ex : source system name where the incident is created. + /// Keeps track of any properties unknown to the library. + internal ClientIncidentDetails(string clientIncidentId, IncidentSource? clientIncidentSource, IDictionary serializedAdditionalRawData) + { + ClientIncidentId = clientIncidentId; + ClientIncidentSource = clientIncidentSource; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Client incident id. ex : id of the incident created to investigate and address the impact if any. + public string ClientIncidentId { get; set; } + /// Client incident source. ex : source system name where the incident is created. + public IncidentSource? ClientIncidentSource { get; set; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ConfidenceLevel.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ConfidenceLevel.cs new file mode 100644 index 0000000000000..e64728d33ae65 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ConfidenceLevel.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.Impact.Models +{ + /// Degree of confidence on the impact being a platform issue. + public readonly partial struct ConfidenceLevel : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ConfidenceLevel(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string LowValue = "Low"; + private const string MediumValue = "Medium"; + private const string HighValue = "High"; + + /// Low confidence on azure being the source of impact. + public static ConfidenceLevel Low { get; } = new ConfidenceLevel(LowValue); + /// Medium confidence on azure being the source of impact. + public static ConfidenceLevel Medium { get; } = new ConfidenceLevel(MediumValue); + /// High confidence on azure being the source of impact. + public static ConfidenceLevel High { get; } = new ConfidenceLevel(HighValue); + /// Determines if two values are the same. + public static bool operator ==(ConfidenceLevel left, ConfidenceLevel right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ConfidenceLevel left, ConfidenceLevel right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ConfidenceLevel(string value) => new ConfidenceLevel(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ConfidenceLevel other && Equals(other); + /// + public bool Equals(ConfidenceLevel other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Connectivity.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Connectivity.Serialization.cs new file mode 100644 index 0000000000000..d3a0a3c55e67d --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Connectivity.Serialization.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Impact.Models +{ + public partial class Connectivity : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Connectivity)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Protocol)) + { + writer.WritePropertyName("protocol"u8); + writer.WriteStringValue(Protocol.Value.ToString()); + } + if (Optional.IsDefined(Port)) + { + writer.WritePropertyName("port"u8); + writer.WriteNumberValue(Port.Value); + } + if (Optional.IsDefined(Source)) + { + writer.WritePropertyName("source"u8); + writer.WriteObjectValue(Source, options); + } + if (Optional.IsDefined(Target)) + { + writer.WritePropertyName("target"u8); + writer.WriteObjectValue(Target, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + Connectivity IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Connectivity)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConnectivity(document.RootElement, options); + } + + internal static Connectivity DeserializeConnectivity(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Protocol? protocol = default; + int? port = default; + SourceOrTarget source = default; + SourceOrTarget target = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("protocol"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + protocol = new Protocol(property.Value.GetString()); + continue; + } + if (property.NameEquals("port"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + port = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("source"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + source = SourceOrTarget.DeserializeSourceOrTarget(property.Value, options); + continue; + } + if (property.NameEquals("target"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + target = SourceOrTarget.DeserializeSourceOrTarget(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Connectivity(protocol, port, source, target, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(Connectivity)} does not support writing '{options.Format}' format."); + } + } + + Connectivity IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeConnectivity(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Connectivity)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Connectivity.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Connectivity.cs new file mode 100644 index 0000000000000..6af81edd87bff --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Connectivity.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Impact.Models +{ + /// Details about connectivity issue. Applicable when root resource causing the issue is not identified. For example, when a VM is impacted due to a network issue, the impacted resource could be VM or the network. In such cases, the connectivity field will have the details about both VM and network. + public partial class Connectivity + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public Connectivity() + { + } + + /// Initializes a new instance of . + /// Protocol used for the connection. + /// Port number for the connection. + /// Source from which the connection was attempted. + /// target which connection was attempted. + /// Keeps track of any properties unknown to the library. + internal Connectivity(Protocol? protocol, int? port, SourceOrTarget source, SourceOrTarget target, IDictionary serializedAdditionalRawData) + { + Protocol = protocol; + Port = port; + Source = source; + Target = target; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Protocol used for the connection. + public Protocol? Protocol { get; set; } + /// Port number for the connection. + public int? Port { get; set; } + /// Source from which the connection was attempted. + internal SourceOrTarget Source { get; set; } + /// Azure resource id, example /subscription/{subscription}/resourceGroup/{rg}/Microsoft.compute/virtualMachine/{vmName}. + public string SourceAzureResourceId + { + get => Source is null ? default : Source.AzureResourceId; + set + { + if (Source is null) + Source = new SourceOrTarget(); + Source.AzureResourceId = value; + } + } + + /// target which connection was attempted. + internal SourceOrTarget Target { get; set; } + /// Azure resource id, example /subscription/{subscription}/resourceGroup/{rg}/Microsoft.compute/virtualMachine/{vmName}. + public string TargetAzureResourceId + { + get => Target is null ? default : Target.AzureResourceId; + set + { + if (Target is null) + Target = new SourceOrTarget(); + Target.AzureResourceId = value; + } + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ConnectorListResult.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ConnectorListResult.Serialization.cs new file mode 100644 index 0000000000000..939ce4002c3a1 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ConnectorListResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Impact.Models +{ + internal partial class ConnectorListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConnectorListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ConnectorListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConnectorListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConnectorListResult(document.RootElement, options); + } + + internal static ConnectorListResult DeserializeConnectorListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ConnectorData.DeserializeConnectorData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConnectorListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ConnectorListResult)} does not support writing '{options.Format}' format."); + } + } + + ConnectorListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeConnectorListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConnectorListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ConnectorListResult.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ConnectorListResult.cs new file mode 100644 index 0000000000000..3748860914e4b --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ConnectorListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.Impact.Models +{ + /// The response of a Connector list operation. + internal partial class ConnectorListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The Connector items on this page. + /// is null. + internal ConnectorListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The Connector items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal ConnectorListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConnectorListResult() + { + } + + /// The Connector items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ConnectorProperties.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ConnectorProperties.Serialization.cs new file mode 100644 index 0000000000000..1f13e3f9ce27e --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ConnectorProperties.Serialization.cs @@ -0,0 +1,180 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Impact.Models +{ + public partial class ConnectorProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConnectorProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + if (options.Format != "W") + { + writer.WritePropertyName("connectorId"u8); + writer.WriteStringValue(ConnectorId); + } + if (options.Format != "W") + { + writer.WritePropertyName("tenantId"u8); + writer.WriteStringValue(TenantId); + } + writer.WritePropertyName("connectorType"u8); + writer.WriteStringValue(ConnectorType.ToString()); + if (options.Format != "W") + { + writer.WritePropertyName("lastRunTimeStamp"u8); + writer.WriteStringValue(LastRunTimeStamp, "O"); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ConnectorProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConnectorProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConnectorProperties(document.RootElement, options); + } + + internal static ConnectorProperties DeserializeConnectorProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ProvisioningState? provisioningState = default; + string connectorId = default; + string tenantId = default; + Platform connectorType = default; + DateTimeOffset lastRunTimeStamp = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("connectorId"u8)) + { + connectorId = property.Value.GetString(); + continue; + } + if (property.NameEquals("tenantId"u8)) + { + tenantId = property.Value.GetString(); + continue; + } + if (property.NameEquals("connectorType"u8)) + { + connectorType = new Platform(property.Value.GetString()); + continue; + } + if (property.NameEquals("lastRunTimeStamp"u8)) + { + lastRunTimeStamp = property.Value.GetDateTimeOffset("O"); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConnectorProperties( + provisioningState, + connectorId, + tenantId, + connectorType, + lastRunTimeStamp, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ConnectorProperties)} does not support writing '{options.Format}' format."); + } + } + + ConnectorProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeConnectorProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConnectorProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ConnectorProperties.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ConnectorProperties.cs new file mode 100644 index 0000000000000..d19e0e2fca9ca --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ConnectorProperties.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Impact.Models +{ + /// Details of the Connector. + public partial class ConnectorProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// unique id of the connector. + /// tenant id of this connector. + /// connector type. + /// last run time stamp of this connector in UTC time zone. + public ConnectorProperties(string connectorId, string tenantId, Platform connectorType, DateTimeOffset lastRunTimeStamp) + { + ConnectorId = connectorId; + TenantId = tenantId; + ConnectorType = connectorType; + LastRunTimeStamp = lastRunTimeStamp; + } + + /// Initializes a new instance of . + /// Resource provisioning state. + /// unique id of the connector. + /// tenant id of this connector. + /// connector type. + /// last run time stamp of this connector in UTC time zone. + /// Keeps track of any properties unknown to the library. + internal ConnectorProperties(ProvisioningState? provisioningState, string connectorId, string tenantId, Platform connectorType, DateTimeOffset lastRunTimeStamp, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + ConnectorId = connectorId; + TenantId = tenantId; + ConnectorType = connectorType; + LastRunTimeStamp = lastRunTimeStamp; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConnectorProperties() + { + } + + /// Resource provisioning state. + public ProvisioningState? ProvisioningState { get; } + /// unique id of the connector. + public string ConnectorId { get; } + /// tenant id of this connector. + public string TenantId { get; } + /// connector type. + public Platform ConnectorType { get; set; } + /// last run time stamp of this connector in UTC time zone. + public DateTimeOffset LastRunTimeStamp { get; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Content.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Content.Serialization.cs new file mode 100644 index 0000000000000..372212bbfc9ab --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Content.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Impact.Models +{ + public partial class Content : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Content)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("title"u8); + writer.WriteStringValue(Title); + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + Content IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Content)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeContent(document.RootElement, options); + } + + internal static Content DeserializeContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string title = default; + string description = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("title"u8)) + { + title = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Content(title, description, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(Content)} does not support writing '{options.Format}' format."); + } + } + + Content IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Content)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Content.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Content.cs new file mode 100644 index 0000000000000..7b935f6fe70fb --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Content.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Impact.Models +{ + /// Article details of the insight like title, description etc. + public partial class Content + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Title of the insight. + /// Description of the insight. + /// or is null. + public Content(string title, string description) + { + Argument.AssertNotNull(title, nameof(title)); + Argument.AssertNotNull(description, nameof(description)); + + Title = title; + Description = description; + } + + /// Initializes a new instance of . + /// Title of the insight. + /// Description of the insight. + /// Keeps track of any properties unknown to the library. + internal Content(string title, string description, IDictionary serializedAdditionalRawData) + { + Title = title; + Description = description; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal Content() + { + } + + /// Title of the insight. + public string Title { get; set; } + /// Description of the insight. + public string Description { get; set; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ErrorDetailProperties.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ErrorDetailProperties.Serialization.cs new file mode 100644 index 0000000000000..05a443b564204 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ErrorDetailProperties.Serialization.cs @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Impact.Models +{ + public partial class ErrorDetailProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ErrorDetailProperties)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(ErrorCode)) + { + writer.WritePropertyName("errorCode"u8); + writer.WriteStringValue(ErrorCode); + } + if (Optional.IsDefined(ErrorMessage)) + { + writer.WritePropertyName("errorMessage"u8); + writer.WriteStringValue(ErrorMessage); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ErrorDetailProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ErrorDetailProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeErrorDetailProperties(document.RootElement, options); + } + + internal static ErrorDetailProperties DeserializeErrorDetailProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string errorCode = default; + string errorMessage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("errorCode"u8)) + { + errorCode = property.Value.GetString(); + continue; + } + if (property.NameEquals("errorMessage"u8)) + { + errorMessage = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ErrorDetailProperties(errorCode, errorMessage, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ErrorDetailProperties)} does not support writing '{options.Format}' format."); + } + } + + ErrorDetailProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeErrorDetailProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ErrorDetailProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ErrorDetailProperties.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ErrorDetailProperties.cs new file mode 100644 index 0000000000000..09398de0ef08a --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ErrorDetailProperties.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Impact.Models +{ + /// ARM error code and error message associated with the impact. + public partial class ErrorDetailProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ErrorDetailProperties() + { + } + + /// Initializes a new instance of . + /// ARM Error code associated with the impact. + /// ARM Error Message associated with the impact. + /// Keeps track of any properties unknown to the library. + internal ErrorDetailProperties(string errorCode, string errorMessage, IDictionary serializedAdditionalRawData) + { + ErrorCode = errorCode; + ErrorMessage = errorMessage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// ARM Error code associated with the impact. + public string ErrorCode { get; set; } + /// ARM Error Message associated with the impact. + public string ErrorMessage { get; set; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ExpectedValueRange.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ExpectedValueRange.Serialization.cs new file mode 100644 index 0000000000000..851acd94bde6e --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ExpectedValueRange.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Impact.Models +{ + public partial class ExpectedValueRange : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExpectedValueRange)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("min"u8); + writer.WriteNumberValue(Min); + writer.WritePropertyName("max"u8); + writer.WriteNumberValue(Max); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ExpectedValueRange IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExpectedValueRange)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeExpectedValueRange(document.RootElement, options); + } + + internal static ExpectedValueRange DeserializeExpectedValueRange(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + double min = default; + double max = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("min"u8)) + { + min = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("max"u8)) + { + max = property.Value.GetDouble(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ExpectedValueRange(min, max, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ExpectedValueRange)} does not support writing '{options.Format}' format."); + } + } + + ExpectedValueRange IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeExpectedValueRange(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ExpectedValueRange)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ExpectedValueRange.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ExpectedValueRange.cs new file mode 100644 index 0000000000000..67dff81e6bca0 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ExpectedValueRange.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Impact.Models +{ + /// Max and Min Threshold values for the metric. + public partial class ExpectedValueRange + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Min threshold value for the metric. + /// Max threshold value for the metric. + public ExpectedValueRange(double min, double max) + { + Min = min; + Max = max; + } + + /// Initializes a new instance of . + /// Min threshold value for the metric. + /// Max threshold value for the metric. + /// Keeps track of any properties unknown to the library. + internal ExpectedValueRange(double min, double max, IDictionary serializedAdditionalRawData) + { + Min = min; + Max = max; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ExpectedValueRange() + { + } + + /// Min threshold value for the metric. + public double Min { get; set; } + /// Max threshold value for the metric. + public double Max { get; set; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ImpactCategoryListResult.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ImpactCategoryListResult.Serialization.cs new file mode 100644 index 0000000000000..c75feb4b2f3dd --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ImpactCategoryListResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Impact.Models +{ + internal partial class ImpactCategoryListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ImpactCategoryListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ImpactCategoryListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ImpactCategoryListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeImpactCategoryListResult(document.RootElement, options); + } + + internal static ImpactCategoryListResult DeserializeImpactCategoryListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ImpactCategoryData.DeserializeImpactCategoryData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ImpactCategoryListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ImpactCategoryListResult)} does not support writing '{options.Format}' format."); + } + } + + ImpactCategoryListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeImpactCategoryListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ImpactCategoryListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ImpactCategoryListResult.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ImpactCategoryListResult.cs new file mode 100644 index 0000000000000..f324ae6a9502f --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ImpactCategoryListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.Impact.Models +{ + /// The response of a ImpactCategory list operation. + internal partial class ImpactCategoryListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The ImpactCategory items on this page. + /// is null. + internal ImpactCategoryListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The ImpactCategory items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal ImpactCategoryListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ImpactCategoryListResult() + { + } + + /// The ImpactCategory items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ImpactCategoryProperties.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ImpactCategoryProperties.Serialization.cs new file mode 100644 index 0000000000000..1d31b4a9cb57e --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ImpactCategoryProperties.Serialization.cs @@ -0,0 +1,194 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Impact.Models +{ + public partial class ImpactCategoryProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ImpactCategoryProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + writer.WritePropertyName("categoryId"u8); + writer.WriteStringValue(CategoryId); + if (Optional.IsDefined(ParentCategoryId)) + { + writer.WritePropertyName("parentCategoryId"u8); + writer.WriteStringValue(ParentCategoryId); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsCollectionDefined(RequiredImpactProperties)) + { + writer.WritePropertyName("requiredImpactProperties"u8); + writer.WriteStartArray(); + foreach (var item in RequiredImpactProperties) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ImpactCategoryProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ImpactCategoryProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeImpactCategoryProperties(document.RootElement, options); + } + + internal static ImpactCategoryProperties DeserializeImpactCategoryProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ProvisioningState? provisioningState = default; + string categoryId = default; + string parentCategoryId = default; + string description = default; + IReadOnlyList requiredImpactProperties = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("categoryId"u8)) + { + categoryId = property.Value.GetString(); + continue; + } + if (property.NameEquals("parentCategoryId"u8)) + { + parentCategoryId = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("requiredImpactProperties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Models.RequiredImpactProperties.DeserializeRequiredImpactProperties(item, options)); + } + requiredImpactProperties = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ImpactCategoryProperties( + provisioningState, + categoryId, + parentCategoryId, + description, + requiredImpactProperties ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ImpactCategoryProperties)} does not support writing '{options.Format}' format."); + } + } + + ImpactCategoryProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeImpactCategoryProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ImpactCategoryProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ImpactCategoryProperties.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ImpactCategoryProperties.cs new file mode 100644 index 0000000000000..9a1be2cde00d6 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ImpactCategoryProperties.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Impact.Models +{ + /// Impact category properties. + public partial class ImpactCategoryProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Unique ID of the category. + /// is null. + internal ImpactCategoryProperties(string categoryId) + { + Argument.AssertNotNull(categoryId, nameof(categoryId)); + + CategoryId = categoryId; + RequiredImpactProperties = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Resource provisioning state. + /// Unique ID of the category. + /// Unique ID of the parent category. + /// Description of the category. + /// The workloadImpact properties which are required when reporting with the impact category. + /// Keeps track of any properties unknown to the library. + internal ImpactCategoryProperties(ProvisioningState? provisioningState, string categoryId, string parentCategoryId, string description, IReadOnlyList requiredImpactProperties, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + CategoryId = categoryId; + ParentCategoryId = parentCategoryId; + Description = description; + RequiredImpactProperties = requiredImpactProperties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ImpactCategoryProperties() + { + } + + /// Resource provisioning state. + public ProvisioningState? ProvisioningState { get; } + /// Unique ID of the category. + public string CategoryId { get; } + /// Unique ID of the parent category. + public string ParentCategoryId { get; } + /// Description of the category. + public string Description { get; } + /// The workloadImpact properties which are required when reporting with the impact category. + public IReadOnlyList RequiredImpactProperties { get; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ImpactDetails.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ImpactDetails.Serialization.cs new file mode 100644 index 0000000000000..a8c9a561828cb --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ImpactDetails.Serialization.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Impact.Models +{ + public partial class ImpactDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ImpactDetails)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("impactedResourceId"u8); + writer.WriteStringValue(ImpactedResourceId); + writer.WritePropertyName("startTime"u8); + writer.WriteStringValue(StartOn, "O"); + if (Optional.IsDefined(EndOn)) + { + writer.WritePropertyName("endTime"u8); + writer.WriteStringValue(EndOn.Value, "O"); + } + writer.WritePropertyName("impactId"u8); + writer.WriteStringValue(ImpactId); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ImpactDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ImpactDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeImpactDetails(document.RootElement, options); + } + + internal static ImpactDetails DeserializeImpactDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string impactedResourceId = default; + DateTimeOffset startTime = default; + DateTimeOffset? endTime = default; + string impactId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("impactedResourceId"u8)) + { + impactedResourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("startTime"u8)) + { + startTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("endTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("impactId"u8)) + { + impactId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ImpactDetails(impactedResourceId, startTime, endTime, impactId, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ImpactDetails)} does not support writing '{options.Format}' format."); + } + } + + ImpactDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeImpactDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ImpactDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ImpactDetails.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ImpactDetails.cs new file mode 100644 index 0000000000000..c036173f457d8 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ImpactDetails.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Impact.Models +{ + /// details of of the impact for which insight has been generated. + public partial class ImpactDetails + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// List of impacted Azure resources. + /// Time at which impact was started according to reported impact. + /// Azure Id of the impact. + /// or is null. + public ImpactDetails(string impactedResourceId, DateTimeOffset startOn, string impactId) + { + Argument.AssertNotNull(impactedResourceId, nameof(impactedResourceId)); + Argument.AssertNotNull(impactId, nameof(impactId)); + + ImpactedResourceId = impactedResourceId; + StartOn = startOn; + ImpactId = impactId; + } + + /// Initializes a new instance of . + /// List of impacted Azure resources. + /// Time at which impact was started according to reported impact. + /// Time at which impact was ended according to reported impact. + /// Azure Id of the impact. + /// Keeps track of any properties unknown to the library. + internal ImpactDetails(string impactedResourceId, DateTimeOffset startOn, DateTimeOffset? endOn, string impactId, IDictionary serializedAdditionalRawData) + { + ImpactedResourceId = impactedResourceId; + StartOn = startOn; + EndOn = endOn; + ImpactId = impactId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ImpactDetails() + { + } + + /// List of impacted Azure resources. + public string ImpactedResourceId { get; set; } + /// Time at which impact was started according to reported impact. + public DateTimeOffset StartOn { get; set; } + /// Time at which impact was ended according to reported impact. + public DateTimeOffset? EndOn { get; set; } + /// Azure Id of the impact. + public string ImpactId { get; set; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/IncidentSource.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/IncidentSource.cs new file mode 100644 index 0000000000000..9f06372cf7b5c --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/IncidentSource.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Impact.Models +{ + /// List of incident interfaces. + public readonly partial struct IncidentSource : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public IncidentSource(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AzureDevopsValue = "AzureDevops"; + private const string ICMValue = "ICM"; + private const string JiraValue = "Jira"; + private const string ServiceNowValue = "ServiceNow"; + private const string OtherValue = "Other"; + + /// When source of Incident is AzureDevops. + public static IncidentSource AzureDevops { get; } = new IncidentSource(AzureDevopsValue); + /// When source of Incident is Microsoft ICM. + public static IncidentSource ICM { get; } = new IncidentSource(ICMValue); + /// When source of Incident is Jira. + public static IncidentSource Jira { get; } = new IncidentSource(JiraValue); + /// When source of Incident is ServiceNow. + public static IncidentSource ServiceNow { get; } = new IncidentSource(ServiceNowValue); + /// When source of Incident is Other. + public static IncidentSource Other { get; } = new IncidentSource(OtherValue); + /// Determines if two values are the same. + public static bool operator ==(IncidentSource left, IncidentSource right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(IncidentSource left, IncidentSource right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator IncidentSource(string value) => new IncidentSource(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is IncidentSource other && Equals(other); + /// + public bool Equals(IncidentSource other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/InsightListResult.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/InsightListResult.Serialization.cs new file mode 100644 index 0000000000000..ae171b1b518d2 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/InsightListResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Impact.Models +{ + internal partial class InsightListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InsightListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + InsightListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InsightListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInsightListResult(document.RootElement, options); + } + + internal static InsightListResult DeserializeInsightListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(InsightData.DeserializeInsightData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InsightListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InsightListResult)} does not support writing '{options.Format}' format."); + } + } + + InsightListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeInsightListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InsightListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/InsightListResult.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/InsightListResult.cs new file mode 100644 index 0000000000000..46f6a9faf87f6 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/InsightListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.Impact.Models +{ + /// The response of a Insight list operation. + internal partial class InsightListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The Insight items on this page. + /// is null. + internal InsightListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The Insight items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal InsightListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InsightListResult() + { + } + + /// The Insight items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/InsightProperties.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/InsightProperties.Serialization.cs new file mode 100644 index 0000000000000..763f2978331af --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/InsightProperties.Serialization.cs @@ -0,0 +1,239 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Impact.Models +{ + public partial class InsightProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InsightProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + writer.WritePropertyName("category"u8); + writer.WriteStringValue(Category); + if (Optional.IsDefined(Status)) + { + writer.WritePropertyName("status"u8); + writer.WriteStringValue(Status); + } + if (Optional.IsDefined(EventId)) + { + writer.WritePropertyName("eventId"u8); + writer.WriteStringValue(EventId); + } + if (Optional.IsDefined(GroupId)) + { + writer.WritePropertyName("groupId"u8); + writer.WriteStringValue(GroupId); + } + writer.WritePropertyName("content"u8); + writer.WriteObjectValue(Content, options); + if (Optional.IsDefined(EventOn)) + { + writer.WritePropertyName("eventTime"u8); + writer.WriteStringValue(EventOn.Value, "O"); + } + writer.WritePropertyName("insightUniqueId"u8); + writer.WriteStringValue(InsightUniqueId); + writer.WritePropertyName("impact"u8); + writer.WriteObjectValue(Impact, options); + if (Optional.IsDefined(AdditionalDetails)) + { + writer.WritePropertyName("additionalDetails"u8); + writer.WriteObjectValue(AdditionalDetails, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + InsightProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InsightProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInsightProperties(document.RootElement, options); + } + + internal static InsightProperties DeserializeInsightProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ProvisioningState? provisioningState = default; + string category = default; + string status = default; + string eventId = default; + string groupId = default; + Content content = default; + DateTimeOffset? eventTime = default; + string insightUniqueId = default; + ImpactDetails impact = default; + InsightPropertiesAdditionalDetails additionalDetails = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("category"u8)) + { + category = property.Value.GetString(); + continue; + } + if (property.NameEquals("status"u8)) + { + status = property.Value.GetString(); + continue; + } + if (property.NameEquals("eventId"u8)) + { + eventId = property.Value.GetString(); + continue; + } + if (property.NameEquals("groupId"u8)) + { + groupId = property.Value.GetString(); + continue; + } + if (property.NameEquals("content"u8)) + { + content = Content.DeserializeContent(property.Value, options); + continue; + } + if (property.NameEquals("eventTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + eventTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("insightUniqueId"u8)) + { + insightUniqueId = property.Value.GetString(); + continue; + } + if (property.NameEquals("impact"u8)) + { + impact = ImpactDetails.DeserializeImpactDetails(property.Value, options); + continue; + } + if (property.NameEquals("additionalDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + additionalDetails = InsightPropertiesAdditionalDetails.DeserializeInsightPropertiesAdditionalDetails(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InsightProperties( + provisioningState, + category, + status, + eventId, + groupId, + content, + eventTime, + insightUniqueId, + impact, + additionalDetails, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InsightProperties)} does not support writing '{options.Format}' format."); + } + } + + InsightProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeInsightProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InsightProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/InsightProperties.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/InsightProperties.cs new file mode 100644 index 0000000000000..3df6e0d3b31c0 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/InsightProperties.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Impact.Models +{ + /// Impact category properties. + public partial class InsightProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// category of the insight. + /// Contains title & description for the insight. + /// unique id of the insight. + /// details of of the impact for which insight has been generated. + /// , , or is null. + public InsightProperties(string category, Content content, string insightUniqueId, ImpactDetails impact) + { + Argument.AssertNotNull(category, nameof(category)); + Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNull(insightUniqueId, nameof(insightUniqueId)); + Argument.AssertNotNull(impact, nameof(impact)); + + Category = category; + Content = content; + InsightUniqueId = insightUniqueId; + Impact = impact; + } + + /// Initializes a new instance of . + /// Resource provisioning state. + /// category of the insight. + /// status of the insight. example resolved, repaired, other. + /// Identifier of the event that has been correlated with this insight. This can be used to aggregate insights for the same event. + /// Identifier that can be used to group similar insights. + /// Contains title & description for the insight. + /// Time of the event, which has been correlated the impact. + /// unique id of the insight. + /// details of of the impact for which insight has been generated. + /// additional details of the insight. + /// Keeps track of any properties unknown to the library. + internal InsightProperties(ProvisioningState? provisioningState, string category, string status, string eventId, string groupId, Content content, DateTimeOffset? eventOn, string insightUniqueId, ImpactDetails impact, InsightPropertiesAdditionalDetails additionalDetails, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + Category = category; + Status = status; + EventId = eventId; + GroupId = groupId; + Content = content; + EventOn = eventOn; + InsightUniqueId = insightUniqueId; + Impact = impact; + AdditionalDetails = additionalDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal InsightProperties() + { + } + + /// Resource provisioning state. + public ProvisioningState? ProvisioningState { get; } + /// category of the insight. + public string Category { get; set; } + /// status of the insight. example resolved, repaired, other. + public string Status { get; set; } + /// Identifier of the event that has been correlated with this insight. This can be used to aggregate insights for the same event. + public string EventId { get; set; } + /// Identifier that can be used to group similar insights. + public string GroupId { get; set; } + /// Contains title & description for the insight. + public Content Content { get; set; } + /// Time of the event, which has been correlated the impact. + public DateTimeOffset? EventOn { get; set; } + /// unique id of the insight. + public string InsightUniqueId { get; set; } + /// details of of the impact for which insight has been generated. + public ImpactDetails Impact { get; set; } + /// additional details of the insight. + public InsightPropertiesAdditionalDetails AdditionalDetails { get; set; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/InsightPropertiesAdditionalDetails.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/InsightPropertiesAdditionalDetails.Serialization.cs new file mode 100644 index 0000000000000..411f55a5a3140 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/InsightPropertiesAdditionalDetails.Serialization.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Impact.Models +{ + public partial class InsightPropertiesAdditionalDetails : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InsightPropertiesAdditionalDetails)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + InsightPropertiesAdditionalDetails IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InsightPropertiesAdditionalDetails)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInsightPropertiesAdditionalDetails(document.RootElement, options); + } + + internal static InsightPropertiesAdditionalDetails DeserializeInsightPropertiesAdditionalDetails(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InsightPropertiesAdditionalDetails(serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InsightPropertiesAdditionalDetails)} does not support writing '{options.Format}' format."); + } + } + + InsightPropertiesAdditionalDetails IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeInsightPropertiesAdditionalDetails(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InsightPropertiesAdditionalDetails)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/InsightPropertiesAdditionalDetails.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/InsightPropertiesAdditionalDetails.cs new file mode 100644 index 0000000000000..f1f71a6ebf381 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/InsightPropertiesAdditionalDetails.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Impact.Models +{ + /// The InsightPropertiesAdditionalDetails. + public partial class InsightPropertiesAdditionalDetails + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public InsightPropertiesAdditionalDetails() + { + } + + /// Initializes a new instance of . + /// Keeps track of any properties unknown to the library. + internal InsightPropertiesAdditionalDetails(IDictionary serializedAdditionalRawData) + { + _serializedAdditionalRawData = serializedAdditionalRawData; + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/MetricUnit.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/MetricUnit.cs new file mode 100644 index 0000000000000..d714f2ef85552 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/MetricUnit.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Impact.Models +{ + /// List of unit of the metric. + public readonly partial struct MetricUnit : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public MetricUnit(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ByteSecondsValue = "ByteSeconds"; + private const string BytesValue = "Bytes"; + private const string BytesPerSecondValue = "BytesPerSecond"; + private const string CoresValue = "Cores"; + private const string CountValue = "Count"; + private const string CountPerSecondValue = "CountPerSecond"; + private const string MilliCoresValue = "MilliCores"; + private const string MilliSecondsValue = "MilliSeconds"; + private const string NanoCoresValue = "NanoCores"; + private const string PercentValue = "Percent"; + private const string SecondsValue = "Seconds"; + private const string OtherValue = "Other"; + + /// When measurement is in ByteSeconds. + public static MetricUnit ByteSeconds { get; } = new MetricUnit(ByteSecondsValue); + /// When measurement is in Bytes. + public static MetricUnit Bytes { get; } = new MetricUnit(BytesValue); + /// When measurement is in BytesPerSecond. + public static MetricUnit BytesPerSecond { get; } = new MetricUnit(BytesPerSecondValue); + /// When measurement is in Cores. + public static MetricUnit Cores { get; } = new MetricUnit(CoresValue); + /// When measurement is in Count. + public static MetricUnit Count { get; } = new MetricUnit(CountValue); + /// When measurement is in CountPerSecond. + public static MetricUnit CountPerSecond { get; } = new MetricUnit(CountPerSecondValue); + /// When measurement is in MilliCores. + public static MetricUnit MilliCores { get; } = new MetricUnit(MilliCoresValue); + /// When measurement is in MilliSeconds. + public static MetricUnit MilliSeconds { get; } = new MetricUnit(MilliSecondsValue); + /// When measurement is in NanoCores. + public static MetricUnit NanoCores { get; } = new MetricUnit(NanoCoresValue); + /// When measurement is in Percent. + public static MetricUnit Percent { get; } = new MetricUnit(PercentValue); + /// When measurement is in Seconds. + public static MetricUnit Seconds { get; } = new MetricUnit(SecondsValue); + /// When measurement is in Other than listed. + public static MetricUnit Other { get; } = new MetricUnit(OtherValue); + /// Determines if two values are the same. + public static bool operator ==(MetricUnit left, MetricUnit right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(MetricUnit left, MetricUnit right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator MetricUnit(string value) => new MetricUnit(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is MetricUnit other && Equals(other); + /// + public bool Equals(MetricUnit other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Performance.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Performance.Serialization.cs new file mode 100644 index 0000000000000..6f67c900a3054 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Performance.Serialization.cs @@ -0,0 +1,195 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Impact.Models +{ + public partial class Performance : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Performance)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(MetricName)) + { + writer.WritePropertyName("metricName"u8); + writer.WriteStringValue(MetricName); + } + if (Optional.IsDefined(Expected)) + { + writer.WritePropertyName("expected"u8); + writer.WriteNumberValue(Expected.Value); + } + if (Optional.IsDefined(Actual)) + { + writer.WritePropertyName("actual"u8); + writer.WriteNumberValue(Actual.Value); + } + if (Optional.IsDefined(ExpectedValueRange)) + { + writer.WritePropertyName("expectedValueRange"u8); + writer.WriteObjectValue(ExpectedValueRange, options); + } + if (Optional.IsDefined(Unit)) + { + writer.WritePropertyName("unit"u8); + writer.WriteStringValue(Unit.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + Performance IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Performance)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePerformance(document.RootElement, options); + } + + internal static Performance DeserializePerformance(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string metricName = default; + double? expected = default; + double? actual = default; + ExpectedValueRange expectedValueRange = default; + MetricUnit? unit = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("metricName"u8)) + { + metricName = property.Value.GetString(); + continue; + } + if (property.NameEquals("expected"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expected = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("actual"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + actual = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("expectedValueRange"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + expectedValueRange = ExpectedValueRange.DeserializeExpectedValueRange(property.Value, options); + continue; + } + if (property.NameEquals("unit"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + unit = new MetricUnit(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Performance( + metricName, + expected, + actual, + expectedValueRange, + unit, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(Performance)} does not support writing '{options.Format}' format."); + } + } + + Performance IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePerformance(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Performance)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Performance.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Performance.cs new file mode 100644 index 0000000000000..475e4f75ec048 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Performance.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Impact.Models +{ + /// Details about impacted performance metrics. Applicable for performance related impact. + public partial class Performance + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public Performance() + { + } + + /// Initializes a new instance of . + /// Name of the Metric examples: Disk, IOPs, CPU, GPU, Memory, details can be found from /impactCategories API. + /// Threshold value for the metric. + /// Observed value for the metric. + /// Max and Min Threshold values for the metric. + /// Unit of the metric ex: Bytes, Percentage, Count, Seconds, Milliseconds, Bytes/Second, Count/Second, etc.., Other. + /// Keeps track of any properties unknown to the library. + internal Performance(string metricName, double? expected, double? actual, ExpectedValueRange expectedValueRange, MetricUnit? unit, IDictionary serializedAdditionalRawData) + { + MetricName = metricName; + Expected = expected; + Actual = actual; + ExpectedValueRange = expectedValueRange; + Unit = unit; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Name of the Metric examples: Disk, IOPs, CPU, GPU, Memory, details can be found from /impactCategories API. + public string MetricName { get; set; } + /// Threshold value for the metric. + public double? Expected { get; set; } + /// Observed value for the metric. + public double? Actual { get; set; } + /// Max and Min Threshold values for the metric. + public ExpectedValueRange ExpectedValueRange { get; set; } + /// Unit of the metric ex: Bytes, Percentage, Count, Seconds, Milliseconds, Bytes/Second, Count/Second, etc.., Other. + public MetricUnit? Unit { get; set; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Platform.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Platform.cs new file mode 100644 index 0000000000000..b831b28bffe8c --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Platform.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.Impact.Models +{ + /// Enum for connector types. + public readonly partial struct Platform : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public Platform(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AzureMonitorValue = "AzureMonitor"; + + /// Type of Azure Monitor. + public static Platform AzureMonitor { get; } = new Platform(AzureMonitorValue); + /// Determines if two values are the same. + public static bool operator ==(Platform left, Platform right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(Platform left, Platform right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator Platform(string value) => new Platform(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is Platform other && Equals(other); + /// + public bool Equals(Platform other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Protocol.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Protocol.cs new file mode 100644 index 0000000000000..f6c8f9778418c --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Protocol.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Impact.Models +{ + /// List of protocols. + public readonly partial struct Protocol : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public Protocol(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TCPValue = "TCP"; + private const string UDPValue = "UDP"; + private const string HTTPValue = "HTTP"; + private const string HTTPSValue = "HTTPS"; + private const string RDPValue = "RDP"; + private const string FTPValue = "FTP"; + private const string SSHValue = "SSH"; + private const string OtherValue = "Other"; + + /// When communication protocol is TCP. + public static Protocol TCP { get; } = new Protocol(TCPValue); + /// When communication protocol is UDP. + public static Protocol UDP { get; } = new Protocol(UDPValue); + /// When communication protocol is HTTP. + public static Protocol HTTP { get; } = new Protocol(HTTPValue); + /// When communication protocol is HTTPS. + public static Protocol HTTPS { get; } = new Protocol(HTTPSValue); + /// When communication protocol is RDP. + public static Protocol RDP { get; } = new Protocol(RDPValue); + /// When communication protocol is FTP. + public static Protocol FTP { get; } = new Protocol(FTPValue); + /// When communication protocol is SSH. + public static Protocol SSH { get; } = new Protocol(SSHValue); + /// When communication protocol is Other. + public static Protocol Other { get; } = new Protocol(OtherValue); + /// Determines if two values are the same. + public static bool operator ==(Protocol left, Protocol right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(Protocol left, Protocol right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator Protocol(string value) => new Protocol(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is Protocol other && Equals(other); + /// + public bool Equals(Protocol other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ProvisioningState.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ProvisioningState.cs new file mode 100644 index 0000000000000..dcfd0d141fce6 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/ProvisioningState.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.Impact.Models +{ + /// Provisioning state of the resource. + public readonly partial struct ProvisioningState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ProvisioningState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string SucceededValue = "Succeeded"; + private const string FailedValue = "Failed"; + private const string CanceledValue = "Canceled"; + + /// Provisioning Succeeded. + public static ProvisioningState Succeeded { get; } = new ProvisioningState(SucceededValue); + /// Provisioning Failed. + public static ProvisioningState Failed { get; } = new ProvisioningState(FailedValue); + /// Provisioning Canceled. + public static ProvisioningState Canceled { get; } = new ProvisioningState(CanceledValue); + /// Determines if two values are the same. + public static bool operator ==(ProvisioningState left, ProvisioningState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ProvisioningState left, ProvisioningState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ProvisioningState(string value) => new ProvisioningState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ProvisioningState other && Equals(other); + /// + public bool Equals(ProvisioningState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/RequiredImpactProperties.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/RequiredImpactProperties.Serialization.cs new file mode 100644 index 0000000000000..38a67e2e6243a --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/RequiredImpactProperties.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Impact.Models +{ + public partial class RequiredImpactProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RequiredImpactProperties)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + if (Optional.IsCollectionDefined(AllowedValues)) + { + writer.WritePropertyName("allowedValues"u8); + writer.WriteStartArray(); + foreach (var item in AllowedValues) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RequiredImpactProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RequiredImpactProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRequiredImpactProperties(document.RootElement, options); + } + + internal static RequiredImpactProperties DeserializeRequiredImpactProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + IReadOnlyList allowedValues = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("allowedValues"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + allowedValues = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RequiredImpactProperties(name, allowedValues ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RequiredImpactProperties)} does not support writing '{options.Format}' format."); + } + } + + RequiredImpactProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeRequiredImpactProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RequiredImpactProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/RequiredImpactProperties.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/RequiredImpactProperties.cs new file mode 100644 index 0000000000000..ca5f654efb054 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/RequiredImpactProperties.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Impact.Models +{ + /// Required impact properties. + public partial class RequiredImpactProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Name of the property. + /// is null. + internal RequiredImpactProperties(string name) + { + Argument.AssertNotNull(name, nameof(name)); + + Name = name; + AllowedValues = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Name of the property. + /// Allowed values values for the property. + /// Keeps track of any properties unknown to the library. + internal RequiredImpactProperties(string name, IReadOnlyList allowedValues, IDictionary serializedAdditionalRawData) + { + Name = name; + AllowedValues = allowedValues; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RequiredImpactProperties() + { + } + + /// Name of the property. + public string Name { get; } + /// Allowed values values for the property. + public IReadOnlyList AllowedValues { get; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/SourceOrTarget.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/SourceOrTarget.Serialization.cs new file mode 100644 index 0000000000000..0e5bd35e115d9 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/SourceOrTarget.Serialization.cs @@ -0,0 +1,129 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Impact.Models +{ + internal partial class SourceOrTarget : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SourceOrTarget)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(AzureResourceId)) + { + writer.WritePropertyName("azureResourceId"u8); + writer.WriteStringValue(AzureResourceId); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SourceOrTarget IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SourceOrTarget)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSourceOrTarget(document.RootElement, options); + } + + internal static SourceOrTarget DeserializeSourceOrTarget(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string azureResourceId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("azureResourceId"u8)) + { + azureResourceId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SourceOrTarget(azureResourceId, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SourceOrTarget)} does not support writing '{options.Format}' format."); + } + } + + SourceOrTarget IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeSourceOrTarget(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SourceOrTarget)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/SourceOrTarget.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/SourceOrTarget.cs new file mode 100644 index 0000000000000..534169a43d51d --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/SourceOrTarget.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Impact.Models +{ + /// Resource details. + internal partial class SourceOrTarget + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public SourceOrTarget() + { + } + + /// Initializes a new instance of . + /// Azure resource id, example /subscription/{subscription}/resourceGroup/{rg}/Microsoft.compute/virtualMachine/{vmName}. + /// Keeps track of any properties unknown to the library. + internal SourceOrTarget(string azureResourceId, IDictionary serializedAdditionalRawData) + { + AzureResourceId = azureResourceId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Azure resource id, example /subscription/{subscription}/resourceGroup/{rg}/Microsoft.compute/virtualMachine/{vmName}. + public string AzureResourceId { get; set; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Toolset.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Toolset.cs new file mode 100644 index 0000000000000..6b62cb40172a0 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Toolset.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.Impact.Models +{ + /// List of azure interfaces. + public readonly partial struct Toolset : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public Toolset(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string TerraformValue = "Terraform"; + private const string PuppetValue = "Puppet"; + private const string ChefValue = "Chef"; + private const string SDKValue = "SDK"; + private const string AnsibleValue = "Ansible"; + private const string ARMValue = "ARM"; + private const string PortalValue = "Portal"; + private const string ShellValue = "Shell"; + private const string OtherValue = "Other"; + + /// If communication toolset is Terraform. + public static Toolset Terraform { get; } = new Toolset(TerraformValue); + /// If communication toolset is Puppet. + public static Toolset Puppet { get; } = new Toolset(PuppetValue); + /// If communication toolset is Chef. + public static Toolset Chef { get; } = new Toolset(ChefValue); + /// If communication toolset is SDK. + public static Toolset SDK { get; } = new Toolset(SDKValue); + /// If communication toolset is Ansible. + public static Toolset Ansible { get; } = new Toolset(AnsibleValue); + /// If communication toolset is ARM. + public static Toolset ARM { get; } = new Toolset(ARMValue); + /// If communication toolset is Portal. + public static Toolset Portal { get; } = new Toolset(PortalValue); + /// If communication toolset is Shell. + public static Toolset Shell { get; } = new Toolset(ShellValue); + /// If communication toolset is Other. + public static Toolset Other { get; } = new Toolset(OtherValue); + /// Determines if two values are the same. + public static bool operator ==(Toolset left, Toolset right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(Toolset left, Toolset right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator Toolset(string value) => new Toolset(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is Toolset other && Equals(other); + /// + public bool Equals(Toolset other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Workload.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Workload.Serialization.cs new file mode 100644 index 0000000000000..cb2a495f8944f --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Workload.Serialization.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Impact.Models +{ + public partial class Workload : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Workload)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(Context)) + { + writer.WritePropertyName("context"u8); + writer.WriteStringValue(Context); + } + if (Optional.IsDefined(Toolset)) + { + writer.WritePropertyName("toolset"u8); + writer.WriteStringValue(Toolset.Value.ToString()); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + Workload IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Workload)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWorkload(document.RootElement, options); + } + + internal static Workload DeserializeWorkload(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string context = default; + Toolset? toolset = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("context"u8)) + { + context = property.Value.GetString(); + continue; + } + if (property.NameEquals("toolset"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + toolset = new Toolset(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Workload(context, toolset, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(Workload)} does not support writing '{options.Format}' format."); + } + } + + Workload IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeWorkload(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Workload)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Workload.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Workload.cs new file mode 100644 index 0000000000000..3b5b53f963fd1 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/Workload.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Impact.Models +{ + /// Information about the impacted workload. + public partial class Workload + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public Workload() + { + } + + /// Initializes a new instance of . + /// the scenario for the workload. + /// Tool used to interact with Azure. SDK, AzPortal, etc.., Other. + /// Keeps track of any properties unknown to the library. + internal Workload(string context, Toolset? toolset, IDictionary serializedAdditionalRawData) + { + Context = context; + Toolset = toolset; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// the scenario for the workload. + public string Context { get; set; } + /// Tool used to interact with Azure. SDK, AzPortal, etc.., Other. + public Toolset? Toolset { get; set; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/WorkloadImpactListResult.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/WorkloadImpactListResult.Serialization.cs new file mode 100644 index 0000000000000..9b353a76c468f --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/WorkloadImpactListResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Impact.Models +{ + internal partial class WorkloadImpactListResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(WorkloadImpactListResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink.AbsoluteUri); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + WorkloadImpactListResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(WorkloadImpactListResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadImpactListResult(document.RootElement, options); + } + + internal static WorkloadImpactListResult DeserializeWorkloadImpactListResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList value = default; + Uri nextLink = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(WorkloadImpactData.DeserializeWorkloadImpactData(item, options)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + nextLink = new Uri(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new WorkloadImpactListResult(value, nextLink, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(WorkloadImpactListResult)} does not support writing '{options.Format}' format."); + } + } + + WorkloadImpactListResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeWorkloadImpactListResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WorkloadImpactListResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/WorkloadImpactListResult.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/WorkloadImpactListResult.cs new file mode 100644 index 0000000000000..b9627f7ccd0f1 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/WorkloadImpactListResult.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.ResourceManager.Impact.Models +{ + /// The response of a WorkloadImpact list operation. + internal partial class WorkloadImpactListResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The WorkloadImpact items on this page. + /// is null. + internal WorkloadImpactListResult(IEnumerable value) + { + Argument.AssertNotNull(value, nameof(value)); + + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The WorkloadImpact items on this page. + /// The link to the next page of items. + /// Keeps track of any properties unknown to the library. + internal WorkloadImpactListResult(IReadOnlyList value, Uri nextLink, IDictionary serializedAdditionalRawData) + { + Value = value; + NextLink = nextLink; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal WorkloadImpactListResult() + { + } + + /// The WorkloadImpact items on this page. + public IReadOnlyList Value { get; } + /// The link to the next page of items. + public Uri NextLink { get; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/WorkloadImpactProperties.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/WorkloadImpactProperties.Serialization.cs new file mode 100644 index 0000000000000..517562547c881 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/WorkloadImpactProperties.Serialization.cs @@ -0,0 +1,378 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Impact.Models +{ + public partial class WorkloadImpactProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(WorkloadImpactProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && Optional.IsDefined(ProvisioningState)) + { + writer.WritePropertyName("provisioningState"u8); + writer.WriteStringValue(ProvisioningState.Value.ToString()); + } + writer.WritePropertyName("startDateTime"u8); + writer.WriteStringValue(StartOn, "O"); + if (Optional.IsDefined(EndOn)) + { + writer.WritePropertyName("endDateTime"u8); + writer.WriteStringValue(EndOn.Value, "O"); + } + writer.WritePropertyName("impactedResourceId"u8); + writer.WriteStringValue(ImpactedResourceId); + if (options.Format != "W" && Optional.IsDefined(ImpactUniqueId)) + { + writer.WritePropertyName("impactUniqueId"u8); + writer.WriteStringValue(ImpactUniqueId); + } + if (options.Format != "W" && Optional.IsDefined(ReportedTimeUtc)) + { + writer.WritePropertyName("reportedTimeUtc"u8); + writer.WriteStringValue(ReportedTimeUtc.Value, "O"); + } + writer.WritePropertyName("impactCategory"u8); + writer.WriteStringValue(ImpactCategory); + if (Optional.IsDefined(ImpactDescription)) + { + writer.WritePropertyName("impactDescription"u8); + writer.WriteStringValue(ImpactDescription); + } + if (Optional.IsCollectionDefined(ArmCorrelationIds)) + { + writer.WritePropertyName("armCorrelationIds"u8); + writer.WriteStartArray(); + foreach (var item in ArmCorrelationIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Performance)) + { + writer.WritePropertyName("performance"u8); + writer.WriteStartArray(); + foreach (var item in Performance) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Connectivity)) + { + writer.WritePropertyName("connectivity"u8); + writer.WriteObjectValue(Connectivity, options); + } + if (Optional.IsDefined(AdditionalProperties)) + { + writer.WritePropertyName("additionalProperties"u8); + writer.WriteObjectValue(AdditionalProperties, options); + } + if (Optional.IsDefined(ErrorDetails)) + { + writer.WritePropertyName("errorDetails"u8); + writer.WriteObjectValue(ErrorDetails, options); + } + if (Optional.IsDefined(Workload)) + { + writer.WritePropertyName("workload"u8); + writer.WriteObjectValue(Workload, options); + } + if (Optional.IsDefined(ImpactGroupId)) + { + writer.WritePropertyName("impactGroupId"u8); + writer.WriteStringValue(ImpactGroupId); + } + if (Optional.IsDefined(ConfidenceLevel)) + { + writer.WritePropertyName("confidenceLevel"u8); + writer.WriteStringValue(ConfidenceLevel.Value.ToString()); + } + if (Optional.IsDefined(ClientIncidentDetails)) + { + writer.WritePropertyName("clientIncidentDetails"u8); + writer.WriteObjectValue(ClientIncidentDetails, options); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + WorkloadImpactProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(WorkloadImpactProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadImpactProperties(document.RootElement, options); + } + + internal static WorkloadImpactProperties DeserializeWorkloadImpactProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ProvisioningState? provisioningState = default; + DateTimeOffset startDateTime = default; + DateTimeOffset? endDateTime = default; + string impactedResourceId = default; + string impactUniqueId = default; + DateTimeOffset? reportedTimeUtc = default; + string impactCategory = default; + string impactDescription = default; + IList armCorrelationIds = default; + IList performance = default; + Connectivity connectivity = default; + WorkloadImpactPropertiesAdditionalProperties additionalProperties = default; + ErrorDetailProperties errorDetails = default; + Workload workload = default; + string impactGroupId = default; + ConfidenceLevel? confidenceLevel = default; + ClientIncidentDetails clientIncidentDetails = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("provisioningState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + provisioningState = new ProvisioningState(property.Value.GetString()); + continue; + } + if (property.NameEquals("startDateTime"u8)) + { + startDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("endDateTime"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endDateTime = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("impactedResourceId"u8)) + { + impactedResourceId = property.Value.GetString(); + continue; + } + if (property.NameEquals("impactUniqueId"u8)) + { + impactUniqueId = property.Value.GetString(); + continue; + } + if (property.NameEquals("reportedTimeUtc"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + reportedTimeUtc = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("impactCategory"u8)) + { + impactCategory = property.Value.GetString(); + continue; + } + if (property.NameEquals("impactDescription"u8)) + { + impactDescription = property.Value.GetString(); + continue; + } + if (property.NameEquals("armCorrelationIds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + armCorrelationIds = array; + continue; + } + if (property.NameEquals("performance"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Models.Performance.DeserializePerformance(item, options)); + } + performance = array; + continue; + } + if (property.NameEquals("connectivity"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + connectivity = Connectivity.DeserializeConnectivity(property.Value, options); + continue; + } + if (property.NameEquals("additionalProperties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + additionalProperties = WorkloadImpactPropertiesAdditionalProperties.DeserializeWorkloadImpactPropertiesAdditionalProperties(property.Value, options); + continue; + } + if (property.NameEquals("errorDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + errorDetails = ErrorDetailProperties.DeserializeErrorDetailProperties(property.Value, options); + continue; + } + if (property.NameEquals("workload"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + workload = Workload.DeserializeWorkload(property.Value, options); + continue; + } + if (property.NameEquals("impactGroupId"u8)) + { + impactGroupId = property.Value.GetString(); + continue; + } + if (property.NameEquals("confidenceLevel"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + confidenceLevel = new ConfidenceLevel(property.Value.GetString()); + continue; + } + if (property.NameEquals("clientIncidentDetails"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + clientIncidentDetails = ClientIncidentDetails.DeserializeClientIncidentDetails(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new WorkloadImpactProperties( + provisioningState, + startDateTime, + endDateTime, + impactedResourceId, + impactUniqueId, + reportedTimeUtc, + impactCategory, + impactDescription, + armCorrelationIds ?? new ChangeTrackingList(), + performance ?? new ChangeTrackingList(), + connectivity, + additionalProperties, + errorDetails, + workload, + impactGroupId, + confidenceLevel, + clientIncidentDetails, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(WorkloadImpactProperties)} does not support writing '{options.Format}' format."); + } + } + + WorkloadImpactProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeWorkloadImpactProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WorkloadImpactProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/WorkloadImpactProperties.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/WorkloadImpactProperties.cs new file mode 100644 index 0000000000000..4c9e32b2bc87d --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/WorkloadImpactProperties.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Impact.Models +{ + /// Workload impact properties. + public partial class WorkloadImpactProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Time at which impact was observed. + /// Azure resource id of the impacted resource. + /// Category of the impact, details can found from /impactCategories API. + /// or is null. + public WorkloadImpactProperties(DateTimeOffset startOn, string impactedResourceId, string impactCategory) + { + Argument.AssertNotNull(impactedResourceId, nameof(impactedResourceId)); + Argument.AssertNotNull(impactCategory, nameof(impactCategory)); + + StartOn = startOn; + ImpactedResourceId = impactedResourceId; + ImpactCategory = impactCategory; + ArmCorrelationIds = new ChangeTrackingList(); + Performance = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// Resource provisioning state. + /// Time at which impact was observed. + /// Time at which impact has ended. + /// Azure resource id of the impacted resource. + /// Unique ID of the impact (UUID). + /// Time at which impact is reported. + /// Category of the impact, details can found from /impactCategories API. + /// A detailed description of the impact. + /// The ARM correlation ids, this is important field for control plane related impacts. + /// Details about performance issue. Applicable for performance impacts. + /// Details about connectivity issue. Applicable when root resource causing the issue is not identified. For example, when a VM is impacted due to a network issue, the impacted resource is identified as the VM, but the root cause is the network. In such cases, the connectivity field will have the details about the network issue. + /// Additional fields related to impact, applicable fields per resource type are list under /impactCategories API. + /// ARM error code and error message associated with the impact. + /// Information about the impacted workload. + /// Use this field to group impacts. + /// Degree of confidence on the impact being a platform issue. + /// Client incident details ex: incidentId , incident source. + /// Keeps track of any properties unknown to the library. + internal WorkloadImpactProperties(ProvisioningState? provisioningState, DateTimeOffset startOn, DateTimeOffset? endOn, string impactedResourceId, string impactUniqueId, DateTimeOffset? reportedTimeUtc, string impactCategory, string impactDescription, IList armCorrelationIds, IList performance, Connectivity connectivity, WorkloadImpactPropertiesAdditionalProperties additionalProperties, ErrorDetailProperties errorDetails, Workload workload, string impactGroupId, ConfidenceLevel? confidenceLevel, ClientIncidentDetails clientIncidentDetails, IDictionary serializedAdditionalRawData) + { + ProvisioningState = provisioningState; + StartOn = startOn; + EndOn = endOn; + ImpactedResourceId = impactedResourceId; + ImpactUniqueId = impactUniqueId; + ReportedTimeUtc = reportedTimeUtc; + ImpactCategory = impactCategory; + ImpactDescription = impactDescription; + ArmCorrelationIds = armCorrelationIds; + Performance = performance; + Connectivity = connectivity; + AdditionalProperties = additionalProperties; + ErrorDetails = errorDetails; + Workload = workload; + ImpactGroupId = impactGroupId; + ConfidenceLevel = confidenceLevel; + ClientIncidentDetails = clientIncidentDetails; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal WorkloadImpactProperties() + { + } + + /// Resource provisioning state. + public ProvisioningState? ProvisioningState { get; } + /// Time at which impact was observed. + public DateTimeOffset StartOn { get; set; } + /// Time at which impact has ended. + public DateTimeOffset? EndOn { get; set; } + /// Azure resource id of the impacted resource. + public string ImpactedResourceId { get; set; } + /// Unique ID of the impact (UUID). + public string ImpactUniqueId { get; } + /// Time at which impact is reported. + public DateTimeOffset? ReportedTimeUtc { get; } + /// Category of the impact, details can found from /impactCategories API. + public string ImpactCategory { get; set; } + /// A detailed description of the impact. + public string ImpactDescription { get; set; } + /// The ARM correlation ids, this is important field for control plane related impacts. + public IList ArmCorrelationIds { get; } + /// Details about performance issue. Applicable for performance impacts. + public IList Performance { get; } + /// Details about connectivity issue. Applicable when root resource causing the issue is not identified. For example, when a VM is impacted due to a network issue, the impacted resource is identified as the VM, but the root cause is the network. In such cases, the connectivity field will have the details about the network issue. + public Connectivity Connectivity { get; set; } + /// Additional fields related to impact, applicable fields per resource type are list under /impactCategories API. + public WorkloadImpactPropertiesAdditionalProperties AdditionalProperties { get; set; } + /// ARM error code and error message associated with the impact. + public ErrorDetailProperties ErrorDetails { get; set; } + /// Information about the impacted workload. + public Workload Workload { get; set; } + /// Use this field to group impacts. + public string ImpactGroupId { get; set; } + /// Degree of confidence on the impact being a platform issue. + public ConfidenceLevel? ConfidenceLevel { get; set; } + /// Client incident details ex: incidentId , incident source. + public ClientIncidentDetails ClientIncidentDetails { get; set; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/WorkloadImpactPropertiesAdditionalProperties.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/WorkloadImpactPropertiesAdditionalProperties.Serialization.cs new file mode 100644 index 0000000000000..9b6ff2a885820 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/WorkloadImpactPropertiesAdditionalProperties.Serialization.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Impact.Models +{ + public partial class WorkloadImpactPropertiesAdditionalProperties : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(WorkloadImpactPropertiesAdditionalProperties)} does not support writing '{format}' format."); + } + + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + WorkloadImpactPropertiesAdditionalProperties IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(WorkloadImpactPropertiesAdditionalProperties)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadImpactPropertiesAdditionalProperties(document.RootElement, options); + } + + internal static WorkloadImpactPropertiesAdditionalProperties DeserializeWorkloadImpactPropertiesAdditionalProperties(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new WorkloadImpactPropertiesAdditionalProperties(serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(WorkloadImpactPropertiesAdditionalProperties)} does not support writing '{options.Format}' format."); + } + } + + WorkloadImpactPropertiesAdditionalProperties IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeWorkloadImpactPropertiesAdditionalProperties(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WorkloadImpactPropertiesAdditionalProperties)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/WorkloadImpactPropertiesAdditionalProperties.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/WorkloadImpactPropertiesAdditionalProperties.cs new file mode 100644 index 0000000000000..76d8cc08cb9f6 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/Models/WorkloadImpactPropertiesAdditionalProperties.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.Impact.Models +{ + /// The WorkloadImpactPropertiesAdditionalProperties. + public partial class WorkloadImpactPropertiesAdditionalProperties + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public WorkloadImpactPropertiesAdditionalProperties() + { + } + + /// Initializes a new instance of . + /// Keeps track of any properties unknown to the library. + internal WorkloadImpactPropertiesAdditionalProperties(IDictionary serializedAdditionalRawData) + { + _serializedAdditionalRawData = serializedAdditionalRawData; + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ProviderConstants.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/ProviderConstants.cs new file mode 100644 index 0000000000000..0ca5a84868005 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/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.Impact +{ + internal static class ProviderConstants + { + public static string DefaultProviderNamespace { get; } = ClientDiagnostics.GetResourceProviderNamespace(typeof(ProviderConstants).Assembly); + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/RestOperations/ConnectorsRestOperations.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/RestOperations/ConnectorsRestOperations.cs new file mode 100644 index 0000000000000..2484225e2ec62 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/RestOperations/ConnectorsRestOperations.cs @@ -0,0 +1,533 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Impact.Models; + +namespace Azure.ResourceManager.Impact +{ + internal partial class ConnectorsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ConnectorsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public ConnectorsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2024-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string connectorName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Impact/connectors/", false); + uri.AppendPath(connectorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string connectorName) + { + 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.Impact/connectors/", false); + uri.AppendPath(connectorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a Connector. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the connector. + /// 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 connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var message = CreateGetRequest(subscriptionId, connectorName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ConnectorData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConnectorData.DeserializeConnectorData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ConnectorData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a Connector. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the connector. + /// 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 connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var message = CreateGetRequest(subscriptionId, connectorName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ConnectorData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConnectorData.DeserializeConnectorData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ConnectorData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateOrUpdateRequestUri(string subscriptionId, string connectorName, ConnectorData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Impact/connectors/", false); + uri.AppendPath(connectorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string subscriptionId, string connectorName, ConnectorData 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("/providers/Microsoft.Impact/connectors/", false); + uri.AppendPath(connectorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create a Connector. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the connector. + /// Resource create parameters. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task CreateOrUpdateAsync(string subscriptionId, string connectorName, ConnectorData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, connectorName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a Connector. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the connector. + /// Resource create parameters. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response CreateOrUpdate(string subscriptionId, string connectorName, ConnectorData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateOrUpdateRequest(subscriptionId, connectorName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateUpdateRequestUri(string subscriptionId, string connectorName, ConnectorData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Impact/connectors/", false); + uri.AppendPath(connectorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateUpdateRequest(string subscriptionId, string connectorName, ConnectorData data) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Impact/connectors/", false); + uri.AppendPath(connectorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Update a Connector. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the connector. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> UpdateAsync(string subscriptionId, string connectorName, ConnectorData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, connectorName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ConnectorData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConnectorData.DeserializeConnectorData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Update a Connector. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the connector. + /// The resource properties to be updated. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response Update(string subscriptionId, string connectorName, ConnectorData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateUpdateRequest(subscriptionId, connectorName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ConnectorData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConnectorData.DeserializeConnectorData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string connectorName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Impact/connectors/", false); + uri.AppendPath(connectorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string connectorName) + { + 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("/providers/Microsoft.Impact/connectors/", false); + uri.AppendPath(connectorName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a Connector. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the connector. + /// 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 connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var message = CreateDeleteRequest(subscriptionId, connectorName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a Connector. + /// The ID of the target subscription. The value must be an UUID. + /// The name of the connector. + /// 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 connectorName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(connectorName, nameof(connectorName)); + + using var message = CreateDeleteRequest(subscriptionId, connectorName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Impact/connectors", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Impact/connectors", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Connector resources by subscription ID. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ConnectorListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConnectorListResult.DeserializeConnectorListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Connector resources by subscription ID. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ConnectorListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConnectorListResult.DeserializeConnectorListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Connector resources by subscription ID. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ConnectorListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ConnectorListResult.DeserializeConnectorListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Connector resources by subscription ID. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ConnectorListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ConnectorListResult.DeserializeConnectorListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/RestOperations/ImpactCategoriesRestOperations.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/RestOperations/ImpactCategoriesRestOperations.cs new file mode 100644 index 0000000000000..e3b3f673157c1 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/RestOperations/ImpactCategoriesRestOperations.cs @@ -0,0 +1,305 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Impact.Models; + +namespace Azure.ResourceManager.Impact +{ + internal partial class ImpactCategoriesRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of ImpactCategoriesRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public ImpactCategoriesRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2024-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string impactCategoryName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Impact/impactCategories/", false); + uri.AppendPath(impactCategoryName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string impactCategoryName) + { + 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.Impact/impactCategories/", false); + uri.AppendPath(impactCategoryName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a ImpactCategory. + /// The ID of the target subscription. The value must be an UUID. + /// Name of the impact category. + /// 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 impactCategoryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(impactCategoryName, nameof(impactCategoryName)); + + using var message = CreateGetRequest(subscriptionId, impactCategoryName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ImpactCategoryData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ImpactCategoryData.DeserializeImpactCategoryData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ImpactCategoryData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a ImpactCategory. + /// The ID of the target subscription. The value must be an UUID. + /// Name of the impact category. + /// 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 impactCategoryName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(impactCategoryName, nameof(impactCategoryName)); + + using var message = CreateGetRequest(subscriptionId, impactCategoryName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ImpactCategoryData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ImpactCategoryData.DeserializeImpactCategoryData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((ImpactCategoryData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId, string categoryName, string resourceType) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Impact/impactCategories", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (categoryName != null) + { + uri.AppendQuery("categoryName", categoryName, true); + } + if (resourceType != null) + { + uri.AppendQuery("resourceType", resourceType, true); + } + return uri; + } + + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, string categoryName, string resourceType) + { + 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.Impact/impactCategories", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (categoryName != null) + { + uri.AppendQuery("categoryName", categoryName, true); + } + if (resourceType != null) + { + uri.AppendQuery("resourceType", resourceType, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List ImpactCategory resources by subscription. + /// The ID of the target subscription. The value must be an UUID. + /// Filter by category name. + /// Filter by resource type. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, string categoryName = null, string resourceType = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId, categoryName, resourceType); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ImpactCategoryListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ImpactCategoryListResult.DeserializeImpactCategoryListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List ImpactCategory resources by subscription. + /// The ID of the target subscription. The value must be an UUID. + /// Filter by category name. + /// Filter by resource type. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, string categoryName = null, string resourceType = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId, categoryName, resourceType); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ImpactCategoryListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ImpactCategoryListResult.DeserializeImpactCategoryListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId, string categoryName, string resourceType) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId, string categoryName, string resourceType) + { + 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 ImpactCategory resources by subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// Filter by category name. + /// Filter by resource type. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, string categoryName = null, string resourceType = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, categoryName, resourceType); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + ImpactCategoryListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = ImpactCategoryListResult.DeserializeImpactCategoryListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List ImpactCategory resources by subscription. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// Filter by category name. + /// Filter by resource type. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, string categoryName = null, string resourceType = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, categoryName, resourceType); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + ImpactCategoryListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = ImpactCategoryListResult.DeserializeImpactCategoryListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/RestOperations/InsightsRestOperations.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/RestOperations/InsightsRestOperations.cs new file mode 100644 index 0000000000000..c689076b53468 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/RestOperations/InsightsRestOperations.cs @@ -0,0 +1,487 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Impact.Models; + +namespace Azure.ResourceManager.Impact +{ + internal partial class InsightsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of InsightsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public InsightsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2024-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string workloadImpactName, string insightName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Impact/workloadImpacts/", false); + uri.AppendPath(workloadImpactName, true); + uri.AppendPath("/insights/", false); + uri.AppendPath(insightName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string workloadImpactName, string insightName) + { + 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.Impact/workloadImpacts/", false); + uri.AppendPath(workloadImpactName, true); + uri.AppendPath("/insights/", false); + uri.AppendPath(insightName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get Insight resources by workloadImpactName and insightName. + /// The ID of the target subscription. The value must be an UUID. + /// workloadImpact resource. + /// Name of the insight. + /// 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 workloadImpactName, string insightName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + Argument.AssertNotNullOrEmpty(insightName, nameof(insightName)); + + using var message = CreateGetRequest(subscriptionId, workloadImpactName, insightName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + InsightData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = InsightData.DeserializeInsightData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((InsightData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get Insight resources by workloadImpactName and insightName. + /// The ID of the target subscription. The value must be an UUID. + /// workloadImpact resource. + /// Name of the insight. + /// 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 workloadImpactName, string insightName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + Argument.AssertNotNullOrEmpty(insightName, nameof(insightName)); + + using var message = CreateGetRequest(subscriptionId, workloadImpactName, insightName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + InsightData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = InsightData.DeserializeInsightData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((InsightData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId, string workloadImpactName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Impact/workloadImpacts/", false); + uri.AppendPath(workloadImpactName, true); + uri.AppendPath("/insights", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId, string workloadImpactName) + { + 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.Impact/workloadImpacts/", false); + uri.AppendPath(workloadImpactName, true); + uri.AppendPath("/insights", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List Insight resources by workloadImpactName. + /// The ID of the target subscription. The value must be an UUID. + /// workloadImpact resource. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, string workloadImpactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + + using var message = CreateListBySubscriptionRequest(subscriptionId, workloadImpactName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + InsightListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = InsightListResult.DeserializeInsightListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Insight resources by workloadImpactName. + /// The ID of the target subscription. The value must be an UUID. + /// workloadImpact resource. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, string workloadImpactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + + using var message = CreateListBySubscriptionRequest(subscriptionId, workloadImpactName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + InsightListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = InsightListResult.DeserializeInsightListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string workloadImpactName, string insightName, InsightData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Impact/workloadImpacts/", false); + uri.AppendPath(workloadImpactName, true); + uri.AppendPath("/insights/", false); + uri.AppendPath(insightName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateRequest(string subscriptionId, string workloadImpactName, string insightName, InsightData 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("/providers/Microsoft.Impact/workloadImpacts/", false); + uri.AppendPath(workloadImpactName, true); + uri.AppendPath("/insights/", false); + uri.AppendPath(insightName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create Insight resource, This is Admin only operation. + /// The ID of the target subscription. The value must be an UUID. + /// workloadImpact resource. + /// Name of the insight. + /// Resource create parameters. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public async Task> CreateAsync(string subscriptionId, string workloadImpactName, string insightName, InsightData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + Argument.AssertNotNullOrEmpty(insightName, nameof(insightName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, workloadImpactName, insightName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + { + InsightData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = InsightData.DeserializeInsightData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create Insight resource, This is Admin only operation. + /// The ID of the target subscription. The value must be an UUID. + /// workloadImpact resource. + /// Name of the insight. + /// Resource create parameters. + /// The cancellation token to use. + /// , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public Response Create(string subscriptionId, string workloadImpactName, string insightName, InsightData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + Argument.AssertNotNullOrEmpty(insightName, nameof(insightName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, workloadImpactName, insightName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + { + InsightData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = InsightData.DeserializeInsightData(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string workloadImpactName, string insightName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Impact/workloadImpacts/", false); + uri.AppendPath(workloadImpactName, true); + uri.AppendPath("/insights/", false); + uri.AppendPath(insightName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string workloadImpactName, string insightName) + { + 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("/providers/Microsoft.Impact/workloadImpacts/", false); + uri.AppendPath(workloadImpactName, true); + uri.AppendPath("/insights/", false); + uri.AppendPath(insightName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete Insight resource, This is Admin only operation. + /// The ID of the target subscription. The value must be an UUID. + /// workloadImpact resource. + /// Name of the insight. + /// 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 workloadImpactName, string insightName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + Argument.AssertNotNullOrEmpty(insightName, nameof(insightName)); + + using var message = CreateDeleteRequest(subscriptionId, workloadImpactName, insightName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete Insight resource, This is Admin only operation. + /// The ID of the target subscription. The value must be an UUID. + /// workloadImpact resource. + /// Name of the insight. + /// 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 workloadImpactName, string insightName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + Argument.AssertNotNullOrEmpty(insightName, nameof(insightName)); + + using var message = CreateDeleteRequest(subscriptionId, workloadImpactName, insightName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId, string workloadImpactName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId, string workloadImpactName) + { + 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 Insight resources by workloadImpactName. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// workloadImpact resource. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, string workloadImpactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, workloadImpactName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + InsightListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = InsightListResult.DeserializeInsightListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List Insight resources by workloadImpactName. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// workloadImpact resource. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, string workloadImpactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId, workloadImpactName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + InsightListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = InsightListResult.DeserializeInsightListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/RestOperations/WorkloadImpactsRestOperations.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/RestOperations/WorkloadImpactsRestOperations.cs new file mode 100644 index 0000000000000..db1d0a5622bed --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/RestOperations/WorkloadImpactsRestOperations.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.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Impact.Models; + +namespace Azure.ResourceManager.Impact +{ + internal partial class WorkloadImpactsRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of WorkloadImpactsRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// Service host. + /// The API version to use for this operation. + /// or is null. + public WorkloadImpactsRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2024-05-01-preview"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal RequestUriBuilder CreateCreateRequestUri(string subscriptionId, string workloadImpactName, WorkloadImpactData data) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Impact/workloadImpacts/", false); + uri.AppendPath(workloadImpactName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateCreateRequest(string subscriptionId, string workloadImpactName, WorkloadImpactData 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("/providers/Microsoft.Impact/workloadImpacts/", false); + uri.AppendPath(workloadImpactName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(data, ModelSerializationExtensions.WireOptions); + request.Content = content; + _userAgent.Apply(message); + return message; + } + + /// Create a WorkloadImpact. + /// The ID of the target subscription. The value must be an UUID. + /// workloadImpact resource. + /// Resource create parameters. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task CreateAsync(string subscriptionId, string workloadImpactName, WorkloadImpactData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, workloadImpactName, data); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Create a WorkloadImpact. + /// The ID of the target subscription. The value must be an UUID. + /// workloadImpact resource. + /// Resource create parameters. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response Create(string subscriptionId, string workloadImpactName, WorkloadImpactData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + Argument.AssertNotNull(data, nameof(data)); + + using var message = CreateCreateRequest(subscriptionId, workloadImpactName, data); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 201: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateGetRequestUri(string subscriptionId, string workloadImpactName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Impact/workloadImpacts/", false); + uri.AppendPath(workloadImpactName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateGetRequest(string subscriptionId, string workloadImpactName) + { + 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.Impact/workloadImpacts/", false); + uri.AppendPath(workloadImpactName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a WorkloadImpact. + /// The ID of the target subscription. The value must be an UUID. + /// workloadImpact resource. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> GetAsync(string subscriptionId, string workloadImpactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + + using var message = CreateGetRequest(subscriptionId, workloadImpactName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadImpactData value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadImpactData.DeserializeWorkloadImpactData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((WorkloadImpactData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a WorkloadImpact. + /// The ID of the target subscription. The value must be an UUID. + /// workloadImpact resource. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response Get(string subscriptionId, string workloadImpactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + + using var message = CreateGetRequest(subscriptionId, workloadImpactName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadImpactData value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadImpactData.DeserializeWorkloadImpactData(document.RootElement); + return Response.FromValue(value, message.Response); + } + case 404: + return Response.FromValue((WorkloadImpactData)null, message.Response); + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateDeleteRequestUri(string subscriptionId, string workloadImpactName) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Impact/workloadImpacts/", false); + uri.AppendPath(workloadImpactName, true); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateDeleteRequest(string subscriptionId, string workloadImpactName) + { + 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("/providers/Microsoft.Impact/workloadImpacts/", false); + uri.AppendPath(workloadImpactName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Delete a WorkloadImpact. + /// The ID of the target subscription. The value must be an UUID. + /// workloadImpact resource. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task DeleteAsync(string subscriptionId, string workloadImpactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + + using var message = CreateDeleteRequest(subscriptionId, workloadImpactName); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Delete a WorkloadImpact. + /// The ID of the target subscription. The value must be an UUID. + /// workloadImpact resource. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + public Response Delete(string subscriptionId, string workloadImpactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + + using var message = CreateDeleteRequest(subscriptionId, workloadImpactName); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + case 204: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionRequestUri(string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Impact/workloadImpacts", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateListBySubscriptionRequest(string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.Impact/workloadImpacts", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List WorkloadImpact resources by subscription ID. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionAsync(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadImpactListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadImpactListResult.DeserializeWorkloadImpactListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List WorkloadImpact resources by subscription ID. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscription(string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionRequest(subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadImpactListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadImpactListResult.DeserializeWorkloadImpactListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateListBySubscriptionNextPageRequestUri(string nextLink, string subscriptionId) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + return uri; + } + + internal HttpMessage CreateListBySubscriptionNextPageRequest(string nextLink, string subscriptionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// List WorkloadImpact resources by subscription ID. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public async Task> ListBySubscriptionNextPageAsync(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + WorkloadImpactListResult value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = WorkloadImpactListResult.DeserializeWorkloadImpactListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// List WorkloadImpact resources by subscription ID. + /// The URL to the next page of results. + /// The ID of the target subscription. The value must be an UUID. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + public Response ListBySubscriptionNextPage(string nextLink, string subscriptionId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + + using var message = CreateListBySubscriptionNextPageRequest(nextLink, subscriptionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + WorkloadImpactListResult value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = WorkloadImpactListResult.DeserializeWorkloadImpactListResult(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/WorkloadImpactCollection.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/WorkloadImpactCollection.cs new file mode 100644 index 0000000000000..cb8f05e5209bd --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/WorkloadImpactCollection.cs @@ -0,0 +1,494 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections; +using System.Collections.Generic; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.Impact +{ + /// + /// 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 GetWorkloadImpacts method from an instance of . + /// + public partial class WorkloadImpactCollection : ArmCollection, IEnumerable, IAsyncEnumerable + { + private readonly ClientDiagnostics _workloadImpactClientDiagnostics; + private readonly WorkloadImpactsRestOperations _workloadImpactRestClient; + + /// Initializes a new instance of the class for mocking. + protected WorkloadImpactCollection() + { + } + + /// 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 WorkloadImpactCollection(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _workloadImpactClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Impact", WorkloadImpactResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(WorkloadImpactResource.ResourceType, out string workloadImpactApiVersion); + _workloadImpactRestClient = new WorkloadImpactsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workloadImpactApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + internal static void ValidateResourceId(ResourceIdentifier id) + { + if (id.ResourceType != SubscriptionResource.ResourceType) + throw new ArgumentException(string.Format(CultureInfo.CurrentCulture, "Invalid resource type {0} expected {1}", id.ResourceType, SubscriptionResource.ResourceType), nameof(id)); + } + + /// + /// Create a WorkloadImpact + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Create + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// workloadImpact resource. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> CreateOrUpdateAsync(WaitUntil waitUntil, string workloadImpactName, WorkloadImpactData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _workloadImpactClientDiagnostics.CreateScope("WorkloadImpactCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = await _workloadImpactRestClient.CreateAsync(Id.SubscriptionId, workloadImpactName, data, cancellationToken).ConfigureAwait(false); + var operation = new ImpactArmOperation(new WorkloadImpactOperationSource(Client), _workloadImpactClientDiagnostics, Pipeline, _workloadImpactRestClient.CreateCreateRequest(Id.SubscriptionId, workloadImpactName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a WorkloadImpact + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Create + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// workloadImpact resource. + /// Resource create parameters. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual ArmOperation CreateOrUpdate(WaitUntil waitUntil, string workloadImpactName, WorkloadImpactData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _workloadImpactClientDiagnostics.CreateScope("WorkloadImpactCollection.CreateOrUpdate"); + scope.Start(); + try + { + var response = _workloadImpactRestClient.Create(Id.SubscriptionId, workloadImpactName, data, cancellationToken); + var operation = new ImpactArmOperation(new WorkloadImpactOperationSource(Client), _workloadImpactClientDiagnostics, Pipeline, _workloadImpactRestClient.CreateCreateRequest(Id.SubscriptionId, workloadImpactName, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletion(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a WorkloadImpact + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// workloadImpact resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetAsync(string workloadImpactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + + using var scope = _workloadImpactClientDiagnostics.CreateScope("WorkloadImpactCollection.Get"); + scope.Start(); + try + { + var response = await _workloadImpactRestClient.GetAsync(Id.SubscriptionId, workloadImpactName, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkloadImpactResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a WorkloadImpact + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// workloadImpact resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Get(string workloadImpactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + + using var scope = _workloadImpactClientDiagnostics.CreateScope("WorkloadImpactCollection.Get"); + scope.Start(); + try + { + var response = _workloadImpactRestClient.Get(Id.SubscriptionId, workloadImpactName, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkloadImpactResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// List WorkloadImpact resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts + /// + /// + /// Operation Id + /// WorkloadImpact_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetAllAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadImpactRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadImpactRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => new WorkloadImpactResource(Client, WorkloadImpactData.DeserializeWorkloadImpactData(e)), _workloadImpactClientDiagnostics, Pipeline, "WorkloadImpactCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// List WorkloadImpact resources by subscription ID + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts + /// + /// + /// Operation Id + /// WorkloadImpact_ListBySubscription + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetAll(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _workloadImpactRestClient.CreateListBySubscriptionRequest(Id.SubscriptionId); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _workloadImpactRestClient.CreateListBySubscriptionNextPageRequest(nextLink, Id.SubscriptionId); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => new WorkloadImpactResource(Client, WorkloadImpactData.DeserializeWorkloadImpactData(e)), _workloadImpactClientDiagnostics, Pipeline, "WorkloadImpactCollection.GetAll", "value", "nextLink", cancellationToken); + } + + /// + /// Checks to see if the resource exists in azure. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// workloadImpact resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> ExistsAsync(string workloadImpactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + + using var scope = _workloadImpactClientDiagnostics.CreateScope("WorkloadImpactCollection.Exists"); + scope.Start(); + try + { + var response = await _workloadImpactRestClient.GetAsync(Id.SubscriptionId, workloadImpactName, 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}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// workloadImpact resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual Response Exists(string workloadImpactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + + using var scope = _workloadImpactClientDiagnostics.CreateScope("WorkloadImpactCollection.Exists"); + scope.Start(); + try + { + var response = _workloadImpactRestClient.Get(Id.SubscriptionId, workloadImpactName, 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}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// workloadImpact resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual async Task> GetIfExistsAsync(string workloadImpactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + + using var scope = _workloadImpactClientDiagnostics.CreateScope("WorkloadImpactCollection.GetIfExists"); + scope.Start(); + try + { + var response = await _workloadImpactRestClient.GetAsync(Id.SubscriptionId, workloadImpactName, cancellationToken: cancellationToken).ConfigureAwait(false); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkloadImpactResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Tries to get details for this resource from the service. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// workloadImpact resource. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// is null. + public virtual NullableResponse GetIfExists(string workloadImpactName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workloadImpactName, nameof(workloadImpactName)); + + using var scope = _workloadImpactClientDiagnostics.CreateScope("WorkloadImpactCollection.GetIfExists"); + scope.Start(); + try + { + var response = _workloadImpactRestClient.Get(Id.SubscriptionId, workloadImpactName, cancellationToken: cancellationToken); + if (response.Value == null) + return new NoValueResponse(response.GetRawResponse()); + return Response.FromValue(new WorkloadImpactResource(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/impactreporting/Azure.ResourceManager.Impact/src/Generated/WorkloadImpactData.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/WorkloadImpactData.Serialization.cs new file mode 100644 index 0000000000000..5b69e5972a4d2 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/WorkloadImpactData.Serialization.cs @@ -0,0 +1,155 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; +using Azure.ResourceManager.Impact.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Impact +{ + public partial class WorkloadImpactData : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(WorkloadImpactData)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Properties)) + { + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties, options); + } + } + + WorkloadImpactData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(WorkloadImpactData)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWorkloadImpactData(document.RootElement, options); + } + + internal static WorkloadImpactData DeserializeWorkloadImpactData(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + WorkloadImpactProperties properties = default; + ResourceIdentifier id = default; + string name = default; + ResourceType type = default; + SystemData systemData = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + properties = WorkloadImpactProperties.DeserializeWorkloadImpactProperties(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = new ResourceIdentifier(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = new ResourceType(property.Value.GetString()); + continue; + } + if (property.NameEquals("systemData"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + systemData = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new WorkloadImpactData( + id, + name, + type, + systemData, + properties, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(WorkloadImpactData)} does not support writing '{options.Format}' format."); + } + } + + WorkloadImpactData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeWorkloadImpactData(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WorkloadImpactData)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/WorkloadImpactData.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/WorkloadImpactData.cs new file mode 100644 index 0000000000000..b6a1afe4e882f --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/WorkloadImpactData.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; +using Azure.ResourceManager.Impact.Models; +using Azure.ResourceManager.Models; + +namespace Azure.ResourceManager.Impact +{ + /// + /// A class representing the WorkloadImpact data model. + /// Workload Impact properties + /// + public partial class WorkloadImpactData : ResourceData + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public WorkloadImpactData() + { + } + + /// Initializes a new instance of . + /// The id. + /// The name. + /// The resourceType. + /// The systemData. + /// The resource-specific properties for this resource. + /// Keeps track of any properties unknown to the library. + internal WorkloadImpactData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, WorkloadImpactProperties properties, IDictionary serializedAdditionalRawData) : base(id, name, resourceType, systemData) + { + Properties = properties; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The resource-specific properties for this resource. + public WorkloadImpactProperties Properties { get; set; } + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/WorkloadImpactResource.Serialization.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/WorkloadImpactResource.Serialization.cs new file mode 100644 index 0000000000000..4257d9be48921 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/WorkloadImpactResource.Serialization.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; + +namespace Azure.ResourceManager.Impact +{ + public partial class WorkloadImpactResource : IJsonModel + { + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) => ((IJsonModel)Data).Write(writer, options); + + WorkloadImpactData IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) => ((IJsonModel)Data).Create(ref reader, options); + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) => ModelReaderWriter.Write(Data, options); + + WorkloadImpactData IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) => ModelReaderWriter.Read(data, options); + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => ((IPersistableModel)Data).GetFormatFromOptions(options); + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/WorkloadImpactResource.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/WorkloadImpactResource.cs new file mode 100644 index 0000000000000..3972d56e68ec7 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Generated/WorkloadImpactResource.cs @@ -0,0 +1,419 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Globalization; +using System.Threading; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Resources; + +namespace Azure.ResourceManager.Impact +{ + /// + /// A Class representing a WorkloadImpact 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 GetWorkloadImpactResource method. + /// Otherwise you can get one from its parent resource using the GetWorkloadImpact method. + /// + public partial class WorkloadImpactResource : ArmResource + { + /// Generate the resource identifier of a instance. + /// The subscriptionId. + /// The workloadImpactName. + public static ResourceIdentifier CreateResourceIdentifier(string subscriptionId, string workloadImpactName) + { + var resourceId = $"/subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}"; + return new ResourceIdentifier(resourceId); + } + + private readonly ClientDiagnostics _workloadImpactClientDiagnostics; + private readonly WorkloadImpactsRestOperations _workloadImpactRestClient; + private readonly WorkloadImpactData _data; + + /// Gets the resource type for the operations. + public static readonly ResourceType ResourceType = "Microsoft.Impact/workloadImpacts"; + + /// Initializes a new instance of the class for mocking. + protected WorkloadImpactResource() + { + } + + /// Initializes a new instance of the class. + /// The client parameters to use in these operations. + /// The resource that is the target of operations. + internal WorkloadImpactResource(ArmClient client, WorkloadImpactData 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 WorkloadImpactResource(ArmClient client, ResourceIdentifier id) : base(client, id) + { + _workloadImpactClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Impact", ResourceType.Namespace, Diagnostics); + TryGetApiVersion(ResourceType, out string workloadImpactApiVersion); + _workloadImpactRestClient = new WorkloadImpactsRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, workloadImpactApiVersion); +#if DEBUG + ValidateResourceId(Id); +#endif + } + + /// Gets whether or not the current instance has data. + public virtual bool HasData { get; } + + /// Gets the data representing this Feature. + /// Throws if there is no data loaded in the current instance. + public virtual WorkloadImpactData 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 InsightResources in the WorkloadImpact. + /// An object representing collection of InsightResources and their operations over a InsightResource. + public virtual InsightCollection GetInsights() + { + return GetCachedClient(client => new InsightCollection(client, Id)); + } + + /// + /// Get Insight resources by workloadImpactName and insightName + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName} + /// + /// + /// Operation Id + /// Insight_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the insight. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual async Task> GetInsightAsync(string insightName, CancellationToken cancellationToken = default) + { + return await GetInsights().GetAsync(insightName, cancellationToken).ConfigureAwait(false); + } + + /// + /// Get Insight resources by workloadImpactName and insightName + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName}/insights/{insightName} + /// + /// + /// Operation Id + /// Insight_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// Name of the insight. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + [ForwardsClientCalls] + public virtual Response GetInsight(string insightName, CancellationToken cancellationToken = default) + { + return GetInsights().Get(insightName, cancellationToken); + } + + /// + /// Get a WorkloadImpact + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual async Task> GetAsync(CancellationToken cancellationToken = default) + { + using var scope = _workloadImpactClientDiagnostics.CreateScope("WorkloadImpactResource.Get"); + scope.Start(); + try + { + var response = await _workloadImpactRestClient.GetAsync(Id.SubscriptionId, Id.Name, cancellationToken).ConfigureAwait(false); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkloadImpactResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a WorkloadImpact + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Get + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// The cancellation token to use. + public virtual Response Get(CancellationToken cancellationToken = default) + { + using var scope = _workloadImpactClientDiagnostics.CreateScope("WorkloadImpactResource.Get"); + scope.Start(); + try + { + var response = _workloadImpactRestClient.Get(Id.SubscriptionId, Id.Name, cancellationToken); + if (response.Value == null) + throw new RequestFailedException(response.GetRawResponse()); + return Response.FromValue(new WorkloadImpactResource(Client, response.Value), response.GetRawResponse()); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a WorkloadImpact + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Delete + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual async Task DeleteAsync(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _workloadImpactClientDiagnostics.CreateScope("WorkloadImpactResource.Delete"); + scope.Start(); + try + { + var response = await _workloadImpactRestClient.DeleteAsync(Id.SubscriptionId, Id.Name, cancellationToken).ConfigureAwait(false); + var uri = _workloadImpactRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new ImpactArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionResponseAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Delete a WorkloadImpact + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Delete + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// The cancellation token to use. + public virtual ArmOperation Delete(WaitUntil waitUntil, CancellationToken cancellationToken = default) + { + using var scope = _workloadImpactClientDiagnostics.CreateScope("WorkloadImpactResource.Delete"); + scope.Start(); + try + { + var response = _workloadImpactRestClient.Delete(Id.SubscriptionId, Id.Name, cancellationToken); + var uri = _workloadImpactRestClient.CreateDeleteRequestUri(Id.SubscriptionId, Id.Name); + var rehydrationToken = NextLinkOperationImplementation.GetRehydrationToken(RequestMethod.Delete, uri.ToUri(), uri.ToString(), "None", null, OperationFinalStateVia.OriginalUri.ToString()); + var operation = new ImpactArmOperation(response, rehydrationToken); + if (waitUntil == WaitUntil.Completed) + operation.WaitForCompletionResponse(cancellationToken); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a WorkloadImpact + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Create + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual async Task> UpdateAsync(WaitUntil waitUntil, WorkloadImpactData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _workloadImpactClientDiagnostics.CreateScope("WorkloadImpactResource.Update"); + scope.Start(); + try + { + var response = await _workloadImpactRestClient.CreateAsync(Id.SubscriptionId, Id.Name, data, cancellationToken).ConfigureAwait(false); + var operation = new ImpactArmOperation(new WorkloadImpactOperationSource(Client), _workloadImpactClientDiagnostics, Pipeline, _workloadImpactRestClient.CreateCreateRequest(Id.SubscriptionId, Id.Name, data).Request, response, OperationFinalStateVia.AzureAsyncOperation); + if (waitUntil == WaitUntil.Completed) + await operation.WaitForCompletionAsync(cancellationToken).ConfigureAwait(false); + return operation; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Create a WorkloadImpact + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.Impact/workloadImpacts/{workloadImpactName} + /// + /// + /// Operation Id + /// WorkloadImpact_Create + /// + /// + /// Default Api Version + /// 2024-05-01-preview + /// + /// + /// Resource + /// + /// + /// + /// + /// if the method should wait to return until the long-running operation has completed on the service; if it should return after starting the operation. For more information on long-running operations, please see Azure.Core Long-Running Operation samples. + /// Resource create parameters. + /// The cancellation token to use. + /// is null. + public virtual ArmOperation Update(WaitUntil waitUntil, WorkloadImpactData data, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(data, nameof(data)); + + using var scope = _workloadImpactClientDiagnostics.CreateScope("WorkloadImpactResource.Update"); + scope.Start(); + try + { + var response = _workloadImpactRestClient.Create(Id.SubscriptionId, Id.Name, data, cancellationToken); + var operation = new ImpactArmOperation(new WorkloadImpactOperationSource(Client), _workloadImpactClientDiagnostics, Pipeline, _workloadImpactRestClient.CreateCreateRequest(Id.SubscriptionId, 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/impactreporting/Azure.ResourceManager.Impact/src/Properties/AssemblyInfo.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Properties/AssemblyInfo.cs new file mode 100644 index 0000000000000..f65883389364d --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/src/Properties/AssemblyInfo.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Runtime.CompilerServices; + +[assembly: InternalsVisibleTo("Azure.ResourceManager.Impact.Tests, PublicKey = 0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] + +// Replace Microsoft.Test with the correct resource provider namepace for your service and uncomment. +// See https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-services-resource-providers +// for the list of possible values. +[assembly: Azure.Core.AzureResourceProviderNamespace("Impact")] diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/tests/Azure.ResourceManager.Impact.Tests.csproj b/sdk/impactreporting/Azure.ResourceManager.Impact/tests/Azure.ResourceManager.Impact.Tests.csproj new file mode 100644 index 0000000000000..e4c4af70c6c70 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/tests/Azure.ResourceManager.Impact.Tests.csproj @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/tests/ImpactManagementTestBase.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/tests/ImpactManagementTestBase.cs new file mode 100644 index 0000000000000..0ed6c12fefb17 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/tests/ImpactManagementTestBase.cs @@ -0,0 +1,45 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure; +using Azure.Core; +using Azure.Core.TestFramework; +using Azure.ResourceManager; +using Azure.ResourceManager.Resources; +using Azure.ResourceManager.TestFramework; +using NUnit.Framework; +using System.Threading.Tasks; + +namespace Azure.ResourceManager.Impact.Tests +{ + public class ImpactManagementTestBase : ManagementRecordedTestBase + { + protected ArmClient Client { get; private set; } + protected SubscriptionResource DefaultSubscription { get; private set; } + + protected ImpactManagementTestBase(bool isAsync, RecordedTestMode mode) + : base(isAsync, mode) + { + } + + protected ImpactManagementTestBase(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/impactreporting/Azure.ResourceManager.Impact/tests/ImpactManagementTestEnvironment.cs b/sdk/impactreporting/Azure.ResourceManager.Impact/tests/ImpactManagementTestEnvironment.cs new file mode 100644 index 0000000000000..99d10052d9eae --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/tests/ImpactManagementTestEnvironment.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core.TestFramework; + +namespace Azure.ResourceManager.Impact.Tests +{ + public class ImpactManagementTestEnvironment : TestEnvironment + { + } +} diff --git a/sdk/impactreporting/Azure.ResourceManager.Impact/tsp-location.yaml b/sdk/impactreporting/Azure.ResourceManager.Impact/tsp-location.yaml new file mode 100644 index 0000000000000..001e9d49510b2 --- /dev/null +++ b/sdk/impactreporting/Azure.ResourceManager.Impact/tsp-location.yaml @@ -0,0 +1,4 @@ +directory: specification/impact/Impact.Management +commit: e0c2ab3266b2692e50d7f31b719aadfb91516e57 +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/impactreporting/ci.mgmt.yml b/sdk/impactreporting/ci.mgmt.yml new file mode 100644 index 0000000000000..b8d009e353850 --- /dev/null +++ b/sdk/impactreporting/ci.mgmt.yml @@ -0,0 +1,26 @@ +# 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/impactreporting /ci.mgmt.yml + - sdk/impactreporting /Azure.ResourceManager.Impact / + + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: impactreporting + ArtifactName: packages + LimitForPullRequest: true + Artifacts: + - name: Azure.ResourceManager.Impact + safeName: AzureResourceManagerImpact diff --git a/sdk/resourcemanager/ci.mgmt.yml b/sdk/resourcemanager/ci.mgmt.yml index 960151044171e..0de5e3d4d8e9f 100644 --- a/sdk/resourcemanager/ci.mgmt.yml +++ b/sdk/resourcemanager/ci.mgmt.yml @@ -103,6 +103,7 @@ trigger: - sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity - sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes - sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork + - sdk/impactreporting/Azure.ResourceManager.Impact - sdk/informaticadatamanagement/Azure.ResourceManager.InformaticaDataManagement - sdk/iot/Azure.ResourceManager.IotFirmwareDefense - sdk/iotcentral/Azure.ResourceManager.IotCentral @@ -308,6 +309,7 @@ pr: - sdk/hybridconnectivity/Azure.ResourceManager.HybridConnectivity - sdk/hybridkubernetes/Azure.ResourceManager.Kubernetes - sdk/hybridnetwork/Azure.ResourceManager.HybridNetwork + - sdk/impactreporting/Azure.ResourceManager.Impact - sdk/informaticadatamanagement/Azure.ResourceManager.InformaticaDataManagement - sdk/iot/Azure.ResourceManager.IotFirmwareDefense - sdk/iotcentral/Azure.ResourceManager.IotCentral