diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/Azure.Analytics.Defender.Easm.sln b/sdk/easm/Azure.Analytics.Defender.Easm/Azure.Analytics.Defender.Easm.sln new file mode 100644 index 000000000000..e25acf848d57 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/Azure.Analytics.Defender.Easm.sln @@ -0,0 +1,56 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.29709.97 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Azure.Core.TestFramework", "..\..\core\Azure.Core.TestFramework\src\Azure.Core.TestFramework.csproj", "{ECC730C1-4AEA-420C-916A-66B19B79E4DC}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Analytics.Defender.Easm", "src\Azure.Analytics.Defender.Easm.csproj", "{28FF4005-4467-4E36-92E7-DEA27DEB1519}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Azure.Analytics.Defender.Easm.Tests", "tests\Azure.Analytics.Defender.Easm.Tests.csproj", "{1F1CD1D4-9932-4B73-99D8-C252A67D4B46}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Debug|Any CPU.Build.0 = Debug|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.ActiveCfg = Release|Any CPU + {B0C276D1-2930-4887-B29A-D1A33E7009A2}.Release|Any CPU.Build.0 = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E9A77AC-792A-4432-8320-ACFD46730401}.Release|Any CPU.Build.0 = Release|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {ECC730C1-4AEA-420C-916A-66B19B79E4DC}.Release|Any CPU.Build.0 = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Debug|Any CPU.Build.0 = Debug|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.ActiveCfg = Release|Any CPU + {A4241C1F-A53D-474C-9E4E-075054407E74}.Release|Any CPU.Build.0 = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Debug|Any CPU.Build.0 = Debug|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.ActiveCfg = Release|Any CPU + {FA8BD3F1-8616-47B6-974C-7576CDF4717E}.Release|Any CPU.Build.0 = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Debug|Any CPU.Build.0 = Debug|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.ActiveCfg = Release|Any CPU + {85677AD3-C214-42FA-AE6E-49B956CAC8DC}.Release|Any CPU.Build.0 = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Debug|Any CPU.Build.0 = Debug|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.ActiveCfg = Release|Any CPU + {28FF4005-4467-4E36-92E7-DEA27DEB1519}.Release|Any CPU.Build.0 = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Debug|Any CPU.Build.0 = Debug|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.ActiveCfg = Release|Any CPU + {1F1CD1D4-9932-4B73-99D8-C252A67D4B46}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {A97F4B90-2591-4689-B1F8-5F21FE6D6CAE} + EndGlobalSection +EndGlobal diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/CHANGELOG.md b/sdk/easm/Azure.Analytics.Defender.Easm/CHANGELOG.md new file mode 100644 index 000000000000..13dd08af78ab --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/CHANGELOG.md @@ -0,0 +1,11 @@ +# Release History + +## 1.0.0-beta.1 (Unreleased) + +### Features Added + +### Breaking Changes + +### Bugs Fixed + +### Other Changes diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/Directory.Build.props b/sdk/easm/Azure.Analytics.Defender.Easm/Directory.Build.props new file mode 100644 index 000000000000..63bd836ad44b --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/Directory.Build.props @@ -0,0 +1,6 @@ + + + + diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/README.md b/sdk/easm/Azure.Analytics.Defender.Easm/README.md new file mode 100644 index 000000000000..e02611eaab8e --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/README.md @@ -0,0 +1,86 @@ +# Azure.Analytics.Defender.Easm client library for .NET + +Azure.Analytics.Defender.Easm is a managed service that helps developers get secret simply and securely. + +Use the client library for to: + +* [Get secret](https://docs.microsoft.com/azure) + +[Source code][source_root] | [Package (NuGet)][package] | [API reference documentation][reference_docs] | [Product documentation][azconfig_docs] | [Samples][source_samples] + + [Source code](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/easm/Azure.Analytics.Defender.Easm/src) | [Package (NuGet)](https://www.nuget.org/packages) | [API reference documentation](https://azure.github.io/azure-sdk-for-net) | [Product documentation](https://docs.microsoft.com/azure) + +## Getting started + +This section should include everything a developer needs to do to install and create their first client connection *very quickly*. + +### Install the package + +First, provide instruction for obtaining and installing the package or library. This section might include only a single line of code, like `dotnet add package package-name`, but should enable a developer to successfully install the package from NuGet, npm, or even cloning a GitHub repository. + +Install the client library for .NET with [NuGet](https://www.nuget.org/ ): + +```dotnetcli +dotnet add package Azure.Analytics.Defender.Easm --prerelease +``` + +### Prerequisites + +Include a section after the install command that details any requirements that must be satisfied before a developer can [authenticate](#authenticate-the-client) and test all of the snippets in the [Examples](#examples) section. For example, for Cosmos DB: + +> You must have an [Azure subscription](https://azure.microsoft.com/free/dotnet/) and [Cosmos DB account](https://docs.microsoft.com/azure/cosmos-db/account-overview) (SQL API). In order to take advantage of the C# 8.0 syntax, it is recommended that you compile using the [.NET Core SDK](https://dotnet.microsoft.com/download) 3.0 or higher with a [language version](https://docs.microsoft.com/dotnet/csharp/language-reference/configure-language-version#override-a-default) of `latest`. It is also possible to compile with the .NET Core SDK 2.1.x using a language version of `preview`. + +### Authenticate the client + +If your library requires authentication for use, such as for Azure services, include instructions and example code needed for initializing and authenticating. + +For example, include details on obtaining an account key and endpoint URI, setting environment variables for each, and initializing the client object. + +## Key concepts + +The *Key concepts* section should describe the functionality of the main classes. Point out the most important and useful classes in the package (with links to their reference pages) and explain how those classes work together. Feel free to use bulleted lists, tables, code blocks, or even diagrams for clarity. + +Include the *Thread safety* and *Additional concepts* sections below at the end of your *Key concepts* section. You may remove or add links depending on what your library makes use of: + +### Thread safety + +We guarantee that all client instance methods are thread-safe and independent of each other ([guideline](https://azure.github.io/azure-sdk/dotnet_introduction.html#dotnet-service-methods-thread-safety)). This ensures that the recommendation of reusing client instances is always safe, even across threads. + +### Additional concepts + +[Client options](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#configuring-service-clients-using-clientoptions) | +[Accessing the response](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#accessing-http-response-details-using-responset) | +[Long-running operations](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#consuming-long-running-operations-using-operationt) | +[Handling failures](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#reporting-errors-requestfailedexception) | +[Diagnostics](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/samples/Diagnostics.md) | +[Mocking](https://github.com/Azure/azure-sdk-for-net/blob/main/sdk/core/Azure.Core/README.md#mocking) | +[Client lifetime](https://devblogs.microsoft.com/azure-sdk/lifetime-management-and-thread-safety-guarantees-of-azure-sdk-net-clients/) + + +## Examples + +You can familiarize yourself with different APIs using [Samples](https://github.com/Azure/azure-sdk-for-net/tree/main/sdk/easm/Azure.Analytics.Defender.Easm/samples). + +## Troubleshooting + +Describe common errors and exceptions, how to "unpack" them if necessary, and include guidance for graceful handling and recovery. + +Provide information to help developers avoid throttling or other service-enforced errors they might encounter. For example, provide guidance and examples for using retry or connection policies in the API. + +If the package or a related package supports it, include tips for logging or enabling instrumentation to help them debug their code. + +## Next steps + +* Provide a link to additional code examples, ideally to those sitting alongside the README in the package's `/samples` directory. +* If appropriate, point users to other packages that might be useful. +* If you think there's a good chance that developers might stumble across your package in error (because they're searching for specific functionality and mistakenly think the package provides that functionality), point them to the packages they might be looking for. + +## Contributing + +This is a template, but your SDK readme should include details on how to contribute code to the repo/package. + + +[style-guide-msft]: https://docs.microsoft.com/style-guide/capitalization +[style-guide-cloud]: https://aka.ms/azsdk/cloud-style-guide + +![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-net/sdk/easm/Azure.Analytics.Defender.Easm/README.png) diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Azure.Analytics.Defender.Easm.csproj b/sdk/easm/Azure.Analytics.Defender.Easm/src/Azure.Analytics.Defender.Easm.csproj new file mode 100644 index 000000000000..f68bcce66d81 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Azure.Analytics.Defender.Easm.csproj @@ -0,0 +1,20 @@ + + + This is the Azure.Analytics.Defender.Easm client library for developing .NET applications with rich experience. + Azure SDK Code Generation Azure.Analytics.Defender.Easm for Azure Data Plane + 1.0.0-beta.1 + Azure.Analytics.Defender.Easm + $(RequiredTargetFrameworks) + true + + + + + + + + + + + + diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AlexaInfo.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AlexaInfo.Serialization.cs new file mode 100644 index 000000000000..5d88120b6b21 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AlexaInfo.Serialization.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class AlexaInfo : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(AlexaRank)) + { + writer.WritePropertyName("alexaRank"u8); + writer.WriteNumberValue(AlexaRank.Value); + } + if (Optional.IsDefined(Category)) + { + writer.WritePropertyName("category"u8); + writer.WriteStringValue(Category); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(Recent)) + { + writer.WritePropertyName("recent"u8); + writer.WriteBooleanValue(Recent.Value); + } + writer.WriteEndObject(); + } + + internal static AlexaInfo DeserializeAlexaInfo(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional alexaRank = default; + Optional category = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional count = default; + Optional recent = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("alexaRank"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + alexaRank = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("category"u8)) + { + category = property.Value.GetString(); + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("recent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + recent = property.Value.GetBoolean(); + continue; + } + } + return new AlexaInfo(Optional.ToNullable(alexaRank), category.Value, Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(count), Optional.ToNullable(recent)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AlexaInfo FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAlexaInfo(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AlexaInfo.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AlexaInfo.cs new file mode 100644 index 000000000000..27a44fb8ee2d --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AlexaInfo.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Analytics.Defender.Easm +{ + /// The AlexaInfo. + public partial class AlexaInfo + { + /// Initializes a new instance of AlexaInfo. + public AlexaInfo() + { + } + + /// Initializes a new instance of AlexaInfo. + /// + /// + /// + /// + /// + /// + internal AlexaInfo(long? alexaRank, string category, DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count, bool? recent) + { + AlexaRank = alexaRank; + Category = category; + FirstSeen = firstSeen; + LastSeen = lastSeen; + Count = count; + Recent = recent; + } + + /// Gets or sets the alexa rank. + public long? AlexaRank { get; set; } + /// Gets or sets the category. + public string Category { get; set; } + /// Gets or sets the first seen. + public DateTimeOffset? FirstSeen { get; set; } + /// Gets or sets the last seen. + public DateTimeOffset? LastSeen { get; set; } + /// Gets or sets the count. + public long? Count { get; set; } + /// Gets or sets the recent. + public bool? Recent { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AnalyticsDefenderEasmClientBuilderExtensions.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AnalyticsDefenderEasmClientBuilderExtensions.cs new file mode 100644 index 000000000000..5450a7b6979b --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AnalyticsDefenderEasmClientBuilderExtensions.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Analytics.Defender.Easm; +using Azure.Core.Extensions; + +namespace Microsoft.Extensions.Azure +{ + /// Extension methods to add to client builder. + public static partial class AnalyticsDefenderEasmClientBuilderExtensions + { + /// Registers a instance. + /// The builder to register with. + /// The endpoint hosting the requested resource. For example, https://{region}.easm.defender.microsoft.com. + /// The ID of the target subscription. + /// The name of the Resource Group. + /// The name of the Workspace. + public static IAzureClientBuilder AddEasmClient(this TBuilder builder, Uri endpoint, string subscriptionId, string resourceGroupName, string workspaceName) + where TBuilder : IAzureClientFactoryBuilderWithCredential + { + return builder.RegisterClientFactory((options, cred) => new EasmClient(endpoint, subscriptionId, resourceGroupName, workspaceName, cred, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// The configuration values. + public static IAzureClientBuilder AddEasmClient(this TBuilder builder, TConfiguration configuration) + where TBuilder : IAzureClientFactoryBuilderWithConfiguration + { + return builder.RegisterClientFactory(configuration); + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AnalyticsDefenderEasmModelFactory.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AnalyticsDefenderEasmModelFactory.cs new file mode 100644 index 000000000000..fbecb3d77200 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AnalyticsDefenderEasmModelFactory.cs @@ -0,0 +1,596 @@ +// 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.Analytics.Defender.Easm +{ + /// Model factory for models. + public static partial class AnalyticsDefenderEasmModelFactory + { + /// Initializes a new instance of AssetResource. + /// Discriminator. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// Global UUID for the asset. + /// The date this asset was first added to this workspace. + /// The date this asset was last updated for this workspace. + /// + /// An optional customer provided identifier for this asset. + /// Customer labels assigned to this asset. + /// An indicator of whether this asset represents a wildcard rollup of assets on this domain. + /// The name of the DiscoGroup that brought added this asset to the workspace. + /// The history of how this asset was pulled into the workspace through the discovery process. + /// + /// A new instance for mocking. + public static AssetResource AssetResource(string kind = null, string id = null, string name = null, string displayName = null, Guid? uuid = null, DateTimeOffset? createdDate = null, DateTimeOffset? updatedDate = null, AssetState? state = null, string externalId = null, IEnumerable labels = null, bool? wildcard = null, string discoGroupName = null, IEnumerable auditTrail = null, string reason = null) + { + labels ??= new List(); + auditTrail ??= new List(); + + return new UnknownAssetResource(kind, id, name, displayName, uuid, createdDate, updatedDate, state, externalId, labels?.ToList(), wildcard, discoGroupName, auditTrail?.ToList(), reason); + } + + /// Initializes a new instance of AsAssetResource. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// Global UUID for the asset. + /// The date this asset was first added to this workspace. + /// The date this asset was last updated for this workspace. + /// + /// An optional customer provided identifier for this asset. + /// Customer labels assigned to this asset. + /// An indicator of whether this asset represents a wildcard rollup of assets on this domain. + /// The name of the DiscoGroup that brought added this asset to the workspace. + /// The history of how this asset was pulled into the workspace through the discovery process. + /// + /// asset. + /// A new instance for mocking. + public static AsAssetResource AsAssetResource(string id = null, string name = null, string displayName = null, Guid? uuid = null, DateTimeOffset? createdDate = null, DateTimeOffset? updatedDate = null, AssetState? state = null, string externalId = null, IEnumerable labels = null, bool? wildcard = null, string discoGroupName = null, IEnumerable auditTrail = null, string reason = null, AsAsset asset = null) + { + labels ??= new List(); + auditTrail ??= new List(); + + return new AsAssetResource("as", id, name, displayName, uuid, createdDate, updatedDate, state, externalId, labels?.ToList(), wildcard, discoGroupName, auditTrail?.ToList(), reason, asset); + } + + /// Initializes a new instance of ObservedString. + /// + /// + /// + /// + /// + /// + /// A new instance for mocking. + public static ObservedString ObservedString(DateTimeOffset? firstSeen = null, DateTimeOffset? lastSeen = null, long? count = null, bool? recent = null, string value = null, IEnumerable sources = null) + { + sources ??= new List(); + + return new ObservedString(firstSeen, lastSeen, count, recent, value, sources?.ToList()); + } + + /// Initializes a new instance of ObservedLong. + /// + /// + /// + /// + /// + /// + /// A new instance for mocking. + public static ObservedLong ObservedLong(DateTimeOffset? firstSeen = null, DateTimeOffset? lastSeen = null, long? count = null, bool? recent = null, long? value = null, IEnumerable sources = null) + { + sources ??= new List(); + + return new ObservedLong(firstSeen, lastSeen, count, recent, value, sources?.ToList()); + } + + /// Initializes a new instance of ObservedInteger. + /// + /// + /// + /// + /// + /// + /// A new instance for mocking. + public static ObservedInteger ObservedInteger(DateTimeOffset? firstSeen = null, DateTimeOffset? lastSeen = null, long? count = null, bool? recent = null, int? value = null, IEnumerable sources = null) + { + sources ??= new List(); + + return new ObservedInteger(firstSeen, lastSeen, count, recent, value, sources?.ToList()); + } + + /// Initializes a new instance of ObservedBoolean. + /// + /// + /// + /// + /// + /// + /// A new instance for mocking. + public static ObservedBoolean ObservedBoolean(DateTimeOffset? firstSeen = null, DateTimeOffset? lastSeen = null, long? count = null, bool? recent = null, bool? value = null, IEnumerable sources = null) + { + sources ??= new List(); + + return new ObservedBoolean(firstSeen, lastSeen, count, recent, value, sources?.ToList()); + } + + /// Initializes a new instance of ObservedHeader. + /// + /// + /// + /// + /// + /// + /// A new instance for mocking. + public static ObservedHeader ObservedHeader(DateTimeOffset? firstSeen = null, DateTimeOffset? lastSeen = null, long? count = null, bool? recent = null, string headerName = null, string headerValue = null) + { + return new ObservedHeader(firstSeen, lastSeen, count, recent, headerName, headerValue); + } + + /// Initializes a new instance of ObservedPortState. + /// + /// + /// + /// + /// + /// + /// A new instance for mocking. + public static ObservedPortState ObservedPortState(DateTimeOffset? firstSeen = null, DateTimeOffset? lastSeen = null, long? count = null, bool? recent = null, ObservedPortStateValue? value = null, int? port = null) + { + return new ObservedPortState(firstSeen, lastSeen, count, recent, value, port); + } + + /// Initializes a new instance of ObservedLocation. + /// + /// + /// + /// + /// + /// + /// A new instance for mocking. + public static ObservedLocation ObservedLocation(DateTimeOffset? firstSeen = null, DateTimeOffset? lastSeen = null, long? count = null, bool? recent = null, Location value = null, IEnumerable sources = null) + { + sources ??= new List(); + + return new ObservedLocation(firstSeen, lastSeen, count, recent, value, sources?.ToList()); + } + + /// Initializes a new instance of ObservedIntegers. + /// + /// + /// + /// + /// + /// + /// A new instance for mocking. + public static ObservedIntegers ObservedIntegers(DateTimeOffset? firstSeen = null, DateTimeOffset? lastSeen = null, long? count = null, bool? recent = null, IEnumerable values = null, IEnumerable sources = null) + { + values ??= new List(); + sources ??= new List(); + + return new ObservedIntegers(firstSeen, lastSeen, count, recent, values?.ToList(), sources?.ToList()); + } + + /// Initializes a new instance of ContactAssetResource. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// Global UUID for the asset. + /// The date this asset was first added to this workspace. + /// The date this asset was last updated for this workspace. + /// + /// An optional customer provided identifier for this asset. + /// Customer labels assigned to this asset. + /// An indicator of whether this asset represents a wildcard rollup of assets on this domain. + /// The name of the DiscoGroup that brought added this asset to the workspace. + /// The history of how this asset was pulled into the workspace through the discovery process. + /// + /// asset. + /// A new instance for mocking. + public static ContactAssetResource ContactAssetResource(string id = null, string name = null, string displayName = null, Guid? uuid = null, DateTimeOffset? createdDate = null, DateTimeOffset? updatedDate = null, AssetState? state = null, string externalId = null, IEnumerable labels = null, bool? wildcard = null, string discoGroupName = null, IEnumerable auditTrail = null, string reason = null, ContactAsset asset = null) + { + labels ??= new List(); + auditTrail ??= new List(); + + return new ContactAssetResource("contact", id, name, displayName, uuid, createdDate, updatedDate, state, externalId, labels?.ToList(), wildcard, discoGroupName, auditTrail?.ToList(), reason, asset); + } + + /// Initializes a new instance of DomainAssetResource. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// Global UUID for the asset. + /// The date this asset was first added to this workspace. + /// The date this asset was last updated for this workspace. + /// + /// An optional customer provided identifier for this asset. + /// Customer labels assigned to this asset. + /// An indicator of whether this asset represents a wildcard rollup of assets on this domain. + /// The name of the DiscoGroup that brought added this asset to the workspace. + /// The history of how this asset was pulled into the workspace through the discovery process. + /// + /// asset. + /// A new instance for mocking. + public static DomainAssetResource DomainAssetResource(string id = null, string name = null, string displayName = null, Guid? uuid = null, DateTimeOffset? createdDate = null, DateTimeOffset? updatedDate = null, AssetState? state = null, string externalId = null, IEnumerable labels = null, bool? wildcard = null, string discoGroupName = null, IEnumerable auditTrail = null, string reason = null, DomainAsset asset = null) + { + labels ??= new List(); + auditTrail ??= new List(); + + return new DomainAssetResource("domain", id, name, displayName, uuid, createdDate, updatedDate, state, externalId, labels?.ToList(), wildcard, discoGroupName, auditTrail?.ToList(), reason, asset); + } + + /// Initializes a new instance of HostAssetResource. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// Global UUID for the asset. + /// The date this asset was first added to this workspace. + /// The date this asset was last updated for this workspace. + /// + /// An optional customer provided identifier for this asset. + /// Customer labels assigned to this asset. + /// An indicator of whether this asset represents a wildcard rollup of assets on this domain. + /// The name of the DiscoGroup that brought added this asset to the workspace. + /// The history of how this asset was pulled into the workspace through the discovery process. + /// + /// asset. + /// A new instance for mocking. + public static HostAssetResource HostAssetResource(string id = null, string name = null, string displayName = null, Guid? uuid = null, DateTimeOffset? createdDate = null, DateTimeOffset? updatedDate = null, AssetState? state = null, string externalId = null, IEnumerable labels = null, bool? wildcard = null, string discoGroupName = null, IEnumerable auditTrail = null, string reason = null, HostAsset asset = null) + { + labels ??= new List(); + auditTrail ??= new List(); + + return new HostAssetResource("host", id, name, displayName, uuid, createdDate, updatedDate, state, externalId, labels?.ToList(), wildcard, discoGroupName, auditTrail?.ToList(), reason, asset); + } + + /// Initializes a new instance of IpAddressAssetResource. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// Global UUID for the asset. + /// The date this asset was first added to this workspace. + /// The date this asset was last updated for this workspace. + /// + /// An optional customer provided identifier for this asset. + /// Customer labels assigned to this asset. + /// An indicator of whether this asset represents a wildcard rollup of assets on this domain. + /// The name of the DiscoGroup that brought added this asset to the workspace. + /// The history of how this asset was pulled into the workspace through the discovery process. + /// + /// asset. + /// A new instance for mocking. + public static IpAddressAssetResource IpAddressAssetResource(string id = null, string name = null, string displayName = null, Guid? uuid = null, DateTimeOffset? createdDate = null, DateTimeOffset? updatedDate = null, AssetState? state = null, string externalId = null, IEnumerable labels = null, bool? wildcard = null, string discoGroupName = null, IEnumerable auditTrail = null, string reason = null, IpAddressAsset asset = null) + { + labels ??= new List(); + auditTrail ??= new List(); + + return new IpAddressAssetResource("ipAddress", id, name, displayName, uuid, createdDate, updatedDate, state, externalId, labels?.ToList(), wildcard, discoGroupName, auditTrail?.ToList(), reason, asset); + } + + /// Initializes a new instance of IpBlockAssetResource. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// Global UUID for the asset. + /// The date this asset was first added to this workspace. + /// The date this asset was last updated for this workspace. + /// + /// An optional customer provided identifier for this asset. + /// Customer labels assigned to this asset. + /// An indicator of whether this asset represents a wildcard rollup of assets on this domain. + /// The name of the DiscoGroup that brought added this asset to the workspace. + /// The history of how this asset was pulled into the workspace through the discovery process. + /// + /// asset. + /// A new instance for mocking. + public static IpBlockAssetResource IpBlockAssetResource(string id = null, string name = null, string displayName = null, Guid? uuid = null, DateTimeOffset? createdDate = null, DateTimeOffset? updatedDate = null, AssetState? state = null, string externalId = null, IEnumerable labels = null, bool? wildcard = null, string discoGroupName = null, IEnumerable auditTrail = null, string reason = null, IpBlockAsset asset = null) + { + labels ??= new List(); + auditTrail ??= new List(); + + return new IpBlockAssetResource("ipBlock", id, name, displayName, uuid, createdDate, updatedDate, state, externalId, labels?.ToList(), wildcard, discoGroupName, auditTrail?.ToList(), reason, asset); + } + + /// Initializes a new instance of PageAssetResource. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// Global UUID for the asset. + /// The date this asset was first added to this workspace. + /// The date this asset was last updated for this workspace. + /// + /// An optional customer provided identifier for this asset. + /// Customer labels assigned to this asset. + /// An indicator of whether this asset represents a wildcard rollup of assets on this domain. + /// The name of the DiscoGroup that brought added this asset to the workspace. + /// The history of how this asset was pulled into the workspace through the discovery process. + /// + /// asset. + /// A new instance for mocking. + public static PageAssetResource PageAssetResource(string id = null, string name = null, string displayName = null, Guid? uuid = null, DateTimeOffset? createdDate = null, DateTimeOffset? updatedDate = null, AssetState? state = null, string externalId = null, IEnumerable labels = null, bool? wildcard = null, string discoGroupName = null, IEnumerable auditTrail = null, string reason = null, PageAsset asset = null) + { + labels ??= new List(); + auditTrail ??= new List(); + + return new PageAssetResource("page", id, name, displayName, uuid, createdDate, updatedDate, state, externalId, labels?.ToList(), wildcard, discoGroupName, auditTrail?.ToList(), reason, asset); + } + + /// Initializes a new instance of SslCertAssetResource. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// Global UUID for the asset. + /// The date this asset was first added to this workspace. + /// The date this asset was last updated for this workspace. + /// + /// An optional customer provided identifier for this asset. + /// Customer labels assigned to this asset. + /// An indicator of whether this asset represents a wildcard rollup of assets on this domain. + /// The name of the DiscoGroup that brought added this asset to the workspace. + /// The history of how this asset was pulled into the workspace through the discovery process. + /// + /// asset. + /// A new instance for mocking. + public static SslCertAssetResource SslCertAssetResource(string id = null, string name = null, string displayName = null, Guid? uuid = null, DateTimeOffset? createdDate = null, DateTimeOffset? updatedDate = null, AssetState? state = null, string externalId = null, IEnumerable labels = null, bool? wildcard = null, string discoGroupName = null, IEnumerable auditTrail = null, string reason = null, SslCertAsset asset = null) + { + labels ??= new List(); + auditTrail ??= new List(); + + return new SslCertAssetResource("sslCert", id, name, displayName, uuid, createdDate, updatedDate, state, externalId, labels?.ToList(), wildcard, discoGroupName, auditTrail?.ToList(), reason, asset); + } + + /// Initializes a new instance of DataConnection. + /// Discriminator. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// The type of data the data connection will transfer. + /// The date the data connection was created. + /// The rate at which the data connection will receive updates. + /// The day to update the data connection on. + /// The date the data connection was last updated. + /// The date the data connection was last updated by user. + /// An indicator of whether the data connection is active. + /// A message that specifies details about data connection if inactive. + /// A new instance for mocking. + public static DataConnection DataConnection(string kind = null, string id = null, string name = null, string displayName = null, DataConnectionContent? content = null, DateTimeOffset? createdDate = null, DataConnectionFrequency? frequency = null, int? frequencyOffset = null, DateTimeOffset? updatedDate = null, DateTimeOffset? userUpdatedAt = null, bool? active = null, string inactiveMessage = null) + { + return new UnknownDataConnection(kind, id, name, displayName, content, createdDate, frequency, frequencyOffset, updatedDate, userUpdatedAt, active, inactiveMessage); + } + + /// Initializes a new instance of LogAnalyticsDataConnection. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// The type of data the data connection will transfer. + /// The date the data connection was created. + /// The rate at which the data connection will receive updates. + /// The day to update the data connection on. + /// The date the data connection was last updated. + /// The date the data connection was last updated by user. + /// An indicator of whether the data connection is active. + /// A message that specifies details about data connection if inactive. + /// properties. + /// A new instance for mocking. + public static LogAnalyticsDataConnection LogAnalyticsDataConnection(string id = null, string name = null, string displayName = null, DataConnectionContent? content = null, DateTimeOffset? createdDate = null, DataConnectionFrequency? frequency = null, int? frequencyOffset = null, DateTimeOffset? updatedDate = null, DateTimeOffset? userUpdatedAt = null, bool? active = null, string inactiveMessage = null, LogAnalyticsDataConnectionProperties properties = null) + { + return new LogAnalyticsDataConnection("logAnalytics", id, name, displayName, content, createdDate, frequency, frequencyOffset, updatedDate, userUpdatedAt, active, inactiveMessage, properties); + } + + /// Initializes a new instance of AzureDataExplorerDataConnection. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// The type of data the data connection will transfer. + /// The date the data connection was created. + /// The rate at which the data connection will receive updates. + /// The day to update the data connection on. + /// The date the data connection was last updated. + /// The date the data connection was last updated by user. + /// An indicator of whether the data connection is active. + /// A message that specifies details about data connection if inactive. + /// properties. + /// A new instance for mocking. + public static AzureDataExplorerDataConnection AzureDataExplorerDataConnection(string id = null, string name = null, string displayName = null, DataConnectionContent? content = null, DateTimeOffset? createdDate = null, DataConnectionFrequency? frequency = null, int? frequencyOffset = null, DateTimeOffset? updatedDate = null, DateTimeOffset? userUpdatedAt = null, bool? active = null, string inactiveMessage = null, AzureDataExplorerDataConnectionProperties properties = null) + { + return new AzureDataExplorerDataConnection("azureDataExplorer", id, name, displayName, content, createdDate, frequency, frequencyOffset, updatedDate, userUpdatedAt, active, inactiveMessage, properties); + } + + /// Initializes a new instance of ValidateResult. + /// This is the top-level error object whose code matches the x-ms-error-code response header. + /// A new instance for mocking. + public static ValidateResult ValidateResult(ErrorDetail error = null) + { + return new ValidateResult(error); + } + + /// Initializes a new instance of ErrorDetail. + /// This is one of a server-defined set of error codes. + /// This is a human-readable representation of the error. + /// This is the error target. + /// This is an array of details about specific errors that led to this reported error. + /// This is an object containing more specific information than the current object about the error. + /// A new instance for mocking. + public static ErrorDetail ErrorDetail(string code = null, string message = null, string target = null, IEnumerable details = null, InnerError innererror = null) + { + details ??= new List(); + + return new ErrorDetail(code, message, target, details?.ToList(), innererror); + } + + /// Initializes a new instance of InnerError. + /// This is a more specific error code than was provided by the containing error. + /// This is an additional field representing the value that caused the error to help with debugging. + /// A new instance for mocking. + public static InnerError InnerError(string code = null, BinaryData value = null) + { + return new InnerError(code, value); + } + + /// Initializes a new instance of DiscoGroup. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// The description for a disco group. + /// The tier for the disco group which will affect the algorithm used for the disco runs in this group. + /// The frequency at which the disco group is supposed to be rerun in milliseconds. + /// The list of seeds used for the disco group runs. + /// The list of names used for the disco group runs. + /// The list of excludes used for the disco group runs, aka assets to exclude from the discovery algorithm. + /// The latest run of this disco group with some limited information, null if the group has never been run. + /// The date for the disco group was created. + /// The unique identifier for the disco template used for the disco group creation. + /// A new instance for mocking. + public static DiscoGroup DiscoGroup(string id = null, string name = null, string displayName = null, string description = null, string tier = null, long? frequencyMilliseconds = null, IEnumerable seeds = null, IEnumerable names = null, IEnumerable excludes = null, DiscoRunResult latestRun = null, DateTimeOffset? createdDate = null, string templateId = null) + { + seeds ??= new List(); + names ??= new List(); + excludes ??= new List(); + + return new DiscoGroup(id, name, displayName, description, tier, frequencyMilliseconds, seeds?.ToList(), names?.ToList(), excludes?.ToList(), latestRun, createdDate, templateId); + } + + /// Initializes a new instance of DiscoTemplate. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// The name of the industry. + /// The name of the region. + /// The country code. + /// The state code. + /// The name of the city. + /// The list of disco template seeds. + /// The list of disco template names. + /// A new instance for mocking. + public static DiscoTemplate DiscoTemplate(string id = null, string name = null, string displayName = null, string industry = null, string region = null, string countryCode = null, string stateCode = null, string city = null, IEnumerable seeds = null, IEnumerable names = null) + { + seeds ??= new List(); + names ??= new List(); + + return new DiscoTemplate(id, name, displayName, industry, region, countryCode, stateCode, city, seeds?.ToList(), names?.ToList()); + } + + /// Initializes a new instance of ReportBillableAssetSummaryResult. + /// + /// A new instance for mocking. + public static ReportBillableAssetSummaryResult ReportBillableAssetSummaryResult(IEnumerable assetSummaries = null) + { + assetSummaries ??= new List(); + + return new ReportBillableAssetSummaryResult(assetSummaries?.ToList()); + } + + /// Initializes a new instance of ReportBillableAssetSnapshotResult. + /// The date these assets were billed on. + /// The total number of billable assets for this date. + /// The breakdown of billable asset counts for each asset type. + /// A new instance for mocking. + public static ReportBillableAssetSnapshotResult ReportBillableAssetSnapshotResult(DateTimeOffset? date = null, long? total = null, IEnumerable assetBreakdown = null) + { + assetBreakdown ??= new List(); + + return new ReportBillableAssetSnapshotResult(date, total, assetBreakdown?.ToList()); + } + + /// Initializes a new instance of ReportBillableAssetBreakdown. + /// The kind of billable asset. + /// The number of assets of this type. + /// A new instance for mocking. + public static ReportBillableAssetBreakdown ReportBillableAssetBreakdown(ReportBillableAssetBreakdownKind? kind = null, long? count = null) + { + return new ReportBillableAssetBreakdown(kind, count); + } + + /// Initializes a new instance of ReportAssetSnapshotResult. + /// The name of the metric. + /// The unique metric name. + /// The customer label that was filtered on, if one was provided. + /// The last time this asset data was updated on this metric. + /// A description of what the metric represents. + /// The page of assets that match the provided metric. + /// A new instance for mocking. + public static ReportAssetSnapshotResult ReportAssetSnapshotResult(string displayName = null, string metric = null, string labelName = null, DateTimeOffset? updatedAt = null, string description = null, AssetPageResult assets = null) + { + return new ReportAssetSnapshotResult(displayName, metric, labelName, updatedAt, description, assets); + } + + /// Initializes a new instance of AssetPageResult. + /// The total number of items available in the full result set. + /// The cursor mark to be used on the next request. Not set if using paging. + /// The link to access the next page of results. Not set if at the end of the result set. + /// The items in the current page of results. + /// A new instance for mocking. + public static AssetPageResult AssetPageResult(long? totalElements = null, string mark = null, string nextLink = null, IEnumerable value = null) + { + value ??= new List(); + + return new AssetPageResult(totalElements, mark, nextLink, value?.ToList()); + } + + /// Initializes a new instance of ReportAssetSummaryResult. + /// The collection of asset summaries. + /// A new instance for mocking. + public static ReportAssetSummaryResult ReportAssetSummaryResult(IEnumerable assetSummaries = null) + { + assetSummaries ??= new List(); + + return new ReportAssetSummaryResult(assetSummaries?.ToList()); + } + + /// Initializes a new instance of AssetSummaryResult. + /// The name of the summary response. Depending on the request time this will either be the asset filter, risk category, or risk metric. + /// The description of the summary response. Filters don't have a description. + /// The last time risk categories or risk metrics were captured. Set to the current time for asset filter requests, which always pull the live asset data. + /// If the request is for a metric category, this will contain the requested unique category name. + /// If the request is for a metric, this will contain the requested unique metric name. + /// If the request is for an asset filter, this will contain the corresponding filter. + /// An optional label used to filter requests results. + /// The count of assets matching the request parameters. + /// The link to the corresponding asset details. + /// The corresponding child entities. For metric categories this will contain metrics. For filters with groupBy and segmentBy this will contain facets. + /// A new instance for mocking. + public static AssetSummaryResult AssetSummaryResult(string displayName = null, string description = null, DateTimeOffset? updatedAt = null, string metricCategory = null, string metric = null, string filter = null, string labelName = null, long? count = null, string link = null, IEnumerable children = null) + { + children ??= new List(); + + return new AssetSummaryResult(displayName, description, updatedAt, metricCategory, metric, filter, labelName, count, link, children?.ToList()); + } + + /// Initializes a new instance of SavedFilter. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// + /// + /// A new instance for mocking. + public static SavedFilter SavedFilter(string id = null, string name = null, string displayName = null, string filter = null, string description = null) + { + return new SavedFilter(id, name, displayName, filter, description); + } + + /// Initializes a new instance of Task. + /// The unique identifier of the task. + /// The time the task started. + /// The time the task completed. + /// The last time the status of the task was updated. + /// The state the task is in. + /// The phase the task is in. + /// The reason the task was moved into its current state, if the task wasn't completed. + /// Attributes unique to the task. This differs by task type. + /// A new instance for mocking. + public static Task Task(string id = null, DateTimeOffset? startedAt = null, DateTimeOffset? completedAt = null, DateTimeOffset? lastPolledAt = null, TaskState? state = null, TaskPhase? phase = null, string reason = null, IReadOnlyDictionary metadata = null) + { + metadata ??= new Dictionary(); + + return new Task(id, startedAt, completedAt, lastPolledAt, state, phase, reason, metadata); + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AsAsset.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AsAsset.Serialization.cs new file mode 100644 index 000000000000..17bccdcf0593 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AsAsset.Serialization.cs @@ -0,0 +1,627 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class AsAsset : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Asn)) + { + writer.WritePropertyName("asn"u8); + writer.WriteNumberValue(Asn.Value); + } + if (Optional.IsCollectionDefined(AsNames)) + { + writer.WritePropertyName("asNames"u8); + writer.WriteStartArray(); + foreach (var item in AsNames) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(OrgNames)) + { + writer.WritePropertyName("orgNames"u8); + writer.WriteStartArray(); + foreach (var item in OrgNames) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(OrgIds)) + { + writer.WritePropertyName("orgIds"u8); + writer.WriteStartArray(); + foreach (var item in OrgIds) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Countries)) + { + writer.WritePropertyName("countries"u8); + writer.WriteStartArray(); + foreach (var item in Countries) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Registries)) + { + writer.WritePropertyName("registries"u8); + writer.WriteStartArray(); + foreach (var item in Registries) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Sources)) + { + writer.WritePropertyName("sources"u8); + writer.WriteStartArray(); + foreach (var item in Sources) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsCollectionDefined(RegistrarCreatedAt)) + { + writer.WritePropertyName("registrarCreatedAt"u8); + writer.WriteStartArray(); + foreach (var item in RegistrarCreatedAt) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(RegistrarUpdatedAt)) + { + writer.WritePropertyName("registrarUpdatedAt"u8); + writer.WriteStartArray(); + foreach (var item in RegistrarUpdatedAt) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(RegistrantContacts)) + { + writer.WritePropertyName("registrantContacts"u8); + writer.WriteStartArray(); + foreach (var item in RegistrantContacts) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(AdminContacts)) + { + writer.WritePropertyName("adminContacts"u8); + writer.WriteStartArray(); + foreach (var item in AdminContacts) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(TechnicalContacts)) + { + writer.WritePropertyName("technicalContacts"u8); + writer.WriteStartArray(); + foreach (var item in TechnicalContacts) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(RegistrarNames)) + { + writer.WritePropertyName("registrarNames"u8); + writer.WriteStartArray(); + foreach (var item in RegistrarNames) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(RegistrantNames)) + { + writer.WritePropertyName("registrantNames"u8); + writer.WriteStartArray(); + foreach (var item in RegistrantNames) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(AdminNames)) + { + writer.WritePropertyName("adminNames"u8); + writer.WriteStartArray(); + foreach (var item in AdminNames) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(TechnicalNames)) + { + writer.WritePropertyName("technicalNames"u8); + writer.WriteStartArray(); + foreach (var item in TechnicalNames) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(AdminOrgs)) + { + writer.WritePropertyName("adminOrgs"u8); + writer.WriteStartArray(); + foreach (var item in AdminOrgs) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(TechnicalOrgs)) + { + writer.WritePropertyName("technicalOrgs"u8); + writer.WriteStartArray(); + foreach (var item in TechnicalOrgs) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(RegistrantPhones)) + { + writer.WritePropertyName("registrantPhones"u8); + writer.WriteStartArray(); + foreach (var item in RegistrantPhones) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(AdminPhones)) + { + writer.WritePropertyName("adminPhones"u8); + writer.WriteStartArray(); + foreach (var item in AdminPhones) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(TechnicalPhones)) + { + writer.WritePropertyName("technicalPhones"u8); + writer.WriteStartArray(); + foreach (var item in TechnicalPhones) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(DetailedFromWhoisAt)) + { + writer.WritePropertyName("detailedFromWhoisAt"u8); + writer.WriteStringValue(DetailedFromWhoisAt.Value, "O"); + } + writer.WriteEndObject(); + } + + internal static AsAsset DeserializeAsAsset(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional asn = default; + Optional> asNames = default; + Optional> orgNames = default; + Optional> orgIds = default; + Optional> countries = default; + Optional> registries = default; + Optional> sources = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional count = default; + Optional> registrarCreatedAt = default; + Optional> registrarUpdatedAt = default; + Optional> registrantContacts = default; + Optional> adminContacts = default; + Optional> technicalContacts = default; + Optional> registrarNames = default; + Optional> registrantNames = default; + Optional> adminNames = default; + Optional> technicalNames = default; + Optional> adminOrgs = default; + Optional> technicalOrgs = default; + Optional> registrantPhones = default; + Optional> adminPhones = default; + Optional> technicalPhones = default; + Optional detailedFromWhoisAt = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("asn"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + asn = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("asNames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + asNames = array; + continue; + } + if (property.NameEquals("orgNames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + orgNames = array; + continue; + } + if (property.NameEquals("orgIds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + orgIds = array; + continue; + } + if (property.NameEquals("countries"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + countries = array; + continue; + } + if (property.NameEquals("registries"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + registries = array; + continue; + } + if (property.NameEquals("sources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Source.DeserializeSource(item)); + } + sources = array; + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("registrarCreatedAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedLong.DeserializeObservedLong(item)); + } + registrarCreatedAt = array; + continue; + } + if (property.NameEquals("registrarUpdatedAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedLong.DeserializeObservedLong(item)); + } + registrarUpdatedAt = array; + continue; + } + if (property.NameEquals("registrantContacts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + registrantContacts = array; + continue; + } + if (property.NameEquals("adminContacts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + adminContacts = array; + continue; + } + if (property.NameEquals("technicalContacts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + technicalContacts = array; + continue; + } + if (property.NameEquals("registrarNames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + registrarNames = array; + continue; + } + if (property.NameEquals("registrantNames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + registrantNames = array; + continue; + } + if (property.NameEquals("adminNames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + adminNames = array; + continue; + } + if (property.NameEquals("technicalNames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + technicalNames = array; + continue; + } + if (property.NameEquals("adminOrgs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + adminOrgs = array; + continue; + } + if (property.NameEquals("technicalOrgs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + technicalOrgs = array; + continue; + } + if (property.NameEquals("registrantPhones"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + registrantPhones = array; + continue; + } + if (property.NameEquals("adminPhones"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + adminPhones = array; + continue; + } + if (property.NameEquals("technicalPhones"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + technicalPhones = array; + continue; + } + if (property.NameEquals("detailedFromWhoisAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + detailedFromWhoisAt = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new AsAsset(Optional.ToNullable(asn), Optional.ToList(asNames), Optional.ToList(orgNames), Optional.ToList(orgIds), Optional.ToList(countries), Optional.ToList(registries), Optional.ToList(sources), Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(count), Optional.ToList(registrarCreatedAt), Optional.ToList(registrarUpdatedAt), Optional.ToList(registrantContacts), Optional.ToList(adminContacts), Optional.ToList(technicalContacts), Optional.ToList(registrarNames), Optional.ToList(registrantNames), Optional.ToList(adminNames), Optional.ToList(technicalNames), Optional.ToList(adminOrgs), Optional.ToList(technicalOrgs), Optional.ToList(registrantPhones), Optional.ToList(adminPhones), Optional.ToList(technicalPhones), Optional.ToNullable(detailedFromWhoisAt)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AsAsset FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAsAsset(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AsAsset.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AsAsset.cs new file mode 100644 index 000000000000..0c9d9492de53 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AsAsset.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The AsAsset. + public partial class AsAsset : InventoryAsset + { + /// Initializes a new instance of AsAsset. + public AsAsset() + { + AsNames = new ChangeTrackingList(); + OrgNames = new ChangeTrackingList(); + OrgIds = new ChangeTrackingList(); + Countries = new ChangeTrackingList(); + Registries = new ChangeTrackingList(); + Sources = new ChangeTrackingList(); + RegistrarCreatedAt = new ChangeTrackingList(); + RegistrarUpdatedAt = new ChangeTrackingList(); + RegistrantContacts = new ChangeTrackingList(); + AdminContacts = new ChangeTrackingList(); + TechnicalContacts = new ChangeTrackingList(); + RegistrarNames = new ChangeTrackingList(); + RegistrantNames = new ChangeTrackingList(); + AdminNames = new ChangeTrackingList(); + TechnicalNames = new ChangeTrackingList(); + AdminOrgs = new ChangeTrackingList(); + TechnicalOrgs = new ChangeTrackingList(); + RegistrantPhones = new ChangeTrackingList(); + AdminPhones = new ChangeTrackingList(); + TechnicalPhones = new ChangeTrackingList(); + } + + /// Initializes a new instance of AsAsset. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + internal AsAsset(long? asn, IList asNames, IList orgNames, IList orgIds, IList countries, IList registries, IList sources, DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count, IList registrarCreatedAt, IList registrarUpdatedAt, IList registrantContacts, IList adminContacts, IList technicalContacts, IList registrarNames, IList registrantNames, IList adminNames, IList technicalNames, IList adminOrgs, IList technicalOrgs, IList registrantPhones, IList adminPhones, IList technicalPhones, DateTimeOffset? detailedFromWhoisAt) + { + Asn = asn; + AsNames = asNames; + OrgNames = orgNames; + OrgIds = orgIds; + Countries = countries; + Registries = registries; + Sources = sources; + FirstSeen = firstSeen; + LastSeen = lastSeen; + Count = count; + RegistrarCreatedAt = registrarCreatedAt; + RegistrarUpdatedAt = registrarUpdatedAt; + RegistrantContacts = registrantContacts; + AdminContacts = adminContacts; + TechnicalContacts = technicalContacts; + RegistrarNames = registrarNames; + RegistrantNames = registrantNames; + AdminNames = adminNames; + TechnicalNames = technicalNames; + AdminOrgs = adminOrgs; + TechnicalOrgs = technicalOrgs; + RegistrantPhones = registrantPhones; + AdminPhones = adminPhones; + TechnicalPhones = technicalPhones; + DetailedFromWhoisAt = detailedFromWhoisAt; + } + + /// Gets or sets the asn. + public long? Asn { get; set; } + /// Gets the as names. + public IList AsNames { get; } + /// Gets the org names. + public IList OrgNames { get; } + /// Gets the org ids. + public IList OrgIds { get; } + /// Gets the countries. + public IList Countries { get; } + /// Gets the registries. + public IList Registries { get; } + /// Gets the sources. + public IList Sources { get; } + /// Gets or sets the first seen. + public DateTimeOffset? FirstSeen { get; set; } + /// Gets or sets the last seen. + public DateTimeOffset? LastSeen { get; set; } + /// Gets or sets the count. + public long? Count { get; set; } + /// Gets the registrar created at. + public IList RegistrarCreatedAt { get; } + /// Gets the registrar updated at. + public IList RegistrarUpdatedAt { get; } + /// Gets the registrant contacts. + public IList RegistrantContacts { get; } + /// Gets the admin contacts. + public IList AdminContacts { get; } + /// Gets the technical contacts. + public IList TechnicalContacts { get; } + /// Gets the registrar names. + public IList RegistrarNames { get; } + /// Gets the registrant names. + public IList RegistrantNames { get; } + /// Gets the admin names. + public IList AdminNames { get; } + /// Gets the technical names. + public IList TechnicalNames { get; } + /// Gets the admin orgs. + public IList AdminOrgs { get; } + /// Gets the technical orgs. + public IList TechnicalOrgs { get; } + /// Gets the registrant phones. + public IList RegistrantPhones { get; } + /// Gets the admin phones. + public IList AdminPhones { get; } + /// Gets the technical phones. + public IList TechnicalPhones { get; } + /// Gets or sets the detailed from whois at. + public DateTimeOffset? DetailedFromWhoisAt { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AsAssetResource.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AsAssetResource.Serialization.cs new file mode 100644 index 000000000000..82a77e128e74 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AsAssetResource.Serialization.cs @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class AsAssetResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("asset"u8); + writer.WriteObjectValue(Asset); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Uuid)) + { + writer.WritePropertyName("uuid"u8); + writer.WriteStringValue(Uuid.Value); + } + if (Optional.IsDefined(CreatedDate)) + { + writer.WritePropertyName("createdDate"u8); + writer.WriteStringValue(CreatedDate.Value, "O"); + } + if (Optional.IsDefined(UpdatedDate)) + { + writer.WritePropertyName("updatedDate"u8); + writer.WriteStringValue(UpdatedDate.Value, "O"); + } + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"u8); + writer.WriteStringValue(State.Value.ToString()); + } + if (Optional.IsDefined(ExternalId)) + { + writer.WritePropertyName("externalId"u8); + writer.WriteStringValue(ExternalId); + } + if (Optional.IsCollectionDefined(Labels)) + { + writer.WritePropertyName("labels"u8); + writer.WriteStartArray(); + foreach (var item in Labels) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Wildcard)) + { + writer.WritePropertyName("wildcard"u8); + writer.WriteBooleanValue(Wildcard.Value); + } + if (Optional.IsDefined(DiscoGroupName)) + { + writer.WritePropertyName("discoGroupName"u8); + writer.WriteStringValue(DiscoGroupName); + } + if (Optional.IsCollectionDefined(AuditTrail)) + { + writer.WritePropertyName("auditTrail"u8); + writer.WriteStartArray(); + foreach (var item in AuditTrail) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Reason)) + { + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason); + } + writer.WriteEndObject(); + } + + internal static AsAssetResource DeserializeAsAssetResource(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AsAsset asset = default; + string kind = default; + string id = default; + Optional name = default; + Optional displayName = default; + Optional uuid = default; + Optional createdDate = default; + Optional updatedDate = default; + Optional state = default; + Optional externalId = default; + Optional> labels = default; + Optional wildcard = default; + Optional discoGroupName = default; + Optional> auditTrail = default; + Optional reason = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("asset"u8)) + { + asset = AsAsset.DeserializeAsAsset(property.Value); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("uuid"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + uuid = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("createdDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("updatedDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + updatedDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("state"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = new AssetState(property.Value.GetString()); + continue; + } + if (property.NameEquals("externalId"u8)) + { + externalId = property.Value.GetString(); + continue; + } + if (property.NameEquals("labels"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + labels = array; + continue; + } + if (property.NameEquals("wildcard"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + wildcard = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("discoGroupName"u8)) + { + discoGroupName = property.Value.GetString(); + continue; + } + if (property.NameEquals("auditTrail"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AuditTrailItem.DeserializeAuditTrailItem(item)); + } + auditTrail = array; + continue; + } + if (property.NameEquals("reason"u8)) + { + reason = property.Value.GetString(); + continue; + } + } + return new AsAssetResource(kind, id, name.Value, displayName.Value, Optional.ToNullable(uuid), Optional.ToNullable(createdDate), Optional.ToNullable(updatedDate), Optional.ToNullable(state), externalId.Value, Optional.ToList(labels), Optional.ToNullable(wildcard), discoGroupName.Value, Optional.ToList(auditTrail), reason.Value, asset); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AsAssetResource FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAsAssetResource(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AsAssetResource.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AsAssetResource.cs new file mode 100644 index 000000000000..2e8a78418e41 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AsAssetResource.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The AsAssetResource. + public partial class AsAssetResource : AssetResource + { + /// Initializes a new instance of AsAssetResource. + /// asset. + /// is null. + public AsAssetResource(AsAsset asset) + { + Argument.AssertNotNull(asset, nameof(asset)); + + Kind = "as"; + Asset = asset; + } + + /// Initializes a new instance of AsAssetResource. + /// Discriminator. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// Global UUID for the asset. + /// The date this asset was first added to this workspace. + /// The date this asset was last updated for this workspace. + /// + /// An optional customer provided identifier for this asset. + /// Customer labels assigned to this asset. + /// An indicator of whether this asset represents a wildcard rollup of assets on this domain. + /// The name of the DiscoGroup that brought added this asset to the workspace. + /// The history of how this asset was pulled into the workspace through the discovery process. + /// + /// asset. + internal AsAssetResource(string kind, string id, string name, string displayName, Guid? uuid, DateTimeOffset? createdDate, DateTimeOffset? updatedDate, AssetState? state, string externalId, IList labels, bool? wildcard, string discoGroupName, IList auditTrail, string reason, AsAsset asset) : base(kind, id, name, displayName, uuid, createdDate, updatedDate, state, externalId, labels, wildcard, discoGroupName, auditTrail, reason) + { + Asset = asset; + } + + /// asset. + public AsAsset Asset { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetPageResult.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetPageResult.Serialization.cs new file mode 100644 index 000000000000..b35ea3926455 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetPageResult.Serialization.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class AssetPageResult + { + internal static AssetPageResult DeserializeAssetPageResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional totalElements = default; + Optional mark = default; + Optional nextLink = default; + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("totalElements"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + totalElements = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("mark"u8)) + { + mark = property.Value.GetString(); + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AssetResource.DeserializeAssetResource(item)); + } + value = array; + continue; + } + } + return new AssetPageResult(Optional.ToNullable(totalElements), mark.Value, nextLink.Value, Optional.ToList(value)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AssetPageResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAssetPageResult(document.RootElement); + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetPageResult.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetPageResult.cs new file mode 100644 index 000000000000..758867148943 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetPageResult.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The page of assets that match the provided metric. + public partial class AssetPageResult + { + /// Initializes a new instance of AssetPageResult. + internal AssetPageResult() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of AssetPageResult. + /// The total number of items available in the full result set. + /// The cursor mark to be used on the next request. Not set if using paging. + /// The link to access the next page of results. Not set if at the end of the result set. + /// The items in the current page of results. + internal AssetPageResult(long? totalElements, string mark, string nextLink, IReadOnlyList value) + { + TotalElements = totalElements; + Mark = mark; + NextLink = nextLink; + Value = value; + } + + /// The total number of items available in the full result set. + public long? TotalElements { get; } + /// The cursor mark to be used on the next request. Not set if using paging. + public string Mark { get; } + /// The link to access the next page of results. Not set if at the end of the result set. + public string NextLink { get; } + /// + /// The items in the current page of results. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , and . + /// + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetResource.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetResource.Serialization.cs new file mode 100644 index 000000000000..b87a5bdc3f7e --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetResource.Serialization.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class AssetResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Uuid)) + { + writer.WritePropertyName("uuid"u8); + writer.WriteStringValue(Uuid.Value); + } + if (Optional.IsDefined(CreatedDate)) + { + writer.WritePropertyName("createdDate"u8); + writer.WriteStringValue(CreatedDate.Value, "O"); + } + if (Optional.IsDefined(UpdatedDate)) + { + writer.WritePropertyName("updatedDate"u8); + writer.WriteStringValue(UpdatedDate.Value, "O"); + } + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"u8); + writer.WriteStringValue(State.Value.ToString()); + } + if (Optional.IsDefined(ExternalId)) + { + writer.WritePropertyName("externalId"u8); + writer.WriteStringValue(ExternalId); + } + if (Optional.IsCollectionDefined(Labels)) + { + writer.WritePropertyName("labels"u8); + writer.WriteStartArray(); + foreach (var item in Labels) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Wildcard)) + { + writer.WritePropertyName("wildcard"u8); + writer.WriteBooleanValue(Wildcard.Value); + } + if (Optional.IsDefined(DiscoGroupName)) + { + writer.WritePropertyName("discoGroupName"u8); + writer.WriteStringValue(DiscoGroupName); + } + if (Optional.IsCollectionDefined(AuditTrail)) + { + writer.WritePropertyName("auditTrail"u8); + writer.WriteStartArray(); + foreach (var item in AuditTrail) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Reason)) + { + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason); + } + writer.WriteEndObject(); + } + + internal static AssetResource DeserializeAssetResource(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("kind", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "as": return AsAssetResource.DeserializeAsAssetResource(element); + case "contact": return ContactAssetResource.DeserializeContactAssetResource(element); + case "domain": return DomainAssetResource.DeserializeDomainAssetResource(element); + case "host": return HostAssetResource.DeserializeHostAssetResource(element); + case "ipAddress": return IpAddressAssetResource.DeserializeIpAddressAssetResource(element); + case "ipBlock": return IpBlockAssetResource.DeserializeIpBlockAssetResource(element); + case "page": return PageAssetResource.DeserializePageAssetResource(element); + case "sslCert": return SslCertAssetResource.DeserializeSslCertAssetResource(element); + } + } + return UnknownAssetResource.DeserializeUnknownAssetResource(element); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AssetResource FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAssetResource(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetResource.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetResource.cs new file mode 100644 index 000000000000..e0ffceeeceea --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetResource.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// + /// The items in the current page of results. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , , , and . + /// + public abstract partial class AssetResource + { + /// Initializes a new instance of AssetResource. + protected AssetResource() + { + Labels = new ChangeTrackingList(); + AuditTrail = new ChangeTrackingList(); + } + + /// Initializes a new instance of AssetResource. + /// Discriminator. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// Global UUID for the asset. + /// The date this asset was first added to this workspace. + /// The date this asset was last updated for this workspace. + /// + /// An optional customer provided identifier for this asset. + /// Customer labels assigned to this asset. + /// An indicator of whether this asset represents a wildcard rollup of assets on this domain. + /// The name of the DiscoGroup that brought added this asset to the workspace. + /// The history of how this asset was pulled into the workspace through the discovery process. + /// + internal AssetResource(string kind, string id, string name, string displayName, Guid? uuid, DateTimeOffset? createdDate, DateTimeOffset? updatedDate, AssetState? state, string externalId, IList labels, bool? wildcard, string discoGroupName, IList auditTrail, string reason) + { + Kind = kind; + Id = id; + Name = name; + DisplayName = displayName; + Uuid = uuid; + CreatedDate = createdDate; + UpdatedDate = updatedDate; + State = state; + ExternalId = externalId; + Labels = labels; + Wildcard = wildcard; + DiscoGroupName = discoGroupName; + AuditTrail = auditTrail; + Reason = reason; + } + + /// Discriminator. + internal string Kind { get; set; } + /// The system generated unique id for the resource. + public string Id { get; } + /// The caller provided unique name for the resource. + public string Name { get; set; } + /// The name that can be used for display purposes. + public string DisplayName { get; set; } + /// Global UUID for the asset. + public Guid? Uuid { get; set; } + /// The date this asset was first added to this workspace. + public DateTimeOffset? CreatedDate { get; set; } + /// The date this asset was last updated for this workspace. + public DateTimeOffset? UpdatedDate { get; set; } + /// Gets or sets the state. + public AssetState? State { get; set; } + /// An optional customer provided identifier for this asset. + public string ExternalId { get; set; } + /// Customer labels assigned to this asset. + public IList Labels { get; } + /// An indicator of whether this asset represents a wildcard rollup of assets on this domain. + public bool? Wildcard { get; set; } + /// The name of the DiscoGroup that brought added this asset to the workspace. + public string DiscoGroupName { get; set; } + /// The history of how this asset was pulled into the workspace through the discovery process. + public IList AuditTrail { get; } + /// Gets or sets the reason. + public string Reason { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetSecurityPolicy.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetSecurityPolicy.Serialization.cs new file mode 100644 index 000000000000..b6f6d47918ed --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetSecurityPolicy.Serialization.cs @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class AssetSecurityPolicy : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(PolicyName)) + { + writer.WritePropertyName("policyName"u8); + writer.WriteStringValue(PolicyName); + } + if (Optional.IsDefined(IsAffected)) + { + writer.WritePropertyName("isAffected"u8); + writer.WriteBooleanValue(IsAffected.Value); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(Recent)) + { + writer.WritePropertyName("recent"u8); + writer.WriteBooleanValue(Recent.Value); + } + if (Optional.IsCollectionDefined(Sources)) + { + writer.WritePropertyName("sources"u8); + writer.WriteStartArray(); + foreach (var item in Sources) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static AssetSecurityPolicy DeserializeAssetSecurityPolicy(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional policyName = default; + Optional isAffected = default; + Optional description = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional count = default; + Optional recent = default; + Optional> sources = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("policyName"u8)) + { + policyName = property.Value.GetString(); + continue; + } + if (property.NameEquals("isAffected"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isAffected = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("recent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + recent = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("sources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Source.DeserializeSource(item)); + } + sources = array; + continue; + } + } + return new AssetSecurityPolicy(policyName.Value, Optional.ToNullable(isAffected), description.Value, Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(count), Optional.ToNullable(recent), Optional.ToList(sources)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AssetSecurityPolicy FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAssetSecurityPolicy(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetSecurityPolicy.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetSecurityPolicy.cs new file mode 100644 index 000000000000..d08fee649039 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetSecurityPolicy.cs @@ -0,0 +1,61 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The AssetSecurityPolicy. + public partial class AssetSecurityPolicy + { + /// Initializes a new instance of AssetSecurityPolicy. + public AssetSecurityPolicy() + { + Sources = new ChangeTrackingList(); + } + + /// Initializes a new instance of AssetSecurityPolicy. + /// + /// + /// + /// + /// + /// + /// + /// + internal AssetSecurityPolicy(string policyName, bool? isAffected, string description, DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count, bool? recent, IList sources) + { + PolicyName = policyName; + IsAffected = isAffected; + Description = description; + FirstSeen = firstSeen; + LastSeen = lastSeen; + Count = count; + Recent = recent; + Sources = sources; + } + + /// Gets or sets the policy name. + public string PolicyName { get; set; } + /// Gets or sets the is affected. + public bool? IsAffected { get; set; } + /// Gets or sets the description. + public string Description { get; set; } + /// Gets or sets the first seen. + public DateTimeOffset? FirstSeen { get; set; } + /// Gets or sets the last seen. + public DateTimeOffset? LastSeen { get; set; } + /// Gets or sets the count. + public long? Count { get; set; } + /// Gets or sets the recent. + public bool? Recent { get; set; } + /// Gets the sources. + public IList Sources { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetState.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetState.cs new file mode 100644 index 000000000000..adedb6e77bce --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetState.cs @@ -0,0 +1,65 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Analytics.Defender.Easm +{ + public readonly partial struct AssetState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AssetState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CandidateValue = "candidate"; + private const string ConfirmedValue = "confirmed"; + private const string DismissedValue = "dismissed"; + private const string CandidateInvestigateValue = "candidateInvestigate"; + private const string AssociatedPartnerValue = "associatedPartner"; + private const string AssociatedThirdpartyValue = "associatedThirdparty"; + private const string ArchivedValue = "archived"; + + /// candidate. + public static AssetState Candidate { get; } = new AssetState(CandidateValue); + /// confirmed. + public static AssetState Confirmed { get; } = new AssetState(ConfirmedValue); + /// dismissed. + public static AssetState Dismissed { get; } = new AssetState(DismissedValue); + /// candidateInvestigate. + public static AssetState CandidateInvestigate { get; } = new AssetState(CandidateInvestigateValue); + /// associatedPartner. + public static AssetState AssociatedPartner { get; } = new AssetState(AssociatedPartnerValue); + /// associatedThirdparty. + public static AssetState AssociatedThirdparty { get; } = new AssetState(AssociatedThirdpartyValue); + /// archived. + public static AssetState Archived { get; } = new AssetState(ArchivedValue); + /// Determines if two values are the same. + public static bool operator ==(AssetState left, AssetState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AssetState left, AssetState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AssetState(string value) => new AssetState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AssetState other && Equals(other); + /// + public bool Equals(AssetState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetSummaryResult.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetSummaryResult.Serialization.cs new file mode 100644 index 000000000000..610ba8100b52 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetSummaryResult.Serialization.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class AssetSummaryResult + { + internal static AssetSummaryResult DeserializeAssetSummaryResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional displayName = default; + Optional description = default; + Optional updatedAt = default; + Optional metricCategory = default; + Optional metric = default; + Optional filter = default; + Optional labelName = default; + Optional count = default; + Optional link = default; + Optional> children = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("updatedAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + updatedAt = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("metricCategory"u8)) + { + metricCategory = property.Value.GetString(); + continue; + } + if (property.NameEquals("metric"u8)) + { + metric = property.Value.GetString(); + continue; + } + if (property.NameEquals("filter"u8)) + { + filter = property.Value.GetString(); + continue; + } + if (property.NameEquals("labelName"u8)) + { + labelName = property.Value.GetString(); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("link"u8)) + { + link = property.Value.GetString(); + continue; + } + if (property.NameEquals("children"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeserializeAssetSummaryResult(item)); + } + children = array; + continue; + } + } + return new AssetSummaryResult(displayName.Value, description.Value, Optional.ToNullable(updatedAt), metricCategory.Value, metric.Value, filter.Value, labelName.Value, Optional.ToNullable(count), link.Value, Optional.ToList(children)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AssetSummaryResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAssetSummaryResult(document.RootElement); + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetSummaryResult.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetSummaryResult.cs new file mode 100644 index 000000000000..92aebafb2dcd --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetSummaryResult.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; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The collection of asset summaries. + public partial class AssetSummaryResult + { + /// Initializes a new instance of AssetSummaryResult. + internal AssetSummaryResult() + { + Children = new ChangeTrackingList(); + } + + /// Initializes a new instance of AssetSummaryResult. + /// The name of the summary response. Depending on the request time this will either be the asset filter, risk category, or risk metric. + /// The description of the summary response. Filters don't have a description. + /// The last time risk categories or risk metrics were captured. Set to the current time for asset filter requests, which always pull the live asset data. + /// If the request is for a metric category, this will contain the requested unique category name. + /// If the request is for a metric, this will contain the requested unique metric name. + /// If the request is for an asset filter, this will contain the corresponding filter. + /// An optional label used to filter requests results. + /// The count of assets matching the request parameters. + /// The link to the corresponding asset details. + /// The corresponding child entities. For metric categories this will contain metrics. For filters with groupBy and segmentBy this will contain facets. + internal AssetSummaryResult(string displayName, string description, DateTimeOffset? updatedAt, string metricCategory, string metric, string filter, string labelName, long? count, string link, IReadOnlyList children) + { + DisplayName = displayName; + Description = description; + UpdatedAt = updatedAt; + MetricCategory = metricCategory; + Metric = metric; + Filter = filter; + LabelName = labelName; + Count = count; + Link = link; + Children = children; + } + + /// The name of the summary response. Depending on the request time this will either be the asset filter, risk category, or risk metric. + public string DisplayName { get; } + /// The description of the summary response. Filters don't have a description. + public string Description { get; } + /// The last time risk categories or risk metrics were captured. Set to the current time for asset filter requests, which always pull the live asset data. + public DateTimeOffset? UpdatedAt { get; } + /// If the request is for a metric category, this will contain the requested unique category name. + public string MetricCategory { get; } + /// If the request is for a metric, this will contain the requested unique metric name. + public string Metric { get; } + /// If the request is for an asset filter, this will contain the corresponding filter. + public string Filter { get; } + /// An optional label used to filter requests results. + public string LabelName { get; } + /// The count of assets matching the request parameters. + public long? Count { get; } + /// The link to the corresponding asset details. + public string Link { get; } + /// The corresponding child entities. For metric categories this will contain metrics. For filters with groupBy and segmentBy this will contain facets. + public IReadOnlyList Children { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Attribute.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Attribute.Serialization.cs new file mode 100644 index 000000000000..6c53b3bcda8d --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Attribute.Serialization.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class Attribute : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(AttributeType)) + { + writer.WritePropertyName("attributeType"u8); + writer.WriteStringValue(AttributeType); + } + if (Optional.IsDefined(AttributeValue)) + { + writer.WritePropertyName("attributeValue"u8); + writer.WriteStringValue(AttributeValue); + } + if (Optional.IsCollectionDefined(Sources)) + { + writer.WritePropertyName("sources"u8); + writer.WriteStartArray(); + foreach (var item in Sources) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(Recent)) + { + writer.WritePropertyName("recent"u8); + writer.WriteBooleanValue(Recent.Value); + } + writer.WriteEndObject(); + } + + internal static Attribute DeserializeAttribute(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional attributeType = default; + Optional attributeValue = default; + Optional> sources = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional count = default; + Optional recent = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("attributeType"u8)) + { + attributeType = property.Value.GetString(); + continue; + } + if (property.NameEquals("attributeValue"u8)) + { + attributeValue = property.Value.GetString(); + continue; + } + if (property.NameEquals("sources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Source.DeserializeSource(item)); + } + sources = array; + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("recent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + recent = property.Value.GetBoolean(); + continue; + } + } + return new Attribute(attributeType.Value, attributeValue.Value, Optional.ToList(sources), Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(count), Optional.ToNullable(recent)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static Attribute FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAttribute(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Attribute.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Attribute.cs new file mode 100644 index 000000000000..dd25e2df577d --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Attribute.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The Attribute. + public partial class Attribute + { + /// Initializes a new instance of Attribute. + public Attribute() + { + Sources = new ChangeTrackingList(); + } + + /// Initializes a new instance of Attribute. + /// + /// + /// + /// + /// + /// + /// + internal Attribute(string attributeType, string attributeValue, IList sources, DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count, bool? recent) + { + AttributeType = attributeType; + AttributeValue = attributeValue; + Sources = sources; + FirstSeen = firstSeen; + LastSeen = lastSeen; + Count = count; + Recent = recent; + } + + /// Gets or sets the attribute type. + public string AttributeType { get; set; } + /// Gets or sets the attribute value. + public string AttributeValue { get; set; } + /// Gets the sources. + public IList Sources { get; } + /// Gets or sets the first seen. + public DateTimeOffset? FirstSeen { get; set; } + /// Gets or sets the last seen. + public DateTimeOffset? LastSeen { get; set; } + /// Gets or sets the count. + public long? Count { get; set; } + /// Gets or sets the recent. + public bool? Recent { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AuditTrailItem.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AuditTrailItem.Serialization.cs new file mode 100644 index 000000000000..3bbf980da93f --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AuditTrailItem.Serialization.cs @@ -0,0 +1,109 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class AuditTrailItem : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Kind)) + { + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.Value.ToString()); + } + if (Optional.IsDefined(Reason)) + { + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason); + } + writer.WriteEndObject(); + } + + internal static AuditTrailItem DeserializeAuditTrailItem(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional id = default; + Optional name = default; + Optional displayName = default; + Optional kind = default; + Optional reason = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + kind = new AuditTrailItemKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("reason"u8)) + { + reason = property.Value.GetString(); + continue; + } + } + return new AuditTrailItem(id.Value, name.Value, displayName.Value, Optional.ToNullable(kind), reason.Value); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AuditTrailItem FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAuditTrailItem(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AuditTrailItem.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AuditTrailItem.cs new file mode 100644 index 000000000000..6df947b01698 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AuditTrailItem.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Analytics.Defender.Easm +{ + /// The history of how this asset was pulled into the workspace through the discovery process. + public partial class AuditTrailItem + { + /// Initializes a new instance of AuditTrailItem. + public AuditTrailItem() + { + } + + /// Initializes a new instance of AuditTrailItem. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// The kind of asset. + /// An explanation of why this audit trail node was discovered from the previous node. + internal AuditTrailItem(string id, string name, string displayName, AuditTrailItemKind? kind, string reason) + { + Id = id; + Name = name; + DisplayName = displayName; + Kind = kind; + Reason = reason; + } + + /// The system generated unique id for the resource. + public string Id { get; set; } + /// The caller provided unique name for the resource. + public string Name { get; set; } + /// The name that can be used for display purposes. + public string DisplayName { get; set; } + /// The kind of asset. + public AuditTrailItemKind? Kind { get; set; } + /// An explanation of why this audit trail node was discovered from the previous node. + public string Reason { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AuditTrailItemKind.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AuditTrailItemKind.cs new file mode 100644 index 000000000000..385eaeb3010e --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AuditTrailItemKind.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.Analytics.Defender.Easm +{ + /// The kind of asset. + public readonly partial struct AuditTrailItemKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AuditTrailItemKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AsValue = "as"; + private const string ContactValue = "contact"; + private const string DomainValue = "domain"; + private const string HostValue = "host"; + private const string IpAddressValue = "ipAddress"; + private const string IpBlockValue = "ipBlock"; + private const string PageValue = "page"; + private const string SslCertValue = "sslCert"; + + /// as. + public static AuditTrailItemKind As { get; } = new AuditTrailItemKind(AsValue); + /// contact. + public static AuditTrailItemKind Contact { get; } = new AuditTrailItemKind(ContactValue); + /// domain. + public static AuditTrailItemKind Domain { get; } = new AuditTrailItemKind(DomainValue); + /// host. + public static AuditTrailItemKind Host { get; } = new AuditTrailItemKind(HostValue); + /// ipAddress. + public static AuditTrailItemKind IpAddress { get; } = new AuditTrailItemKind(IpAddressValue); + /// ipBlock. + public static AuditTrailItemKind IpBlock { get; } = new AuditTrailItemKind(IpBlockValue); + /// page. + public static AuditTrailItemKind Page { get; } = new AuditTrailItemKind(PageValue); + /// sslCert. + public static AuditTrailItemKind SslCert { get; } = new AuditTrailItemKind(SslCertValue); + /// Determines if two values are the same. + public static bool operator ==(AuditTrailItemKind left, AuditTrailItemKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AuditTrailItemKind left, AuditTrailItemKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AuditTrailItemKind(string value) => new AuditTrailItemKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AuditTrailItemKind other && Equals(other); + /// + public bool Equals(AuditTrailItemKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AzureDataExplorerDataConnection.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AzureDataExplorerDataConnection.Serialization.cs new file mode 100644 index 000000000000..a34ba729aa12 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AzureDataExplorerDataConnection.Serialization.cs @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class AzureDataExplorerDataConnection : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Content)) + { + writer.WritePropertyName("content"u8); + writer.WriteStringValue(Content.Value.ToString()); + } + if (Optional.IsDefined(Frequency)) + { + writer.WritePropertyName("frequency"u8); + writer.WriteStringValue(Frequency.Value.ToString()); + } + if (Optional.IsDefined(FrequencyOffset)) + { + writer.WritePropertyName("frequencyOffset"u8); + writer.WriteNumberValue(FrequencyOffset.Value); + } + if (Optional.IsDefined(Active)) + { + writer.WritePropertyName("active"u8); + writer.WriteBooleanValue(Active.Value); + } + writer.WriteEndObject(); + } + + internal static AzureDataExplorerDataConnection DeserializeAzureDataExplorerDataConnection(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AzureDataExplorerDataConnectionProperties properties = default; + string kind = default; + Optional id = default; + string name = default; + Optional displayName = default; + Optional content = default; + Optional createdDate = default; + Optional frequency = default; + Optional frequencyOffset = default; + Optional updatedDate = default; + Optional userUpdatedAt = default; + Optional active = default; + Optional inactiveMessage = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + properties = AzureDataExplorerDataConnectionProperties.DeserializeAzureDataExplorerDataConnectionProperties(property.Value); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("content"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + content = new DataConnectionContent(property.Value.GetString()); + continue; + } + if (property.NameEquals("createdDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("frequency"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + frequency = new DataConnectionFrequency(property.Value.GetString()); + continue; + } + if (property.NameEquals("frequencyOffset"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + frequencyOffset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("updatedDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + updatedDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("userUpdatedAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + userUpdatedAt = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("active"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + active = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("inactiveMessage"u8)) + { + inactiveMessage = property.Value.GetString(); + continue; + } + } + return new AzureDataExplorerDataConnection(kind, id.Value, name, displayName.Value, Optional.ToNullable(content), Optional.ToNullable(createdDate), Optional.ToNullable(frequency), Optional.ToNullable(frequencyOffset), Optional.ToNullable(updatedDate), Optional.ToNullable(userUpdatedAt), Optional.ToNullable(active), inactiveMessage.Value, properties); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AzureDataExplorerDataConnection FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAzureDataExplorerDataConnection(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AzureDataExplorerDataConnection.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AzureDataExplorerDataConnection.cs new file mode 100644 index 000000000000..81f463233812 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AzureDataExplorerDataConnection.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The AzureDataExplorerDataConnection. + public partial class AzureDataExplorerDataConnection : DataConnection + { + /// Initializes a new instance of AzureDataExplorerDataConnection. + /// properties. + /// is null. + public AzureDataExplorerDataConnection(AzureDataExplorerDataConnectionProperties properties) + { + Argument.AssertNotNull(properties, nameof(properties)); + + Kind = "azureDataExplorer"; + Properties = properties; + } + + /// Initializes a new instance of AzureDataExplorerDataConnection. + /// Discriminator. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// The type of data the data connection will transfer. + /// The date the data connection was created. + /// The rate at which the data connection will receive updates. + /// The day to update the data connection on. + /// The date the data connection was last updated. + /// The date the data connection was last updated by user. + /// An indicator of whether the data connection is active. + /// A message that specifies details about data connection if inactive. + /// properties. + internal AzureDataExplorerDataConnection(string kind, string id, string name, string displayName, DataConnectionContent? content, DateTimeOffset? createdDate, DataConnectionFrequency? frequency, int? frequencyOffset, DateTimeOffset? updatedDate, DateTimeOffset? userUpdatedAt, bool? active, string inactiveMessage, AzureDataExplorerDataConnectionProperties properties) : base(kind, id, name, displayName, content, createdDate, frequency, frequencyOffset, updatedDate, userUpdatedAt, active, inactiveMessage) + { + Properties = properties; + } + + /// properties. + public AzureDataExplorerDataConnectionProperties Properties { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AzureDataExplorerDataConnectionData.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AzureDataExplorerDataConnectionData.Serialization.cs new file mode 100644 index 000000000000..177fc1e102e5 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AzureDataExplorerDataConnectionData.Serialization.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class AzureDataExplorerDataConnectionData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Content)) + { + writer.WritePropertyName("content"u8); + writer.WriteStringValue(Content.Value.ToString()); + } + if (Optional.IsDefined(Frequency)) + { + writer.WritePropertyName("frequency"u8); + writer.WriteStringValue(Frequency.Value.ToString()); + } + if (Optional.IsDefined(FrequencyOffset)) + { + writer.WritePropertyName("frequencyOffset"u8); + writer.WriteNumberValue(FrequencyOffset.Value); + } + writer.WriteEndObject(); + } + + /// Convert into a Utf8JsonRequestContent. + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AzureDataExplorerDataConnectionData.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AzureDataExplorerDataConnectionData.cs new file mode 100644 index 000000000000..78a9c596703b --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AzureDataExplorerDataConnectionData.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The AzureDataExplorerDataConnectionData. + public partial class AzureDataExplorerDataConnectionData : DataConnectionData + { + /// Initializes a new instance of AzureDataExplorerDataConnectionData. + /// properties. + /// is null. + public AzureDataExplorerDataConnectionData(AzureDataExplorerDataConnectionProperties properties) + { + Argument.AssertNotNull(properties, nameof(properties)); + + Kind = "azureDataExplorer"; + Properties = properties; + } + + /// Initializes a new instance of AzureDataExplorerDataConnectionData. + /// Discriminator. + /// The name of data connection. + /// The type of data the data connection will transfer. + /// The rate at which the data connection will receive updates. + /// The day to update the data connection on. (1-7 for weekly, 1-31 for monthly). + /// properties. + internal AzureDataExplorerDataConnectionData(string kind, string name, DataConnectionContent? content, DataConnectionFrequency? frequency, int? frequencyOffset, AzureDataExplorerDataConnectionProperties properties) : base(kind, name, content, frequency, frequencyOffset) + { + Properties = properties; + } + + /// properties. + public AzureDataExplorerDataConnectionProperties Properties { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AzureDataExplorerDataConnectionProperties.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AzureDataExplorerDataConnectionProperties.Serialization.cs new file mode 100644 index 000000000000..ec7ef5aee29f --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AzureDataExplorerDataConnectionProperties.Serialization.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class AzureDataExplorerDataConnectionProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ClusterName)) + { + writer.WritePropertyName("clusterName"u8); + writer.WriteStringValue(ClusterName); + } + if (Optional.IsDefined(Region)) + { + writer.WritePropertyName("region"u8); + writer.WriteStringValue(Region); + } + if (Optional.IsDefined(DatabaseName)) + { + writer.WritePropertyName("databaseName"u8); + writer.WriteStringValue(DatabaseName); + } + writer.WriteEndObject(); + } + + internal static AzureDataExplorerDataConnectionProperties DeserializeAzureDataExplorerDataConnectionProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional clusterName = default; + Optional region = default; + Optional databaseName = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("clusterName"u8)) + { + clusterName = property.Value.GetString(); + continue; + } + if (property.NameEquals("region"u8)) + { + region = property.Value.GetString(); + continue; + } + if (property.NameEquals("databaseName"u8)) + { + databaseName = property.Value.GetString(); + continue; + } + } + return new AzureDataExplorerDataConnectionProperties(clusterName.Value, region.Value, databaseName.Value); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AzureDataExplorerDataConnectionProperties FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAzureDataExplorerDataConnectionProperties(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AzureDataExplorerDataConnectionProperties.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AzureDataExplorerDataConnectionProperties.cs new file mode 100644 index 000000000000..ffa3faf966a3 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AzureDataExplorerDataConnectionProperties.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Analytics.Defender.Easm +{ + /// The AzureDataExplorerDataConnectionProperties. + public partial class AzureDataExplorerDataConnectionProperties : DataConnectionProperties + { + /// Initializes a new instance of AzureDataExplorerDataConnectionProperties. + public AzureDataExplorerDataConnectionProperties() + { + } + + /// Initializes a new instance of AzureDataExplorerDataConnectionProperties. + /// The azure data explorer cluster name. + /// The azure data explorer region. + /// The azure data explorer database name. + internal AzureDataExplorerDataConnectionProperties(string clusterName, string region, string databaseName) + { + ClusterName = clusterName; + Region = region; + DatabaseName = databaseName; + } + + /// The azure data explorer cluster name. + public string ClusterName { get; set; } + /// The azure data explorer region. + public string Region { get; set; } + /// The azure data explorer database name. + public string DatabaseName { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Banner.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Banner.Serialization.cs new file mode 100644 index 000000000000..069bd9c92970 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Banner.Serialization.cs @@ -0,0 +1,196 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class Banner : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Port)) + { + writer.WritePropertyName("port"u8); + writer.WriteNumberValue(Port.Value); + } + if (Optional.IsDefined(BannerProperty)) + { + writer.WritePropertyName("banner"u8); + writer.WriteStringValue(BannerProperty); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(ScanType)) + { + writer.WritePropertyName("scanType"u8); + writer.WriteStringValue(ScanType); + } + if (Optional.IsDefined(BannerMetadata)) + { + writer.WritePropertyName("bannerMetadata"u8); + writer.WriteStringValue(BannerMetadata); + } + if (Optional.IsDefined(Recent)) + { + writer.WritePropertyName("recent"u8); + writer.WriteBooleanValue(Recent.Value); + } + if (Optional.IsDefined(Sha256)) + { + writer.WritePropertyName("sha256"u8); + writer.WriteStringValue(Sha256); + } + if (Optional.IsCollectionDefined(Sources)) + { + writer.WritePropertyName("sources"u8); + writer.WriteStartArray(); + foreach (var item in Sources) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static Banner DeserializeBanner(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional port = default; + Optional banner = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional count = default; + Optional scanType = default; + Optional bannerMetadata = default; + Optional recent = default; + Optional sha256 = default; + Optional> sources = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("port"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + port = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("banner"u8)) + { + banner = property.Value.GetString(); + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("scanType"u8)) + { + scanType = property.Value.GetString(); + continue; + } + if (property.NameEquals("bannerMetadata"u8)) + { + bannerMetadata = property.Value.GetString(); + continue; + } + if (property.NameEquals("recent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + recent = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("sha256"u8)) + { + sha256 = property.Value.GetString(); + continue; + } + if (property.NameEquals("sources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Source.DeserializeSource(item)); + } + sources = array; + continue; + } + } + return new Banner(Optional.ToNullable(port), banner.Value, Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(count), scanType.Value, bannerMetadata.Value, Optional.ToNullable(recent), sha256.Value, Optional.ToList(sources)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static Banner FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeBanner(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Banner.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Banner.cs new file mode 100644 index 000000000000..e2dd29e9338a --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Banner.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; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The Banner. + public partial class Banner + { + /// Initializes a new instance of Banner. + public Banner() + { + Sources = new ChangeTrackingList(); + } + + /// Initializes a new instance of Banner. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + internal Banner(int? port, string bannerProperty, DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count, string scanType, string bannerMetadata, bool? recent, string sha256, IList sources) + { + Port = port; + BannerProperty = bannerProperty; + FirstSeen = firstSeen; + LastSeen = lastSeen; + Count = count; + ScanType = scanType; + BannerMetadata = bannerMetadata; + Recent = recent; + Sha256 = sha256; + Sources = sources; + } + + /// Gets or sets the port. + public int? Port { get; set; } + /// Gets or sets the banner property. + public string BannerProperty { get; set; } + /// Gets or sets the first seen. + public DateTimeOffset? FirstSeen { get; set; } + /// Gets or sets the last seen. + public DateTimeOffset? LastSeen { get; set; } + /// Gets or sets the count. + public long? Count { get; set; } + /// Gets or sets the scan type. + public string ScanType { get; set; } + /// Gets or sets the banner metadata. + public string BannerMetadata { get; set; } + /// Gets or sets the recent. + public bool? Recent { get; set; } + /// Gets or sets the sha 256. + public string Sha256 { get; set; } + /// Gets the sources. + public IList Sources { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ContactAsset.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ContactAsset.Serialization.cs new file mode 100644 index 000000000000..838b322270a6 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ContactAsset.Serialization.cs @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class ContactAsset : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Email)) + { + writer.WritePropertyName("email"u8); + writer.WriteStringValue(Email); + } + if (Optional.IsCollectionDefined(Names)) + { + writer.WritePropertyName("names"u8); + writer.WriteStartArray(); + foreach (var item in Names) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Organizations)) + { + writer.WritePropertyName("organizations"u8); + writer.WriteStartArray(); + foreach (var item in Organizations) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Sources)) + { + writer.WritePropertyName("sources"u8); + writer.WriteStartArray(); + foreach (var item in Sources) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + writer.WriteEndObject(); + } + + internal static ContactAsset DeserializeContactAsset(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional email = default; + Optional> names = default; + Optional> organizations = default; + Optional> sources = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional count = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("email"u8)) + { + email = property.Value.GetString(); + continue; + } + if (property.NameEquals("names"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + names = array; + continue; + } + if (property.NameEquals("organizations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + organizations = array; + continue; + } + if (property.NameEquals("sources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Source.DeserializeSource(item)); + } + sources = array; + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + } + return new ContactAsset(email.Value, Optional.ToList(names), Optional.ToList(organizations), Optional.ToList(sources), Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(count)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ContactAsset FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeContactAsset(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ContactAsset.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ContactAsset.cs new file mode 100644 index 000000000000..572f2802ee08 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ContactAsset.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The ContactAsset. + public partial class ContactAsset : InventoryAsset + { + /// Initializes a new instance of ContactAsset. + public ContactAsset() + { + Names = new ChangeTrackingList(); + Organizations = new ChangeTrackingList(); + Sources = new ChangeTrackingList(); + } + + /// Initializes a new instance of ContactAsset. + /// + /// + /// + /// + /// + /// + /// + internal ContactAsset(string email, IList names, IList organizations, IList sources, DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count) + { + Email = email; + Names = names; + Organizations = organizations; + Sources = sources; + FirstSeen = firstSeen; + LastSeen = lastSeen; + Count = count; + } + + /// Gets or sets the email. + public string Email { get; set; } + /// Gets the names. + public IList Names { get; } + /// Gets the organizations. + public IList Organizations { get; } + /// Gets the sources. + public IList Sources { get; } + /// Gets or sets the first seen. + public DateTimeOffset? FirstSeen { get; set; } + /// Gets or sets the last seen. + public DateTimeOffset? LastSeen { get; set; } + /// Gets or sets the count. + public long? Count { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ContactAssetResource.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ContactAssetResource.Serialization.cs new file mode 100644 index 000000000000..f2423aea1d19 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ContactAssetResource.Serialization.cs @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class ContactAssetResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("asset"u8); + writer.WriteObjectValue(Asset); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Uuid)) + { + writer.WritePropertyName("uuid"u8); + writer.WriteStringValue(Uuid.Value); + } + if (Optional.IsDefined(CreatedDate)) + { + writer.WritePropertyName("createdDate"u8); + writer.WriteStringValue(CreatedDate.Value, "O"); + } + if (Optional.IsDefined(UpdatedDate)) + { + writer.WritePropertyName("updatedDate"u8); + writer.WriteStringValue(UpdatedDate.Value, "O"); + } + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"u8); + writer.WriteStringValue(State.Value.ToString()); + } + if (Optional.IsDefined(ExternalId)) + { + writer.WritePropertyName("externalId"u8); + writer.WriteStringValue(ExternalId); + } + if (Optional.IsCollectionDefined(Labels)) + { + writer.WritePropertyName("labels"u8); + writer.WriteStartArray(); + foreach (var item in Labels) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Wildcard)) + { + writer.WritePropertyName("wildcard"u8); + writer.WriteBooleanValue(Wildcard.Value); + } + if (Optional.IsDefined(DiscoGroupName)) + { + writer.WritePropertyName("discoGroupName"u8); + writer.WriteStringValue(DiscoGroupName); + } + if (Optional.IsCollectionDefined(AuditTrail)) + { + writer.WritePropertyName("auditTrail"u8); + writer.WriteStartArray(); + foreach (var item in AuditTrail) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Reason)) + { + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason); + } + writer.WriteEndObject(); + } + + internal static ContactAssetResource DeserializeContactAssetResource(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ContactAsset asset = default; + string kind = default; + string id = default; + Optional name = default; + Optional displayName = default; + Optional uuid = default; + Optional createdDate = default; + Optional updatedDate = default; + Optional state = default; + Optional externalId = default; + Optional> labels = default; + Optional wildcard = default; + Optional discoGroupName = default; + Optional> auditTrail = default; + Optional reason = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("asset"u8)) + { + asset = ContactAsset.DeserializeContactAsset(property.Value); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("uuid"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + uuid = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("createdDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("updatedDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + updatedDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("state"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = new AssetState(property.Value.GetString()); + continue; + } + if (property.NameEquals("externalId"u8)) + { + externalId = property.Value.GetString(); + continue; + } + if (property.NameEquals("labels"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + labels = array; + continue; + } + if (property.NameEquals("wildcard"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + wildcard = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("discoGroupName"u8)) + { + discoGroupName = property.Value.GetString(); + continue; + } + if (property.NameEquals("auditTrail"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AuditTrailItem.DeserializeAuditTrailItem(item)); + } + auditTrail = array; + continue; + } + if (property.NameEquals("reason"u8)) + { + reason = property.Value.GetString(); + continue; + } + } + return new ContactAssetResource(kind, id, name.Value, displayName.Value, Optional.ToNullable(uuid), Optional.ToNullable(createdDate), Optional.ToNullable(updatedDate), Optional.ToNullable(state), externalId.Value, Optional.ToList(labels), Optional.ToNullable(wildcard), discoGroupName.Value, Optional.ToList(auditTrail), reason.Value, asset); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new ContactAssetResource FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeContactAssetResource(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ContactAssetResource.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ContactAssetResource.cs new file mode 100644 index 000000000000..8bb9cf3c7b2f --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ContactAssetResource.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The ContactAssetResource. + public partial class ContactAssetResource : AssetResource + { + /// Initializes a new instance of ContactAssetResource. + /// asset. + /// is null. + public ContactAssetResource(ContactAsset asset) + { + Argument.AssertNotNull(asset, nameof(asset)); + + Kind = "contact"; + Asset = asset; + } + + /// Initializes a new instance of ContactAssetResource. + /// Discriminator. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// Global UUID for the asset. + /// The date this asset was first added to this workspace. + /// The date this asset was last updated for this workspace. + /// + /// An optional customer provided identifier for this asset. + /// Customer labels assigned to this asset. + /// An indicator of whether this asset represents a wildcard rollup of assets on this domain. + /// The name of the DiscoGroup that brought added this asset to the workspace. + /// The history of how this asset was pulled into the workspace through the discovery process. + /// + /// asset. + internal ContactAssetResource(string kind, string id, string name, string displayName, Guid? uuid, DateTimeOffset? createdDate, DateTimeOffset? updatedDate, AssetState? state, string externalId, IList labels, bool? wildcard, string discoGroupName, IList auditTrail, string reason, ContactAsset asset) : base(kind, id, name, displayName, uuid, createdDate, updatedDate, state, externalId, labels, wildcard, discoGroupName, auditTrail, reason) + { + Asset = asset; + } + + /// asset. + public ContactAsset Asset { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Cookie.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Cookie.Serialization.cs new file mode 100644 index 000000000000..f39071a86c24 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Cookie.Serialization.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class Cookie : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(CookieName)) + { + writer.WritePropertyName("cookieName"u8); + writer.WriteStringValue(CookieName); + } + if (Optional.IsDefined(CookieDomain)) + { + writer.WritePropertyName("cookieDomain"u8); + writer.WriteStringValue(CookieDomain); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(Recent)) + { + writer.WritePropertyName("recent"u8); + writer.WriteBooleanValue(Recent.Value); + } + if (Optional.IsDefined(CookieExpiryDate)) + { + writer.WritePropertyName("cookieExpiryDate"u8); + writer.WriteStringValue(CookieExpiryDate.Value, "O"); + } + writer.WriteEndObject(); + } + + internal static Cookie DeserializeCookie(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional cookieName = default; + Optional cookieDomain = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional count = default; + Optional recent = default; + Optional cookieExpiryDate = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("cookieName"u8)) + { + cookieName = property.Value.GetString(); + continue; + } + if (property.NameEquals("cookieDomain"u8)) + { + cookieDomain = property.Value.GetString(); + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("recent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + recent = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("cookieExpiryDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + cookieExpiryDate = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new Cookie(cookieName.Value, cookieDomain.Value, Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(count), Optional.ToNullable(recent), Optional.ToNullable(cookieExpiryDate)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static Cookie FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCookie(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Cookie.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Cookie.cs new file mode 100644 index 000000000000..110c3d04ae49 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Cookie.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Analytics.Defender.Easm +{ + /// The Cookie. + public partial class Cookie + { + /// Initializes a new instance of Cookie. + public Cookie() + { + } + + /// Initializes a new instance of Cookie. + /// + /// + /// + /// + /// + /// + /// + internal Cookie(string cookieName, string cookieDomain, DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count, bool? recent, DateTimeOffset? cookieExpiryDate) + { + CookieName = cookieName; + CookieDomain = cookieDomain; + FirstSeen = firstSeen; + LastSeen = lastSeen; + Count = count; + Recent = recent; + CookieExpiryDate = cookieExpiryDate; + } + + /// Gets or sets the cookie name. + public string CookieName { get; set; } + /// Gets or sets the cookie domain. + public string CookieDomain { get; set; } + /// Gets or sets the first seen. + public DateTimeOffset? FirstSeen { get; set; } + /// Gets or sets the last seen. + public DateTimeOffset? LastSeen { get; set; } + /// Gets or sets the count. + public long? Count { get; set; } + /// Gets or sets the recent. + public bool? Recent { get; set; } + /// Gets or sets the cookie expiry date. + public DateTimeOffset? CookieExpiryDate { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Cve.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Cve.Serialization.cs new file mode 100644 index 000000000000..0ba8c7e5b930 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Cve.Serialization.cs @@ -0,0 +1,102 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class Cve : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(CweId)) + { + writer.WritePropertyName("cweId"u8); + writer.WriteStringValue(CweId); + } + if (Optional.IsDefined(CvssScore)) + { + writer.WritePropertyName("cvssScore"u8); + writer.WriteNumberValue(CvssScore.Value); + } + if (Optional.IsDefined(Cvss3Summary)) + { + writer.WritePropertyName("cvss3Summary"u8); + writer.WriteObjectValue(Cvss3Summary); + } + writer.WriteEndObject(); + } + + internal static Cve DeserializeCve(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional cweId = default; + Optional cvssScore = default; + Optional cvss3Summary = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("cweId"u8)) + { + cweId = property.Value.GetString(); + continue; + } + if (property.NameEquals("cvssScore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + cvssScore = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("cvss3Summary"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + cvss3Summary = Cvss3Summary.DeserializeCvss3Summary(property.Value); + continue; + } + } + return new Cve(name.Value, cweId.Value, Optional.ToNullable(cvssScore), cvss3Summary.Value); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static Cve FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCve(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Cve.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Cve.cs new file mode 100644 index 000000000000..fe04acb2d3c1 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Cve.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Analytics.Defender.Easm +{ + /// The Cve. + public partial class Cve + { + /// Initializes a new instance of Cve. + public Cve() + { + } + + /// Initializes a new instance of Cve. + /// + /// + /// + /// + internal Cve(string name, string cweId, float? cvssScore, Cvss3Summary cvss3Summary) + { + Name = name; + CweId = cweId; + CvssScore = cvssScore; + Cvss3Summary = cvss3Summary; + } + + /// Gets or sets the name. + public string Name { get; set; } + /// Gets or sets the cwe id. + public string CweId { get; set; } + /// Gets or sets the cvss score. + public float? CvssScore { get; set; } + /// Gets or sets the cvss 3 summary. + public Cvss3Summary Cvss3Summary { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Cvss3Summary.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Cvss3Summary.Serialization.cs new file mode 100644 index 000000000000..e7649dc68646 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Cvss3Summary.Serialization.cs @@ -0,0 +1,249 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class Cvss3Summary : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Version)) + { + writer.WritePropertyName("version"u8); + writer.WriteStringValue(Version); + } + if (Optional.IsDefined(VectorString)) + { + writer.WritePropertyName("vectorString"u8); + writer.WriteStringValue(VectorString); + } + if (Optional.IsDefined(AttackVector)) + { + writer.WritePropertyName("attackVector"u8); + writer.WriteStringValue(AttackVector); + } + if (Optional.IsDefined(AttackComplexity)) + { + writer.WritePropertyName("attackComplexity"u8); + writer.WriteStringValue(AttackComplexity); + } + if (Optional.IsDefined(PrivilegesRequired)) + { + writer.WritePropertyName("privilegesRequired"u8); + writer.WriteStringValue(PrivilegesRequired); + } + if (Optional.IsDefined(UserInteraction)) + { + writer.WritePropertyName("userInteraction"u8); + writer.WriteStringValue(UserInteraction); + } + if (Optional.IsDefined(Scope)) + { + writer.WritePropertyName("scope"u8); + writer.WriteStringValue(Scope); + } + if (Optional.IsDefined(ConfidentialityImpact)) + { + writer.WritePropertyName("confidentialityImpact"u8); + writer.WriteStringValue(ConfidentialityImpact); + } + if (Optional.IsDefined(IntegrityImpact)) + { + writer.WritePropertyName("integrityImpact"u8); + writer.WriteStringValue(IntegrityImpact); + } + if (Optional.IsDefined(AvailabilityImpact)) + { + writer.WritePropertyName("availabilityImpact"u8); + writer.WriteStringValue(AvailabilityImpact); + } + if (Optional.IsDefined(BaseScore)) + { + writer.WritePropertyName("baseScore"u8); + writer.WriteNumberValue(BaseScore.Value); + } + if (Optional.IsDefined(BaseSeverity)) + { + writer.WritePropertyName("baseSeverity"u8); + writer.WriteStringValue(BaseSeverity); + } + if (Optional.IsDefined(ExploitCodeMaturity)) + { + writer.WritePropertyName("exploitCodeMaturity"u8); + writer.WriteStringValue(ExploitCodeMaturity); + } + if (Optional.IsDefined(RemediationLevel)) + { + writer.WritePropertyName("remediationLevel"u8); + writer.WriteStringValue(RemediationLevel); + } + if (Optional.IsDefined(ReportConfidence)) + { + writer.WritePropertyName("reportConfidence"u8); + writer.WriteStringValue(ReportConfidence); + } + if (Optional.IsDefined(ExploitabilityScore)) + { + writer.WritePropertyName("exploitabilityScore"u8); + writer.WriteNumberValue(ExploitabilityScore.Value); + } + if (Optional.IsDefined(ImpactScore)) + { + writer.WritePropertyName("impactScore"u8); + writer.WriteNumberValue(ImpactScore.Value); + } + writer.WriteEndObject(); + } + + internal static Cvss3Summary DeserializeCvss3Summary(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional version = default; + Optional vectorString = default; + Optional attackVector = default; + Optional attackComplexity = default; + Optional privilegesRequired = default; + Optional userInteraction = default; + Optional scope = default; + Optional confidentialityImpact = default; + Optional integrityImpact = default; + Optional availabilityImpact = default; + Optional baseScore = default; + Optional baseSeverity = default; + Optional exploitCodeMaturity = default; + Optional remediationLevel = default; + Optional reportConfidence = default; + Optional exploitabilityScore = default; + Optional impactScore = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("version"u8)) + { + version = property.Value.GetString(); + continue; + } + if (property.NameEquals("vectorString"u8)) + { + vectorString = property.Value.GetString(); + continue; + } + if (property.NameEquals("attackVector"u8)) + { + attackVector = property.Value.GetString(); + continue; + } + if (property.NameEquals("attackComplexity"u8)) + { + attackComplexity = property.Value.GetString(); + continue; + } + if (property.NameEquals("privilegesRequired"u8)) + { + privilegesRequired = property.Value.GetString(); + continue; + } + if (property.NameEquals("userInteraction"u8)) + { + userInteraction = property.Value.GetString(); + continue; + } + if (property.NameEquals("scope"u8)) + { + scope = property.Value.GetString(); + continue; + } + if (property.NameEquals("confidentialityImpact"u8)) + { + confidentialityImpact = property.Value.GetString(); + continue; + } + if (property.NameEquals("integrityImpact"u8)) + { + integrityImpact = property.Value.GetString(); + continue; + } + if (property.NameEquals("availabilityImpact"u8)) + { + availabilityImpact = property.Value.GetString(); + continue; + } + if (property.NameEquals("baseScore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + baseScore = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("baseSeverity"u8)) + { + baseSeverity = property.Value.GetString(); + continue; + } + if (property.NameEquals("exploitCodeMaturity"u8)) + { + exploitCodeMaturity = property.Value.GetString(); + continue; + } + if (property.NameEquals("remediationLevel"u8)) + { + remediationLevel = property.Value.GetString(); + continue; + } + if (property.NameEquals("reportConfidence"u8)) + { + reportConfidence = property.Value.GetString(); + continue; + } + if (property.NameEquals("exploitabilityScore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + exploitabilityScore = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("impactScore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + impactScore = property.Value.GetSingle(); + continue; + } + } + return new Cvss3Summary(version.Value, vectorString.Value, attackVector.Value, attackComplexity.Value, privilegesRequired.Value, userInteraction.Value, scope.Value, confidentialityImpact.Value, integrityImpact.Value, availabilityImpact.Value, Optional.ToNullable(baseScore), baseSeverity.Value, exploitCodeMaturity.Value, remediationLevel.Value, reportConfidence.Value, Optional.ToNullable(exploitabilityScore), Optional.ToNullable(impactScore)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static Cvss3Summary FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCvss3Summary(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Cvss3Summary.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Cvss3Summary.cs new file mode 100644 index 000000000000..05cac8c6703d --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Cvss3Summary.cs @@ -0,0 +1,92 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Analytics.Defender.Easm +{ + /// The Cvss3Summary. + public partial class Cvss3Summary + { + /// Initializes a new instance of Cvss3Summary. + public Cvss3Summary() + { + } + + /// Initializes a new instance of Cvss3Summary. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + internal Cvss3Summary(string version, string vectorString, string attackVector, string attackComplexity, string privilegesRequired, string userInteraction, string scope, string confidentialityImpact, string integrityImpact, string availabilityImpact, float? baseScore, string baseSeverity, string exploitCodeMaturity, string remediationLevel, string reportConfidence, float? exploitabilityScore, float? impactScore) + { + Version = version; + VectorString = vectorString; + AttackVector = attackVector; + AttackComplexity = attackComplexity; + PrivilegesRequired = privilegesRequired; + UserInteraction = userInteraction; + Scope = scope; + ConfidentialityImpact = confidentialityImpact; + IntegrityImpact = integrityImpact; + AvailabilityImpact = availabilityImpact; + BaseScore = baseScore; + BaseSeverity = baseSeverity; + ExploitCodeMaturity = exploitCodeMaturity; + RemediationLevel = remediationLevel; + ReportConfidence = reportConfidence; + ExploitabilityScore = exploitabilityScore; + ImpactScore = impactScore; + } + + /// Gets or sets the version. + public string Version { get; set; } + /// Gets or sets the vector string. + public string VectorString { get; set; } + /// Gets or sets the attack vector. + public string AttackVector { get; set; } + /// Gets or sets the attack complexity. + public string AttackComplexity { get; set; } + /// Gets or sets the privileges required. + public string PrivilegesRequired { get; set; } + /// Gets or sets the user interaction. + public string UserInteraction { get; set; } + /// Gets or sets the scope. + public string Scope { get; set; } + /// Gets or sets the confidentiality impact. + public string ConfidentialityImpact { get; set; } + /// Gets or sets the integrity impact. + public string IntegrityImpact { get; set; } + /// Gets or sets the availability impact. + public string AvailabilityImpact { get; set; } + /// Gets or sets the base score. + public float? BaseScore { get; set; } + /// Gets or sets the base severity. + public string BaseSeverity { get; set; } + /// Gets or sets the exploit code maturity. + public string ExploitCodeMaturity { get; set; } + /// Gets or sets the remediation level. + public string RemediationLevel { get; set; } + /// Gets or sets the report confidence. + public string ReportConfidence { get; set; } + /// Gets or sets the exploitability score. + public float? ExploitabilityScore { get; set; } + /// Gets or sets the impact score. + public float? ImpactScore { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DataConnection.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DataConnection.Serialization.cs new file mode 100644 index 000000000000..a508627726aa --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DataConnection.Serialization.cs @@ -0,0 +1,87 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class DataConnection : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Content)) + { + writer.WritePropertyName("content"u8); + writer.WriteStringValue(Content.Value.ToString()); + } + if (Optional.IsDefined(Frequency)) + { + writer.WritePropertyName("frequency"u8); + writer.WriteStringValue(Frequency.Value.ToString()); + } + if (Optional.IsDefined(FrequencyOffset)) + { + writer.WritePropertyName("frequencyOffset"u8); + writer.WriteNumberValue(FrequencyOffset.Value); + } + if (Optional.IsDefined(Active)) + { + writer.WritePropertyName("active"u8); + writer.WriteBooleanValue(Active.Value); + } + writer.WriteEndObject(); + } + + internal static DataConnection DeserializeDataConnection(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("kind", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "logAnalytics": return LogAnalyticsDataConnection.DeserializeLogAnalyticsDataConnection(element); + case "azureDataExplorer": return AzureDataExplorerDataConnection.DeserializeAzureDataExplorerDataConnection(element); + } + } + return UnknownDataConnection.DeserializeUnknownDataConnection(element); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DataConnection FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDataConnection(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DataConnection.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DataConnection.cs new file mode 100644 index 000000000000..18eacd080bf5 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DataConnection.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Analytics.Defender.Easm +{ + /// + /// The DataConnection. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public abstract partial class DataConnection + { + /// Initializes a new instance of DataConnection. + protected DataConnection() + { + } + + /// Initializes a new instance of DataConnection. + /// Discriminator. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// The type of data the data connection will transfer. + /// The date the data connection was created. + /// The rate at which the data connection will receive updates. + /// The day to update the data connection on. + /// The date the data connection was last updated. + /// The date the data connection was last updated by user. + /// An indicator of whether the data connection is active. + /// A message that specifies details about data connection if inactive. + internal DataConnection(string kind, string id, string name, string displayName, DataConnectionContent? content, DateTimeOffset? createdDate, DataConnectionFrequency? frequency, int? frequencyOffset, DateTimeOffset? updatedDate, DateTimeOffset? userUpdatedAt, bool? active, string inactiveMessage) + { + Kind = kind; + Id = id; + Name = name; + DisplayName = displayName; + Content = content; + CreatedDate = createdDate; + Frequency = frequency; + FrequencyOffset = frequencyOffset; + UpdatedDate = updatedDate; + UserUpdatedAt = userUpdatedAt; + Active = active; + InactiveMessage = inactiveMessage; + } + + /// Discriminator. + internal string Kind { get; set; } + /// The system generated unique id for the resource. + public string Id { get; set; } + /// The caller provided unique name for the resource. + public string Name { get; } + /// The name that can be used for display purposes. + public string DisplayName { get; set; } + /// The type of data the data connection will transfer. + public DataConnectionContent? Content { get; set; } + /// The date the data connection was created. + public DateTimeOffset? CreatedDate { get; } + /// The rate at which the data connection will receive updates. + public DataConnectionFrequency? Frequency { get; set; } + /// The day to update the data connection on. + public int? FrequencyOffset { get; set; } + /// The date the data connection was last updated. + public DateTimeOffset? UpdatedDate { get; } + /// The date the data connection was last updated by user. + public DateTimeOffset? UserUpdatedAt { get; } + /// An indicator of whether the data connection is active. + public bool? Active { get; set; } + /// A message that specifies details about data connection if inactive. + public string InactiveMessage { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DataConnectionContent.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DataConnectionContent.cs new file mode 100644 index 000000000000..57e23b550634 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DataConnectionContent.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Analytics.Defender.Easm +{ + /// The type of data the data connection will transfer. + public readonly partial struct DataConnectionContent : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DataConnectionContent(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AssetsValue = "assets"; + private const string AttackSurfaceInsightsValue = "attackSurfaceInsights"; + + /// assets. + public static DataConnectionContent Assets { get; } = new DataConnectionContent(AssetsValue); + /// attackSurfaceInsights. + public static DataConnectionContent AttackSurfaceInsights { get; } = new DataConnectionContent(AttackSurfaceInsightsValue); + /// Determines if two values are the same. + public static bool operator ==(DataConnectionContent left, DataConnectionContent right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DataConnectionContent left, DataConnectionContent right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DataConnectionContent(string value) => new DataConnectionContent(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DataConnectionContent other && Equals(other); + /// + public bool Equals(DataConnectionContent other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DataConnectionData.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DataConnectionData.Serialization.cs new file mode 100644 index 000000000000..71b4f704d619 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DataConnectionData.Serialization.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class DataConnectionData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Content)) + { + writer.WritePropertyName("content"u8); + writer.WriteStringValue(Content.Value.ToString()); + } + if (Optional.IsDefined(Frequency)) + { + writer.WritePropertyName("frequency"u8); + writer.WriteStringValue(Frequency.Value.ToString()); + } + if (Optional.IsDefined(FrequencyOffset)) + { + writer.WritePropertyName("frequencyOffset"u8); + writer.WriteNumberValue(FrequencyOffset.Value); + } + writer.WriteEndObject(); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DataConnectionData.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DataConnectionData.cs new file mode 100644 index 000000000000..8e11423778b0 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DataConnectionData.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Analytics.Defender.Easm +{ + /// + /// The DataConnectionData. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public abstract partial class DataConnectionData + { + /// Initializes a new instance of DataConnectionData. + protected DataConnectionData() + { + } + + /// Initializes a new instance of DataConnectionData. + /// Discriminator. + /// The name of data connection. + /// The type of data the data connection will transfer. + /// The rate at which the data connection will receive updates. + /// The day to update the data connection on. (1-7 for weekly, 1-31 for monthly). + internal DataConnectionData(string kind, string name, DataConnectionContent? content, DataConnectionFrequency? frequency, int? frequencyOffset) + { + Kind = kind; + Name = name; + Content = content; + Frequency = frequency; + FrequencyOffset = frequencyOffset; + } + + /// Discriminator. + internal string Kind { get; set; } + /// The name of data connection. + public string Name { get; set; } + /// The type of data the data connection will transfer. + public DataConnectionContent? Content { get; set; } + /// The rate at which the data connection will receive updates. + public DataConnectionFrequency? Frequency { get; set; } + /// The day to update the data connection on. (1-7 for weekly, 1-31 for monthly). + public int? FrequencyOffset { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DataConnectionFrequency.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DataConnectionFrequency.cs new file mode 100644 index 000000000000..bb16b9147894 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DataConnectionFrequency.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.Analytics.Defender.Easm +{ + /// The rate at which the data connection will receive updates. + public readonly partial struct DataConnectionFrequency : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DataConnectionFrequency(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DailyValue = "daily"; + private const string WeeklyValue = "weekly"; + private const string MonthlyValue = "monthly"; + + /// daily. + public static DataConnectionFrequency Daily { get; } = new DataConnectionFrequency(DailyValue); + /// weekly. + public static DataConnectionFrequency Weekly { get; } = new DataConnectionFrequency(WeeklyValue); + /// monthly. + public static DataConnectionFrequency Monthly { get; } = new DataConnectionFrequency(MonthlyValue); + /// Determines if two values are the same. + public static bool operator ==(DataConnectionFrequency left, DataConnectionFrequency right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DataConnectionFrequency left, DataConnectionFrequency right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DataConnectionFrequency(string value) => new DataConnectionFrequency(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DataConnectionFrequency other && Equals(other); + /// + public bool Equals(DataConnectionFrequency other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DataConnectionProperties.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DataConnectionProperties.cs new file mode 100644 index 000000000000..53d1ca9b5749 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DataConnectionProperties.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Analytics.Defender.Easm +{ + /// The properties required to establish connection to a particular service. + public partial class DataConnectionProperties + { + /// Initializes a new instance of DataConnectionProperties. + internal DataConnectionProperties() + { + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DependentResource.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DependentResource.Serialization.cs new file mode 100644 index 000000000000..2415a0a1647d --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DependentResource.Serialization.cs @@ -0,0 +1,376 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class DependentResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Md5)) + { + writer.WritePropertyName("md5"u8); + writer.WriteStringValue(Md5); + } + if (Optional.IsDefined(ResponseBodySize)) + { + writer.WritePropertyName("responseBodySize"u8); + writer.WriteNumberValue(ResponseBodySize.Value); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(FirstSeenCrawlGuid)) + { + writer.WritePropertyName("firstSeenCrawlGuid"u8); + writer.WriteStringValue(FirstSeenCrawlGuid); + } + if (Optional.IsDefined(FirstSeenPageGuid)) + { + writer.WritePropertyName("firstSeenPageGuid"u8); + writer.WriteStringValue(FirstSeenPageGuid); + } + if (Optional.IsDefined(FirstSeenResourceGuid)) + { + writer.WritePropertyName("firstSeenResourceGuid"u8); + writer.WriteStringValue(FirstSeenResourceGuid); + } + if (Optional.IsDefined(LastSeenCrawlGuid)) + { + writer.WritePropertyName("lastSeenCrawlGuid"u8); + writer.WriteStringValue(LastSeenCrawlGuid); + } + if (Optional.IsDefined(LastSeenPageGuid)) + { + writer.WritePropertyName("lastSeenPageGuid"u8); + writer.WriteStringValue(LastSeenPageGuid); + } + if (Optional.IsDefined(LastSeenResourceGuid)) + { + writer.WritePropertyName("lastSeenResourceGuid"u8); + writer.WriteStringValue(LastSeenResourceGuid); + } + if (Optional.IsCollectionDefined(ResponseBodyMinhash)) + { + writer.WritePropertyName("responseBodyMinhash"u8); + writer.WriteStartArray(); + foreach (var item in ResponseBodyMinhash) + { + writer.WriteNumberValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(ContentType)) + { + writer.WritePropertyName("contentType"u8); + writer.WriteStringValue(ContentType); + } + if (Optional.IsDefined(Sha256)) + { + writer.WritePropertyName("sha256"u8); + writer.WriteStringValue(Sha256); + } + if (Optional.IsDefined(Sha384)) + { + writer.WritePropertyName("sha384"u8); + writer.WriteStringValue(Sha384); + } + if (Optional.IsDefined(Sha512)) + { + writer.WritePropertyName("sha512"u8); + writer.WriteStringValue(Sha512); + } + if (Optional.IsDefined(Url)) + { + writer.WritePropertyName("url"u8); + writer.WriteStringValue(Url.AbsoluteUri); + } + if (Optional.IsDefined(Cached)) + { + writer.WritePropertyName("cached"u8); + writer.WriteBooleanValue(Cached.Value); + } + if (Optional.IsCollectionDefined(SriChecks)) + { + writer.WritePropertyName("sriChecks"u8); + writer.WriteStartArray(); + foreach (var item in SriChecks) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Host)) + { + writer.WritePropertyName("host"u8); + writer.WriteStringValue(Host); + } + if (Optional.IsDefined(LastObservedViolation)) + { + writer.WritePropertyName("lastObservedViolation"u8); + writer.WriteStringValue(LastObservedViolation.Value, "O"); + } + if (Optional.IsDefined(LastObservedValidation)) + { + writer.WritePropertyName("lastObservedValidation"u8); + writer.WriteStringValue(LastObservedValidation.Value, "O"); + } + if (Optional.IsDefined(LastObservedActualSriHash)) + { + writer.WritePropertyName("lastObservedActualSriHash"u8); + writer.WriteStringValue(LastObservedActualSriHash); + } + if (Optional.IsDefined(LastObservedExpectedSriHash)) + { + writer.WritePropertyName("lastObservedExpectedSriHash"u8); + writer.WriteStringValue(LastObservedExpectedSriHash); + } + writer.WriteEndObject(); + } + + internal static DependentResource DeserializeDependentResource(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional md5 = default; + Optional responseBodySize = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional count = default; + Optional firstSeenCrawlGuid = default; + Optional firstSeenPageGuid = default; + Optional firstSeenResourceGuid = default; + Optional lastSeenCrawlGuid = default; + Optional lastSeenPageGuid = default; + Optional lastSeenResourceGuid = default; + Optional> responseBodyMinhash = default; + Optional contentType = default; + Optional sha256 = default; + Optional sha384 = default; + Optional sha512 = default; + Optional url = default; + Optional cached = default; + Optional> sriChecks = default; + Optional host = default; + Optional lastObservedViolation = default; + Optional lastObservedValidation = default; + Optional lastObservedActualSriHash = default; + Optional lastObservedExpectedSriHash = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("md5"u8)) + { + md5 = property.Value.GetString(); + continue; + } + if (property.NameEquals("responseBodySize"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + responseBodySize = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("firstSeenCrawlGuid"u8)) + { + firstSeenCrawlGuid = property.Value.GetString(); + continue; + } + if (property.NameEquals("firstSeenPageGuid"u8)) + { + firstSeenPageGuid = property.Value.GetString(); + continue; + } + if (property.NameEquals("firstSeenResourceGuid"u8)) + { + firstSeenResourceGuid = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastSeenCrawlGuid"u8)) + { + lastSeenCrawlGuid = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastSeenPageGuid"u8)) + { + lastSeenPageGuid = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastSeenResourceGuid"u8)) + { + lastSeenResourceGuid = property.Value.GetString(); + continue; + } + if (property.NameEquals("responseBodyMinhash"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetInt32()); + } + responseBodyMinhash = array; + continue; + } + if (property.NameEquals("contentType"u8)) + { + contentType = property.Value.GetString(); + continue; + } + if (property.NameEquals("sha256"u8)) + { + sha256 = property.Value.GetString(); + continue; + } + if (property.NameEquals("sha384"u8)) + { + sha384 = property.Value.GetString(); + continue; + } + if (property.NameEquals("sha512"u8)) + { + sha512 = property.Value.GetString(); + continue; + } + if (property.NameEquals("url"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + url = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("cached"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + cached = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("sriChecks"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SubResourceIntegrityCheck.DeserializeSubResourceIntegrityCheck(item)); + } + sriChecks = array; + continue; + } + if (property.NameEquals("host"u8)) + { + host = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastObservedViolation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastObservedViolation = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastObservedValidation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastObservedValidation = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastObservedActualSriHash"u8)) + { + lastObservedActualSriHash = property.Value.GetString(); + continue; + } + if (property.NameEquals("lastObservedExpectedSriHash"u8)) + { + lastObservedExpectedSriHash = property.Value.GetString(); + continue; + } + } + return new DependentResource(md5.Value, Optional.ToNullable(responseBodySize), Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(count), firstSeenCrawlGuid.Value, firstSeenPageGuid.Value, firstSeenResourceGuid.Value, lastSeenCrawlGuid.Value, lastSeenPageGuid.Value, lastSeenResourceGuid.Value, Optional.ToList(responseBodyMinhash), contentType.Value, sha256.Value, sha384.Value, sha512.Value, url.Value, Optional.ToNullable(cached), Optional.ToList(sriChecks), host.Value, Optional.ToNullable(lastObservedViolation), Optional.ToNullable(lastObservedValidation), lastObservedActualSriHash.Value, lastObservedExpectedSriHash.Value); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DependentResource FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDependentResource(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DependentResource.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DependentResource.cs new file mode 100644 index 000000000000..383474937d5c --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DependentResource.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The DependentResource. + public partial class DependentResource + { + /// Initializes a new instance of DependentResource. + public DependentResource() + { + ResponseBodyMinhash = new ChangeTrackingList(); + SriChecks = new ChangeTrackingList(); + } + + /// Initializes a new instance of DependentResource. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + internal DependentResource(string md5, long? responseBodySize, DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count, string firstSeenCrawlGuid, string firstSeenPageGuid, string firstSeenResourceGuid, string lastSeenCrawlGuid, string lastSeenPageGuid, string lastSeenResourceGuid, IList responseBodyMinhash, string contentType, string sha256, string sha384, string sha512, Uri url, bool? cached, IList sriChecks, string host, DateTimeOffset? lastObservedViolation, DateTimeOffset? lastObservedValidation, string lastObservedActualSriHash, string lastObservedExpectedSriHash) + { + Md5 = md5; + ResponseBodySize = responseBodySize; + FirstSeen = firstSeen; + LastSeen = lastSeen; + Count = count; + FirstSeenCrawlGuid = firstSeenCrawlGuid; + FirstSeenPageGuid = firstSeenPageGuid; + FirstSeenResourceGuid = firstSeenResourceGuid; + LastSeenCrawlGuid = lastSeenCrawlGuid; + LastSeenPageGuid = lastSeenPageGuid; + LastSeenResourceGuid = lastSeenResourceGuid; + ResponseBodyMinhash = responseBodyMinhash; + ContentType = contentType; + Sha256 = sha256; + Sha384 = sha384; + Sha512 = sha512; + Url = url; + Cached = cached; + SriChecks = sriChecks; + Host = host; + LastObservedViolation = lastObservedViolation; + LastObservedValidation = lastObservedValidation; + LastObservedActualSriHash = lastObservedActualSriHash; + LastObservedExpectedSriHash = lastObservedExpectedSriHash; + } + + /// Gets or sets the md 5. + public string Md5 { get; set; } + /// Gets or sets the response body size. + public long? ResponseBodySize { get; set; } + /// Gets or sets the first seen. + public DateTimeOffset? FirstSeen { get; set; } + /// Gets or sets the last seen. + public DateTimeOffset? LastSeen { get; set; } + /// Gets or sets the count. + public long? Count { get; set; } + /// Gets or sets the first seen crawl guid. + public string FirstSeenCrawlGuid { get; set; } + /// Gets or sets the first seen page guid. + public string FirstSeenPageGuid { get; set; } + /// Gets or sets the first seen resource guid. + public string FirstSeenResourceGuid { get; set; } + /// Gets or sets the last seen crawl guid. + public string LastSeenCrawlGuid { get; set; } + /// Gets or sets the last seen page guid. + public string LastSeenPageGuid { get; set; } + /// Gets or sets the last seen resource guid. + public string LastSeenResourceGuid { get; set; } + /// Gets the response body minhash. + public IList ResponseBodyMinhash { get; } + /// Gets or sets the content type. + public string ContentType { get; set; } + /// Gets or sets the sha 256. + public string Sha256 { get; set; } + /// Gets or sets the sha 384. + public string Sha384 { get; set; } + /// Gets or sets the sha 512. + public string Sha512 { get; set; } + /// Gets or sets the url. + public Uri Url { get; set; } + /// Gets or sets the cached. + public bool? Cached { get; set; } + /// Gets the sri checks. + public IList SriChecks { get; } + /// Gets or sets the host. + public string Host { get; set; } + /// Gets or sets the last observed violation. + public DateTimeOffset? LastObservedViolation { get; set; } + /// Gets or sets the last observed validation. + public DateTimeOffset? LastObservedValidation { get; set; } + /// Gets or sets the last observed actual sri hash. + public string LastObservedActualSriHash { get; set; } + /// Gets or sets the last observed expected sri hash. + public string LastObservedExpectedSriHash { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoGroup.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoGroup.Serialization.cs new file mode 100644 index 000000000000..b30ea12fdb2c --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoGroup.Serialization.cs @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class DiscoGroup : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(Tier)) + { + writer.WritePropertyName("tier"u8); + writer.WriteStringValue(Tier); + } + if (Optional.IsDefined(FrequencyMilliseconds)) + { + writer.WritePropertyName("frequencyMilliseconds"u8); + writer.WriteNumberValue(FrequencyMilliseconds.Value); + } + if (Optional.IsCollectionDefined(Seeds)) + { + writer.WritePropertyName("seeds"u8); + writer.WriteStartArray(); + foreach (var item in Seeds) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Names)) + { + writer.WritePropertyName("names"u8); + writer.WriteStartArray(); + foreach (var item in Names) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Excludes)) + { + writer.WritePropertyName("excludes"u8); + writer.WriteStartArray(); + foreach (var item in Excludes) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(LatestRun)) + { + writer.WritePropertyName("latestRun"u8); + writer.WriteObjectValue(LatestRun); + } + if (Optional.IsDefined(CreatedDate)) + { + writer.WritePropertyName("createdDate"u8); + writer.WriteStringValue(CreatedDate.Value, "O"); + } + if (Optional.IsDefined(TemplateId)) + { + writer.WritePropertyName("templateId"u8); + writer.WriteStringValue(TemplateId); + } + writer.WriteEndObject(); + } + + internal static DiscoGroup DeserializeDiscoGroup(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional id = default; + string name = default; + Optional displayName = default; + Optional description = default; + Optional tier = default; + Optional frequencyMilliseconds = default; + Optional> seeds = default; + Optional> names = default; + Optional> excludes = default; + Optional latestRun = default; + Optional createdDate = default; + Optional templateId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("tier"u8)) + { + tier = property.Value.GetString(); + continue; + } + if (property.NameEquals("frequencyMilliseconds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + frequencyMilliseconds = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("seeds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DiscoSource.DeserializeDiscoSource(item)); + } + seeds = array; + continue; + } + if (property.NameEquals("names"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + names = array; + continue; + } + if (property.NameEquals("excludes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DiscoSource.DeserializeDiscoSource(item)); + } + excludes = array; + continue; + } + if (property.NameEquals("latestRun"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + latestRun = DiscoRunResult.DeserializeDiscoRunResult(property.Value); + continue; + } + if (property.NameEquals("createdDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("templateId"u8)) + { + templateId = property.Value.GetString(); + continue; + } + } + return new DiscoGroup(id.Value, name, displayName.Value, description.Value, tier.Value, Optional.ToNullable(frequencyMilliseconds), Optional.ToList(seeds), Optional.ToList(names), Optional.ToList(excludes), latestRun.Value, Optional.ToNullable(createdDate), templateId.Value); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DiscoGroup FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDiscoGroup(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoGroup.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoGroup.cs new file mode 100644 index 000000000000..f4fa32ba9378 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoGroup.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The DiscoGroup. + public partial class DiscoGroup + { + /// Initializes a new instance of DiscoGroup. + public DiscoGroup() + { + Seeds = new ChangeTrackingList(); + Names = new ChangeTrackingList(); + Excludes = new ChangeTrackingList(); + } + + /// Initializes a new instance of DiscoGroup. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// The description for a disco group. + /// The tier for the disco group which will affect the algorithm used for the disco runs in this group. + /// The frequency at which the disco group is supposed to be rerun in milliseconds. + /// The list of seeds used for the disco group runs. + /// The list of names used for the disco group runs. + /// The list of excludes used for the disco group runs, aka assets to exclude from the discovery algorithm. + /// The latest run of this disco group with some limited information, null if the group has never been run. + /// The date for the disco group was created. + /// The unique identifier for the disco template used for the disco group creation. + internal DiscoGroup(string id, string name, string displayName, string description, string tier, long? frequencyMilliseconds, IList seeds, IList names, IList excludes, DiscoRunResult latestRun, DateTimeOffset? createdDate, string templateId) + { + Id = id; + Name = name; + DisplayName = displayName; + Description = description; + Tier = tier; + FrequencyMilliseconds = frequencyMilliseconds; + Seeds = seeds; + Names = names; + Excludes = excludes; + LatestRun = latestRun; + CreatedDate = createdDate; + TemplateId = templateId; + } + + /// The system generated unique id for the resource. + public string Id { get; set; } + /// The caller provided unique name for the resource. + public string Name { get; } + /// The name that can be used for display purposes. + public string DisplayName { get; set; } + /// The description for a disco group. + public string Description { get; set; } + /// The tier for the disco group which will affect the algorithm used for the disco runs in this group. + public string Tier { get; set; } + /// The frequency at which the disco group is supposed to be rerun in milliseconds. + public long? FrequencyMilliseconds { get; set; } + /// The list of seeds used for the disco group runs. + public IList Seeds { get; } + /// The list of names used for the disco group runs. + public IList Names { get; } + /// The list of excludes used for the disco group runs, aka assets to exclude from the discovery algorithm. + public IList Excludes { get; } + /// The latest run of this disco group with some limited information, null if the group has never been run. + public DiscoRunResult LatestRun { get; set; } + /// The date for the disco group was created. + public DateTimeOffset? CreatedDate { get; set; } + /// The unique identifier for the disco template used for the disco group creation. + public string TemplateId { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoGroupData.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoGroupData.Serialization.cs new file mode 100644 index 000000000000..adbc7429c6b6 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoGroupData.Serialization.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class DiscoGroupData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + if (Optional.IsDefined(Tier)) + { + writer.WritePropertyName("tier"u8); + writer.WriteStringValue(Tier); + } + if (Optional.IsDefined(FrequencyMilliseconds)) + { + writer.WritePropertyName("frequencyMilliseconds"u8); + writer.WriteNumberValue(FrequencyMilliseconds.Value); + } + if (Optional.IsCollectionDefined(Seeds)) + { + writer.WritePropertyName("seeds"u8); + writer.WriteStartArray(); + foreach (var item in Seeds) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Names)) + { + writer.WritePropertyName("names"u8); + writer.WriteStartArray(); + foreach (var item in Names) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Excludes)) + { + writer.WritePropertyName("excludes"u8); + writer.WriteStartArray(); + foreach (var item in Excludes) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(TemplateId)) + { + writer.WritePropertyName("templateId"u8); + writer.WriteStringValue(TemplateId); + } + writer.WriteEndObject(); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoGroupData.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoGroupData.cs new file mode 100644 index 000000000000..e7ac0578ca0c --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoGroupData.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// A request body used to create a discovery group. + public partial class DiscoGroupData + { + /// Initializes a new instance of DiscoGroupData. + public DiscoGroupData() + { + Seeds = new ChangeTrackingList(); + Names = new ChangeTrackingList(); + Excludes = new ChangeTrackingList(); + } + + /// Initializes a new instance of DiscoGroupData. + /// The name for a disco group. + /// The description for a disco group. + /// The tier for the disco group which will affect the algorithm used for the disco runs in this group. + /// The frequency at which the disco group is supposed to be rerun in milliseconds. + /// The list of seeds used for the disco group runs. + /// The list of names used for the disco group runs. + /// The list of excludes used for the disco group runs, aka assets to exclude from the discovery algorithm. + /// The unique identifier for the disco template used for the disco group creation. + internal DiscoGroupData(string name, string description, string tier, long? frequencyMilliseconds, IList seeds, IList names, IList excludes, string templateId) + { + Name = name; + Description = description; + Tier = tier; + FrequencyMilliseconds = frequencyMilliseconds; + Seeds = seeds; + Names = names; + Excludes = excludes; + TemplateId = templateId; + } + + /// The name for a disco group. + public string Name { get; set; } + /// The description for a disco group. + public string Description { get; set; } + /// The tier for the disco group which will affect the algorithm used for the disco runs in this group. + public string Tier { get; set; } + /// The frequency at which the disco group is supposed to be rerun in milliseconds. + public long? FrequencyMilliseconds { get; set; } + /// The list of seeds used for the disco group runs. + public IList Seeds { get; } + /// The list of names used for the disco group runs. + public IList Names { get; } + /// The list of excludes used for the disco group runs, aka assets to exclude from the discovery algorithm. + public IList Excludes { get; } + /// The unique identifier for the disco template used for the disco group creation. + public string TemplateId { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoRunResult.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoRunResult.Serialization.cs new file mode 100644 index 000000000000..afbff5f43319 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoRunResult.Serialization.cs @@ -0,0 +1,213 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class DiscoRunResult : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(SubmittedDate)) + { + writer.WritePropertyName("submittedDate"u8); + writer.WriteStringValue(SubmittedDate.Value, "O"); + } + if (Optional.IsDefined(StartedDate)) + { + writer.WritePropertyName("startedDate"u8); + writer.WriteStringValue(StartedDate.Value, "O"); + } + if (Optional.IsDefined(CompletedDate)) + { + writer.WritePropertyName("completedDate"u8); + writer.WriteStringValue(CompletedDate.Value, "O"); + } + if (Optional.IsDefined(Tier)) + { + writer.WritePropertyName("tier"u8); + writer.WriteStringValue(Tier); + } + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"u8); + writer.WriteStringValue(State.Value.ToString()); + } + if (Optional.IsDefined(TotalAssetsFoundCount)) + { + writer.WritePropertyName("totalAssetsFoundCount"u8); + writer.WriteNumberValue(TotalAssetsFoundCount.Value); + } + if (Optional.IsCollectionDefined(Seeds)) + { + writer.WritePropertyName("seeds"u8); + writer.WriteStartArray(); + foreach (var item in Seeds) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Excludes)) + { + writer.WritePropertyName("excludes"u8); + writer.WriteStartArray(); + foreach (var item in Excludes) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Names)) + { + writer.WritePropertyName("names"u8); + writer.WriteStartArray(); + foreach (var item in Names) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static DiscoRunResult DeserializeDiscoRunResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional submittedDate = default; + Optional startedDate = default; + Optional completedDate = default; + Optional tier = default; + Optional state = default; + Optional totalAssetsFoundCount = default; + Optional> seeds = default; + Optional> excludes = default; + Optional> names = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("submittedDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + submittedDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("startedDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startedDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("completedDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + completedDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("tier"u8)) + { + tier = property.Value.GetString(); + continue; + } + if (property.NameEquals("state"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = new DiscoRunState(property.Value.GetString()); + continue; + } + if (property.NameEquals("totalAssetsFoundCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + totalAssetsFoundCount = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("seeds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DiscoSource.DeserializeDiscoSource(item)); + } + seeds = array; + continue; + } + if (property.NameEquals("excludes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DiscoSource.DeserializeDiscoSource(item)); + } + excludes = array; + continue; + } + if (property.NameEquals("names"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + names = array; + continue; + } + } + return new DiscoRunResult(Optional.ToNullable(submittedDate), Optional.ToNullable(startedDate), Optional.ToNullable(completedDate), tier.Value, Optional.ToNullable(state), Optional.ToNullable(totalAssetsFoundCount), Optional.ToList(seeds), Optional.ToList(excludes), Optional.ToList(names)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DiscoRunResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDiscoRunResult(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoRunResult.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoRunResult.cs new file mode 100644 index 000000000000..431e6cb3e267 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoRunResult.cs @@ -0,0 +1,67 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The latest run of this disco group with some limited information, null if the group has never been run. + public partial class DiscoRunResult + { + /// Initializes a new instance of DiscoRunResult. + public DiscoRunResult() + { + Seeds = new ChangeTrackingList(); + Excludes = new ChangeTrackingList(); + Names = new ChangeTrackingList(); + } + + /// Initializes a new instance of DiscoRunResult. + /// The date for when the disco run was created in the system. + /// The date for when the disco run was actually started by the system. + /// The date for when the disco run was completed by the system. + /// The tier which will affect the algorithm used for the disco run. + /// The State of the disco run. + /// The total count of assets that were found this disco run. + /// The list of seeds used for the disco run. + /// The list of excludes used for the disco run, aka assets to exclude from the discovery algorithm. + /// The list of names used for the disco run. + internal DiscoRunResult(DateTimeOffset? submittedDate, DateTimeOffset? startedDate, DateTimeOffset? completedDate, string tier, DiscoRunState? state, long? totalAssetsFoundCount, IList seeds, IList excludes, IList names) + { + SubmittedDate = submittedDate; + StartedDate = startedDate; + CompletedDate = completedDate; + Tier = tier; + State = state; + TotalAssetsFoundCount = totalAssetsFoundCount; + Seeds = seeds; + Excludes = excludes; + Names = names; + } + + /// The date for when the disco run was created in the system. + public DateTimeOffset? SubmittedDate { get; set; } + /// The date for when the disco run was actually started by the system. + public DateTimeOffset? StartedDate { get; set; } + /// The date for when the disco run was completed by the system. + public DateTimeOffset? CompletedDate { get; set; } + /// The tier which will affect the algorithm used for the disco run. + public string Tier { get; set; } + /// The State of the disco run. + public DiscoRunState? State { get; set; } + /// The total count of assets that were found this disco run. + public long? TotalAssetsFoundCount { get; set; } + /// The list of seeds used for the disco run. + public IList Seeds { get; } + /// The list of excludes used for the disco run, aka assets to exclude from the discovery algorithm. + public IList Excludes { get; } + /// The list of names used for the disco run. + public IList Names { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoRunState.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoRunState.cs new file mode 100644 index 000000000000..be67f9d46144 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoRunState.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Analytics.Defender.Easm +{ + /// The State of the disco run. + public readonly partial struct DiscoRunState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DiscoRunState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PendingValue = "pending"; + private const string RunningValue = "running"; + private const string CompletedValue = "completed"; + private const string FailedValue = "failed"; + + /// pending. + public static DiscoRunState Pending { get; } = new DiscoRunState(PendingValue); + /// running. + public static DiscoRunState Running { get; } = new DiscoRunState(RunningValue); + /// completed. + public static DiscoRunState Completed { get; } = new DiscoRunState(CompletedValue); + /// failed. + public static DiscoRunState Failed { get; } = new DiscoRunState(FailedValue); + /// Determines if two values are the same. + public static bool operator ==(DiscoRunState left, DiscoRunState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DiscoRunState left, DiscoRunState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DiscoRunState(string value) => new DiscoRunState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DiscoRunState other && Equals(other); + /// + public bool Equals(DiscoRunState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoSource.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoSource.Serialization.cs new file mode 100644 index 000000000000..0c9dea174473 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoSource.Serialization.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class DiscoSource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Kind)) + { + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.Value.ToString()); + } + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + writer.WriteEndObject(); + } + + internal static DiscoSource DeserializeDiscoSource(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional kind = default; + Optional name = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + kind = new DiscoSourceKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + } + return new DiscoSource(Optional.ToNullable(kind), name.Value); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DiscoSource FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDiscoSource(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoSource.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoSource.cs new file mode 100644 index 000000000000..3b1ee2d734db --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoSource.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Analytics.Defender.Easm +{ + /// Source entity used to drive discovery. + public partial class DiscoSource + { + /// Initializes a new instance of DiscoSource. + public DiscoSource() + { + } + + /// Initializes a new instance of DiscoSource. + /// The kind of disco source. + /// The name for the disco source. + internal DiscoSource(DiscoSourceKind? kind, string name) + { + Kind = kind; + Name = name; + } + + /// The kind of disco source. + public DiscoSourceKind? Kind { get; set; } + /// The name for the disco source. + public string Name { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoSourceKind.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoSourceKind.cs new file mode 100644 index 000000000000..3e389425920a --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoSourceKind.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Analytics.Defender.Easm +{ + /// The kind of disco source. + public readonly partial struct DiscoSourceKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DiscoSourceKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AsValue = "as"; + private const string AttributeValue = "attribute"; + private const string ContactValue = "contact"; + private const string DomainValue = "domain"; + private const string HostValue = "host"; + private const string IpBlockValue = "ipBlock"; + + /// as. + public static DiscoSourceKind As { get; } = new DiscoSourceKind(AsValue); + /// attribute. + public static DiscoSourceKind Attribute { get; } = new DiscoSourceKind(AttributeValue); + /// contact. + public static DiscoSourceKind Contact { get; } = new DiscoSourceKind(ContactValue); + /// domain. + public static DiscoSourceKind Domain { get; } = new DiscoSourceKind(DomainValue); + /// host. + public static DiscoSourceKind Host { get; } = new DiscoSourceKind(HostValue); + /// ipBlock. + public static DiscoSourceKind IpBlock { get; } = new DiscoSourceKind(IpBlockValue); + /// Determines if two values are the same. + public static bool operator ==(DiscoSourceKind left, DiscoSourceKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DiscoSourceKind left, DiscoSourceKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator DiscoSourceKind(string value) => new DiscoSourceKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DiscoSourceKind other && Equals(other); + /// + public bool Equals(DiscoSourceKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoTemplate.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoTemplate.Serialization.cs new file mode 100644 index 000000000000..006dabc9c35e --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoTemplate.Serialization.cs @@ -0,0 +1,115 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class DiscoTemplate + { + internal static DiscoTemplate DeserializeDiscoTemplate(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + Optional name = default; + Optional displayName = default; + Optional industry = default; + Optional region = default; + Optional countryCode = default; + Optional stateCode = default; + Optional city = default; + Optional> seeds = default; + Optional> names = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("industry"u8)) + { + industry = property.Value.GetString(); + continue; + } + if (property.NameEquals("region"u8)) + { + region = property.Value.GetString(); + continue; + } + if (property.NameEquals("countryCode"u8)) + { + countryCode = property.Value.GetString(); + continue; + } + if (property.NameEquals("stateCode"u8)) + { + stateCode = property.Value.GetString(); + continue; + } + if (property.NameEquals("city"u8)) + { + city = property.Value.GetString(); + continue; + } + if (property.NameEquals("seeds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DiscoSource.DeserializeDiscoSource(item)); + } + seeds = array; + continue; + } + if (property.NameEquals("names"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + names = array; + continue; + } + } + return new DiscoTemplate(id, name.Value, displayName.Value, industry.Value, region.Value, countryCode.Value, stateCode.Value, city.Value, Optional.ToList(seeds), Optional.ToList(names)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DiscoTemplate FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDiscoTemplate(document.RootElement); + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoTemplate.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoTemplate.cs new file mode 100644 index 000000000000..5150fed5d15d --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoTemplate.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The items in the current page of results. + public partial class DiscoTemplate + { + /// Initializes a new instance of DiscoTemplate. + internal DiscoTemplate() + { + Seeds = new ChangeTrackingList(); + Names = new ChangeTrackingList(); + } + + /// Initializes a new instance of DiscoTemplate. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// The name of the industry. + /// The name of the region. + /// The country code. + /// The state code. + /// The name of the city. + /// The list of disco template seeds. + /// The list of disco template names. + internal DiscoTemplate(string id, string name, string displayName, string industry, string region, string countryCode, string stateCode, string city, IReadOnlyList seeds, IReadOnlyList names) + { + Id = id; + Name = name; + DisplayName = displayName; + Industry = industry; + Region = region; + CountryCode = countryCode; + StateCode = stateCode; + City = city; + Seeds = seeds; + Names = names; + } + + /// The system generated unique id for the resource. + public string Id { get; } + /// The caller provided unique name for the resource. + public string Name { get; } + /// The name that can be used for display purposes. + public string DisplayName { get; } + /// The name of the industry. + public string Industry { get; } + /// The name of the region. + public string Region { get; } + /// The country code. + public string CountryCode { get; } + /// The state code. + public string StateCode { get; } + /// The name of the city. + public string City { get; } + /// The list of disco template seeds. + public IReadOnlyList Seeds { get; } + /// The list of disco template names. + public IReadOnlyList Names { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Docs/EasmClient.xml b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Docs/EasmClient.xml new file mode 100644 index 000000000000..f215b60fb55d --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Docs/EasmClient.xml @@ -0,0 +1,3703 @@ + + + + + +This sample shows how to call UpdateAssetsAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +AssetResource assetResource = new AsAssetResource(new AsAsset()); +Response response = await client.UpdateAssetsAsync("", assetResource); +]]> +This sample shows how to call UpdateAssetsAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +AssetResource assetResource = new AsAssetResource(new AsAsset +{ + Asn = 1234L, + AsNames = {new ObservedString + { + Value = "", + Sources = {new Source + { + SourceProperty = "", + FirstSeen = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + LastSeen = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + Count = 1234L, + Reason = "", + }}, + }}, + OrgNames = { default }, + OrgIds = { default }, + Countries = { default }, + Registries = { default }, + Sources = { default }, + FirstSeen = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + LastSeen = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + Count = 1234L, + RegistrarCreatedAt = {new ObservedLong + { + Value = 1234L, + Sources = {default}, + }}, + RegistrarUpdatedAt = { default }, + RegistrantContacts = { default }, + AdminContacts = { default }, + TechnicalContacts = { default }, + RegistrarNames = { default }, + RegistrantNames = { default }, + AdminNames = { default }, + TechnicalNames = { default }, + AdminOrgs = { default }, + TechnicalOrgs = { default }, + RegistrantPhones = { default }, + AdminPhones = { default }, + TechnicalPhones = { default }, + DetailedFromWhoisAt = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), +}) +{ + Name = "", + DisplayName = "", + Uuid = Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), + CreatedDate = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + UpdatedDate = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + State = AssetState.Candidate, + ExternalId = "", + Labels = { "" }, + Wildcard = true, + DiscoGroupName = "", + AuditTrail = {new AuditTrailItem + { + Id = "", + Name = "", + DisplayName = "", + Kind = AuditTrailItemKind.As, + Reason = "", + }}, + Reason = "", +}; +Response response = await client.UpdateAssetsAsync("", assetResource); +]]> + + + +This sample shows how to call UpdateAssets. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +AssetResource assetResource = new AsAssetResource(new AsAsset()); +Response response = client.UpdateAssets("", assetResource); +]]> +This sample shows how to call UpdateAssets with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +AssetResource assetResource = new AsAssetResource(new AsAsset +{ + Asn = 1234L, + AsNames = {new ObservedString + { + Value = "", + Sources = {new Source + { + SourceProperty = "", + FirstSeen = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + LastSeen = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + Count = 1234L, + Reason = "", + }}, + }}, + OrgNames = { default }, + OrgIds = { default }, + Countries = { default }, + Registries = { default }, + Sources = { default }, + FirstSeen = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + LastSeen = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + Count = 1234L, + RegistrarCreatedAt = {new ObservedLong + { + Value = 1234L, + Sources = {default}, + }}, + RegistrarUpdatedAt = { default }, + RegistrantContacts = { default }, + AdminContacts = { default }, + TechnicalContacts = { default }, + RegistrarNames = { default }, + RegistrantNames = { default }, + AdminNames = { default }, + TechnicalNames = { default }, + AdminOrgs = { default }, + TechnicalOrgs = { default }, + RegistrantPhones = { default }, + AdminPhones = { default }, + TechnicalPhones = { default }, + DetailedFromWhoisAt = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), +}) +{ + Name = "", + DisplayName = "", + Uuid = Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), + CreatedDate = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + UpdatedDate = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + State = AssetState.Candidate, + ExternalId = "", + Labels = { "" }, + Wildcard = true, + DiscoGroupName = "", + AuditTrail = {new AuditTrailItem + { + Id = "", + Name = "", + DisplayName = "", + Kind = AuditTrailItemKind.As, + Reason = "", + }}, + Reason = "", +}; +Response response = client.UpdateAssets("", assetResource); +]]> + + + +This sample shows how to call UpdateAssetsAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +using RequestContent content = RequestContent.Create(new +{ + asset = new object(), + kind = "as", +}); +Response response = await client.UpdateAssetsAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call UpdateAssetsAsync with all parameters and request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +using RequestContent content = RequestContent.Create(new +{ + asset = new + { + asn = 1234L, + asNames = new object[] + { + new + { + value = "", + sources = new object[] + { + new + { + source = "", + firstSeen = "2022-05-10T14:57:31.2311892-04:00", + lastSeen = "2022-05-10T14:57:31.2311892-04:00", + count = 1234L, + reason = "", + } + }, + firstSeen = "2022-05-10T14:57:31.2311892-04:00", + lastSeen = "2022-05-10T14:57:31.2311892-04:00", + count = 1234L, + recent = true, + } + }, + orgNames = new object[] + { + null + }, + orgIds = new object[] + { + null + }, + countries = new object[] + { + null + }, + registries = new object[] + { + null + }, + sources = new object[] + { + null + }, + firstSeen = "2022-05-10T14:57:31.2311892-04:00", + lastSeen = "2022-05-10T14:57:31.2311892-04:00", + count = 1234L, + registrarCreatedAt = new object[] + { + new + { + value = 1234L, + sources = new object[] + { + null + }, + firstSeen = "2022-05-10T14:57:31.2311892-04:00", + lastSeen = "2022-05-10T14:57:31.2311892-04:00", + count = 1234L, + recent = true, + } + }, + registrarUpdatedAt = new object[] + { + null + }, + registrantContacts = new object[] + { + null + }, + adminContacts = new object[] + { + null + }, + technicalContacts = new object[] + { + null + }, + registrarNames = new object[] + { + null + }, + registrantNames = new object[] + { + null + }, + adminNames = new object[] + { + null + }, + technicalNames = new object[] + { + null + }, + adminOrgs = new object[] + { + null + }, + technicalOrgs = new object[] + { + null + }, + registrantPhones = new object[] + { + null + }, + adminPhones = new object[] + { + null + }, + technicalPhones = new object[] + { + null + }, + detailedFromWhoisAt = "2022-05-10T14:57:31.2311892-04:00", + }, + kind = "as", + name = "", + displayName = "", + uuid = "73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a", + createdDate = "2022-05-10T14:57:31.2311892-04:00", + updatedDate = "2022-05-10T14:57:31.2311892-04:00", + state = "candidate", + externalId = "", + labels = new object[] + { + "" + }, + wildcard = true, + discoGroupName = "", + auditTrail = new object[] + { + new + { + id = "", + name = "", + displayName = "", + kind = "as", + reason = "", + } + }, + reason = "", +}); +Response response = await client.UpdateAssetsAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("uuid").ToString()); +Console.WriteLine(result.GetProperty("createdDate").ToString()); +Console.WriteLine(result.GetProperty("updatedDate").ToString()); +Console.WriteLine(result.GetProperty("state").ToString()); +Console.WriteLine(result.GetProperty("externalId").ToString()); +Console.WriteLine(result.GetProperty("labels")[0].ToString()); +Console.WriteLine(result.GetProperty("wildcard").ToString()); +Console.WriteLine(result.GetProperty("discoGroupName").ToString()); +Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("reason").ToString()); +]]> + + + +This sample shows how to call UpdateAssets and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +using RequestContent content = RequestContent.Create(new +{ + asset = new object(), + kind = "as", +}); +Response response = client.UpdateAssets("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call UpdateAssets with all parameters and request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +using RequestContent content = RequestContent.Create(new +{ + asset = new + { + asn = 1234L, + asNames = new object[] + { + new + { + value = "", + sources = new object[] + { + new + { + source = "", + firstSeen = "2022-05-10T14:57:31.2311892-04:00", + lastSeen = "2022-05-10T14:57:31.2311892-04:00", + count = 1234L, + reason = "", + } + }, + firstSeen = "2022-05-10T14:57:31.2311892-04:00", + lastSeen = "2022-05-10T14:57:31.2311892-04:00", + count = 1234L, + recent = true, + } + }, + orgNames = new object[] + { + null + }, + orgIds = new object[] + { + null + }, + countries = new object[] + { + null + }, + registries = new object[] + { + null + }, + sources = new object[] + { + null + }, + firstSeen = "2022-05-10T14:57:31.2311892-04:00", + lastSeen = "2022-05-10T14:57:31.2311892-04:00", + count = 1234L, + registrarCreatedAt = new object[] + { + new + { + value = 1234L, + sources = new object[] + { + null + }, + firstSeen = "2022-05-10T14:57:31.2311892-04:00", + lastSeen = "2022-05-10T14:57:31.2311892-04:00", + count = 1234L, + recent = true, + } + }, + registrarUpdatedAt = new object[] + { + null + }, + registrantContacts = new object[] + { + null + }, + adminContacts = new object[] + { + null + }, + technicalContacts = new object[] + { + null + }, + registrarNames = new object[] + { + null + }, + registrantNames = new object[] + { + null + }, + adminNames = new object[] + { + null + }, + technicalNames = new object[] + { + null + }, + adminOrgs = new object[] + { + null + }, + technicalOrgs = new object[] + { + null + }, + registrantPhones = new object[] + { + null + }, + adminPhones = new object[] + { + null + }, + technicalPhones = new object[] + { + null + }, + detailedFromWhoisAt = "2022-05-10T14:57:31.2311892-04:00", + }, + kind = "as", + name = "", + displayName = "", + uuid = "73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a", + createdDate = "2022-05-10T14:57:31.2311892-04:00", + updatedDate = "2022-05-10T14:57:31.2311892-04:00", + state = "candidate", + externalId = "", + labels = new object[] + { + "" + }, + wildcard = true, + discoGroupName = "", + auditTrail = new object[] + { + new + { + id = "", + name = "", + displayName = "", + kind = "as", + reason = "", + } + }, + reason = "", +}); +Response response = client.UpdateAssets("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("uuid").ToString()); +Console.WriteLine(result.GetProperty("createdDate").ToString()); +Console.WriteLine(result.GetProperty("updatedDate").ToString()); +Console.WriteLine(result.GetProperty("state").ToString()); +Console.WriteLine(result.GetProperty("externalId").ToString()); +Console.WriteLine(result.GetProperty("labels")[0].ToString()); +Console.WriteLine(result.GetProperty("wildcard").ToString()); +Console.WriteLine(result.GetProperty("discoGroupName").ToString()); +Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("reason").ToString()); +]]> + + + +This sample shows how to call GetAssetResourceAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.GetAssetResourceAsync(""); +]]> +This sample shows how to call GetAssetResourceAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.GetAssetResourceAsync(""); +]]> + + + +This sample shows how to call GetAssetResource. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.GetAssetResource(""); +]]> +This sample shows how to call GetAssetResource with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.GetAssetResource(""); +]]> + + + +This sample shows how to call GetAssetResourceAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.GetAssetResourceAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call GetAssetResourceAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.GetAssetResourceAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("uuid").ToString()); +Console.WriteLine(result.GetProperty("createdDate").ToString()); +Console.WriteLine(result.GetProperty("updatedDate").ToString()); +Console.WriteLine(result.GetProperty("state").ToString()); +Console.WriteLine(result.GetProperty("externalId").ToString()); +Console.WriteLine(result.GetProperty("labels")[0].ToString()); +Console.WriteLine(result.GetProperty("wildcard").ToString()); +Console.WriteLine(result.GetProperty("discoGroupName").ToString()); +Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("reason").ToString()); +]]> + + + +This sample shows how to call GetAssetResource and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.GetAssetResource("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call GetAssetResource with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.GetAssetResource("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("uuid").ToString()); +Console.WriteLine(result.GetProperty("createdDate").ToString()); +Console.WriteLine(result.GetProperty("updatedDate").ToString()); +Console.WriteLine(result.GetProperty("state").ToString()); +Console.WriteLine(result.GetProperty("externalId").ToString()); +Console.WriteLine(result.GetProperty("labels")[0].ToString()); +Console.WriteLine(result.GetProperty("wildcard").ToString()); +Console.WriteLine(result.GetProperty("discoGroupName").ToString()); +Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("reason").ToString()); +]]> + + + +This sample shows how to call ValidateDataConnectionAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +DataConnectionData dataConnectionData = new LogAnalyticsDataConnectionData(new LogAnalyticsDataConnectionProperties()); +Response response = await client.ValidateDataConnectionAsync(dataConnectionData); +]]> +This sample shows how to call ValidateDataConnectionAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +DataConnectionData dataConnectionData = new LogAnalyticsDataConnectionData(new LogAnalyticsDataConnectionProperties +{ + ApiKey = "", + WorkspaceId = "", +}) +{ + Name = "", + Content = DataConnectionContent.Assets, + Frequency = DataConnectionFrequency.Daily, + FrequencyOffset = 1234, +}; +Response response = await client.ValidateDataConnectionAsync(dataConnectionData); +]]> + + + +This sample shows how to call ValidateDataConnection. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +DataConnectionData dataConnectionData = new LogAnalyticsDataConnectionData(new LogAnalyticsDataConnectionProperties()); +Response response = client.ValidateDataConnection(dataConnectionData); +]]> +This sample shows how to call ValidateDataConnection with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +DataConnectionData dataConnectionData = new LogAnalyticsDataConnectionData(new LogAnalyticsDataConnectionProperties +{ + ApiKey = "", + WorkspaceId = "", +}) +{ + Name = "", + Content = DataConnectionContent.Assets, + Frequency = DataConnectionFrequency.Daily, + FrequencyOffset = 1234, +}; +Response response = client.ValidateDataConnection(dataConnectionData); +]]> + + + +This sample shows how to call ValidateDataConnectionAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +using RequestContent content = RequestContent.Create(new +{ + properties = new object(), + kind = "logAnalytics", +}); +Response response = await client.ValidateDataConnectionAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> +This sample shows how to call ValidateDataConnectionAsync with all request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +using RequestContent content = RequestContent.Create(new +{ + properties = new + { + apiKey = "", + workspaceId = "", + }, + kind = "logAnalytics", + name = "", + content = "assets", + frequency = "daily", + frequencyOffset = 1234, +}); +Response response = await client.ValidateDataConnectionAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("value").ToString()); +]]> + + + +This sample shows how to call ValidateDataConnection and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +using RequestContent content = RequestContent.Create(new +{ + properties = new object(), + kind = "logAnalytics", +}); +Response response = client.ValidateDataConnection(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> +This sample shows how to call ValidateDataConnection with all request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +using RequestContent content = RequestContent.Create(new +{ + properties = new + { + apiKey = "", + workspaceId = "", + }, + kind = "logAnalytics", + name = "", + content = "assets", + frequency = "daily", + frequencyOffset = 1234, +}); +Response response = client.ValidateDataConnection(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("value").ToString()); +]]> + + + +This sample shows how to call GetDataConnectionAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.GetDataConnectionAsync(""); +]]> +This sample shows how to call GetDataConnectionAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.GetDataConnectionAsync(""); +]]> + + + +This sample shows how to call GetDataConnection. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.GetDataConnection(""); +]]> +This sample shows how to call GetDataConnection with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.GetDataConnection(""); +]]> + + + +This sample shows how to call GetDataConnectionAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.GetDataConnectionAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +]]> +This sample shows how to call GetDataConnectionAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.GetDataConnectionAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("content").ToString()); +Console.WriteLine(result.GetProperty("createdDate").ToString()); +Console.WriteLine(result.GetProperty("frequency").ToString()); +Console.WriteLine(result.GetProperty("frequencyOffset").ToString()); +Console.WriteLine(result.GetProperty("updatedDate").ToString()); +Console.WriteLine(result.GetProperty("userUpdatedAt").ToString()); +Console.WriteLine(result.GetProperty("active").ToString()); +Console.WriteLine(result.GetProperty("inactiveMessage").ToString()); +]]> + + + +This sample shows how to call GetDataConnection and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.GetDataConnection("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +]]> +This sample shows how to call GetDataConnection with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.GetDataConnection("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("content").ToString()); +Console.WriteLine(result.GetProperty("createdDate").ToString()); +Console.WriteLine(result.GetProperty("frequency").ToString()); +Console.WriteLine(result.GetProperty("frequencyOffset").ToString()); +Console.WriteLine(result.GetProperty("updatedDate").ToString()); +Console.WriteLine(result.GetProperty("userUpdatedAt").ToString()); +Console.WriteLine(result.GetProperty("active").ToString()); +Console.WriteLine(result.GetProperty("inactiveMessage").ToString()); +]]> + + + +This sample shows how to call CreateOrReplaceDataConnectionAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +DataConnection dataConnection = new LogAnalyticsDataConnection(new LogAnalyticsDataConnectionProperties()); +Response response = await client.CreateOrReplaceDataConnectionAsync("", dataConnection); +]]> +This sample shows how to call CreateOrReplaceDataConnectionAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +DataConnection dataConnection = new LogAnalyticsDataConnection(new LogAnalyticsDataConnectionProperties +{ + ApiKey = "", + WorkspaceId = "", +}) +{ + Id = "", + DisplayName = "", + Content = DataConnectionContent.Assets, + Frequency = DataConnectionFrequency.Daily, + FrequencyOffset = 1234, + Active = true, +}; +Response response = await client.CreateOrReplaceDataConnectionAsync("", dataConnection); +]]> + + + +This sample shows how to call CreateOrReplaceDataConnection. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +DataConnection dataConnection = new LogAnalyticsDataConnection(new LogAnalyticsDataConnectionProperties()); +Response response = client.CreateOrReplaceDataConnection("", dataConnection); +]]> +This sample shows how to call CreateOrReplaceDataConnection with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +DataConnection dataConnection = new LogAnalyticsDataConnection(new LogAnalyticsDataConnectionProperties +{ + ApiKey = "", + WorkspaceId = "", +}) +{ + Id = "", + DisplayName = "", + Content = DataConnectionContent.Assets, + Frequency = DataConnectionFrequency.Daily, + FrequencyOffset = 1234, + Active = true, +}; +Response response = client.CreateOrReplaceDataConnection("", dataConnection); +]]> + + + +This sample shows how to call CreateOrReplaceDataConnectionAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +using RequestContent content = RequestContent.Create(new +{ + properties = new object(), + kind = "logAnalytics", +}); +Response response = await client.CreateOrReplaceDataConnectionAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +]]> +This sample shows how to call CreateOrReplaceDataConnectionAsync with all parameters and request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +using RequestContent content = RequestContent.Create(new +{ + properties = new + { + apiKey = "", + workspaceId = "", + }, + kind = "logAnalytics", + id = "", + displayName = "", + content = "assets", + frequency = "daily", + frequencyOffset = 1234, + active = true, +}); +Response response = await client.CreateOrReplaceDataConnectionAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("content").ToString()); +Console.WriteLine(result.GetProperty("createdDate").ToString()); +Console.WriteLine(result.GetProperty("frequency").ToString()); +Console.WriteLine(result.GetProperty("frequencyOffset").ToString()); +Console.WriteLine(result.GetProperty("updatedDate").ToString()); +Console.WriteLine(result.GetProperty("userUpdatedAt").ToString()); +Console.WriteLine(result.GetProperty("active").ToString()); +Console.WriteLine(result.GetProperty("inactiveMessage").ToString()); +]]> + + + +This sample shows how to call CreateOrReplaceDataConnection and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +using RequestContent content = RequestContent.Create(new +{ + properties = new object(), + kind = "logAnalytics", +}); +Response response = client.CreateOrReplaceDataConnection("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +]]> +This sample shows how to call CreateOrReplaceDataConnection with all parameters and request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +using RequestContent content = RequestContent.Create(new +{ + properties = new + { + apiKey = "", + workspaceId = "", + }, + kind = "logAnalytics", + id = "", + displayName = "", + content = "assets", + frequency = "daily", + frequencyOffset = 1234, + active = true, +}); +Response response = client.CreateOrReplaceDataConnection("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("content").ToString()); +Console.WriteLine(result.GetProperty("createdDate").ToString()); +Console.WriteLine(result.GetProperty("frequency").ToString()); +Console.WriteLine(result.GetProperty("frequencyOffset").ToString()); +Console.WriteLine(result.GetProperty("updatedDate").ToString()); +Console.WriteLine(result.GetProperty("userUpdatedAt").ToString()); +Console.WriteLine(result.GetProperty("active").ToString()); +Console.WriteLine(result.GetProperty("inactiveMessage").ToString()); +]]> + + + +This sample shows how to call DeleteDataConnectionAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.DeleteDataConnectionAsync(""); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call DeleteDataConnectionAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.DeleteDataConnectionAsync(""); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call DeleteDataConnection. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.DeleteDataConnection(""); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call DeleteDataConnection with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.DeleteDataConnection(""); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call ValidateDiscoGroupAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +DiscoGroupData discoGroupData = new DiscoGroupData(); +Response response = await client.ValidateDiscoGroupAsync(discoGroupData); +]]> +This sample shows how to call ValidateDiscoGroupAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +DiscoGroupData discoGroupData = new DiscoGroupData +{ + Name = "", + Description = "", + Tier = "", + FrequencyMilliseconds = 1234L, + Seeds = {new DiscoSource + { + Kind = DiscoSourceKind.As, + Name = "", + }}, + Names = { "" }, + Excludes = { default }, + TemplateId = "", +}; +Response response = await client.ValidateDiscoGroupAsync(discoGroupData); +]]> + + + +This sample shows how to call ValidateDiscoGroup. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +DiscoGroupData discoGroupData = new DiscoGroupData(); +Response response = client.ValidateDiscoGroup(discoGroupData); +]]> +This sample shows how to call ValidateDiscoGroup with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +DiscoGroupData discoGroupData = new DiscoGroupData +{ + Name = "", + Description = "", + Tier = "", + FrequencyMilliseconds = 1234L, + Seeds = {new DiscoSource + { + Kind = DiscoSourceKind.As, + Name = "", + }}, + Names = { "" }, + Excludes = { default }, + TemplateId = "", +}; +Response response = client.ValidateDiscoGroup(discoGroupData); +]]> + + + +This sample shows how to call ValidateDiscoGroupAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = await client.ValidateDiscoGroupAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> +This sample shows how to call ValidateDiscoGroupAsync with all request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +using RequestContent content = RequestContent.Create(new +{ + name = "", + description = "", + tier = "", + frequencyMilliseconds = 1234L, + seeds = new object[] + { + new + { + kind = "as", + name = "", + } + }, + names = new object[] + { + "" + }, + excludes = new object[] + { + null + }, + templateId = "", +}); +Response response = await client.ValidateDiscoGroupAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("value").ToString()); +]]> + + + +This sample shows how to call ValidateDiscoGroup and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = client.ValidateDiscoGroup(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> +This sample shows how to call ValidateDiscoGroup with all request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +using RequestContent content = RequestContent.Create(new +{ + name = "", + description = "", + tier = "", + frequencyMilliseconds = 1234L, + seeds = new object[] + { + new + { + kind = "as", + name = "", + } + }, + names = new object[] + { + "" + }, + excludes = new object[] + { + null + }, + templateId = "", +}); +Response response = client.ValidateDiscoGroup(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("value").ToString()); +]]> + + + +This sample shows how to call GetDiscoGroupAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.GetDiscoGroupAsync(""); +]]> +This sample shows how to call GetDiscoGroupAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.GetDiscoGroupAsync(""); +]]> + + + +This sample shows how to call GetDiscoGroup. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.GetDiscoGroup(""); +]]> +This sample shows how to call GetDiscoGroup with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.GetDiscoGroup(""); +]]> + + + +This sample shows how to call GetDiscoGroupAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.GetDiscoGroupAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +]]> +This sample shows how to call GetDiscoGroupAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.GetDiscoGroupAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("tier").ToString()); +Console.WriteLine(result.GetProperty("frequencyMilliseconds").ToString()); +Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("names")[0].ToString()); +Console.WriteLine(result.GetProperty("excludes")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("excludes")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("submittedDate").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("startedDate").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("completedDate").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("tier").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("state").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("totalAssetsFoundCount").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("seeds")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("seeds")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("excludes")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("excludes")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("names")[0].ToString()); +Console.WriteLine(result.GetProperty("createdDate").ToString()); +Console.WriteLine(result.GetProperty("templateId").ToString()); +]]> + + + +This sample shows how to call GetDiscoGroup and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.GetDiscoGroup("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +]]> +This sample shows how to call GetDiscoGroup with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.GetDiscoGroup("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("tier").ToString()); +Console.WriteLine(result.GetProperty("frequencyMilliseconds").ToString()); +Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("names")[0].ToString()); +Console.WriteLine(result.GetProperty("excludes")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("excludes")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("submittedDate").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("startedDate").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("completedDate").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("tier").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("state").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("totalAssetsFoundCount").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("seeds")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("seeds")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("excludes")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("excludes")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("names")[0].ToString()); +Console.WriteLine(result.GetProperty("createdDate").ToString()); +Console.WriteLine(result.GetProperty("templateId").ToString()); +]]> + + + +This sample shows how to call CreateOrReplaceDiscoGroupAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +DiscoGroup discoGroup = new DiscoGroup(); +Response response = await client.CreateOrReplaceDiscoGroupAsync("", discoGroup); +]]> +This sample shows how to call CreateOrReplaceDiscoGroupAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +DiscoGroup discoGroup = new DiscoGroup +{ + Id = "", + DisplayName = "", + Description = "", + Tier = "", + FrequencyMilliseconds = 1234L, + Seeds = {new DiscoSource + { + Kind = DiscoSourceKind.As, + Name = "", + }}, + Names = { "" }, + Excludes = { default }, + LatestRun = new DiscoRunResult + { + SubmittedDate = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + StartedDate = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + CompletedDate = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + Tier = "", + State = DiscoRunState.Pending, + TotalAssetsFoundCount = 1234L, + Seeds = { default }, + Excludes = { default }, + Names = { "" }, + }, + CreatedDate = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + TemplateId = "", +}; +Response response = await client.CreateOrReplaceDiscoGroupAsync("", discoGroup); +]]> + + + +This sample shows how to call CreateOrReplaceDiscoGroup. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +DiscoGroup discoGroup = new DiscoGroup(); +Response response = client.CreateOrReplaceDiscoGroup("", discoGroup); +]]> +This sample shows how to call CreateOrReplaceDiscoGroup with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +DiscoGroup discoGroup = new DiscoGroup +{ + Id = "", + DisplayName = "", + Description = "", + Tier = "", + FrequencyMilliseconds = 1234L, + Seeds = {new DiscoSource + { + Kind = DiscoSourceKind.As, + Name = "", + }}, + Names = { "" }, + Excludes = { default }, + LatestRun = new DiscoRunResult + { + SubmittedDate = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + StartedDate = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + CompletedDate = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + Tier = "", + State = DiscoRunState.Pending, + TotalAssetsFoundCount = 1234L, + Seeds = { default }, + Excludes = { default }, + Names = { "" }, + }, + CreatedDate = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + TemplateId = "", +}; +Response response = client.CreateOrReplaceDiscoGroup("", discoGroup); +]]> + + + +This sample shows how to call CreateOrReplaceDiscoGroupAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = await client.CreateOrReplaceDiscoGroupAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +]]> +This sample shows how to call CreateOrReplaceDiscoGroupAsync with all parameters and request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +using RequestContent content = RequestContent.Create(new +{ + id = "", + displayName = "", + description = "", + tier = "", + frequencyMilliseconds = 1234L, + seeds = new object[] + { + new + { + kind = "as", + name = "", + } + }, + names = new object[] + { + "" + }, + excludes = new object[] + { + null + }, + latestRun = new + { + submittedDate = "2022-05-10T14:57:31.2311892-04:00", + startedDate = "2022-05-10T14:57:31.2311892-04:00", + completedDate = "2022-05-10T14:57:31.2311892-04:00", + tier = "", + state = "pending", + totalAssetsFoundCount = 1234L, + seeds = new object[] + { + null + }, + excludes = new object[] + { + null + }, + names = new object[] + { + "" + }, + }, + createdDate = "2022-05-10T14:57:31.2311892-04:00", + templateId = "", +}); +Response response = await client.CreateOrReplaceDiscoGroupAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("tier").ToString()); +Console.WriteLine(result.GetProperty("frequencyMilliseconds").ToString()); +Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("names")[0].ToString()); +Console.WriteLine(result.GetProperty("excludes")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("excludes")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("submittedDate").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("startedDate").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("completedDate").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("tier").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("state").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("totalAssetsFoundCount").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("seeds")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("seeds")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("excludes")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("excludes")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("names")[0].ToString()); +Console.WriteLine(result.GetProperty("createdDate").ToString()); +Console.WriteLine(result.GetProperty("templateId").ToString()); +]]> + + + +This sample shows how to call CreateOrReplaceDiscoGroup and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = client.CreateOrReplaceDiscoGroup("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +]]> +This sample shows how to call CreateOrReplaceDiscoGroup with all parameters and request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +using RequestContent content = RequestContent.Create(new +{ + id = "", + displayName = "", + description = "", + tier = "", + frequencyMilliseconds = 1234L, + seeds = new object[] + { + new + { + kind = "as", + name = "", + } + }, + names = new object[] + { + "" + }, + excludes = new object[] + { + null + }, + latestRun = new + { + submittedDate = "2022-05-10T14:57:31.2311892-04:00", + startedDate = "2022-05-10T14:57:31.2311892-04:00", + completedDate = "2022-05-10T14:57:31.2311892-04:00", + tier = "", + state = "pending", + totalAssetsFoundCount = 1234L, + seeds = new object[] + { + null + }, + excludes = new object[] + { + null + }, + names = new object[] + { + "" + }, + }, + createdDate = "2022-05-10T14:57:31.2311892-04:00", + templateId = "", +}); +Response response = client.CreateOrReplaceDiscoGroup("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("tier").ToString()); +Console.WriteLine(result.GetProperty("frequencyMilliseconds").ToString()); +Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("names")[0].ToString()); +Console.WriteLine(result.GetProperty("excludes")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("excludes")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("submittedDate").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("startedDate").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("completedDate").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("tier").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("state").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("totalAssetsFoundCount").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("seeds")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("seeds")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("excludes")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("excludes")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("latestRun").GetProperty("names")[0].ToString()); +Console.WriteLine(result.GetProperty("createdDate").ToString()); +Console.WriteLine(result.GetProperty("templateId").ToString()); +]]> + + + +This sample shows how to call RunDiscoGroupAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.RunDiscoGroupAsync(""); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call RunDiscoGroupAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.RunDiscoGroupAsync(""); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call RunDiscoGroup. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.RunDiscoGroup(""); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call RunDiscoGroup with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.RunDiscoGroup(""); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call GetDiscoTemplateAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.GetDiscoTemplateAsync(""); +]]> +This sample shows how to call GetDiscoTemplateAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.GetDiscoTemplateAsync(""); +]]> + + + +This sample shows how to call GetDiscoTemplate. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.GetDiscoTemplate(""); +]]> +This sample shows how to call GetDiscoTemplate with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.GetDiscoTemplate(""); +]]> + + + +This sample shows how to call GetDiscoTemplateAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.GetDiscoTemplateAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call GetDiscoTemplateAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.GetDiscoTemplateAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("industry").ToString()); +Console.WriteLine(result.GetProperty("region").ToString()); +Console.WriteLine(result.GetProperty("countryCode").ToString()); +Console.WriteLine(result.GetProperty("stateCode").ToString()); +Console.WriteLine(result.GetProperty("city").ToString()); +Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("names")[0].ToString()); +]]> + + + +This sample shows how to call GetDiscoTemplate and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.GetDiscoTemplate("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call GetDiscoTemplate with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.GetDiscoTemplate("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("industry").ToString()); +Console.WriteLine(result.GetProperty("region").ToString()); +Console.WriteLine(result.GetProperty("countryCode").ToString()); +Console.WriteLine(result.GetProperty("stateCode").ToString()); +Console.WriteLine(result.GetProperty("city").ToString()); +Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("names")[0].ToString()); +]]> + + + +This sample shows how to call GetBillableAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.GetBillableAsync(); +]]> +This sample shows how to call GetBillableAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.GetBillableAsync(); +]]> + + + +This sample shows how to call GetBillable. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.GetBillable(); +]]> +This sample shows how to call GetBillable with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.GetBillable(); +]]> + + + +This sample shows how to call GetBillableAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.GetBillableAsync(null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> +This sample shows how to call GetBillableAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.GetBillableAsync(null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("date").ToString()); +Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("assetBreakdown")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("assetBreakdown")[0].GetProperty("count").ToString()); +]]> + + + +This sample shows how to call GetBillable and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.GetBillable(null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> +This sample shows how to call GetBillable with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.GetBillable(null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("date").ToString()); +Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("total").ToString()); +Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("assetBreakdown")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("assetBreakdown")[0].GetProperty("count").ToString()); +]]> + + + +This sample shows how to call GetSnapshotAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +ReportAssetSnapshotRequest reportAssetSnapshotRequest = new ReportAssetSnapshotRequest(); +Response response = await client.GetSnapshotAsync(reportAssetSnapshotRequest); +]]> +This sample shows how to call GetSnapshotAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +ReportAssetSnapshotRequest reportAssetSnapshotRequest = new ReportAssetSnapshotRequest +{ + Metric = "", + LabelName = "", + Size = 1234, + Page = 1234, +}; +Response response = await client.GetSnapshotAsync(reportAssetSnapshotRequest); +]]> + + + +This sample shows how to call GetSnapshot. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +ReportAssetSnapshotRequest reportAssetSnapshotRequest = new ReportAssetSnapshotRequest(); +Response response = client.GetSnapshot(reportAssetSnapshotRequest); +]]> +This sample shows how to call GetSnapshot with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +ReportAssetSnapshotRequest reportAssetSnapshotRequest = new ReportAssetSnapshotRequest +{ + Metric = "", + LabelName = "", + Size = 1234, + Page = 1234, +}; +Response response = client.GetSnapshot(reportAssetSnapshotRequest); +]]> + + + +This sample shows how to call GetSnapshotAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = await client.GetSnapshotAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> +This sample shows how to call GetSnapshotAsync with all request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +using RequestContent content = RequestContent.Create(new +{ + metric = "", + labelName = "", + size = 1234, + page = 1234, +}); +Response response = await client.GetSnapshotAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("metric").ToString()); +Console.WriteLine(result.GetProperty("labelName").ToString()); +Console.WriteLine(result.GetProperty("updatedAt").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("totalElements").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("mark").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("nextLink").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("uuid").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("createdDate").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("updatedDate").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("state").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("externalId").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("labels")[0].ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("wildcard").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("discoGroupName").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("auditTrail")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("auditTrail")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("auditTrail")[0].GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("auditTrail")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("auditTrail")[0].GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("reason").ToString()); +]]> + + + +This sample shows how to call GetSnapshot and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = client.GetSnapshot(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> +This sample shows how to call GetSnapshot with all request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +using RequestContent content = RequestContent.Create(new +{ + metric = "", + labelName = "", + size = 1234, + page = 1234, +}); +Response response = client.GetSnapshot(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("metric").ToString()); +Console.WriteLine(result.GetProperty("labelName").ToString()); +Console.WriteLine(result.GetProperty("updatedAt").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("totalElements").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("mark").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("nextLink").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("uuid").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("createdDate").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("updatedDate").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("state").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("externalId").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("labels")[0].ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("wildcard").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("discoGroupName").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("auditTrail")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("auditTrail")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("auditTrail")[0].GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("auditTrail")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("auditTrail")[0].GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("reason").ToString()); +]]> + + + +This sample shows how to call GetSummaryAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +ReportAssetSummaryRequest reportAssetSummaryRequest = new ReportAssetSummaryRequest(); +Response response = await client.GetSummaryAsync(reportAssetSummaryRequest); +]]> +This sample shows how to call GetSummaryAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +ReportAssetSummaryRequest reportAssetSummaryRequest = new ReportAssetSummaryRequest +{ + MetricCategories = { "" }, + Metrics = { "" }, + Filters = { "" }, + GroupBy = "", + SegmentBy = "", + LabelName = "", +}; +Response response = await client.GetSummaryAsync(reportAssetSummaryRequest); +]]> + + + +This sample shows how to call GetSummary. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +ReportAssetSummaryRequest reportAssetSummaryRequest = new ReportAssetSummaryRequest(); +Response response = client.GetSummary(reportAssetSummaryRequest); +]]> +This sample shows how to call GetSummary with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +ReportAssetSummaryRequest reportAssetSummaryRequest = new ReportAssetSummaryRequest +{ + MetricCategories = { "" }, + Metrics = { "" }, + Filters = { "" }, + GroupBy = "", + SegmentBy = "", + LabelName = "", +}; +Response response = client.GetSummary(reportAssetSummaryRequest); +]]> + + + +This sample shows how to call GetSummaryAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = await client.GetSummaryAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> +This sample shows how to call GetSummaryAsync with all request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +using RequestContent content = RequestContent.Create(new +{ + metricCategories = new object[] + { + "" + }, + metrics = new object[] + { + "" + }, + filters = new object[] + { + "" + }, + groupBy = "", + segmentBy = "", + labelName = "", +}); +Response response = await client.GetSummaryAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("updatedAt").ToString()); +Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("metricCategory").ToString()); +Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("metric").ToString()); +Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("filter").ToString()); +Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("labelName").ToString()); +Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("count").ToString()); +Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("link").ToString()); +]]> + + + +This sample shows how to call GetSummary and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = client.GetSummary(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> +This sample shows how to call GetSummary with all request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +using RequestContent content = RequestContent.Create(new +{ + metricCategories = new object[] + { + "" + }, + metrics = new object[] + { + "" + }, + filters = new object[] + { + "" + }, + groupBy = "", + segmentBy = "", + labelName = "", +}); +Response response = client.GetSummary(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("description").ToString()); +Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("updatedAt").ToString()); +Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("metricCategory").ToString()); +Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("metric").ToString()); +Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("filter").ToString()); +Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("labelName").ToString()); +Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("count").ToString()); +Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("link").ToString()); +]]> + + + +This sample shows how to call GetSavedFilterAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.GetSavedFilterAsync(""); +]]> +This sample shows how to call GetSavedFilterAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.GetSavedFilterAsync(""); +]]> + + + +This sample shows how to call GetSavedFilter. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.GetSavedFilter(""); +]]> +This sample shows how to call GetSavedFilter with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.GetSavedFilter(""); +]]> + + + +This sample shows how to call GetSavedFilterAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.GetSavedFilterAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +]]> +This sample shows how to call GetSavedFilterAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.GetSavedFilterAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("filter").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +]]> + + + +This sample shows how to call GetSavedFilter and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.GetSavedFilter("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +]]> +This sample shows how to call GetSavedFilter with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.GetSavedFilter("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("filter").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +]]> + + + +This sample shows how to call CreateOrReplaceSavedFilterAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +SavedFilter savedFilter = new SavedFilter(); +Response response = await client.CreateOrReplaceSavedFilterAsync("", savedFilter); +]]> +This sample shows how to call CreateOrReplaceSavedFilterAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +SavedFilter savedFilter = new SavedFilter +{ + Id = "", + DisplayName = "", + Filter = "", + Description = "", +}; +Response response = await client.CreateOrReplaceSavedFilterAsync("", savedFilter); +]]> + + + +This sample shows how to call CreateOrReplaceSavedFilter. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +SavedFilter savedFilter = new SavedFilter(); +Response response = client.CreateOrReplaceSavedFilter("", savedFilter); +]]> +This sample shows how to call CreateOrReplaceSavedFilter with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +SavedFilter savedFilter = new SavedFilter +{ + Id = "", + DisplayName = "", + Filter = "", + Description = "", +}; +Response response = client.CreateOrReplaceSavedFilter("", savedFilter); +]]> + + + +This sample shows how to call CreateOrReplaceSavedFilterAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = await client.CreateOrReplaceSavedFilterAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +]]> +This sample shows how to call CreateOrReplaceSavedFilterAsync with all parameters and request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +using RequestContent content = RequestContent.Create(new +{ + id = "", + displayName = "", + filter = "", + description = "", +}); +Response response = await client.CreateOrReplaceSavedFilterAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("filter").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +]]> + + + +This sample shows how to call CreateOrReplaceSavedFilter and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +using RequestContent content = RequestContent.Create(new object()); +Response response = client.CreateOrReplaceSavedFilter("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +]]> +This sample shows how to call CreateOrReplaceSavedFilter with all parameters and request content and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +using RequestContent content = RequestContent.Create(new +{ + id = "", + displayName = "", + filter = "", + description = "", +}); +Response response = client.CreateOrReplaceSavedFilter("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("filter").ToString()); +Console.WriteLine(result.GetProperty("description").ToString()); +]]> + + + +This sample shows how to call DeleteSavedFilterAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.DeleteSavedFilterAsync(""); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call DeleteSavedFilterAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.DeleteSavedFilterAsync(""); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call DeleteSavedFilter. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.DeleteSavedFilter(""); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call DeleteSavedFilter with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.DeleteSavedFilter(""); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call GetTaskAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.GetTaskAsync(""); +]]> +This sample shows how to call GetTaskAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.GetTaskAsync(""); +]]> + + + +This sample shows how to call GetTask. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.GetTask(""); +]]> +This sample shows how to call GetTask with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.GetTask(""); +]]> + + + +This sample shows how to call GetTaskAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.GetTaskAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call GetTaskAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.GetTaskAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("startedAt").ToString()); +Console.WriteLine(result.GetProperty("completedAt").ToString()); +Console.WriteLine(result.GetProperty("lastPolledAt").ToString()); +Console.WriteLine(result.GetProperty("state").ToString()); +Console.WriteLine(result.GetProperty("phase").ToString()); +Console.WriteLine(result.GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call GetTask and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.GetTask("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call GetTask with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.GetTask("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("startedAt").ToString()); +Console.WriteLine(result.GetProperty("completedAt").ToString()); +Console.WriteLine(result.GetProperty("lastPolledAt").ToString()); +Console.WriteLine(result.GetProperty("state").ToString()); +Console.WriteLine(result.GetProperty("phase").ToString()); +Console.WriteLine(result.GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call CancelTaskAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.CancelTaskAsync(""); +]]> +This sample shows how to call CancelTaskAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.CancelTaskAsync(""); +]]> + + + +This sample shows how to call CancelTask. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.CancelTask(""); +]]> +This sample shows how to call CancelTask with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.CancelTask(""); +]]> + + + +This sample shows how to call CancelTaskAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.CancelTaskAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call CancelTaskAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = await client.CancelTaskAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("startedAt").ToString()); +Console.WriteLine(result.GetProperty("completedAt").ToString()); +Console.WriteLine(result.GetProperty("lastPolledAt").ToString()); +Console.WriteLine(result.GetProperty("state").ToString()); +Console.WriteLine(result.GetProperty("phase").ToString()); +Console.WriteLine(result.GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call CancelTask and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.CancelTask("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call CancelTask with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +Response response = client.CancelTask("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("startedAt").ToString()); +Console.WriteLine(result.GetProperty("completedAt").ToString()); +Console.WriteLine(result.GetProperty("lastPolledAt").ToString()); +Console.WriteLine(result.GetProperty("state").ToString()); +Console.WriteLine(result.GetProperty("phase").ToString()); +Console.WriteLine(result.GetProperty("reason").ToString()); +Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +]]> + + + +This sample shows how to call GetAssetResourcesAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +await foreach (AssetResource item in client.GetAssetResourcesAsync()) +{ +} +]]> +This sample shows how to call GetAssetResourcesAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +await foreach (AssetResource item in client.GetAssetResourcesAsync(filter: "", orderby: "", skip: 1234, maxpagesize: 1234, mark: "")) +{ +} +]]> + + + +This sample shows how to call GetAssetResources. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +foreach (AssetResource item in client.GetAssetResources()) +{ +} +]]> +This sample shows how to call GetAssetResources with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +foreach (AssetResource item in client.GetAssetResources(filter: "", orderby: "", skip: 1234, maxpagesize: 1234, mark: "")) +{ +} +]]> + + + +This sample shows how to call GetAssetResourcesAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +await foreach (BinaryData item in client.GetAssetResourcesAsync(null, null, null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); +} +]]> +This sample shows how to call GetAssetResourcesAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +await foreach (BinaryData item in client.GetAssetResourcesAsync("", "", 1234, 1234, "", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("uuid").ToString()); + Console.WriteLine(result.GetProperty("createdDate").ToString()); + Console.WriteLine(result.GetProperty("updatedDate").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("externalId").ToString()); + Console.WriteLine(result.GetProperty("labels")[0].ToString()); + Console.WriteLine(result.GetProperty("wildcard").ToString()); + Console.WriteLine(result.GetProperty("discoGroupName").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("reason").ToString()); +} +]]> + + + +This sample shows how to call GetAssetResources and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +foreach (BinaryData item in client.GetAssetResources(null, null, null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); +} +]]> +This sample shows how to call GetAssetResources with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +foreach (BinaryData item in client.GetAssetResources("", "", 1234, 1234, "", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("uuid").ToString()); + Console.WriteLine(result.GetProperty("createdDate").ToString()); + Console.WriteLine(result.GetProperty("updatedDate").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("externalId").ToString()); + Console.WriteLine(result.GetProperty("labels")[0].ToString()); + Console.WriteLine(result.GetProperty("wildcard").ToString()); + Console.WriteLine(result.GetProperty("discoGroupName").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("reason").ToString()); +} +]]> + + + +This sample shows how to call GetDataConnectionsAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +await foreach (DataConnection item in client.GetDataConnectionsAsync()) +{ +} +]]> +This sample shows how to call GetDataConnectionsAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +await foreach (DataConnection item in client.GetDataConnectionsAsync(skip: 1234, maxpagesize: 1234)) +{ +} +]]> + + + +This sample shows how to call GetDataConnections. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +foreach (DataConnection item in client.GetDataConnections()) +{ +} +]]> +This sample shows how to call GetDataConnections with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +foreach (DataConnection item in client.GetDataConnections(skip: 1234, maxpagesize: 1234)) +{ +} +]]> + + + +This sample shows how to call GetDataConnectionsAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +await foreach (BinaryData item in client.GetDataConnectionsAsync(null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); +} +]]> +This sample shows how to call GetDataConnectionsAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +await foreach (BinaryData item in client.GetDataConnectionsAsync(1234, 1234, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("content").ToString()); + Console.WriteLine(result.GetProperty("createdDate").ToString()); + Console.WriteLine(result.GetProperty("frequency").ToString()); + Console.WriteLine(result.GetProperty("frequencyOffset").ToString()); + Console.WriteLine(result.GetProperty("updatedDate").ToString()); + Console.WriteLine(result.GetProperty("userUpdatedAt").ToString()); + Console.WriteLine(result.GetProperty("active").ToString()); + Console.WriteLine(result.GetProperty("inactiveMessage").ToString()); +} +]]> + + + +This sample shows how to call GetDataConnections and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +foreach (BinaryData item in client.GetDataConnections(null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); +} +]]> +This sample shows how to call GetDataConnections with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +foreach (BinaryData item in client.GetDataConnections(1234, 1234, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("content").ToString()); + Console.WriteLine(result.GetProperty("createdDate").ToString()); + Console.WriteLine(result.GetProperty("frequency").ToString()); + Console.WriteLine(result.GetProperty("frequencyOffset").ToString()); + Console.WriteLine(result.GetProperty("updatedDate").ToString()); + Console.WriteLine(result.GetProperty("userUpdatedAt").ToString()); + Console.WriteLine(result.GetProperty("active").ToString()); + Console.WriteLine(result.GetProperty("inactiveMessage").ToString()); +} +]]> + + + +This sample shows how to call GetDiscoGroupsAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +await foreach (DiscoGroup item in client.GetDiscoGroupsAsync()) +{ +} +]]> +This sample shows how to call GetDiscoGroupsAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +await foreach (DiscoGroup item in client.GetDiscoGroupsAsync(filter: "", skip: 1234, maxpagesize: 1234)) +{ +} +]]> + + + +This sample shows how to call GetDiscoGroups. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +foreach (DiscoGroup item in client.GetDiscoGroups()) +{ +} +]]> +This sample shows how to call GetDiscoGroups with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +foreach (DiscoGroup item in client.GetDiscoGroups(filter: "", skip: 1234, maxpagesize: 1234)) +{ +} +]]> + + + +This sample shows how to call GetDiscoGroupsAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +await foreach (BinaryData item in client.GetDiscoGroupsAsync(null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); +} +]]> +This sample shows how to call GetDiscoGroupsAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +await foreach (BinaryData item in client.GetDiscoGroupsAsync("", 1234, 1234, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tier").ToString()); + Console.WriteLine(result.GetProperty("frequencyMilliseconds").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("names")[0].ToString()); + Console.WriteLine(result.GetProperty("excludes")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("excludes")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("submittedDate").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("startedDate").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("completedDate").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("tier").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("totalAssetsFoundCount").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("seeds")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("seeds")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("excludes")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("excludes")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("names")[0].ToString()); + Console.WriteLine(result.GetProperty("createdDate").ToString()); + Console.WriteLine(result.GetProperty("templateId").ToString()); +} +]]> + + + +This sample shows how to call GetDiscoGroups and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +foreach (BinaryData item in client.GetDiscoGroups(null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); +} +]]> +This sample shows how to call GetDiscoGroups with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +foreach (BinaryData item in client.GetDiscoGroups("", 1234, 1234, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tier").ToString()); + Console.WriteLine(result.GetProperty("frequencyMilliseconds").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("names")[0].ToString()); + Console.WriteLine(result.GetProperty("excludes")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("excludes")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("submittedDate").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("startedDate").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("completedDate").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("tier").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("totalAssetsFoundCount").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("seeds")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("seeds")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("excludes")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("excludes")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("names")[0].ToString()); + Console.WriteLine(result.GetProperty("createdDate").ToString()); + Console.WriteLine(result.GetProperty("templateId").ToString()); +} +]]> + + + +This sample shows how to call GetRunsAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +await foreach (DiscoRunResult item in client.GetRunsAsync("")) +{ +} +]]> +This sample shows how to call GetRunsAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +await foreach (DiscoRunResult item in client.GetRunsAsync("", filter: "", skip: 1234, maxpagesize: 1234)) +{ +} +]]> + + + +This sample shows how to call GetRuns. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +foreach (DiscoRunResult item in client.GetRuns("")) +{ +} +]]> +This sample shows how to call GetRuns with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +foreach (DiscoRunResult item in client.GetRuns("", filter: "", skip: 1234, maxpagesize: 1234)) +{ +} +]]> + + + +This sample shows how to call GetRunsAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +await foreach (BinaryData item in client.GetRunsAsync("", null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.ToString()); +} +]]> +This sample shows how to call GetRunsAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +await foreach (BinaryData item in client.GetRunsAsync("", "", 1234, 1234, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("submittedDate").ToString()); + Console.WriteLine(result.GetProperty("startedDate").ToString()); + Console.WriteLine(result.GetProperty("completedDate").ToString()); + Console.WriteLine(result.GetProperty("tier").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("totalAssetsFoundCount").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("excludes")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("excludes")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("names")[0].ToString()); +} +]]> + + + +This sample shows how to call GetRuns and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +foreach (BinaryData item in client.GetRuns("", null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.ToString()); +} +]]> +This sample shows how to call GetRuns with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +foreach (BinaryData item in client.GetRuns("", "", 1234, 1234, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("submittedDate").ToString()); + Console.WriteLine(result.GetProperty("startedDate").ToString()); + Console.WriteLine(result.GetProperty("completedDate").ToString()); + Console.WriteLine(result.GetProperty("tier").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("totalAssetsFoundCount").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("excludes")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("excludes")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("names")[0].ToString()); +} +]]> + + + +This sample shows how to call GetDiscoTemplatesAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +await foreach (DiscoTemplate item in client.GetDiscoTemplatesAsync()) +{ +} +]]> +This sample shows how to call GetDiscoTemplatesAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +await foreach (DiscoTemplate item in client.GetDiscoTemplatesAsync(filter: "", skip: 1234, maxpagesize: 1234)) +{ +} +]]> + + + +This sample shows how to call GetDiscoTemplates. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +foreach (DiscoTemplate item in client.GetDiscoTemplates()) +{ +} +]]> +This sample shows how to call GetDiscoTemplates with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +foreach (DiscoTemplate item in client.GetDiscoTemplates(filter: "", skip: 1234, maxpagesize: 1234)) +{ +} +]]> + + + +This sample shows how to call GetDiscoTemplatesAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +await foreach (BinaryData item in client.GetDiscoTemplatesAsync(null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); +} +]]> +This sample shows how to call GetDiscoTemplatesAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +await foreach (BinaryData item in client.GetDiscoTemplatesAsync("", 1234, 1234, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("industry").ToString()); + Console.WriteLine(result.GetProperty("region").ToString()); + Console.WriteLine(result.GetProperty("countryCode").ToString()); + Console.WriteLine(result.GetProperty("stateCode").ToString()); + Console.WriteLine(result.GetProperty("city").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("names")[0].ToString()); +} +]]> + + + +This sample shows how to call GetDiscoTemplates and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +foreach (BinaryData item in client.GetDiscoTemplates(null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); +} +]]> +This sample shows how to call GetDiscoTemplates with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +foreach (BinaryData item in client.GetDiscoTemplates("", 1234, 1234, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("industry").ToString()); + Console.WriteLine(result.GetProperty("region").ToString()); + Console.WriteLine(result.GetProperty("countryCode").ToString()); + Console.WriteLine(result.GetProperty("stateCode").ToString()); + Console.WriteLine(result.GetProperty("city").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("names")[0].ToString()); +} +]]> + + + +This sample shows how to call GetSavedFiltersAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +await foreach (SavedFilter item in client.GetSavedFiltersAsync()) +{ +} +]]> +This sample shows how to call GetSavedFiltersAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +await foreach (SavedFilter item in client.GetSavedFiltersAsync(filter: "", skip: 1234, maxpagesize: 1234)) +{ +} +]]> + + + +This sample shows how to call GetSavedFilters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +foreach (SavedFilter item in client.GetSavedFilters()) +{ +} +]]> +This sample shows how to call GetSavedFilters with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +foreach (SavedFilter item in client.GetSavedFilters(filter: "", skip: 1234, maxpagesize: 1234)) +{ +} +]]> + + + +This sample shows how to call GetSavedFiltersAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +await foreach (BinaryData item in client.GetSavedFiltersAsync(null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); +} +]]> +This sample shows how to call GetSavedFiltersAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +await foreach (BinaryData item in client.GetSavedFiltersAsync("", 1234, 1234, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); +} +]]> + + + +This sample shows how to call GetSavedFilters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +foreach (BinaryData item in client.GetSavedFilters(null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); +} +]]> +This sample shows how to call GetSavedFilters with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +foreach (BinaryData item in client.GetSavedFilters("", 1234, 1234, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); +} +]]> + + + +This sample shows how to call GetTasksAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +await foreach (Task item in client.GetTasksAsync()) +{ +} +]]> +This sample shows how to call GetTasksAsync with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +await foreach (Task item in client.GetTasksAsync(filter: "", orderby: "", skip: 1234, maxpagesize: 1234)) +{ +} +]]> + + + +This sample shows how to call GetTasks. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +foreach (Task item in client.GetTasks()) +{ +} +]]> +This sample shows how to call GetTasks with all parameters. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +foreach (Task item in client.GetTasks(filter: "", orderby: "", skip: 1234, maxpagesize: 1234)) +{ +} +]]> + + + +This sample shows how to call GetTasksAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +await foreach (BinaryData item in client.GetTasksAsync(null, null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); +} +]]> +This sample shows how to call GetTasksAsync with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +await foreach (BinaryData item in client.GetTasksAsync("", "", 1234, 1234, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("startedAt").ToString()); + Console.WriteLine(result.GetProperty("completedAt").ToString()); + Console.WriteLine(result.GetProperty("lastPolledAt").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("phase").ToString()); + Console.WriteLine(result.GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +} +]]> + + + +This sample shows how to call GetTasks and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +foreach (BinaryData item in client.GetTasks(null, null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); +} +]]> +This sample shows how to call GetTasks with all parameters and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, "", "", "", credential); + +foreach (BinaryData item in client.GetTasks("", "", 1234, 1234, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("startedAt").ToString()); + Console.WriteLine(result.GetProperty("completedAt").ToString()); + Console.WriteLine(result.GetProperty("lastPolledAt").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("phase").ToString()); + Console.WriteLine(result.GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); +} +]]> + + + \ No newline at end of file diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DomainAsset.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DomainAsset.Serialization.cs new file mode 100644 index 000000000000..dafeae8be154 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DomainAsset.Serialization.cs @@ -0,0 +1,763 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class DomainAsset : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Domain)) + { + writer.WritePropertyName("domain"u8); + writer.WriteStringValue(Domain); + } + if (Optional.IsDefined(WhoisId)) + { + writer.WritePropertyName("whoisId"u8); + writer.WriteNumberValue(WhoisId.Value); + } + if (Optional.IsCollectionDefined(RegistrarIanaIds)) + { + writer.WritePropertyName("registrarIanaIds"u8); + writer.WriteStartArray(); + foreach (var item in RegistrarIanaIds) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(RegistrantContacts)) + { + writer.WritePropertyName("registrantContacts"u8); + writer.WriteStartArray(); + foreach (var item in RegistrantContacts) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(RegistrantOrgs)) + { + writer.WritePropertyName("registrantOrgs"u8); + writer.WriteStartArray(); + foreach (var item in RegistrantOrgs) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(AdminContacts)) + { + writer.WritePropertyName("adminContacts"u8); + writer.WriteStartArray(); + foreach (var item in AdminContacts) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(TechnicalContacts)) + { + writer.WritePropertyName("technicalContacts"u8); + writer.WriteStartArray(); + foreach (var item in TechnicalContacts) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(AlexaInfos)) + { + writer.WritePropertyName("alexaInfos"u8); + writer.WriteStartArray(); + foreach (var item in AlexaInfos) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(NameServers)) + { + writer.WritePropertyName("nameServers"u8); + writer.WriteStartArray(); + foreach (var item in NameServers) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(MailServers)) + { + writer.WritePropertyName("mailServers"u8); + writer.WriteStartArray(); + foreach (var item in MailServers) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(WhoisServers)) + { + writer.WritePropertyName("whoisServers"u8); + writer.WriteStartArray(); + foreach (var item in WhoisServers) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(DomainStatuses)) + { + writer.WritePropertyName("domainStatuses"u8); + writer.WriteStartArray(); + foreach (var item in DomainStatuses) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(RegistrarCreatedAt)) + { + writer.WritePropertyName("registrarCreatedAt"u8); + writer.WriteStartArray(); + foreach (var item in RegistrarCreatedAt) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(RegistrarUpdatedAt)) + { + writer.WritePropertyName("registrarUpdatedAt"u8); + writer.WriteStartArray(); + foreach (var item in RegistrarUpdatedAt) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(RegistrarExpiresAt)) + { + writer.WritePropertyName("registrarExpiresAt"u8); + writer.WriteStartArray(); + foreach (var item in RegistrarExpiresAt) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(SoaRecords)) + { + writer.WritePropertyName("soaRecords"u8); + writer.WriteStartArray(); + foreach (var item in SoaRecords) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(DetailedFromWhoisAt)) + { + writer.WritePropertyName("detailedFromWhoisAt"u8); + writer.WriteStringValue(DetailedFromWhoisAt.Value, "O"); + } + if (Optional.IsCollectionDefined(RegistrarNames)) + { + writer.WritePropertyName("registrarNames"u8); + writer.WriteStartArray(); + foreach (var item in RegistrarNames) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Sources)) + { + writer.WritePropertyName("sources"u8); + writer.WriteStartArray(); + foreach (var item in Sources) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsCollectionDefined(ParkedDomain)) + { + writer.WritePropertyName("parkedDomain"u8); + writer.WriteStartArray(); + foreach (var item in ParkedDomain) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(RegistrantNames)) + { + writer.WritePropertyName("registrantNames"u8); + writer.WriteStartArray(); + foreach (var item in RegistrantNames) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(AdminNames)) + { + writer.WritePropertyName("adminNames"u8); + writer.WriteStartArray(); + foreach (var item in AdminNames) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(TechnicalNames)) + { + writer.WritePropertyName("technicalNames"u8); + writer.WriteStartArray(); + foreach (var item in TechnicalNames) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(AdminOrgs)) + { + writer.WritePropertyName("adminOrgs"u8); + writer.WriteStartArray(); + foreach (var item in AdminOrgs) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(TechnicalOrgs)) + { + writer.WritePropertyName("technicalOrgs"u8); + writer.WriteStartArray(); + foreach (var item in TechnicalOrgs) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(RegistrantPhones)) + { + writer.WritePropertyName("registrantPhones"u8); + writer.WriteStartArray(); + foreach (var item in RegistrantPhones) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(AdminPhones)) + { + writer.WritePropertyName("adminPhones"u8); + writer.WriteStartArray(); + foreach (var item in AdminPhones) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(TechnicalPhones)) + { + writer.WritePropertyName("technicalPhones"u8); + writer.WriteStartArray(); + foreach (var item in TechnicalPhones) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static DomainAsset DeserializeDomainAsset(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional domain = default; + Optional whoisId = default; + Optional> registrarIanaIds = default; + Optional> registrantContacts = default; + Optional> registrantOrgs = default; + Optional> adminContacts = default; + Optional> technicalContacts = default; + Optional> alexaInfos = default; + Optional> nameServers = default; + Optional> mailServers = default; + Optional> whoisServers = default; + Optional> domainStatuses = default; + Optional> registrarCreatedAt = default; + Optional> registrarUpdatedAt = default; + Optional> registrarExpiresAt = default; + Optional> soaRecords = default; + Optional detailedFromWhoisAt = default; + Optional> registrarNames = default; + Optional> sources = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional count = default; + Optional> parkedDomain = default; + Optional> registrantNames = default; + Optional> adminNames = default; + Optional> technicalNames = default; + Optional> adminOrgs = default; + Optional> technicalOrgs = default; + Optional> registrantPhones = default; + Optional> adminPhones = default; + Optional> technicalPhones = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("domain"u8)) + { + domain = property.Value.GetString(); + continue; + } + if (property.NameEquals("whoisId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + whoisId = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("registrarIanaIds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedInteger.DeserializeObservedInteger(item)); + } + registrarIanaIds = array; + continue; + } + if (property.NameEquals("registrantContacts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + registrantContacts = array; + continue; + } + if (property.NameEquals("registrantOrgs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + registrantOrgs = array; + continue; + } + if (property.NameEquals("adminContacts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + adminContacts = array; + continue; + } + if (property.NameEquals("technicalContacts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + technicalContacts = array; + continue; + } + if (property.NameEquals("alexaInfos"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AlexaInfo.DeserializeAlexaInfo(item)); + } + alexaInfos = array; + continue; + } + if (property.NameEquals("nameServers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + nameServers = array; + continue; + } + if (property.NameEquals("mailServers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + mailServers = array; + continue; + } + if (property.NameEquals("whoisServers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + whoisServers = array; + continue; + } + if (property.NameEquals("domainStatuses"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + domainStatuses = array; + continue; + } + if (property.NameEquals("registrarCreatedAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedLong.DeserializeObservedLong(item)); + } + registrarCreatedAt = array; + continue; + } + if (property.NameEquals("registrarUpdatedAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedLong.DeserializeObservedLong(item)); + } + registrarUpdatedAt = array; + continue; + } + if (property.NameEquals("registrarExpiresAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedLong.DeserializeObservedLong(item)); + } + registrarExpiresAt = array; + continue; + } + if (property.NameEquals("soaRecords"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SoaRecord.DeserializeSoaRecord(item)); + } + soaRecords = array; + continue; + } + if (property.NameEquals("detailedFromWhoisAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + detailedFromWhoisAt = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("registrarNames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + registrarNames = array; + continue; + } + if (property.NameEquals("sources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Source.DeserializeSource(item)); + } + sources = array; + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("parkedDomain"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedBoolean.DeserializeObservedBoolean(item)); + } + parkedDomain = array; + continue; + } + if (property.NameEquals("registrantNames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + registrantNames = array; + continue; + } + if (property.NameEquals("adminNames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + adminNames = array; + continue; + } + if (property.NameEquals("technicalNames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + technicalNames = array; + continue; + } + if (property.NameEquals("adminOrgs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + adminOrgs = array; + continue; + } + if (property.NameEquals("technicalOrgs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + technicalOrgs = array; + continue; + } + if (property.NameEquals("registrantPhones"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + registrantPhones = array; + continue; + } + if (property.NameEquals("adminPhones"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + adminPhones = array; + continue; + } + if (property.NameEquals("technicalPhones"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + technicalPhones = array; + continue; + } + } + return new DomainAsset(domain.Value, Optional.ToNullable(whoisId), Optional.ToList(registrarIanaIds), Optional.ToList(registrantContacts), Optional.ToList(registrantOrgs), Optional.ToList(adminContacts), Optional.ToList(technicalContacts), Optional.ToList(alexaInfos), Optional.ToList(nameServers), Optional.ToList(mailServers), Optional.ToList(whoisServers), Optional.ToList(domainStatuses), Optional.ToList(registrarCreatedAt), Optional.ToList(registrarUpdatedAt), Optional.ToList(registrarExpiresAt), Optional.ToList(soaRecords), Optional.ToNullable(detailedFromWhoisAt), Optional.ToList(registrarNames), Optional.ToList(sources), Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(count), Optional.ToList(parkedDomain), Optional.ToList(registrantNames), Optional.ToList(adminNames), Optional.ToList(technicalNames), Optional.ToList(adminOrgs), Optional.ToList(technicalOrgs), Optional.ToList(registrantPhones), Optional.ToList(adminPhones), Optional.ToList(technicalPhones)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DomainAsset FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDomainAsset(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DomainAsset.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DomainAsset.cs new file mode 100644 index 000000000000..6552f03838cd --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DomainAsset.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The DomainAsset. + public partial class DomainAsset : InventoryAsset + { + /// Initializes a new instance of DomainAsset. + public DomainAsset() + { + RegistrarIanaIds = new ChangeTrackingList(); + RegistrantContacts = new ChangeTrackingList(); + RegistrantOrgs = new ChangeTrackingList(); + AdminContacts = new ChangeTrackingList(); + TechnicalContacts = new ChangeTrackingList(); + AlexaInfos = new ChangeTrackingList(); + NameServers = new ChangeTrackingList(); + MailServers = new ChangeTrackingList(); + WhoisServers = new ChangeTrackingList(); + DomainStatuses = new ChangeTrackingList(); + RegistrarCreatedAt = new ChangeTrackingList(); + RegistrarUpdatedAt = new ChangeTrackingList(); + RegistrarExpiresAt = new ChangeTrackingList(); + SoaRecords = new ChangeTrackingList(); + RegistrarNames = new ChangeTrackingList(); + Sources = new ChangeTrackingList(); + ParkedDomain = new ChangeTrackingList(); + RegistrantNames = new ChangeTrackingList(); + AdminNames = new ChangeTrackingList(); + TechnicalNames = new ChangeTrackingList(); + AdminOrgs = new ChangeTrackingList(); + TechnicalOrgs = new ChangeTrackingList(); + RegistrantPhones = new ChangeTrackingList(); + AdminPhones = new ChangeTrackingList(); + TechnicalPhones = new ChangeTrackingList(); + } + + /// Initializes a new instance of DomainAsset. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + internal DomainAsset(string domain, long? whoisId, IList registrarIanaIds, IList registrantContacts, IList registrantOrgs, IList adminContacts, IList technicalContacts, IList alexaInfos, IList nameServers, IList mailServers, IList whoisServers, IList domainStatuses, IList registrarCreatedAt, IList registrarUpdatedAt, IList registrarExpiresAt, IList soaRecords, DateTimeOffset? detailedFromWhoisAt, IList registrarNames, IList sources, DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count, IList parkedDomain, IList registrantNames, IList adminNames, IList technicalNames, IList adminOrgs, IList technicalOrgs, IList registrantPhones, IList adminPhones, IList technicalPhones) + { + Domain = domain; + WhoisId = whoisId; + RegistrarIanaIds = registrarIanaIds; + RegistrantContacts = registrantContacts; + RegistrantOrgs = registrantOrgs; + AdminContacts = adminContacts; + TechnicalContacts = technicalContacts; + AlexaInfos = alexaInfos; + NameServers = nameServers; + MailServers = mailServers; + WhoisServers = whoisServers; + DomainStatuses = domainStatuses; + RegistrarCreatedAt = registrarCreatedAt; + RegistrarUpdatedAt = registrarUpdatedAt; + RegistrarExpiresAt = registrarExpiresAt; + SoaRecords = soaRecords; + DetailedFromWhoisAt = detailedFromWhoisAt; + RegistrarNames = registrarNames; + Sources = sources; + FirstSeen = firstSeen; + LastSeen = lastSeen; + Count = count; + ParkedDomain = parkedDomain; + RegistrantNames = registrantNames; + AdminNames = adminNames; + TechnicalNames = technicalNames; + AdminOrgs = adminOrgs; + TechnicalOrgs = technicalOrgs; + RegistrantPhones = registrantPhones; + AdminPhones = adminPhones; + TechnicalPhones = technicalPhones; + } + + /// Gets or sets the domain. + public string Domain { get; set; } + /// Gets or sets the whois id. + public long? WhoisId { get; set; } + /// Gets the registrar iana ids. + public IList RegistrarIanaIds { get; } + /// Gets the registrant contacts. + public IList RegistrantContacts { get; } + /// Gets the registrant orgs. + public IList RegistrantOrgs { get; } + /// Gets the admin contacts. + public IList AdminContacts { get; } + /// Gets the technical contacts. + public IList TechnicalContacts { get; } + /// Gets the alexa infos. + public IList AlexaInfos { get; } + /// Gets the name servers. + public IList NameServers { get; } + /// Gets the mail servers. + public IList MailServers { get; } + /// Gets the whois servers. + public IList WhoisServers { get; } + /// Gets the domain statuses. + public IList DomainStatuses { get; } + /// Gets the registrar created at. + public IList RegistrarCreatedAt { get; } + /// Gets the registrar updated at. + public IList RegistrarUpdatedAt { get; } + /// Gets the registrar expires at. + public IList RegistrarExpiresAt { get; } + /// Gets the soa records. + public IList SoaRecords { get; } + /// Gets or sets the detailed from whois at. + public DateTimeOffset? DetailedFromWhoisAt { get; set; } + /// Gets the registrar names. + public IList RegistrarNames { get; } + /// Gets the sources. + public IList Sources { get; } + /// Gets or sets the first seen. + public DateTimeOffset? FirstSeen { get; set; } + /// Gets or sets the last seen. + public DateTimeOffset? LastSeen { get; set; } + /// Gets or sets the count. + public long? Count { get; set; } + /// Gets the parked domain. + public IList ParkedDomain { get; } + /// Gets the registrant names. + public IList RegistrantNames { get; } + /// Gets the admin names. + public IList AdminNames { get; } + /// Gets the technical names. + public IList TechnicalNames { get; } + /// Gets the admin orgs. + public IList AdminOrgs { get; } + /// Gets the technical orgs. + public IList TechnicalOrgs { get; } + /// Gets the registrant phones. + public IList RegistrantPhones { get; } + /// Gets the admin phones. + public IList AdminPhones { get; } + /// Gets the technical phones. + public IList TechnicalPhones { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DomainAssetResource.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DomainAssetResource.Serialization.cs new file mode 100644 index 000000000000..54223d86b305 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DomainAssetResource.Serialization.cs @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class DomainAssetResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("asset"u8); + writer.WriteObjectValue(Asset); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Uuid)) + { + writer.WritePropertyName("uuid"u8); + writer.WriteStringValue(Uuid.Value); + } + if (Optional.IsDefined(CreatedDate)) + { + writer.WritePropertyName("createdDate"u8); + writer.WriteStringValue(CreatedDate.Value, "O"); + } + if (Optional.IsDefined(UpdatedDate)) + { + writer.WritePropertyName("updatedDate"u8); + writer.WriteStringValue(UpdatedDate.Value, "O"); + } + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"u8); + writer.WriteStringValue(State.Value.ToString()); + } + if (Optional.IsDefined(ExternalId)) + { + writer.WritePropertyName("externalId"u8); + writer.WriteStringValue(ExternalId); + } + if (Optional.IsCollectionDefined(Labels)) + { + writer.WritePropertyName("labels"u8); + writer.WriteStartArray(); + foreach (var item in Labels) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Wildcard)) + { + writer.WritePropertyName("wildcard"u8); + writer.WriteBooleanValue(Wildcard.Value); + } + if (Optional.IsDefined(DiscoGroupName)) + { + writer.WritePropertyName("discoGroupName"u8); + writer.WriteStringValue(DiscoGroupName); + } + if (Optional.IsCollectionDefined(AuditTrail)) + { + writer.WritePropertyName("auditTrail"u8); + writer.WriteStartArray(); + foreach (var item in AuditTrail) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Reason)) + { + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason); + } + writer.WriteEndObject(); + } + + internal static DomainAssetResource DeserializeDomainAssetResource(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DomainAsset asset = default; + string kind = default; + string id = default; + Optional name = default; + Optional displayName = default; + Optional uuid = default; + Optional createdDate = default; + Optional updatedDate = default; + Optional state = default; + Optional externalId = default; + Optional> labels = default; + Optional wildcard = default; + Optional discoGroupName = default; + Optional> auditTrail = default; + Optional reason = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("asset"u8)) + { + asset = DomainAsset.DeserializeDomainAsset(property.Value); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("uuid"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + uuid = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("createdDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("updatedDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + updatedDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("state"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = new AssetState(property.Value.GetString()); + continue; + } + if (property.NameEquals("externalId"u8)) + { + externalId = property.Value.GetString(); + continue; + } + if (property.NameEquals("labels"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + labels = array; + continue; + } + if (property.NameEquals("wildcard"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + wildcard = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("discoGroupName"u8)) + { + discoGroupName = property.Value.GetString(); + continue; + } + if (property.NameEquals("auditTrail"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AuditTrailItem.DeserializeAuditTrailItem(item)); + } + auditTrail = array; + continue; + } + if (property.NameEquals("reason"u8)) + { + reason = property.Value.GetString(); + continue; + } + } + return new DomainAssetResource(kind, id, name.Value, displayName.Value, Optional.ToNullable(uuid), Optional.ToNullable(createdDate), Optional.ToNullable(updatedDate), Optional.ToNullable(state), externalId.Value, Optional.ToList(labels), Optional.ToNullable(wildcard), discoGroupName.Value, Optional.ToList(auditTrail), reason.Value, asset); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new DomainAssetResource FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDomainAssetResource(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DomainAssetResource.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DomainAssetResource.cs new file mode 100644 index 000000000000..c26d31d68f16 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DomainAssetResource.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The DomainAssetResource. + public partial class DomainAssetResource : AssetResource + { + /// Initializes a new instance of DomainAssetResource. + /// asset. + /// is null. + public DomainAssetResource(DomainAsset asset) + { + Argument.AssertNotNull(asset, nameof(asset)); + + Kind = "domain"; + Asset = asset; + } + + /// Initializes a new instance of DomainAssetResource. + /// Discriminator. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// Global UUID for the asset. + /// The date this asset was first added to this workspace. + /// The date this asset was last updated for this workspace. + /// + /// An optional customer provided identifier for this asset. + /// Customer labels assigned to this asset. + /// An indicator of whether this asset represents a wildcard rollup of assets on this domain. + /// The name of the DiscoGroup that brought added this asset to the workspace. + /// The history of how this asset was pulled into the workspace through the discovery process. + /// + /// asset. + internal DomainAssetResource(string kind, string id, string name, string displayName, Guid? uuid, DateTimeOffset? createdDate, DateTimeOffset? updatedDate, AssetState? state, string externalId, IList labels, bool? wildcard, string discoGroupName, IList auditTrail, string reason, DomainAsset asset) : base(kind, id, name, displayName, uuid, createdDate, updatedDate, state, externalId, labels, wildcard, discoGroupName, auditTrail, reason) + { + Asset = asset; + } + + /// asset. + public DomainAsset Asset { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/EasmClient.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/EasmClient.cs new file mode 100644 index 000000000000..ca9c20dcc094 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/EasmClient.cs @@ -0,0 +1,3491 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Analytics.Defender.Easm +{ + // Data plane generated client. + /// Provides access to inventory assets. + public partial class EasmClient + { + private static readonly string[] AuthorizationScopes = new string[] { "https://easm.defender.microsoft.com/.default" }; + private readonly TokenCredential _tokenCredential; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _subscriptionId; + private readonly string _resourceGroupName; + private readonly string _workspaceName; + private readonly string _apiVersion; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline => _pipeline; + + /// Initializes a new instance of EasmClient for mocking. + protected EasmClient() + { + } + + /// Initializes a new instance of EasmClient. + /// The endpoint hosting the requested resource. For example, https://{region}.easm.defender.microsoft.com. + /// The ID of the target subscription. + /// The name of the Resource Group. + /// The name of the Workspace. + /// A credential used to authenticate to an Azure Service. + /// , , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public EasmClient(Uri endpoint, string subscriptionId, string resourceGroupName, string workspaceName, TokenCredential credential) : this(endpoint, subscriptionId, resourceGroupName, workspaceName, credential, new EasmClientOptions()) + { + } + + /// Initializes a new instance of EasmClient. + /// The endpoint hosting the requested resource. For example, https://{region}.easm.defender.microsoft.com. + /// The ID of the target subscription. + /// The name of the Resource Group. + /// The name of the Workspace. + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// , , , or is null. + /// , or is an empty string, and was expected to be non-empty. + public EasmClient(Uri endpoint, string subscriptionId, string resourceGroupName, string workspaceName, TokenCredential credential, EasmClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(resourceGroupName, nameof(resourceGroupName)); + Argument.AssertNotNullOrEmpty(workspaceName, nameof(workspaceName)); + Argument.AssertNotNull(credential, nameof(credential)); + options ??= new EasmClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _tokenCredential = credential; + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _subscriptionId = subscriptionId; + _resourceGroupName = resourceGroupName; + _workspaceName = workspaceName; + _apiVersion = options.Version; + } + + /// Update labels on assets matching the provided filter. + /// An expression on the resource type that selects the resources to be returned. + /// The items in the current page of results. + /// The cancellation token to use. + /// or is null. + /// + public virtual async Task> UpdateAssetsAsync(string filter, AssetResource assetResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(filter, nameof(filter)); + Argument.AssertNotNull(assetResource, nameof(assetResource)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = assetResource.ToRequestContent(); + Response response = await UpdateAssetsAsync(filter, content, context).ConfigureAwait(false); + return Response.FromValue(AssetResource.FromResponse(response), response); + } + + /// Update labels on assets matching the provided filter. + /// An expression on the resource type that selects the resources to be returned. + /// The items in the current page of results. + /// The cancellation token to use. + /// or is null. + /// + public virtual Response UpdateAssets(string filter, AssetResource assetResource, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(filter, nameof(filter)); + Argument.AssertNotNull(assetResource, nameof(assetResource)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = assetResource.ToRequestContent(); + Response response = UpdateAssets(filter, content, context); + return Response.FromValue(AssetResource.FromResponse(response), response); + } + + /// + /// [Protocol Method] Update labels on assets matching the provided filter. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// An expression on the resource type that selects the resources to be returned. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task UpdateAssetsAsync(string filter, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(filter, nameof(filter)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.UpdateAssets"); + scope.Start(); + try + { + using HttpMessage message = CreateUpdateAssetsRequest(filter, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Update labels on assets matching the provided filter. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// An expression on the resource type that selects the resources to be returned. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response UpdateAssets(string filter, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(filter, nameof(filter)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.UpdateAssets"); + scope.Start(); + try + { + using HttpMessage message = CreateUpdateAssetsRequest(filter, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieve an asset by assetId. + /// The system generated unique id for the resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetAssetResourceAsync(string assetId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(assetId, nameof(assetId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetAssetResourceAsync(assetId, context).ConfigureAwait(false); + return Response.FromValue(AssetResource.FromResponse(response), response); + } + + /// Retrieve an asset by assetId. + /// The system generated unique id for the resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetAssetResource(string assetId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(assetId, nameof(assetId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetAssetResource(assetId, context); + return Response.FromValue(AssetResource.FromResponse(response), response); + } + + /// + /// [Protocol Method] Retrieve an asset by assetId. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The system generated unique id for the resource. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetAssetResourceAsync(string assetId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(assetId, nameof(assetId)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetAssetResource"); + scope.Start(); + try + { + using HttpMessage message = CreateGetAssetResourceRequest(assetId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Retrieve an asset by assetId. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The system generated unique id for the resource. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetAssetResource(string assetId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(assetId, nameof(assetId)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetAssetResource"); + scope.Start(); + try + { + using HttpMessage message = CreateGetAssetResourceRequest(assetId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Validate a data connection with a given dataConnectionName. + /// The DataConnectionData to use. + /// The cancellation token to use. + /// is null. + /// + public virtual async Task> ValidateDataConnectionAsync(DataConnectionData dataConnectionData, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(dataConnectionData, nameof(dataConnectionData)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = dataConnectionData.ToRequestContent(); + Response response = await ValidateDataConnectionAsync(content, context).ConfigureAwait(false); + return Response.FromValue(ValidateResult.FromResponse(response), response); + } + + /// Validate a data connection with a given dataConnectionName. + /// The DataConnectionData to use. + /// The cancellation token to use. + /// is null. + /// + public virtual Response ValidateDataConnection(DataConnectionData dataConnectionData, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(dataConnectionData, nameof(dataConnectionData)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = dataConnectionData.ToRequestContent(); + Response response = ValidateDataConnection(content, context); + return Response.FromValue(ValidateResult.FromResponse(response), response); + } + + /// + /// [Protocol Method] Validate a data connection with a given dataConnectionName. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task ValidateDataConnectionAsync(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.ValidateDataConnection"); + scope.Start(); + try + { + using HttpMessage message = CreateValidateDataConnectionRequest(content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Validate a data connection with a given dataConnectionName. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response ValidateDataConnection(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.ValidateDataConnection"); + scope.Start(); + try + { + using HttpMessage message = CreateValidateDataConnectionRequest(content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieve a data connection with a given dataConnectionName. + /// The caller provided unique name for the resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetDataConnectionAsync(string dataConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataConnectionName, nameof(dataConnectionName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetDataConnectionAsync(dataConnectionName, context).ConfigureAwait(false); + return Response.FromValue(DataConnection.FromResponse(response), response); + } + + /// Retrieve a data connection with a given dataConnectionName. + /// The caller provided unique name for the resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetDataConnection(string dataConnectionName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataConnectionName, nameof(dataConnectionName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetDataConnection(dataConnectionName, context); + return Response.FromValue(DataConnection.FromResponse(response), response); + } + + /// + /// [Protocol Method] Retrieve a data connection with a given dataConnectionName. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The caller provided unique name for the resource. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetDataConnectionAsync(string dataConnectionName, RequestContext context) + { + Argument.AssertNotNullOrEmpty(dataConnectionName, nameof(dataConnectionName)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetDataConnection"); + scope.Start(); + try + { + using HttpMessage message = CreateGetDataConnectionRequest(dataConnectionName, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Retrieve a data connection with a given dataConnectionName. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The caller provided unique name for the resource. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetDataConnection(string dataConnectionName, RequestContext context) + { + Argument.AssertNotNullOrEmpty(dataConnectionName, nameof(dataConnectionName)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetDataConnection"); + scope.Start(); + try + { + using HttpMessage message = CreateGetDataConnectionRequest(dataConnectionName, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or replace a data connection with a given dataConnectionName. + /// The caller provided unique name for the resource. + /// The DataConnection to use. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> CreateOrReplaceDataConnectionAsync(string dataConnectionName, DataConnection dataConnection, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataConnectionName, nameof(dataConnectionName)); + Argument.AssertNotNull(dataConnection, nameof(dataConnection)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = dataConnection.ToRequestContent(); + Response response = await CreateOrReplaceDataConnectionAsync(dataConnectionName, content, context).ConfigureAwait(false); + return Response.FromValue(DataConnection.FromResponse(response), response); + } + + /// Create or replace a data connection with a given dataConnectionName. + /// The caller provided unique name for the resource. + /// The DataConnection to use. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response CreateOrReplaceDataConnection(string dataConnectionName, DataConnection dataConnection, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataConnectionName, nameof(dataConnectionName)); + Argument.AssertNotNull(dataConnection, nameof(dataConnection)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = dataConnection.ToRequestContent(); + Response response = CreateOrReplaceDataConnection(dataConnectionName, content, context); + return Response.FromValue(DataConnection.FromResponse(response), response); + } + + /// + /// [Protocol Method] Create or replace a data connection with a given dataConnectionName. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The caller provided unique name for the resource. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task CreateOrReplaceDataConnectionAsync(string dataConnectionName, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(dataConnectionName, nameof(dataConnectionName)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.CreateOrReplaceDataConnection"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrReplaceDataConnectionRequest(dataConnectionName, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Create or replace a data connection with a given dataConnectionName. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The caller provided unique name for the resource. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response CreateOrReplaceDataConnection(string dataConnectionName, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(dataConnectionName, nameof(dataConnectionName)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.CreateOrReplaceDataConnection"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrReplaceDataConnectionRequest(dataConnectionName, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Delete a data connection with a given dataConnectionName. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The caller provided unique name for the resource. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task DeleteDataConnectionAsync(string dataConnectionName, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(dataConnectionName, nameof(dataConnectionName)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.DeleteDataConnection"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteDataConnectionRequest(dataConnectionName, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Delete a data connection with a given dataConnectionName. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The caller provided unique name for the resource. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response DeleteDataConnection(string dataConnectionName, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(dataConnectionName, nameof(dataConnectionName)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.DeleteDataConnection"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteDataConnectionRequest(dataConnectionName, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Validate a discovery group with a given groupName. + /// A request body used to create a discovery group. + /// The cancellation token to use. + /// is null. + /// + public virtual async Task> ValidateDiscoGroupAsync(DiscoGroupData discoGroupData, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(discoGroupData, nameof(discoGroupData)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = discoGroupData.ToRequestContent(); + Response response = await ValidateDiscoGroupAsync(content, context).ConfigureAwait(false); + return Response.FromValue(ValidateResult.FromResponse(response), response); + } + + /// Validate a discovery group with a given groupName. + /// A request body used to create a discovery group. + /// The cancellation token to use. + /// is null. + /// + public virtual Response ValidateDiscoGroup(DiscoGroupData discoGroupData, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(discoGroupData, nameof(discoGroupData)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = discoGroupData.ToRequestContent(); + Response response = ValidateDiscoGroup(content, context); + return Response.FromValue(ValidateResult.FromResponse(response), response); + } + + /// + /// [Protocol Method] Validate a discovery group with a given groupName. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task ValidateDiscoGroupAsync(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.ValidateDiscoGroup"); + scope.Start(); + try + { + using HttpMessage message = CreateValidateDiscoGroupRequest(content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Validate a discovery group with a given groupName. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response ValidateDiscoGroup(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.ValidateDiscoGroup"); + scope.Start(); + try + { + using HttpMessage message = CreateValidateDiscoGroupRequest(content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieve a discovery group with a given groupName. + /// The caller provided unique name for the resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetDiscoGroupAsync(string groupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetDiscoGroupAsync(groupName, context).ConfigureAwait(false); + return Response.FromValue(DiscoGroup.FromResponse(response), response); + } + + /// Retrieve a discovery group with a given groupName. + /// The caller provided unique name for the resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetDiscoGroup(string groupName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetDiscoGroup(groupName, context); + return Response.FromValue(DiscoGroup.FromResponse(response), response); + } + + /// + /// [Protocol Method] Retrieve a discovery group with a given groupName. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The caller provided unique name for the resource. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetDiscoGroupAsync(string groupName, RequestContext context) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetDiscoGroup"); + scope.Start(); + try + { + using HttpMessage message = CreateGetDiscoGroupRequest(groupName, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Retrieve a discovery group with a given groupName. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The caller provided unique name for the resource. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetDiscoGroup(string groupName, RequestContext context) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetDiscoGroup"); + scope.Start(); + try + { + using HttpMessage message = CreateGetDiscoGroupRequest(groupName, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create a discovery group with a given groupName. + /// The caller provided unique name for the resource. + /// The DiscoGroup to use. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> CreateOrReplaceDiscoGroupAsync(string groupName, DiscoGroup discoGroup, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + Argument.AssertNotNull(discoGroup, nameof(discoGroup)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = discoGroup.ToRequestContent(); + Response response = await CreateOrReplaceDiscoGroupAsync(groupName, content, context).ConfigureAwait(false); + return Response.FromValue(DiscoGroup.FromResponse(response), response); + } + + /// Create a discovery group with a given groupName. + /// The caller provided unique name for the resource. + /// The DiscoGroup to use. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response CreateOrReplaceDiscoGroup(string groupName, DiscoGroup discoGroup, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + Argument.AssertNotNull(discoGroup, nameof(discoGroup)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = discoGroup.ToRequestContent(); + Response response = CreateOrReplaceDiscoGroup(groupName, content, context); + return Response.FromValue(DiscoGroup.FromResponse(response), response); + } + + /// + /// [Protocol Method] Create a discovery group with a given groupName. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The caller provided unique name for the resource. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task CreateOrReplaceDiscoGroupAsync(string groupName, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.CreateOrReplaceDiscoGroup"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrReplaceDiscoGroupRequest(groupName, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Create a discovery group with a given groupName. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The caller provided unique name for the resource. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response CreateOrReplaceDiscoGroup(string groupName, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.CreateOrReplaceDiscoGroup"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrReplaceDiscoGroupRequest(groupName, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Run a discovery group with a given groupName. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The caller provided unique name for the resource. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task RunDiscoGroupAsync(string groupName, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.RunDiscoGroup"); + scope.Start(); + try + { + using HttpMessage message = CreateRunDiscoGroupRequest(groupName, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Run a discovery group with a given groupName. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The caller provided unique name for the resource. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response RunDiscoGroup(string groupName, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.RunDiscoGroup"); + scope.Start(); + try + { + using HttpMessage message = CreateRunDiscoGroupRequest(groupName, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieve a disco template with a given templateId. + /// The system generated unique id for the resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetDiscoTemplateAsync(string templateId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(templateId, nameof(templateId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetDiscoTemplateAsync(templateId, context).ConfigureAwait(false); + return Response.FromValue(DiscoTemplate.FromResponse(response), response); + } + + /// Retrieve a disco template with a given templateId. + /// The system generated unique id for the resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetDiscoTemplate(string templateId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(templateId, nameof(templateId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetDiscoTemplate(templateId, context); + return Response.FromValue(DiscoTemplate.FromResponse(response), response); + } + + /// + /// [Protocol Method] Retrieve a disco template with a given templateId. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The system generated unique id for the resource. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetDiscoTemplateAsync(string templateId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(templateId, nameof(templateId)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetDiscoTemplate"); + scope.Start(); + try + { + using HttpMessage message = CreateGetDiscoTemplateRequest(templateId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Retrieve a disco template with a given templateId. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The system generated unique id for the resource. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetDiscoTemplate(string templateId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(templateId, nameof(templateId)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetDiscoTemplate"); + scope.Start(); + try + { + using HttpMessage message = CreateGetDiscoTemplateRequest(templateId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get billable assets summary for the workspace. + /// The cancellation token to use. + /// + public virtual async Task> GetBillableAsync(CancellationToken cancellationToken = default) + { + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetBillableAsync(context).ConfigureAwait(false); + return Response.FromValue(ReportBillableAssetSummaryResult.FromResponse(response), response); + } + + /// Get billable assets summary for the workspace. + /// The cancellation token to use. + /// + public virtual Response GetBillable(CancellationToken cancellationToken = default) + { + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetBillable(context); + return Response.FromValue(ReportBillableAssetSummaryResult.FromResponse(response), response); + } + + /// + /// [Protocol Method] Get billable assets summary for the workspace. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetBillableAsync(RequestContext context) + { + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetBillable"); + scope.Start(); + try + { + using HttpMessage message = CreateGetBillableRequest(context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Get billable assets summary for the workspace. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetBillable(RequestContext context) + { + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetBillable"); + scope.Start(); + try + { + using HttpMessage message = CreateGetBillableRequest(context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get the most recent snapshot of asset summary values for the snapshot request. + /// A request body used to retrieve an asset report snapshot. + /// The cancellation token to use. + /// is null. + /// + public virtual async Task> GetSnapshotAsync(ReportAssetSnapshotRequest reportAssetSnapshotRequest, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(reportAssetSnapshotRequest, nameof(reportAssetSnapshotRequest)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = reportAssetSnapshotRequest.ToRequestContent(); + Response response = await GetSnapshotAsync(content, context).ConfigureAwait(false); + return Response.FromValue(ReportAssetSnapshotResult.FromResponse(response), response); + } + + /// Get the most recent snapshot of asset summary values for the snapshot request. + /// A request body used to retrieve an asset report snapshot. + /// The cancellation token to use. + /// is null. + /// + public virtual Response GetSnapshot(ReportAssetSnapshotRequest reportAssetSnapshotRequest, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(reportAssetSnapshotRequest, nameof(reportAssetSnapshotRequest)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = reportAssetSnapshotRequest.ToRequestContent(); + Response response = GetSnapshot(content, context); + return Response.FromValue(ReportAssetSnapshotResult.FromResponse(response), response); + } + + /// + /// [Protocol Method] Get the most recent snapshot of asset summary values for the snapshot request. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetSnapshotAsync(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetSnapshot"); + scope.Start(); + try + { + using HttpMessage message = CreateGetSnapshotRequest(content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Get the most recent snapshot of asset summary values for the snapshot request. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetSnapshot(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetSnapshot"); + scope.Start(); + try + { + using HttpMessage message = CreateGetSnapshotRequest(content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get asset summary details for the summary request. + /// A request body used to retrieve summary asset information. One and only one collection of summary identifiers must be provided: filters, metrics, or metricCategories. + /// The cancellation token to use. + /// is null. + /// + public virtual async Task> GetSummaryAsync(ReportAssetSummaryRequest reportAssetSummaryRequest, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(reportAssetSummaryRequest, nameof(reportAssetSummaryRequest)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = reportAssetSummaryRequest.ToRequestContent(); + Response response = await GetSummaryAsync(content, context).ConfigureAwait(false); + return Response.FromValue(ReportAssetSummaryResult.FromResponse(response), response); + } + + /// Get asset summary details for the summary request. + /// A request body used to retrieve summary asset information. One and only one collection of summary identifiers must be provided: filters, metrics, or metricCategories. + /// The cancellation token to use. + /// is null. + /// + public virtual Response GetSummary(ReportAssetSummaryRequest reportAssetSummaryRequest, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(reportAssetSummaryRequest, nameof(reportAssetSummaryRequest)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = reportAssetSummaryRequest.ToRequestContent(); + Response response = GetSummary(content, context); + return Response.FromValue(ReportAssetSummaryResult.FromResponse(response), response); + } + + /// + /// [Protocol Method] Get asset summary details for the summary request. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetSummaryAsync(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetSummary"); + scope.Start(); + try + { + using HttpMessage message = CreateGetSummaryRequest(content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Get asset summary details for the summary request. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetSummary(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetSummary"); + scope.Start(); + try + { + using HttpMessage message = CreateGetSummaryRequest(content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieve a saved filter by filterName. + /// The caller provided unique name for the resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetSavedFilterAsync(string filterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetSavedFilterAsync(filterName, context).ConfigureAwait(false); + return Response.FromValue(SavedFilter.FromResponse(response), response); + } + + /// Retrieve a saved filter by filterName. + /// The caller provided unique name for the resource. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetSavedFilter(string filterName, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetSavedFilter(filterName, context); + return Response.FromValue(SavedFilter.FromResponse(response), response); + } + + /// + /// [Protocol Method] Retrieve a saved filter by filterName. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The caller provided unique name for the resource. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetSavedFilterAsync(string filterName, RequestContext context) + { + Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetSavedFilter"); + scope.Start(); + try + { + using HttpMessage message = CreateGetSavedFilterRequest(filterName, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Retrieve a saved filter by filterName. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The caller provided unique name for the resource. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetSavedFilter(string filterName, RequestContext context) + { + Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetSavedFilter"); + scope.Start(); + try + { + using HttpMessage message = CreateGetSavedFilterRequest(filterName, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Create or replace a saved filter with a given filterName. + /// The caller provided unique name for the resource. + /// The SavedFilter to use. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> CreateOrReplaceSavedFilterAsync(string filterName, SavedFilter savedFilter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); + Argument.AssertNotNull(savedFilter, nameof(savedFilter)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = savedFilter.ToRequestContent(); + Response response = await CreateOrReplaceSavedFilterAsync(filterName, content, context).ConfigureAwait(false); + return Response.FromValue(SavedFilter.FromResponse(response), response); + } + + /// Create or replace a saved filter with a given filterName. + /// The caller provided unique name for the resource. + /// The SavedFilter to use. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response CreateOrReplaceSavedFilter(string filterName, SavedFilter savedFilter, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); + Argument.AssertNotNull(savedFilter, nameof(savedFilter)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = savedFilter.ToRequestContent(); + Response response = CreateOrReplaceSavedFilter(filterName, content, context); + return Response.FromValue(SavedFilter.FromResponse(response), response); + } + + /// + /// [Protocol Method] Create or replace a saved filter with a given filterName. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The caller provided unique name for the resource. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task CreateOrReplaceSavedFilterAsync(string filterName, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.CreateOrReplaceSavedFilter"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrReplaceSavedFilterRequest(filterName, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Create or replace a saved filter with a given filterName. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The caller provided unique name for the resource. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response CreateOrReplaceSavedFilter(string filterName, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.CreateOrReplaceSavedFilter"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrReplaceSavedFilterRequest(filterName, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Delete a saved filter with a given filterName. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The caller provided unique name for the resource. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task DeleteSavedFilterAsync(string filterName, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.DeleteSavedFilter"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteSavedFilterRequest(filterName, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Delete a saved filter with a given filterName. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The caller provided unique name for the resource. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response DeleteSavedFilter(string filterName, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.DeleteSavedFilter"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteSavedFilterRequest(filterName, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieve a task by taskId. + /// The unique identifier of the task. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetTaskAsync(string taskId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(taskId, nameof(taskId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetTaskAsync(taskId, context).ConfigureAwait(false); + return Response.FromValue(Task.FromResponse(response), response); + } + + /// Retrieve a task by taskId. + /// The unique identifier of the task. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetTask(string taskId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(taskId, nameof(taskId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetTask(taskId, context); + return Response.FromValue(Task.FromResponse(response), response); + } + + /// + /// [Protocol Method] Retrieve a task by taskId. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The unique identifier of the task. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetTaskAsync(string taskId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(taskId, nameof(taskId)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetTask"); + scope.Start(); + try + { + using HttpMessage message = CreateGetTaskRequest(taskId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Retrieve a task by taskId. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The unique identifier of the task. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetTask(string taskId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(taskId, nameof(taskId)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetTask"); + scope.Start(); + try + { + using HttpMessage message = CreateGetTaskRequest(taskId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Cancel a task by taskId. + /// The unique identifier of the task. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> CancelTaskAsync(string taskId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(taskId, nameof(taskId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await CancelTaskAsync(taskId, context).ConfigureAwait(false); + return Response.FromValue(Task.FromResponse(response), response); + } + + /// Cancel a task by taskId. + /// The unique identifier of the task. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response CancelTask(string taskId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(taskId, nameof(taskId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = CancelTask(taskId, context); + return Response.FromValue(Task.FromResponse(response), response); + } + + /// + /// [Protocol Method] Cancel a task by taskId. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The unique identifier of the task. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task CancelTaskAsync(string taskId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(taskId, nameof(taskId)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.CancelTask"); + scope.Start(); + try + { + using HttpMessage message = CreateCancelTaskRequest(taskId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Cancel a task by taskId. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The unique identifier of the task. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response CancelTask(string taskId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(taskId, nameof(taskId)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.CancelTask"); + scope.Start(); + try + { + using HttpMessage message = CreateCancelTaskRequest(taskId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieve a list of assets for the provided search parameters. + /// Filter the result list using the given expression. + /// A list of expressions that specify the order of the returned resources. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// Specify this value instead of 'skip' to use cursor-based searching. Initial value is '*' and subsequent values are returned in the response. + /// The cancellation token to use. + /// + public virtual AsyncPageable GetAssetResourcesAsync(string filter = null, string orderby = null, int? skip = null, int? maxpagesize = null, string mark = null, CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAssetResourcesRequest(filter, orderby, skip, maxpagesize, mark, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAssetResourcesNextPageRequest(nextLink, filter, orderby, skip, maxpagesize, mark, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, AssetResource.DeserializeAssetResource, ClientDiagnostics, _pipeline, "EasmClient.GetAssetResources", "value", "nextLink", context); + } + + /// Retrieve a list of assets for the provided search parameters. + /// Filter the result list using the given expression. + /// A list of expressions that specify the order of the returned resources. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// Specify this value instead of 'skip' to use cursor-based searching. Initial value is '*' and subsequent values are returned in the response. + /// The cancellation token to use. + /// + public virtual Pageable GetAssetResources(string filter = null, string orderby = null, int? skip = null, int? maxpagesize = null, string mark = null, CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAssetResourcesRequest(filter, orderby, skip, maxpagesize, mark, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAssetResourcesNextPageRequest(nextLink, filter, orderby, skip, maxpagesize, mark, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, AssetResource.DeserializeAssetResource, ClientDiagnostics, _pipeline, "EasmClient.GetAssetResources", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieve a list of assets for the provided search parameters. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Filter the result list using the given expression. + /// A list of expressions that specify the order of the returned resources. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// Specify this value instead of 'skip' to use cursor-based searching. Initial value is '*' and subsequent values are returned in the response. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual AsyncPageable GetAssetResourcesAsync(string filter, string orderby, int? skip, int? maxpagesize, string mark, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAssetResourcesRequest(filter, orderby, skip, maxpagesize, mark, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAssetResourcesNextPageRequest(nextLink, filter, orderby, skip, maxpagesize, mark, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EasmClient.GetAssetResources", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieve a list of assets for the provided search parameters. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Filter the result list using the given expression. + /// A list of expressions that specify the order of the returned resources. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// Specify this value instead of 'skip' to use cursor-based searching. Initial value is '*' and subsequent values are returned in the response. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual Pageable GetAssetResources(string filter, string orderby, int? skip, int? maxpagesize, string mark, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAssetResourcesRequest(filter, orderby, skip, maxpagesize, mark, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAssetResourcesNextPageRequest(nextLink, filter, orderby, skip, maxpagesize, mark, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EasmClient.GetAssetResources", "value", "nextLink", context); + } + + /// Retrieve a list of data connections. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// The cancellation token to use. + /// + public virtual AsyncPageable GetDataConnectionsAsync(int? skip = null, int? maxpagesize = null, CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDataConnectionsRequest(skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDataConnectionsNextPageRequest(nextLink, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, DataConnection.DeserializeDataConnection, ClientDiagnostics, _pipeline, "EasmClient.GetDataConnections", "value", "nextLink", context); + } + + /// Retrieve a list of data connections. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// The cancellation token to use. + /// + public virtual Pageable GetDataConnections(int? skip = null, int? maxpagesize = null, CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDataConnectionsRequest(skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDataConnectionsNextPageRequest(nextLink, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, DataConnection.DeserializeDataConnection, ClientDiagnostics, _pipeline, "EasmClient.GetDataConnections", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieve a list of data connections. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The number of result items to skip. + /// The maximum number of result items per page. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual AsyncPageable GetDataConnectionsAsync(int? skip, int? maxpagesize, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDataConnectionsRequest(skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDataConnectionsNextPageRequest(nextLink, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EasmClient.GetDataConnections", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieve a list of data connections. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The number of result items to skip. + /// The maximum number of result items per page. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual Pageable GetDataConnections(int? skip, int? maxpagesize, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDataConnectionsRequest(skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDataConnectionsNextPageRequest(nextLink, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EasmClient.GetDataConnections", "value", "nextLink", context); + } + + /// Retrieve a list of discovery group for the provided search parameters. + /// Filter the result list using the given expression. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// The cancellation token to use. + /// + public virtual AsyncPageable GetDiscoGroupsAsync(string filter = null, int? skip = null, int? maxpagesize = null, CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDiscoGroupsRequest(filter, skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDiscoGroupsNextPageRequest(nextLink, filter, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, DiscoGroup.DeserializeDiscoGroup, ClientDiagnostics, _pipeline, "EasmClient.GetDiscoGroups", "value", "nextLink", context); + } + + /// Retrieve a list of discovery group for the provided search parameters. + /// Filter the result list using the given expression. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// The cancellation token to use. + /// + public virtual Pageable GetDiscoGroups(string filter = null, int? skip = null, int? maxpagesize = null, CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDiscoGroupsRequest(filter, skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDiscoGroupsNextPageRequest(nextLink, filter, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, DiscoGroup.DeserializeDiscoGroup, ClientDiagnostics, _pipeline, "EasmClient.GetDiscoGroups", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieve a list of discovery group for the provided search parameters. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Filter the result list using the given expression. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual AsyncPageable GetDiscoGroupsAsync(string filter, int? skip, int? maxpagesize, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDiscoGroupsRequest(filter, skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDiscoGroupsNextPageRequest(nextLink, filter, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EasmClient.GetDiscoGroups", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieve a list of discovery group for the provided search parameters. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Filter the result list using the given expression. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual Pageable GetDiscoGroups(string filter, int? skip, int? maxpagesize, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDiscoGroupsRequest(filter, skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDiscoGroupsNextPageRequest(nextLink, filter, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EasmClient.GetDiscoGroups", "value", "nextLink", context); + } + + /// Retrieve a collection of discovery run results for a discovery group with a given groupName. + /// The unique identifier for the discovery group. + /// Filter the result list using the given expression. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual AsyncPageable GetRunsAsync(string groupName, string filter = null, int? skip = null, int? maxpagesize = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetRunsRequest(groupName, filter, skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetRunsNextPageRequest(nextLink, groupName, filter, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, DiscoRunResult.DeserializeDiscoRunResult, ClientDiagnostics, _pipeline, "EasmClient.GetRuns", "value", "nextLink", context); + } + + /// Retrieve a collection of discovery run results for a discovery group with a given groupName. + /// The unique identifier for the discovery group. + /// Filter the result list using the given expression. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Pageable GetRuns(string groupName, string filter = null, int? skip = null, int? maxpagesize = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetRunsRequest(groupName, filter, skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetRunsNextPageRequest(nextLink, groupName, filter, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, DiscoRunResult.DeserializeDiscoRunResult, ClientDiagnostics, _pipeline, "EasmClient.GetRuns", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieve a collection of discovery run results for a discovery group with a given groupName. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The unique identifier for the discovery group. + /// Filter the result list using the given expression. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual AsyncPageable GetRunsAsync(string groupName, string filter, int? skip, int? maxpagesize, RequestContext context) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetRunsRequest(groupName, filter, skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetRunsNextPageRequest(nextLink, groupName, filter, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EasmClient.GetRuns", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieve a collection of discovery run results for a discovery group with a given groupName. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The unique identifier for the discovery group. + /// Filter the result list using the given expression. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual Pageable GetRuns(string groupName, string filter, int? skip, int? maxpagesize, RequestContext context) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetRunsRequest(groupName, filter, skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetRunsNextPageRequest(nextLink, groupName, filter, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EasmClient.GetRuns", "value", "nextLink", context); + } + + /// Retrieve a list of disco templates for the provided search parameters. + /// Filter the result list using the given expression. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// The cancellation token to use. + /// + public virtual AsyncPageable GetDiscoTemplatesAsync(string filter = null, int? skip = null, int? maxpagesize = null, CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDiscoTemplatesRequest(filter, skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDiscoTemplatesNextPageRequest(nextLink, filter, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, DiscoTemplate.DeserializeDiscoTemplate, ClientDiagnostics, _pipeline, "EasmClient.GetDiscoTemplates", "value", "nextLink", context); + } + + /// Retrieve a list of disco templates for the provided search parameters. + /// Filter the result list using the given expression. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// The cancellation token to use. + /// + public virtual Pageable GetDiscoTemplates(string filter = null, int? skip = null, int? maxpagesize = null, CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDiscoTemplatesRequest(filter, skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDiscoTemplatesNextPageRequest(nextLink, filter, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, DiscoTemplate.DeserializeDiscoTemplate, ClientDiagnostics, _pipeline, "EasmClient.GetDiscoTemplates", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieve a list of disco templates for the provided search parameters. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Filter the result list using the given expression. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual AsyncPageable GetDiscoTemplatesAsync(string filter, int? skip, int? maxpagesize, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDiscoTemplatesRequest(filter, skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDiscoTemplatesNextPageRequest(nextLink, filter, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EasmClient.GetDiscoTemplates", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieve a list of disco templates for the provided search parameters. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Filter the result list using the given expression. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual Pageable GetDiscoTemplates(string filter, int? skip, int? maxpagesize, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDiscoTemplatesRequest(filter, skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDiscoTemplatesNextPageRequest(nextLink, filter, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EasmClient.GetDiscoTemplates", "value", "nextLink", context); + } + + /// Retrieve a list of saved filters for the provided search parameters. + /// Filter the result list using the given expression. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// The cancellation token to use. + /// + public virtual AsyncPageable GetSavedFiltersAsync(string filter = null, int? skip = null, int? maxpagesize = null, CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSavedFiltersRequest(filter, skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSavedFiltersNextPageRequest(nextLink, filter, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, SavedFilter.DeserializeSavedFilter, ClientDiagnostics, _pipeline, "EasmClient.GetSavedFilters", "value", "nextLink", context); + } + + /// Retrieve a list of saved filters for the provided search parameters. + /// Filter the result list using the given expression. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// The cancellation token to use. + /// + public virtual Pageable GetSavedFilters(string filter = null, int? skip = null, int? maxpagesize = null, CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSavedFiltersRequest(filter, skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSavedFiltersNextPageRequest(nextLink, filter, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, SavedFilter.DeserializeSavedFilter, ClientDiagnostics, _pipeline, "EasmClient.GetSavedFilters", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieve a list of saved filters for the provided search parameters. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Filter the result list using the given expression. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual AsyncPageable GetSavedFiltersAsync(string filter, int? skip, int? maxpagesize, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSavedFiltersRequest(filter, skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSavedFiltersNextPageRequest(nextLink, filter, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EasmClient.GetSavedFilters", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieve a list of saved filters for the provided search parameters. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Filter the result list using the given expression. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual Pageable GetSavedFilters(string filter, int? skip, int? maxpagesize, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetSavedFiltersRequest(filter, skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetSavedFiltersNextPageRequest(nextLink, filter, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EasmClient.GetSavedFilters", "value", "nextLink", context); + } + + /// Retrieve a list of tasks for the provided search parameters. + /// Filter the result list using the given expression. + /// A list of expressions that specify the order of the returned resources. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// The cancellation token to use. + /// + public virtual AsyncPageable GetTasksAsync(string filter = null, string orderby = null, int? skip = null, int? maxpagesize = null, CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTasksRequest(filter, orderby, skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTasksNextPageRequest(nextLink, filter, orderby, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, Task.DeserializeTask, ClientDiagnostics, _pipeline, "EasmClient.GetTasks", "value", "nextLink", context); + } + + /// Retrieve a list of tasks for the provided search parameters. + /// Filter the result list using the given expression. + /// A list of expressions that specify the order of the returned resources. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// The cancellation token to use. + /// + public virtual Pageable GetTasks(string filter = null, string orderby = null, int? skip = null, int? maxpagesize = null, CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTasksRequest(filter, orderby, skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTasksNextPageRequest(nextLink, filter, orderby, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, Task.DeserializeTask, ClientDiagnostics, _pipeline, "EasmClient.GetTasks", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieve a list of tasks for the provided search parameters. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Filter the result list using the given expression. + /// A list of expressions that specify the order of the returned resources. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual AsyncPageable GetTasksAsync(string filter, string orderby, int? skip, int? maxpagesize, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTasksRequest(filter, orderby, skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTasksNextPageRequest(nextLink, filter, orderby, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EasmClient.GetTasks", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieve a list of tasks for the provided search parameters. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Filter the result list using the given expression. + /// A list of expressions that specify the order of the returned resources. + /// The number of result items to skip. + /// The maximum number of result items per page. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual Pageable GetTasks(string filter, string orderby, int? skip, int? maxpagesize, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTasksRequest(filter, orderby, skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTasksNextPageRequest(nextLink, filter, orderby, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EasmClient.GetTasks", "value", "nextLink", context); + } + + internal HttpMessage CreateGetAssetResourcesRequest(string filter, string orderby, int? skip, int? maxpagesize, string mark, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendPath("/assets", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("filter", filter, true); + } + if (orderby != null) + { + uri.AppendQuery("orderby", orderby, true); + } + if (skip != null) + { + uri.AppendQuery("skip", skip.Value, true); + } + if (maxpagesize != null) + { + uri.AppendQuery("maxpagesize", maxpagesize.Value, true); + } + if (mark != null) + { + uri.AppendQuery("mark", mark, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateUpdateAssetsRequest(string filter, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendPath("/assets", false); + uri.AppendQuery("filter", filter, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateGetAssetResourceRequest(string assetId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendPath("/assets/", false); + uri.AppendPath(assetId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetDataConnectionsRequest(int? skip, int? maxpagesize, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendPath("/dataConnections", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (skip != null) + { + uri.AppendQuery("skip", skip.Value, true); + } + if (maxpagesize != null) + { + uri.AppendQuery("maxpagesize", maxpagesize.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateValidateDataConnectionRequest(RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendPath("/dataConnections:validate", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateGetDataConnectionRequest(string dataConnectionName, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendPath("/dataConnections/", false); + uri.AppendPath(dataConnectionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCreateOrReplaceDataConnectionRequest(string dataConnectionName, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendPath("/dataConnections/", false); + uri.AppendPath(dataConnectionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateDeleteDataConnectionRequest(string dataConnectionName, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendPath("/dataConnections/", false); + uri.AppendPath(dataConnectionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetDiscoGroupsRequest(string filter, int? skip, int? maxpagesize, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendPath("/discoGroups", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("filter", filter, true); + } + if (skip != null) + { + uri.AppendQuery("skip", skip.Value, true); + } + if (maxpagesize != null) + { + uri.AppendQuery("maxpagesize", maxpagesize.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateValidateDiscoGroupRequest(RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendPath("/discoGroups:validate", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateGetDiscoGroupRequest(string groupName, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendPath("/discoGroups/", false); + uri.AppendPath(groupName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCreateOrReplaceDiscoGroupRequest(string groupName, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendPath("/discoGroups/", false); + uri.AppendPath(groupName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateRunDiscoGroupRequest(string groupName, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendPath("/discoGroups/", false); + uri.AppendPath(groupName, true); + uri.AppendPath(":run", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetRunsRequest(string groupName, string filter, int? skip, int? maxpagesize, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendPath("/discoGroups/", false); + uri.AppendPath(groupName, true); + uri.AppendPath("/runs", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("filter", filter, true); + } + if (skip != null) + { + uri.AppendQuery("skip", skip.Value, true); + } + if (maxpagesize != null) + { + uri.AppendQuery("maxpagesize", maxpagesize.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetDiscoTemplatesRequest(string filter, int? skip, int? maxpagesize, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendPath("/discoTemplates", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("filter", filter, true); + } + if (skip != null) + { + uri.AppendQuery("skip", skip.Value, true); + } + if (maxpagesize != null) + { + uri.AppendQuery("maxpagesize", maxpagesize.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetDiscoTemplateRequest(string templateId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendPath("/discoTemplates/", false); + uri.AppendPath(templateId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetBillableRequest(RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendPath("/reports/assets:getBillable", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetSnapshotRequest(RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendPath("/reports/assets:getSnapshot", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateGetSummaryRequest(RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendPath("/reports/assets:getSummary", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateGetSavedFiltersRequest(string filter, int? skip, int? maxpagesize, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendPath("/savedFilters", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("filter", filter, true); + } + if (skip != null) + { + uri.AppendQuery("skip", skip.Value, true); + } + if (maxpagesize != null) + { + uri.AppendQuery("maxpagesize", maxpagesize.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetSavedFilterRequest(string filterName, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendPath("/savedFilters/", false); + uri.AppendPath(filterName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCreateOrReplaceSavedFilterRequest(string filterName, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendPath("/savedFilters/", false); + uri.AppendPath(filterName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateDeleteSavedFilterRequest(string filterName, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendPath("/savedFilters/", false); + uri.AppendPath(filterName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetTasksRequest(string filter, string orderby, int? skip, int? maxpagesize, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendPath("/tasks", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("filter", filter, true); + } + if (orderby != null) + { + uri.AppendQuery("orderby", orderby, true); + } + if (skip != null) + { + uri.AppendQuery("skip", skip.Value, true); + } + if (maxpagesize != null) + { + uri.AppendQuery("maxpagesize", maxpagesize.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetTaskRequest(string taskId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendPath("/tasks/", false); + uri.AppendPath(taskId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCancelTaskRequest(string taskId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendPath("/tasks/", false); + uri.AppendPath(taskId, true); + uri.AppendPath(":cancel", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetAssetResourcesNextPageRequest(string nextLink, string filter, string orderby, int? skip, int? maxpagesize, string mark, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetDataConnectionsNextPageRequest(string nextLink, int? skip, int? maxpagesize, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetDiscoGroupsNextPageRequest(string nextLink, string filter, int? skip, int? maxpagesize, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetRunsNextPageRequest(string nextLink, string groupName, string filter, int? skip, int? maxpagesize, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetDiscoTemplatesNextPageRequest(string nextLink, string filter, int? skip, int? maxpagesize, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetSavedFiltersNextPageRequest(string nextLink, string filter, int? skip, int? maxpagesize, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetTasksNextPageRequest(string nextLink, string filter, string orderby, int? skip, int? maxpagesize, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/subscriptions/", false); + uri.AppendRaw(_subscriptionId, true); + uri.AppendRaw("/resourceGroups/", false); + uri.AppendRaw(_resourceGroupName, true); + uri.AppendRaw("/workspaces/", false); + uri.AppendRaw(_workspaceName, true); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + private static RequestContext DefaultRequestContext = new RequestContext(); + internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) + { + if (!cancellationToken.CanBeCanceled) + { + return DefaultRequestContext; + } + + return new RequestContext() { CancellationToken = cancellationToken }; + } + + private static ResponseClassifier _responseClassifier200; + private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + private static ResponseClassifier _responseClassifier204; + private static ResponseClassifier ResponseClassifier204 => _responseClassifier204 ??= new StatusCodeClassifier(stackalloc ushort[] { 204 }); + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/EasmClientOptions.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/EasmClientOptions.cs new file mode 100644 index 000000000000..e5ea46ee7b0b --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/EasmClientOptions.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// Client options for EasmClient. + public partial class EasmClientOptions : ClientOptions + { + private const ServiceVersion LatestVersion = ServiceVersion.V2023_03_01_Preview; + + /// The version of the service to use. + public enum ServiceVersion + { + /// Service version "2023-03-01-preview". + V2023_03_01_Preview = 1, + } + + internal string Version { get; } + + /// Initializes new instance of EasmClientOptions. + public EasmClientOptions(ServiceVersion version = LatestVersion) + { + Version = version switch + { + ServiceVersion.V2023_03_01_Preview => "2023-03-01-preview", + _ => throw new NotSupportedException() + }; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ErrorDetail.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ErrorDetail.Serialization.cs new file mode 100644 index 000000000000..ac32a7de55d4 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ErrorDetail.Serialization.cs @@ -0,0 +1,80 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class ErrorDetail + { + internal static ErrorDetail DeserializeErrorDetail(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string code = default; + string message = default; + Optional target = default; + Optional> details = default; + Optional innererror = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("code"u8)) + { + code = property.Value.GetString(); + continue; + } + if (property.NameEquals("message"u8)) + { + message = property.Value.GetString(); + continue; + } + if (property.NameEquals("target"u8)) + { + target = property.Value.GetString(); + continue; + } + if (property.NameEquals("details"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeserializeErrorDetail(item)); + } + details = array; + continue; + } + if (property.NameEquals("innererror"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + innererror = InnerError.DeserializeInnerError(property.Value); + continue; + } + } + return new ErrorDetail(code, message, target.Value, Optional.ToList(details), innererror.Value); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ErrorDetail FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeErrorDetail(document.RootElement); + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ErrorDetail.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ErrorDetail.cs new file mode 100644 index 000000000000..bc7ac762ab6f --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ErrorDetail.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// This is the top-level error object whose code matches the x-ms-error-code response header. + public partial class ErrorDetail + { + /// Initializes a new instance of ErrorDetail. + /// This is one of a server-defined set of error codes. + /// This is a human-readable representation of the error. + /// or is null. + internal ErrorDetail(string code, string message) + { + Argument.AssertNotNull(code, nameof(code)); + Argument.AssertNotNull(message, nameof(message)); + + Code = code; + Message = message; + Details = new ChangeTrackingList(); + } + + /// Initializes a new instance of ErrorDetail. + /// This is one of a server-defined set of error codes. + /// This is a human-readable representation of the error. + /// This is the error target. + /// This is an array of details about specific errors that led to this reported error. + /// This is an object containing more specific information than the current object about the error. + internal ErrorDetail(string code, string message, string target, IReadOnlyList details, InnerError innererror) + { + Code = code; + Message = message; + Target = target; + Details = details; + Innererror = innererror; + } + + /// This is one of a server-defined set of error codes. + public string Code { get; } + /// This is a human-readable representation of the error. + public string Message { get; } + /// This is the error target. + public string Target { get; } + /// This is an array of details about specific errors that led to this reported error. + public IReadOnlyList Details { get; } + /// This is an object containing more specific information than the current object about the error. + public InnerError Innererror { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/GuidPair.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/GuidPair.Serialization.cs new file mode 100644 index 000000000000..f8b7b4b31e82 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/GuidPair.Serialization.cs @@ -0,0 +1,103 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class GuidPair : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(PageGuid)) + { + writer.WritePropertyName("pageGuid"u8); + writer.WriteStringValue(PageGuid); + } + if (Optional.IsDefined(CrawlStateGuid)) + { + writer.WritePropertyName("crawlStateGuid"u8); + writer.WriteStringValue(CrawlStateGuid); + } + if (Optional.IsDefined(LoadDate)) + { + writer.WritePropertyName("loadDate"u8); + writer.WriteStringValue(LoadDate.Value, "O"); + } + if (Optional.IsDefined(Recent)) + { + writer.WritePropertyName("recent"u8); + writer.WriteBooleanValue(Recent.Value); + } + writer.WriteEndObject(); + } + + internal static GuidPair DeserializeGuidPair(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional pageGuid = default; + Optional crawlStateGuid = default; + Optional loadDate = default; + Optional recent = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("pageGuid"u8)) + { + pageGuid = property.Value.GetString(); + continue; + } + if (property.NameEquals("crawlStateGuid"u8)) + { + crawlStateGuid = property.Value.GetString(); + continue; + } + if (property.NameEquals("loadDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loadDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("recent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + recent = property.Value.GetBoolean(); + continue; + } + } + return new GuidPair(pageGuid.Value, crawlStateGuid.Value, Optional.ToNullable(loadDate), Optional.ToNullable(recent)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static GuidPair FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeGuidPair(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/GuidPair.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/GuidPair.cs new file mode 100644 index 000000000000..456379ca4cdc --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/GuidPair.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Analytics.Defender.Easm +{ + /// The GuidPair. + public partial class GuidPair + { + /// Initializes a new instance of GuidPair. + public GuidPair() + { + } + + /// Initializes a new instance of GuidPair. + /// + /// + /// + /// + internal GuidPair(string pageGuid, string crawlStateGuid, DateTimeOffset? loadDate, bool? recent) + { + PageGuid = pageGuid; + CrawlStateGuid = crawlStateGuid; + LoadDate = loadDate; + Recent = recent; + } + + /// Gets or sets the page guid. + public string PageGuid { get; set; } + /// Gets or sets the crawl state guid. + public string CrawlStateGuid { get; set; } + /// Gets or sets the load date. + public DateTimeOffset? LoadDate { get; set; } + /// Gets or sets the recent. + public bool? Recent { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/HostAsset.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/HostAsset.Serialization.cs new file mode 100644 index 000000000000..b7cfef288dee --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/HostAsset.Serialization.cs @@ -0,0 +1,799 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class HostAsset : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Host)) + { + writer.WritePropertyName("host"u8); + writer.WriteStringValue(Host); + } + if (Optional.IsDefined(Domain)) + { + writer.WritePropertyName("domain"u8); + writer.WriteStringValue(Domain); + } + if (Optional.IsCollectionDefined(IpAddresses)) + { + writer.WritePropertyName("ipAddresses"u8); + writer.WriteStartArray(); + foreach (var item in IpAddresses) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(WebComponents)) + { + writer.WritePropertyName("webComponents"u8); + writer.WriteStartArray(); + foreach (var item in WebComponents) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Headers)) + { + writer.WritePropertyName("headers"u8); + writer.WriteStartArray(); + foreach (var item in Headers) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Attributes)) + { + writer.WritePropertyName("attributes"u8); + writer.WriteStartArray(); + foreach (var item in Attributes) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Cookies)) + { + writer.WritePropertyName("cookies"u8); + writer.WriteStartArray(); + foreach (var item in Cookies) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(SslCerts)) + { + writer.WritePropertyName("sslCerts"u8); + writer.WriteStartArray(); + foreach (var item in SslCerts) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ParentHosts)) + { + writer.WritePropertyName("parentHosts"u8); + writer.WriteStartArray(); + foreach (var item in ParentHosts) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ChildHosts)) + { + writer.WritePropertyName("childHosts"u8); + writer.WriteStartArray(); + foreach (var item in ChildHosts) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(HostCore)) + { + writer.WritePropertyName("hostCore"u8); + writer.WriteObjectValue(HostCore); + } + if (Optional.IsCollectionDefined(Services)) + { + writer.WritePropertyName("services"u8); + writer.WriteStartArray(); + foreach (var item in Services) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Cnames)) + { + writer.WritePropertyName("cnames"u8); + writer.WriteStartArray(); + foreach (var item in Cnames) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Sources)) + { + writer.WritePropertyName("sources"u8); + writer.WriteStartArray(); + foreach (var item in Sources) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsCollectionDefined(ResourceUrls)) + { + writer.WritePropertyName("resourceUrls"u8); + writer.WriteStartArray(); + foreach (var item in ResourceUrls) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ScanMetadata)) + { + writer.WritePropertyName("scanMetadata"u8); + writer.WriteStartArray(); + foreach (var item in ScanMetadata) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Asns)) + { + writer.WritePropertyName("asns"u8); + writer.WriteStartArray(); + foreach (var item in Asns) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(IpBlocks)) + { + writer.WritePropertyName("ipBlocks"u8); + writer.WriteStartArray(); + foreach (var item in IpBlocks) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ResponseBodies)) + { + writer.WritePropertyName("responseBodies"u8); + writer.WriteStartArray(); + foreach (var item in ResponseBodies) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(DomainAsset)) + { + writer.WritePropertyName("domainAsset"u8); + writer.WriteObjectValue(DomainAsset); + } + if (Optional.IsCollectionDefined(NsRecord)) + { + writer.WritePropertyName("nsRecord"u8); + writer.WriteStartArray(); + foreach (var item in NsRecord) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(MxRecord)) + { + writer.WritePropertyName("mxRecord"u8); + writer.WriteStartArray(); + foreach (var item in MxRecord) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Webserver)) + { + writer.WritePropertyName("webserver"u8); + writer.WriteStartArray(); + foreach (var item in Webserver) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStartArray(); + foreach (var item in Location) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Nxdomain)) + { + writer.WritePropertyName("nxdomain"u8); + writer.WriteStartArray(); + foreach (var item in Nxdomain) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(SslServerConfig)) + { + writer.WritePropertyName("sslServerConfig"u8); + writer.WriteStartArray(); + foreach (var item in SslServerConfig) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(IsWildcard)) + { + writer.WritePropertyName("isWildcard"u8); + writer.WriteStartArray(); + foreach (var item in IsWildcard) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Banners)) + { + writer.WritePropertyName("banners"u8); + writer.WriteStartArray(); + foreach (var item in Banners) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Ipv4)) + { + writer.WritePropertyName("ipv4"u8); + writer.WriteStartArray(); + foreach (var item in Ipv4) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Ipv6)) + { + writer.WritePropertyName("ipv6"u8); + writer.WriteStartArray(); + foreach (var item in Ipv6) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static HostAsset DeserializeHostAsset(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional host = default; + Optional domain = default; + Optional> ipAddresses = default; + Optional> webComponents = default; + Optional> headers = default; + Optional> attributes = default; + Optional> cookies = default; + Optional> sslCerts = default; + Optional> parentHosts = default; + Optional> childHosts = default; + Optional hostCore = default; + Optional> services = default; + Optional> cnames = default; + Optional> sources = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional count = default; + Optional> resourceUrls = default; + Optional> scanMetadata = default; + Optional> asns = default; + Optional> ipBlocks = default; + Optional> responseBodies = default; + Optional domainAsset = default; + Optional> nsRecord = default; + Optional> mxRecord = default; + Optional> webserver = default; + Optional> location = default; + Optional> nxdomain = default; + Optional> sslServerConfig = default; + Optional> isWildcard = default; + Optional> banners = default; + Optional> ipv4 = default; + Optional> ipv6 = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("host"u8)) + { + host = property.Value.GetString(); + continue; + } + if (property.NameEquals("domain"u8)) + { + domain = property.Value.GetString(); + continue; + } + if (property.NameEquals("ipAddresses"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + ipAddresses = array; + continue; + } + if (property.NameEquals("webComponents"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(WebComponent.DeserializeWebComponent(item)); + } + webComponents = array; + continue; + } + if (property.NameEquals("headers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedHeader.DeserializeObservedHeader(item)); + } + headers = array; + continue; + } + if (property.NameEquals("attributes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Attribute.DeserializeAttribute(item)); + } + attributes = array; + continue; + } + if (property.NameEquals("cookies"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Cookie.DeserializeCookie(item)); + } + cookies = array; + continue; + } + if (property.NameEquals("sslCerts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SslCertAsset.DeserializeSslCertAsset(item)); + } + sslCerts = array; + continue; + } + if (property.NameEquals("parentHosts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + parentHosts = array; + continue; + } + if (property.NameEquals("childHosts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + childHosts = array; + continue; + } + if (property.NameEquals("hostCore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hostCore = HostCore.DeserializeHostCore(property.Value); + continue; + } + if (property.NameEquals("services"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Service.DeserializeService(item)); + } + services = array; + continue; + } + if (property.NameEquals("cnames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + cnames = array; + continue; + } + if (property.NameEquals("sources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Source.DeserializeSource(item)); + } + sources = array; + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("resourceUrls"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ResourceUrl.DeserializeResourceUrl(item)); + } + resourceUrls = array; + continue; + } + if (property.NameEquals("scanMetadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Easm.ScanMetadata.DeserializeScanMetadata(item)); + } + scanMetadata = array; + continue; + } + if (property.NameEquals("asns"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedLong.DeserializeObservedLong(item)); + } + asns = array; + continue; + } + if (property.NameEquals("ipBlocks"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(IpBlock.DeserializeIpBlock(item)); + } + ipBlocks = array; + continue; + } + if (property.NameEquals("responseBodies"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + responseBodies = array; + continue; + } + if (property.NameEquals("domainAsset"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + domainAsset = DomainAsset.DeserializeDomainAsset(property.Value); + continue; + } + if (property.NameEquals("nsRecord"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedBoolean.DeserializeObservedBoolean(item)); + } + nsRecord = array; + continue; + } + if (property.NameEquals("mxRecord"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedBoolean.DeserializeObservedBoolean(item)); + } + mxRecord = array; + continue; + } + if (property.NameEquals("webserver"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedBoolean.DeserializeObservedBoolean(item)); + } + webserver = array; + continue; + } + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedLocation.DeserializeObservedLocation(item)); + } + location = array; + continue; + } + if (property.NameEquals("nxdomain"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedBoolean.DeserializeObservedBoolean(item)); + } + nxdomain = array; + continue; + } + if (property.NameEquals("sslServerConfig"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Easm.SslServerConfig.DeserializeSslServerConfig(item)); + } + sslServerConfig = array; + continue; + } + if (property.NameEquals("isWildcard"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedBoolean.DeserializeObservedBoolean(item)); + } + isWildcard = array; + continue; + } + if (property.NameEquals("banners"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Banner.DeserializeBanner(item)); + } + banners = array; + continue; + } + if (property.NameEquals("ipv4"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedBoolean.DeserializeObservedBoolean(item)); + } + ipv4 = array; + continue; + } + if (property.NameEquals("ipv6"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedBoolean.DeserializeObservedBoolean(item)); + } + ipv6 = array; + continue; + } + } + return new HostAsset(host.Value, domain.Value, Optional.ToList(ipAddresses), Optional.ToList(webComponents), Optional.ToList(headers), Optional.ToList(attributes), Optional.ToList(cookies), Optional.ToList(sslCerts), Optional.ToList(parentHosts), Optional.ToList(childHosts), hostCore.Value, Optional.ToList(services), Optional.ToList(cnames), Optional.ToList(sources), Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(count), Optional.ToList(resourceUrls), Optional.ToList(scanMetadata), Optional.ToList(asns), Optional.ToList(ipBlocks), Optional.ToList(responseBodies), domainAsset.Value, Optional.ToList(nsRecord), Optional.ToList(mxRecord), Optional.ToList(webserver), Optional.ToList(location), Optional.ToList(nxdomain), Optional.ToList(sslServerConfig), Optional.ToList(isWildcard), Optional.ToList(banners), Optional.ToList(ipv4), Optional.ToList(ipv6)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static HostAsset FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeHostAsset(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/HostAsset.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/HostAsset.cs new file mode 100644 index 000000000000..4a2ad9ba9e78 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/HostAsset.cs @@ -0,0 +1,186 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The HostAsset. + public partial class HostAsset : InventoryAsset + { + /// Initializes a new instance of HostAsset. + public HostAsset() + { + IpAddresses = new ChangeTrackingList(); + WebComponents = new ChangeTrackingList(); + Headers = new ChangeTrackingList(); + Attributes = new ChangeTrackingList(); + Cookies = new ChangeTrackingList(); + SslCerts = new ChangeTrackingList(); + ParentHosts = new ChangeTrackingList(); + ChildHosts = new ChangeTrackingList(); + Services = new ChangeTrackingList(); + Cnames = new ChangeTrackingList(); + Sources = new ChangeTrackingList(); + ResourceUrls = new ChangeTrackingList(); + ScanMetadata = new ChangeTrackingList(); + Asns = new ChangeTrackingList(); + IpBlocks = new ChangeTrackingList(); + ResponseBodies = new ChangeTrackingList(); + NsRecord = new ChangeTrackingList(); + MxRecord = new ChangeTrackingList(); + Webserver = new ChangeTrackingList(); + Location = new ChangeTrackingList(); + Nxdomain = new ChangeTrackingList(); + SslServerConfig = new ChangeTrackingList(); + IsWildcard = new ChangeTrackingList(); + Banners = new ChangeTrackingList(); + Ipv4 = new ChangeTrackingList(); + Ipv6 = new ChangeTrackingList(); + } + + /// Initializes a new instance of HostAsset. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + internal HostAsset(string host, string domain, IList ipAddresses, IList webComponents, IList headers, IList attributes, IList cookies, IList sslCerts, IList parentHosts, IList childHosts, HostCore hostCore, IList services, IList cnames, IList sources, DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count, IList resourceUrls, IList scanMetadata, IList asns, IList ipBlocks, IList responseBodies, DomainAsset domainAsset, IList nsRecord, IList mxRecord, IList webserver, IList location, IList nxdomain, IList sslServerConfig, IList isWildcard, IList banners, IList ipv4, IList ipv6) + { + Host = host; + Domain = domain; + IpAddresses = ipAddresses; + WebComponents = webComponents; + Headers = headers; + Attributes = attributes; + Cookies = cookies; + SslCerts = sslCerts; + ParentHosts = parentHosts; + ChildHosts = childHosts; + HostCore = hostCore; + Services = services; + Cnames = cnames; + Sources = sources; + FirstSeen = firstSeen; + LastSeen = lastSeen; + Count = count; + ResourceUrls = resourceUrls; + ScanMetadata = scanMetadata; + Asns = asns; + IpBlocks = ipBlocks; + ResponseBodies = responseBodies; + DomainAsset = domainAsset; + NsRecord = nsRecord; + MxRecord = mxRecord; + Webserver = webserver; + Location = location; + Nxdomain = nxdomain; + SslServerConfig = sslServerConfig; + IsWildcard = isWildcard; + Banners = banners; + Ipv4 = ipv4; + Ipv6 = ipv6; + } + + /// Gets or sets the host. + public string Host { get; set; } + /// Gets or sets the domain. + public string Domain { get; set; } + /// Gets the ip addresses. + public IList IpAddresses { get; } + /// Gets the web components. + public IList WebComponents { get; } + /// Gets the headers. + public IList Headers { get; } + /// Gets the attributes. + public IList Attributes { get; } + /// Gets the cookies. + public IList Cookies { get; } + /// Gets the ssl certs. + public IList SslCerts { get; } + /// Gets the parent hosts. + public IList ParentHosts { get; } + /// Gets the child hosts. + public IList ChildHosts { get; } + /// Gets or sets the host core. + public HostCore HostCore { get; set; } + /// Gets the services. + public IList Services { get; } + /// Gets the cnames. + public IList Cnames { get; } + /// Gets the sources. + public IList Sources { get; } + /// Gets or sets the first seen. + public DateTimeOffset? FirstSeen { get; set; } + /// Gets or sets the last seen. + public DateTimeOffset? LastSeen { get; set; } + /// Gets or sets the count. + public long? Count { get; set; } + /// Gets the resource urls. + public IList ResourceUrls { get; } + /// Gets the scan metadata. + public IList ScanMetadata { get; } + /// Gets the asns. + public IList Asns { get; } + /// Gets the ip blocks. + public IList IpBlocks { get; } + /// Gets the response bodies. + public IList ResponseBodies { get; } + /// Gets or sets the domain asset. + public DomainAsset DomainAsset { get; set; } + /// Gets the ns record. + public IList NsRecord { get; } + /// Gets the mx record. + public IList MxRecord { get; } + /// Gets the webserver. + public IList Webserver { get; } + /// Gets the location. + public IList Location { get; } + /// Gets the nxdomain. + public IList Nxdomain { get; } + /// Gets the ssl server config. + public IList SslServerConfig { get; } + /// Gets the is wildcard. + public IList IsWildcard { get; } + /// Gets the banners. + public IList Banners { get; } + /// Gets the ipv 4. + public IList Ipv4 { get; } + /// Gets the ipv 6. + public IList Ipv6 { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/HostAssetResource.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/HostAssetResource.Serialization.cs new file mode 100644 index 000000000000..635411728fc1 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/HostAssetResource.Serialization.cs @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class HostAssetResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("asset"u8); + writer.WriteObjectValue(Asset); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Uuid)) + { + writer.WritePropertyName("uuid"u8); + writer.WriteStringValue(Uuid.Value); + } + if (Optional.IsDefined(CreatedDate)) + { + writer.WritePropertyName("createdDate"u8); + writer.WriteStringValue(CreatedDate.Value, "O"); + } + if (Optional.IsDefined(UpdatedDate)) + { + writer.WritePropertyName("updatedDate"u8); + writer.WriteStringValue(UpdatedDate.Value, "O"); + } + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"u8); + writer.WriteStringValue(State.Value.ToString()); + } + if (Optional.IsDefined(ExternalId)) + { + writer.WritePropertyName("externalId"u8); + writer.WriteStringValue(ExternalId); + } + if (Optional.IsCollectionDefined(Labels)) + { + writer.WritePropertyName("labels"u8); + writer.WriteStartArray(); + foreach (var item in Labels) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Wildcard)) + { + writer.WritePropertyName("wildcard"u8); + writer.WriteBooleanValue(Wildcard.Value); + } + if (Optional.IsDefined(DiscoGroupName)) + { + writer.WritePropertyName("discoGroupName"u8); + writer.WriteStringValue(DiscoGroupName); + } + if (Optional.IsCollectionDefined(AuditTrail)) + { + writer.WritePropertyName("auditTrail"u8); + writer.WriteStartArray(); + foreach (var item in AuditTrail) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Reason)) + { + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason); + } + writer.WriteEndObject(); + } + + internal static HostAssetResource DeserializeHostAssetResource(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + HostAsset asset = default; + string kind = default; + string id = default; + Optional name = default; + Optional displayName = default; + Optional uuid = default; + Optional createdDate = default; + Optional updatedDate = default; + Optional state = default; + Optional externalId = default; + Optional> labels = default; + Optional wildcard = default; + Optional discoGroupName = default; + Optional> auditTrail = default; + Optional reason = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("asset"u8)) + { + asset = HostAsset.DeserializeHostAsset(property.Value); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("uuid"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + uuid = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("createdDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("updatedDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + updatedDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("state"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = new AssetState(property.Value.GetString()); + continue; + } + if (property.NameEquals("externalId"u8)) + { + externalId = property.Value.GetString(); + continue; + } + if (property.NameEquals("labels"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + labels = array; + continue; + } + if (property.NameEquals("wildcard"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + wildcard = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("discoGroupName"u8)) + { + discoGroupName = property.Value.GetString(); + continue; + } + if (property.NameEquals("auditTrail"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AuditTrailItem.DeserializeAuditTrailItem(item)); + } + auditTrail = array; + continue; + } + if (property.NameEquals("reason"u8)) + { + reason = property.Value.GetString(); + continue; + } + } + return new HostAssetResource(kind, id, name.Value, displayName.Value, Optional.ToNullable(uuid), Optional.ToNullable(createdDate), Optional.ToNullable(updatedDate), Optional.ToNullable(state), externalId.Value, Optional.ToList(labels), Optional.ToNullable(wildcard), discoGroupName.Value, Optional.ToList(auditTrail), reason.Value, asset); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new HostAssetResource FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeHostAssetResource(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/HostAssetResource.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/HostAssetResource.cs new file mode 100644 index 000000000000..0ea077d79651 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/HostAssetResource.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The HostAssetResource. + public partial class HostAssetResource : AssetResource + { + /// Initializes a new instance of HostAssetResource. + /// asset. + /// is null. + public HostAssetResource(HostAsset asset) + { + Argument.AssertNotNull(asset, nameof(asset)); + + Kind = "host"; + Asset = asset; + } + + /// Initializes a new instance of HostAssetResource. + /// Discriminator. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// Global UUID for the asset. + /// The date this asset was first added to this workspace. + /// The date this asset was last updated for this workspace. + /// + /// An optional customer provided identifier for this asset. + /// Customer labels assigned to this asset. + /// An indicator of whether this asset represents a wildcard rollup of assets on this domain. + /// The name of the DiscoGroup that brought added this asset to the workspace. + /// The history of how this asset was pulled into the workspace through the discovery process. + /// + /// asset. + internal HostAssetResource(string kind, string id, string name, string displayName, Guid? uuid, DateTimeOffset? createdDate, DateTimeOffset? updatedDate, AssetState? state, string externalId, IList labels, bool? wildcard, string discoGroupName, IList auditTrail, string reason, HostAsset asset) : base(kind, id, name, displayName, uuid, createdDate, updatedDate, state, externalId, labels, wildcard, discoGroupName, auditTrail, reason) + { + Asset = asset; + } + + /// asset. + public HostAsset Asset { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/HostCore.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/HostCore.Serialization.cs new file mode 100644 index 000000000000..3d5363b864f2 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/HostCore.Serialization.cs @@ -0,0 +1,609 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class HostCore : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Host)) + { + writer.WritePropertyName("host"u8); + writer.WriteStringValue(Host); + } + if (Optional.IsDefined(Domain)) + { + writer.WritePropertyName("domain"u8); + writer.WriteStringValue(Domain); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(BlacklistCauseFirstSeen)) + { + writer.WritePropertyName("blacklistCauseFirstSeen"u8); + writer.WriteStringValue(BlacklistCauseFirstSeen.Value, "O"); + } + if (Optional.IsDefined(BlacklistCauseLastSeen)) + { + writer.WritePropertyName("blacklistCauseLastSeen"u8); + writer.WriteStringValue(BlacklistCauseLastSeen.Value, "O"); + } + if (Optional.IsDefined(BlacklistCauseCount)) + { + writer.WritePropertyName("blacklistCauseCount"u8); + writer.WriteNumberValue(BlacklistCauseCount.Value); + } + if (Optional.IsDefined(BlacklistResourceFirstSeen)) + { + writer.WritePropertyName("blacklistResourceFirstSeen"u8); + writer.WriteStringValue(BlacklistResourceFirstSeen.Value, "O"); + } + if (Optional.IsDefined(BlacklistResourceLastSeen)) + { + writer.WritePropertyName("blacklistResourceLastSeen"u8); + writer.WriteStringValue(BlacklistResourceLastSeen.Value, "O"); + } + if (Optional.IsDefined(BlacklistResourceCount)) + { + writer.WritePropertyName("blacklistResourceCount"u8); + writer.WriteNumberValue(BlacklistResourceCount.Value); + } + if (Optional.IsDefined(BlacklistSequenceFirstSeen)) + { + writer.WritePropertyName("blacklistSequenceFirstSeen"u8); + writer.WriteStringValue(BlacklistSequenceFirstSeen.Value, "O"); + } + if (Optional.IsDefined(BlacklistSequenceLastSeen)) + { + writer.WritePropertyName("blacklistSequenceLastSeen"u8); + writer.WriteStringValue(BlacklistSequenceLastSeen.Value, "O"); + } + if (Optional.IsDefined(BlacklistSequenceCount)) + { + writer.WritePropertyName("blacklistSequenceCount"u8); + writer.WriteNumberValue(BlacklistSequenceCount.Value); + } + if (Optional.IsDefined(PhishCauseCount)) + { + writer.WritePropertyName("phishCauseCount"u8); + writer.WriteNumberValue(PhishCauseCount.Value); + } + if (Optional.IsDefined(MalwareCauseCount)) + { + writer.WritePropertyName("malwareCauseCount"u8); + writer.WriteNumberValue(MalwareCauseCount.Value); + } + if (Optional.IsDefined(SpamCauseCount)) + { + writer.WritePropertyName("spamCauseCount"u8); + writer.WriteNumberValue(SpamCauseCount.Value); + } + if (Optional.IsDefined(ScamCauseCount)) + { + writer.WritePropertyName("scamCauseCount"u8); + writer.WriteNumberValue(ScamCauseCount.Value); + } + if (Optional.IsDefined(PhishResourceCount)) + { + writer.WritePropertyName("phishResourceCount"u8); + writer.WriteNumberValue(PhishResourceCount.Value); + } + if (Optional.IsDefined(MalwareResourceCount)) + { + writer.WritePropertyName("malwareResourceCount"u8); + writer.WriteNumberValue(MalwareResourceCount.Value); + } + if (Optional.IsDefined(SpamResourceCount)) + { + writer.WritePropertyName("spamResourceCount"u8); + writer.WriteNumberValue(SpamResourceCount.Value); + } + if (Optional.IsDefined(ScamResourceCount)) + { + writer.WritePropertyName("scamResourceCount"u8); + writer.WriteNumberValue(ScamResourceCount.Value); + } + if (Optional.IsDefined(PhishSequenceCount)) + { + writer.WritePropertyName("phishSequenceCount"u8); + writer.WriteNumberValue(PhishSequenceCount.Value); + } + if (Optional.IsDefined(MalwareSequenceCount)) + { + writer.WritePropertyName("malwareSequenceCount"u8); + writer.WriteNumberValue(MalwareSequenceCount.Value); + } + if (Optional.IsDefined(SpamSequenceCount)) + { + writer.WritePropertyName("spamSequenceCount"u8); + writer.WriteNumberValue(SpamSequenceCount.Value); + } + if (Optional.IsDefined(ScamSequenceCount)) + { + writer.WritePropertyName("scamSequenceCount"u8); + writer.WriteNumberValue(ScamSequenceCount.Value); + } + if (Optional.IsDefined(AlexaRank)) + { + writer.WritePropertyName("alexaRank"u8); + writer.WriteNumberValue(AlexaRank.Value); + } + if (Optional.IsDefined(HostReputationScore)) + { + writer.WritePropertyName("hostReputationScore"u8); + writer.WriteNumberValue(HostReputationScore.Value); + } + if (Optional.IsDefined(HostPhishReputationScore)) + { + writer.WritePropertyName("hostPhishReputationScore"u8); + writer.WriteNumberValue(HostPhishReputationScore.Value); + } + if (Optional.IsDefined(HostMalwareReputationScore)) + { + writer.WritePropertyName("hostMalwareReputationScore"u8); + writer.WriteNumberValue(HostMalwareReputationScore.Value); + } + if (Optional.IsDefined(HostSpamReputationScore)) + { + writer.WritePropertyName("hostSpamReputationScore"u8); + writer.WriteNumberValue(HostSpamReputationScore.Value); + } + if (Optional.IsDefined(HostScamReputationScore)) + { + writer.WritePropertyName("hostScamReputationScore"u8); + writer.WriteNumberValue(HostScamReputationScore.Value); + } + if (Optional.IsDefined(DomainReputationScore)) + { + writer.WritePropertyName("domainReputationScore"u8); + writer.WriteNumberValue(DomainReputationScore.Value); + } + if (Optional.IsDefined(DomainPhishReputationScore)) + { + writer.WritePropertyName("domainPhishReputationScore"u8); + writer.WriteNumberValue(DomainPhishReputationScore.Value); + } + if (Optional.IsDefined(DomainMalwareReputationScore)) + { + writer.WritePropertyName("domainMalwareReputationScore"u8); + writer.WriteNumberValue(DomainMalwareReputationScore.Value); + } + if (Optional.IsDefined(DomainSpamReputationScore)) + { + writer.WritePropertyName("domainSpamReputationScore"u8); + writer.WriteNumberValue(DomainSpamReputationScore.Value); + } + if (Optional.IsDefined(DomainScamReputationScore)) + { + writer.WritePropertyName("domainScamReputationScore"u8); + writer.WriteNumberValue(DomainScamReputationScore.Value); + } + if (Optional.IsDefined(Uuid)) + { + writer.WritePropertyName("uuid"u8); + writer.WriteStringValue(Uuid); + } + writer.WriteEndObject(); + } + + internal static HostCore DeserializeHostCore(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional host = default; + Optional domain = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional count = default; + Optional blacklistCauseFirstSeen = default; + Optional blacklistCauseLastSeen = default; + Optional blacklistCauseCount = default; + Optional blacklistResourceFirstSeen = default; + Optional blacklistResourceLastSeen = default; + Optional blacklistResourceCount = default; + Optional blacklistSequenceFirstSeen = default; + Optional blacklistSequenceLastSeen = default; + Optional blacklistSequenceCount = default; + Optional phishCauseCount = default; + Optional malwareCauseCount = default; + Optional spamCauseCount = default; + Optional scamCauseCount = default; + Optional phishResourceCount = default; + Optional malwareResourceCount = default; + Optional spamResourceCount = default; + Optional scamResourceCount = default; + Optional phishSequenceCount = default; + Optional malwareSequenceCount = default; + Optional spamSequenceCount = default; + Optional scamSequenceCount = default; + Optional alexaRank = default; + Optional hostReputationScore = default; + Optional hostPhishReputationScore = default; + Optional hostMalwareReputationScore = default; + Optional hostSpamReputationScore = default; + Optional hostScamReputationScore = default; + Optional domainReputationScore = default; + Optional domainPhishReputationScore = default; + Optional domainMalwareReputationScore = default; + Optional domainSpamReputationScore = default; + Optional domainScamReputationScore = default; + Optional uuid = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("host"u8)) + { + host = property.Value.GetString(); + continue; + } + if (property.NameEquals("domain"u8)) + { + domain = property.Value.GetString(); + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("blacklistCauseFirstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + blacklistCauseFirstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("blacklistCauseLastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + blacklistCauseLastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("blacklistCauseCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + blacklistCauseCount = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("blacklistResourceFirstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + blacklistResourceFirstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("blacklistResourceLastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + blacklistResourceLastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("blacklistResourceCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + blacklistResourceCount = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("blacklistSequenceFirstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + blacklistSequenceFirstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("blacklistSequenceLastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + blacklistSequenceLastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("blacklistSequenceCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + blacklistSequenceCount = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("phishCauseCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + phishCauseCount = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("malwareCauseCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + malwareCauseCount = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("spamCauseCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + spamCauseCount = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("scamCauseCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scamCauseCount = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("phishResourceCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + phishResourceCount = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("malwareResourceCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + malwareResourceCount = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("spamResourceCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + spamResourceCount = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("scamResourceCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scamResourceCount = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("phishSequenceCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + phishSequenceCount = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("malwareSequenceCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + malwareSequenceCount = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("spamSequenceCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + spamSequenceCount = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("scamSequenceCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + scamSequenceCount = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("alexaRank"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + alexaRank = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("hostReputationScore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hostReputationScore = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("hostPhishReputationScore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hostPhishReputationScore = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("hostMalwareReputationScore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hostMalwareReputationScore = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("hostSpamReputationScore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hostSpamReputationScore = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("hostScamReputationScore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + hostScamReputationScore = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("domainReputationScore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + domainReputationScore = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("domainPhishReputationScore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + domainPhishReputationScore = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("domainMalwareReputationScore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + domainMalwareReputationScore = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("domainSpamReputationScore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + domainSpamReputationScore = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("domainScamReputationScore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + domainScamReputationScore = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("uuid"u8)) + { + uuid = property.Value.GetString(); + continue; + } + } + return new HostCore(host.Value, domain.Value, Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(count), Optional.ToNullable(blacklistCauseFirstSeen), Optional.ToNullable(blacklistCauseLastSeen), Optional.ToNullable(blacklistCauseCount), Optional.ToNullable(blacklistResourceFirstSeen), Optional.ToNullable(blacklistResourceLastSeen), Optional.ToNullable(blacklistResourceCount), Optional.ToNullable(blacklistSequenceFirstSeen), Optional.ToNullable(blacklistSequenceLastSeen), Optional.ToNullable(blacklistSequenceCount), Optional.ToNullable(phishCauseCount), Optional.ToNullable(malwareCauseCount), Optional.ToNullable(spamCauseCount), Optional.ToNullable(scamCauseCount), Optional.ToNullable(phishResourceCount), Optional.ToNullable(malwareResourceCount), Optional.ToNullable(spamResourceCount), Optional.ToNullable(scamResourceCount), Optional.ToNullable(phishSequenceCount), Optional.ToNullable(malwareSequenceCount), Optional.ToNullable(spamSequenceCount), Optional.ToNullable(scamSequenceCount), Optional.ToNullable(alexaRank), Optional.ToNullable(hostReputationScore), Optional.ToNullable(hostPhishReputationScore), Optional.ToNullable(hostMalwareReputationScore), Optional.ToNullable(hostSpamReputationScore), Optional.ToNullable(hostScamReputationScore), Optional.ToNullable(domainReputationScore), Optional.ToNullable(domainPhishReputationScore), Optional.ToNullable(domainMalwareReputationScore), Optional.ToNullable(domainSpamReputationScore), Optional.ToNullable(domainScamReputationScore), uuid.Value); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static HostCore FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeHostCore(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/HostCore.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/HostCore.cs new file mode 100644 index 000000000000..405130b4787d --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/HostCore.cs @@ -0,0 +1,178 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Analytics.Defender.Easm +{ + /// The HostCore. + public partial class HostCore + { + /// Initializes a new instance of HostCore. + public HostCore() + { + } + + /// Initializes a new instance of HostCore. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + internal HostCore(string host, string domain, DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count, DateTimeOffset? blacklistCauseFirstSeen, DateTimeOffset? blacklistCauseLastSeen, long? blacklistCauseCount, DateTimeOffset? blacklistResourceFirstSeen, DateTimeOffset? blacklistResourceLastSeen, long? blacklistResourceCount, DateTimeOffset? blacklistSequenceFirstSeen, DateTimeOffset? blacklistSequenceLastSeen, long? blacklistSequenceCount, long? phishCauseCount, long? malwareCauseCount, long? spamCauseCount, long? scamCauseCount, long? phishResourceCount, long? malwareResourceCount, long? spamResourceCount, long? scamResourceCount, long? phishSequenceCount, long? malwareSequenceCount, long? spamSequenceCount, long? scamSequenceCount, int? alexaRank, int? hostReputationScore, int? hostPhishReputationScore, int? hostMalwareReputationScore, int? hostSpamReputationScore, int? hostScamReputationScore, int? domainReputationScore, int? domainPhishReputationScore, int? domainMalwareReputationScore, int? domainSpamReputationScore, int? domainScamReputationScore, string uuid) + { + Host = host; + Domain = domain; + FirstSeen = firstSeen; + LastSeen = lastSeen; + Count = count; + BlacklistCauseFirstSeen = blacklistCauseFirstSeen; + BlacklistCauseLastSeen = blacklistCauseLastSeen; + BlacklistCauseCount = blacklistCauseCount; + BlacklistResourceFirstSeen = blacklistResourceFirstSeen; + BlacklistResourceLastSeen = blacklistResourceLastSeen; + BlacklistResourceCount = blacklistResourceCount; + BlacklistSequenceFirstSeen = blacklistSequenceFirstSeen; + BlacklistSequenceLastSeen = blacklistSequenceLastSeen; + BlacklistSequenceCount = blacklistSequenceCount; + PhishCauseCount = phishCauseCount; + MalwareCauseCount = malwareCauseCount; + SpamCauseCount = spamCauseCount; + ScamCauseCount = scamCauseCount; + PhishResourceCount = phishResourceCount; + MalwareResourceCount = malwareResourceCount; + SpamResourceCount = spamResourceCount; + ScamResourceCount = scamResourceCount; + PhishSequenceCount = phishSequenceCount; + MalwareSequenceCount = malwareSequenceCount; + SpamSequenceCount = spamSequenceCount; + ScamSequenceCount = scamSequenceCount; + AlexaRank = alexaRank; + HostReputationScore = hostReputationScore; + HostPhishReputationScore = hostPhishReputationScore; + HostMalwareReputationScore = hostMalwareReputationScore; + HostSpamReputationScore = hostSpamReputationScore; + HostScamReputationScore = hostScamReputationScore; + DomainReputationScore = domainReputationScore; + DomainPhishReputationScore = domainPhishReputationScore; + DomainMalwareReputationScore = domainMalwareReputationScore; + DomainSpamReputationScore = domainSpamReputationScore; + DomainScamReputationScore = domainScamReputationScore; + Uuid = uuid; + } + + /// Gets or sets the host. + public string Host { get; set; } + /// Gets or sets the domain. + public string Domain { get; set; } + /// Gets or sets the first seen. + public DateTimeOffset? FirstSeen { get; set; } + /// Gets or sets the last seen. + public DateTimeOffset? LastSeen { get; set; } + /// Gets or sets the count. + public long? Count { get; set; } + /// Gets or sets the blacklist cause first seen. + public DateTimeOffset? BlacklistCauseFirstSeen { get; set; } + /// Gets or sets the blacklist cause last seen. + public DateTimeOffset? BlacklistCauseLastSeen { get; set; } + /// Gets or sets the blacklist cause count. + public long? BlacklistCauseCount { get; set; } + /// Gets or sets the blacklist resource first seen. + public DateTimeOffset? BlacklistResourceFirstSeen { get; set; } + /// Gets or sets the blacklist resource last seen. + public DateTimeOffset? BlacklistResourceLastSeen { get; set; } + /// Gets or sets the blacklist resource count. + public long? BlacklistResourceCount { get; set; } + /// Gets or sets the blacklist sequence first seen. + public DateTimeOffset? BlacklistSequenceFirstSeen { get; set; } + /// Gets or sets the blacklist sequence last seen. + public DateTimeOffset? BlacklistSequenceLastSeen { get; set; } + /// Gets or sets the blacklist sequence count. + public long? BlacklistSequenceCount { get; set; } + /// Gets or sets the phish cause count. + public long? PhishCauseCount { get; set; } + /// Gets or sets the malware cause count. + public long? MalwareCauseCount { get; set; } + /// Gets or sets the spam cause count. + public long? SpamCauseCount { get; set; } + /// Gets or sets the scam cause count. + public long? ScamCauseCount { get; set; } + /// Gets or sets the phish resource count. + public long? PhishResourceCount { get; set; } + /// Gets or sets the malware resource count. + public long? MalwareResourceCount { get; set; } + /// Gets or sets the spam resource count. + public long? SpamResourceCount { get; set; } + /// Gets or sets the scam resource count. + public long? ScamResourceCount { get; set; } + /// Gets or sets the phish sequence count. + public long? PhishSequenceCount { get; set; } + /// Gets or sets the malware sequence count. + public long? MalwareSequenceCount { get; set; } + /// Gets or sets the spam sequence count. + public long? SpamSequenceCount { get; set; } + /// Gets or sets the scam sequence count. + public long? ScamSequenceCount { get; set; } + /// Gets or sets the alexa rank. + public int? AlexaRank { get; set; } + /// Gets or sets the host reputation score. + public int? HostReputationScore { get; set; } + /// Gets or sets the host phish reputation score. + public int? HostPhishReputationScore { get; set; } + /// Gets or sets the host malware reputation score. + public int? HostMalwareReputationScore { get; set; } + /// Gets or sets the host spam reputation score. + public int? HostSpamReputationScore { get; set; } + /// Gets or sets the host scam reputation score. + public int? HostScamReputationScore { get; set; } + /// Gets or sets the domain reputation score. + public int? DomainReputationScore { get; set; } + /// Gets or sets the domain phish reputation score. + public int? DomainPhishReputationScore { get; set; } + /// Gets or sets the domain malware reputation score. + public int? DomainMalwareReputationScore { get; set; } + /// Gets or sets the domain spam reputation score. + public int? DomainSpamReputationScore { get; set; } + /// Gets or sets the domain scam reputation score. + public int? DomainScamReputationScore { get; set; } + /// Gets or sets the uuid. + public string Uuid { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/InnerError.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/InnerError.Serialization.cs new file mode 100644 index 000000000000..fca587c2356d --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/InnerError.Serialization.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class InnerError + { + internal static InnerError DeserializeInnerError(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional code = default; + Optional value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("code"u8)) + { + code = property.Value.GetString(); + continue; + } + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + value = BinaryData.FromString(property.Value.GetRawText()); + continue; + } + } + return new InnerError(code.Value, value.Value); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static InnerError FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeInnerError(document.RootElement); + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/InnerError.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/InnerError.cs new file mode 100644 index 000000000000..1079de258bc6 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/InnerError.cs @@ -0,0 +1,63 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Analytics.Defender.Easm +{ + /// This is an object containing more specific information than the current object about the error. + public partial class InnerError + { + /// Initializes a new instance of InnerError. + internal InnerError() + { + } + + /// Initializes a new instance of InnerError. + /// This is a more specific error code than was provided by the containing error. + /// This is an additional field representing the value that caused the error to help with debugging. + internal InnerError(string code, BinaryData value) + { + Code = code; + Value = value; + } + + /// This is a more specific error code than was provided by the containing error. + public string Code { get; } + /// + /// This is an additional field representing the value that caused the error to help with debugging. + /// + /// To assign an object to this property use . + /// + /// + /// To assign an already formated 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" }. + /// + /// + /// + /// + public BinaryData Value { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/InventoryAsset.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/InventoryAsset.cs new file mode 100644 index 000000000000..fb8ec92ac917 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/InventoryAsset.cs @@ -0,0 +1,18 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Analytics.Defender.Easm +{ + /// The InventoryAsset. + public partial class InventoryAsset + { + /// Initializes a new instance of InventoryAsset. + internal InventoryAsset() + { + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/IpAddressAsset.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/IpAddressAsset.Serialization.cs new file mode 100644 index 000000000000..8f19c388f165 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/IpAddressAsset.Serialization.cs @@ -0,0 +1,613 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class IpAddressAsset : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(IpAddress)) + { + writer.WritePropertyName("ipAddress"u8); + writer.WriteStringValue(IpAddress); + } + if (Optional.IsCollectionDefined(Asns)) + { + writer.WritePropertyName("asns"u8); + writer.WriteStartArray(); + foreach (var item in Asns) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Reputations)) + { + writer.WritePropertyName("reputations"u8); + writer.WriteStartArray(); + foreach (var item in Reputations) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(WebComponents)) + { + writer.WritePropertyName("webComponents"u8); + writer.WriteStartArray(); + foreach (var item in WebComponents) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(NetRanges)) + { + writer.WritePropertyName("netRanges"u8); + writer.WriteStartArray(); + foreach (var item in NetRanges) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Headers)) + { + writer.WritePropertyName("headers"u8); + writer.WriteStartArray(); + foreach (var item in Headers) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Attributes)) + { + writer.WritePropertyName("attributes"u8); + writer.WriteStartArray(); + foreach (var item in Attributes) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Cookies)) + { + writer.WritePropertyName("cookies"u8); + writer.WriteStartArray(); + foreach (var item in Cookies) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(SslCerts)) + { + writer.WritePropertyName("sslCerts"u8); + writer.WriteStartArray(); + foreach (var item in SslCerts) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Services)) + { + writer.WritePropertyName("services"u8); + writer.WriteStartArray(); + foreach (var item in Services) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(IpBlocks)) + { + writer.WritePropertyName("ipBlocks"u8); + writer.WriteStartArray(); + foreach (var item in IpBlocks) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Sources)) + { + writer.WritePropertyName("sources"u8); + writer.WriteStartArray(); + foreach (var item in Sources) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsCollectionDefined(Banners)) + { + writer.WritePropertyName("banners"u8); + writer.WriteStartArray(); + foreach (var item in Banners) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ScanMetadata)) + { + writer.WritePropertyName("scanMetadata"u8); + writer.WriteStartArray(); + foreach (var item in ScanMetadata) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(NsRecord)) + { + writer.WritePropertyName("nsRecord"u8); + writer.WriteStartArray(); + foreach (var item in NsRecord) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(MxRecord)) + { + writer.WritePropertyName("mxRecord"u8); + writer.WriteStartArray(); + foreach (var item in MxRecord) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStartArray(); + foreach (var item in Location) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Hosts)) + { + writer.WritePropertyName("hosts"u8); + writer.WriteStartArray(); + foreach (var item in Hosts) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Nxdomain)) + { + writer.WritePropertyName("nxdomain"u8); + writer.WriteStartArray(); + foreach (var item in Nxdomain) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(SslServerConfig)) + { + writer.WritePropertyName("sslServerConfig"u8); + writer.WriteStartArray(); + foreach (var item in SslServerConfig) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Ipv4)) + { + writer.WritePropertyName("ipv4"u8); + writer.WriteBooleanValue(Ipv4.Value); + } + if (Optional.IsDefined(Ipv6)) + { + writer.WritePropertyName("ipv6"u8); + writer.WriteBooleanValue(Ipv6.Value); + } + writer.WriteEndObject(); + } + + internal static IpAddressAsset DeserializeIpAddressAsset(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional ipAddress = default; + Optional> asns = default; + Optional> reputations = default; + Optional> webComponents = default; + Optional> netRanges = default; + Optional> headers = default; + Optional> attributes = default; + Optional> cookies = default; + Optional> sslCerts = default; + Optional> services = default; + Optional> ipBlocks = default; + Optional> sources = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional count = default; + Optional> banners = default; + Optional> scanMetadata = default; + Optional> nsRecord = default; + Optional> mxRecord = default; + Optional> location = default; + Optional> hosts = default; + Optional> nxdomain = default; + Optional> sslServerConfig = default; + Optional ipv4 = default; + Optional ipv6 = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("ipAddress"u8)) + { + ipAddress = property.Value.GetString(); + continue; + } + if (property.NameEquals("asns"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedLong.DeserializeObservedLong(item)); + } + asns = array; + continue; + } + if (property.NameEquals("reputations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Reputation.DeserializeReputation(item)); + } + reputations = array; + continue; + } + if (property.NameEquals("webComponents"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(WebComponent.DeserializeWebComponent(item)); + } + webComponents = array; + continue; + } + if (property.NameEquals("netRanges"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + netRanges = array; + continue; + } + if (property.NameEquals("headers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedHeader.DeserializeObservedHeader(item)); + } + headers = array; + continue; + } + if (property.NameEquals("attributes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Attribute.DeserializeAttribute(item)); + } + attributes = array; + continue; + } + if (property.NameEquals("cookies"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Cookie.DeserializeCookie(item)); + } + cookies = array; + continue; + } + if (property.NameEquals("sslCerts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SslCertAsset.DeserializeSslCertAsset(item)); + } + sslCerts = array; + continue; + } + if (property.NameEquals("services"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Service.DeserializeService(item)); + } + services = array; + continue; + } + if (property.NameEquals("ipBlocks"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(IpBlock.DeserializeIpBlock(item)); + } + ipBlocks = array; + continue; + } + if (property.NameEquals("sources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Source.DeserializeSource(item)); + } + sources = array; + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("banners"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Banner.DeserializeBanner(item)); + } + banners = array; + continue; + } + if (property.NameEquals("scanMetadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Easm.ScanMetadata.DeserializeScanMetadata(item)); + } + scanMetadata = array; + continue; + } + if (property.NameEquals("nsRecord"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedBoolean.DeserializeObservedBoolean(item)); + } + nsRecord = array; + continue; + } + if (property.NameEquals("mxRecord"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedBoolean.DeserializeObservedBoolean(item)); + } + mxRecord = array; + continue; + } + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedLocation.DeserializeObservedLocation(item)); + } + location = array; + continue; + } + if (property.NameEquals("hosts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + hosts = array; + continue; + } + if (property.NameEquals("nxdomain"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedBoolean.DeserializeObservedBoolean(item)); + } + nxdomain = array; + continue; + } + if (property.NameEquals("sslServerConfig"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Easm.SslServerConfig.DeserializeSslServerConfig(item)); + } + sslServerConfig = array; + continue; + } + if (property.NameEquals("ipv4"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ipv4 = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("ipv6"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ipv6 = property.Value.GetBoolean(); + continue; + } + } + return new IpAddressAsset(ipAddress.Value, Optional.ToList(asns), Optional.ToList(reputations), Optional.ToList(webComponents), Optional.ToList(netRanges), Optional.ToList(headers), Optional.ToList(attributes), Optional.ToList(cookies), Optional.ToList(sslCerts), Optional.ToList(services), Optional.ToList(ipBlocks), Optional.ToList(sources), Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(count), Optional.ToList(banners), Optional.ToList(scanMetadata), Optional.ToList(nsRecord), Optional.ToList(mxRecord), Optional.ToList(location), Optional.ToList(hosts), Optional.ToList(nxdomain), Optional.ToList(sslServerConfig), Optional.ToNullable(ipv4), Optional.ToNullable(ipv6)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static IpAddressAsset FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeIpAddressAsset(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/IpAddressAsset.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/IpAddressAsset.cs new file mode 100644 index 000000000000..5126e6ca3057 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/IpAddressAsset.cs @@ -0,0 +1,147 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The IpAddressAsset. + public partial class IpAddressAsset : InventoryAsset + { + /// Initializes a new instance of IpAddressAsset. + public IpAddressAsset() + { + Asns = new ChangeTrackingList(); + Reputations = new ChangeTrackingList(); + WebComponents = new ChangeTrackingList(); + NetRanges = new ChangeTrackingList(); + Headers = new ChangeTrackingList(); + Attributes = new ChangeTrackingList(); + Cookies = new ChangeTrackingList(); + SslCerts = new ChangeTrackingList(); + Services = new ChangeTrackingList(); + IpBlocks = new ChangeTrackingList(); + Sources = new ChangeTrackingList(); + Banners = new ChangeTrackingList(); + ScanMetadata = new ChangeTrackingList(); + NsRecord = new ChangeTrackingList(); + MxRecord = new ChangeTrackingList(); + Location = new ChangeTrackingList(); + Hosts = new ChangeTrackingList(); + Nxdomain = new ChangeTrackingList(); + SslServerConfig = new ChangeTrackingList(); + } + + /// Initializes a new instance of IpAddressAsset. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + internal IpAddressAsset(string ipAddress, IList asns, IList reputations, IList webComponents, IList netRanges, IList headers, IList attributes, IList cookies, IList sslCerts, IList services, IList ipBlocks, IList sources, DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count, IList banners, IList scanMetadata, IList nsRecord, IList mxRecord, IList location, IList hosts, IList nxdomain, IList sslServerConfig, bool? ipv4, bool? ipv6) + { + IpAddress = ipAddress; + Asns = asns; + Reputations = reputations; + WebComponents = webComponents; + NetRanges = netRanges; + Headers = headers; + Attributes = attributes; + Cookies = cookies; + SslCerts = sslCerts; + Services = services; + IpBlocks = ipBlocks; + Sources = sources; + FirstSeen = firstSeen; + LastSeen = lastSeen; + Count = count; + Banners = banners; + ScanMetadata = scanMetadata; + NsRecord = nsRecord; + MxRecord = mxRecord; + Location = location; + Hosts = hosts; + Nxdomain = nxdomain; + SslServerConfig = sslServerConfig; + Ipv4 = ipv4; + Ipv6 = ipv6; + } + + /// Gets or sets the ip address. + public string IpAddress { get; set; } + /// Gets the asns. + public IList Asns { get; } + /// Gets the reputations. + public IList Reputations { get; } + /// Gets the web components. + public IList WebComponents { get; } + /// Gets the net ranges. + public IList NetRanges { get; } + /// Gets the headers. + public IList Headers { get; } + /// Gets the attributes. + public IList Attributes { get; } + /// Gets the cookies. + public IList Cookies { get; } + /// Gets the ssl certs. + public IList SslCerts { get; } + /// Gets the services. + public IList Services { get; } + /// Gets the ip blocks. + public IList IpBlocks { get; } + /// Gets the sources. + public IList Sources { get; } + /// Gets or sets the first seen. + public DateTimeOffset? FirstSeen { get; set; } + /// Gets or sets the last seen. + public DateTimeOffset? LastSeen { get; set; } + /// Gets or sets the count. + public long? Count { get; set; } + /// Gets the banners. + public IList Banners { get; } + /// Gets the scan metadata. + public IList ScanMetadata { get; } + /// Gets the ns record. + public IList NsRecord { get; } + /// Gets the mx record. + public IList MxRecord { get; } + /// Gets the location. + public IList Location { get; } + /// Gets the hosts. + public IList Hosts { get; } + /// Gets the nxdomain. + public IList Nxdomain { get; } + /// Gets the ssl server config. + public IList SslServerConfig { get; } + /// Gets or sets the ipv 4. + public bool? Ipv4 { get; set; } + /// Gets or sets the ipv 6. + public bool? Ipv6 { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/IpAddressAssetResource.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/IpAddressAssetResource.Serialization.cs new file mode 100644 index 000000000000..d39ecd3a732a --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/IpAddressAssetResource.Serialization.cs @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class IpAddressAssetResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("asset"u8); + writer.WriteObjectValue(Asset); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Uuid)) + { + writer.WritePropertyName("uuid"u8); + writer.WriteStringValue(Uuid.Value); + } + if (Optional.IsDefined(CreatedDate)) + { + writer.WritePropertyName("createdDate"u8); + writer.WriteStringValue(CreatedDate.Value, "O"); + } + if (Optional.IsDefined(UpdatedDate)) + { + writer.WritePropertyName("updatedDate"u8); + writer.WriteStringValue(UpdatedDate.Value, "O"); + } + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"u8); + writer.WriteStringValue(State.Value.ToString()); + } + if (Optional.IsDefined(ExternalId)) + { + writer.WritePropertyName("externalId"u8); + writer.WriteStringValue(ExternalId); + } + if (Optional.IsCollectionDefined(Labels)) + { + writer.WritePropertyName("labels"u8); + writer.WriteStartArray(); + foreach (var item in Labels) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Wildcard)) + { + writer.WritePropertyName("wildcard"u8); + writer.WriteBooleanValue(Wildcard.Value); + } + if (Optional.IsDefined(DiscoGroupName)) + { + writer.WritePropertyName("discoGroupName"u8); + writer.WriteStringValue(DiscoGroupName); + } + if (Optional.IsCollectionDefined(AuditTrail)) + { + writer.WritePropertyName("auditTrail"u8); + writer.WriteStartArray(); + foreach (var item in AuditTrail) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Reason)) + { + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason); + } + writer.WriteEndObject(); + } + + internal static IpAddressAssetResource DeserializeIpAddressAssetResource(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IpAddressAsset asset = default; + string kind = default; + string id = default; + Optional name = default; + Optional displayName = default; + Optional uuid = default; + Optional createdDate = default; + Optional updatedDate = default; + Optional state = default; + Optional externalId = default; + Optional> labels = default; + Optional wildcard = default; + Optional discoGroupName = default; + Optional> auditTrail = default; + Optional reason = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("asset"u8)) + { + asset = IpAddressAsset.DeserializeIpAddressAsset(property.Value); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("uuid"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + uuid = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("createdDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("updatedDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + updatedDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("state"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = new AssetState(property.Value.GetString()); + continue; + } + if (property.NameEquals("externalId"u8)) + { + externalId = property.Value.GetString(); + continue; + } + if (property.NameEquals("labels"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + labels = array; + continue; + } + if (property.NameEquals("wildcard"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + wildcard = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("discoGroupName"u8)) + { + discoGroupName = property.Value.GetString(); + continue; + } + if (property.NameEquals("auditTrail"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AuditTrailItem.DeserializeAuditTrailItem(item)); + } + auditTrail = array; + continue; + } + if (property.NameEquals("reason"u8)) + { + reason = property.Value.GetString(); + continue; + } + } + return new IpAddressAssetResource(kind, id, name.Value, displayName.Value, Optional.ToNullable(uuid), Optional.ToNullable(createdDate), Optional.ToNullable(updatedDate), Optional.ToNullable(state), externalId.Value, Optional.ToList(labels), Optional.ToNullable(wildcard), discoGroupName.Value, Optional.ToList(auditTrail), reason.Value, asset); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new IpAddressAssetResource FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeIpAddressAssetResource(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/IpAddressAssetResource.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/IpAddressAssetResource.cs new file mode 100644 index 000000000000..4f5560445085 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/IpAddressAssetResource.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The IpAddressAssetResource. + public partial class IpAddressAssetResource : AssetResource + { + /// Initializes a new instance of IpAddressAssetResource. + /// asset. + /// is null. + public IpAddressAssetResource(IpAddressAsset asset) + { + Argument.AssertNotNull(asset, nameof(asset)); + + Kind = "ipAddress"; + Asset = asset; + } + + /// Initializes a new instance of IpAddressAssetResource. + /// Discriminator. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// Global UUID for the asset. + /// The date this asset was first added to this workspace. + /// The date this asset was last updated for this workspace. + /// + /// An optional customer provided identifier for this asset. + /// Customer labels assigned to this asset. + /// An indicator of whether this asset represents a wildcard rollup of assets on this domain. + /// The name of the DiscoGroup that brought added this asset to the workspace. + /// The history of how this asset was pulled into the workspace through the discovery process. + /// + /// asset. + internal IpAddressAssetResource(string kind, string id, string name, string displayName, Guid? uuid, DateTimeOffset? createdDate, DateTimeOffset? updatedDate, AssetState? state, string externalId, IList labels, bool? wildcard, string discoGroupName, IList auditTrail, string reason, IpAddressAsset asset) : base(kind, id, name, displayName, uuid, createdDate, updatedDate, state, externalId, labels, wildcard, discoGroupName, auditTrail, reason) + { + Asset = asset; + } + + /// asset. + public IpAddressAsset Asset { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/IpBlock.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/IpBlock.Serialization.cs new file mode 100644 index 000000000000..4294ec123b8c --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/IpBlock.Serialization.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class IpBlock : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(IpBlockProperty)) + { + writer.WritePropertyName("ipBlock"u8); + writer.WriteStringValue(IpBlockProperty); + } + if (Optional.IsCollectionDefined(Sources)) + { + writer.WritePropertyName("sources"u8); + writer.WriteStartArray(); + foreach (var item in Sources) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(Recent)) + { + writer.WritePropertyName("recent"u8); + writer.WriteBooleanValue(Recent.Value); + } + writer.WriteEndObject(); + } + + internal static IpBlock DeserializeIpBlock(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional ipBlock = default; + Optional> sources = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional count = default; + Optional recent = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("ipBlock"u8)) + { + ipBlock = property.Value.GetString(); + continue; + } + if (property.NameEquals("sources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Source.DeserializeSource(item)); + } + sources = array; + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("recent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + recent = property.Value.GetBoolean(); + continue; + } + } + return new IpBlock(ipBlock.Value, Optional.ToList(sources), Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(count), Optional.ToNullable(recent)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static IpBlock FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeIpBlock(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/IpBlock.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/IpBlock.cs new file mode 100644 index 000000000000..f5f71e0d40d7 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/IpBlock.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The IpBlock. + public partial class IpBlock + { + /// Initializes a new instance of IpBlock. + public IpBlock() + { + Sources = new ChangeTrackingList(); + } + + /// Initializes a new instance of IpBlock. + /// + /// + /// + /// + /// + /// + internal IpBlock(string ipBlockProperty, IList sources, DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count, bool? recent) + { + IpBlockProperty = ipBlockProperty; + Sources = sources; + FirstSeen = firstSeen; + LastSeen = lastSeen; + Count = count; + Recent = recent; + } + + /// Gets or sets the ip block property. + public string IpBlockProperty { get; set; } + /// Gets the sources. + public IList Sources { get; } + /// Gets or sets the first seen. + public DateTimeOffset? FirstSeen { get; set; } + /// Gets or sets the last seen. + public DateTimeOffset? LastSeen { get; set; } + /// Gets or sets the count. + public long? Count { get; set; } + /// Gets or sets the recent. + public bool? Recent { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/IpBlockAsset.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/IpBlockAsset.Serialization.cs new file mode 100644 index 000000000000..9c71ee9dd5fc --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/IpBlockAsset.Serialization.cs @@ -0,0 +1,725 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class IpBlockAsset : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(IpBlock)) + { + writer.WritePropertyName("ipBlock"u8); + writer.WriteStringValue(IpBlock); + } + if (Optional.IsCollectionDefined(Asns)) + { + writer.WritePropertyName("asns"u8); + writer.WriteStartArray(); + foreach (var item in Asns) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(BgpPrefixes)) + { + writer.WritePropertyName("bgpPrefixes"u8); + writer.WriteStartArray(); + foreach (var item in BgpPrefixes) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(NetNames)) + { + writer.WritePropertyName("netNames"u8); + writer.WriteStartArray(); + foreach (var item in NetNames) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(RegistrantContacts)) + { + writer.WritePropertyName("registrantContacts"u8); + writer.WriteStartArray(); + foreach (var item in RegistrantContacts) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(RegistrantOrgs)) + { + writer.WritePropertyName("registrantOrgs"u8); + writer.WriteStartArray(); + foreach (var item in RegistrantOrgs) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(AdminContacts)) + { + writer.WritePropertyName("adminContacts"u8); + writer.WriteStartArray(); + foreach (var item in AdminContacts) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(TechnicalContacts)) + { + writer.WritePropertyName("technicalContacts"u8); + writer.WriteStartArray(); + foreach (var item in TechnicalContacts) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(RegistrarCreatedAt)) + { + writer.WritePropertyName("registrarCreatedAt"u8); + writer.WriteStartArray(); + foreach (var item in RegistrarCreatedAt) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(RegistrarUpdatedAt)) + { + writer.WritePropertyName("registrarUpdatedAt"u8); + writer.WriteStartArray(); + foreach (var item in RegistrarUpdatedAt) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(NetRanges)) + { + writer.WritePropertyName("netRanges"u8); + writer.WriteStartArray(); + foreach (var item in NetRanges) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(StartIp)) + { + writer.WritePropertyName("startIp"u8); + writer.WriteStringValue(StartIp); + } + if (Optional.IsDefined(EndIp)) + { + writer.WritePropertyName("endIp"u8); + writer.WriteStringValue(EndIp); + } + if (Optional.IsCollectionDefined(Reputations)) + { + writer.WritePropertyName("reputations"u8); + writer.WriteStartArray(); + foreach (var item in Reputations) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(DetailedFromWhoisAt)) + { + writer.WritePropertyName("detailedFromWhoisAt"u8); + writer.WriteStringValue(DetailedFromWhoisAt.Value, "O"); + } + if (Optional.IsCollectionDefined(Sources)) + { + writer.WritePropertyName("sources"u8); + writer.WriteStartArray(); + foreach (var item in Sources) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsCollectionDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStartArray(); + foreach (var item in Location) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(RegistrarExpiresAt)) + { + writer.WritePropertyName("registrarExpiresAt"u8); + writer.WriteStartArray(); + foreach (var item in RegistrarExpiresAt) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(RegistrantNames)) + { + writer.WritePropertyName("registrantNames"u8); + writer.WriteStartArray(); + foreach (var item in RegistrantNames) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(AdminNames)) + { + writer.WritePropertyName("adminNames"u8); + writer.WriteStartArray(); + foreach (var item in AdminNames) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(TechnicalNames)) + { + writer.WritePropertyName("technicalNames"u8); + writer.WriteStartArray(); + foreach (var item in TechnicalNames) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(AdminOrgs)) + { + writer.WritePropertyName("adminOrgs"u8); + writer.WriteStartArray(); + foreach (var item in AdminOrgs) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(TechnicalOrgs)) + { + writer.WritePropertyName("technicalOrgs"u8); + writer.WriteStartArray(); + foreach (var item in TechnicalOrgs) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(RegistrantPhones)) + { + writer.WritePropertyName("registrantPhones"u8); + writer.WriteStartArray(); + foreach (var item in RegistrantPhones) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(AdminPhones)) + { + writer.WritePropertyName("adminPhones"u8); + writer.WriteStartArray(); + foreach (var item in AdminPhones) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(TechnicalPhones)) + { + writer.WritePropertyName("technicalPhones"u8); + writer.WriteStartArray(); + foreach (var item in TechnicalPhones) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Ipv4)) + { + writer.WritePropertyName("ipv4"u8); + writer.WriteBooleanValue(Ipv4.Value); + } + if (Optional.IsDefined(Ipv6)) + { + writer.WritePropertyName("ipv6"u8); + writer.WriteBooleanValue(Ipv6.Value); + } + writer.WriteEndObject(); + } + + internal static IpBlockAsset DeserializeIpBlockAsset(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional ipBlock = default; + Optional> asns = default; + Optional> bgpPrefixes = default; + Optional> netNames = default; + Optional> registrantContacts = default; + Optional> registrantOrgs = default; + Optional> adminContacts = default; + Optional> technicalContacts = default; + Optional> registrarCreatedAt = default; + Optional> registrarUpdatedAt = default; + Optional> netRanges = default; + Optional startIp = default; + Optional endIp = default; + Optional> reputations = default; + Optional detailedFromWhoisAt = default; + Optional> sources = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional count = default; + Optional> location = default; + Optional> registrarExpiresAt = default; + Optional> registrantNames = default; + Optional> adminNames = default; + Optional> technicalNames = default; + Optional> adminOrgs = default; + Optional> technicalOrgs = default; + Optional> registrantPhones = default; + Optional> adminPhones = default; + Optional> technicalPhones = default; + Optional ipv4 = default; + Optional ipv6 = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("ipBlock"u8)) + { + ipBlock = property.Value.GetString(); + continue; + } + if (property.NameEquals("asns"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedLong.DeserializeObservedLong(item)); + } + asns = array; + continue; + } + if (property.NameEquals("bgpPrefixes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + bgpPrefixes = array; + continue; + } + if (property.NameEquals("netNames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + netNames = array; + continue; + } + if (property.NameEquals("registrantContacts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + registrantContacts = array; + continue; + } + if (property.NameEquals("registrantOrgs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + registrantOrgs = array; + continue; + } + if (property.NameEquals("adminContacts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + adminContacts = array; + continue; + } + if (property.NameEquals("technicalContacts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + technicalContacts = array; + continue; + } + if (property.NameEquals("registrarCreatedAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedLong.DeserializeObservedLong(item)); + } + registrarCreatedAt = array; + continue; + } + if (property.NameEquals("registrarUpdatedAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedLong.DeserializeObservedLong(item)); + } + registrarUpdatedAt = array; + continue; + } + if (property.NameEquals("netRanges"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + netRanges = array; + continue; + } + if (property.NameEquals("startIp"u8)) + { + startIp = property.Value.GetString(); + continue; + } + if (property.NameEquals("endIp"u8)) + { + endIp = property.Value.GetString(); + continue; + } + if (property.NameEquals("reputations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Reputation.DeserializeReputation(item)); + } + reputations = array; + continue; + } + if (property.NameEquals("detailedFromWhoisAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + detailedFromWhoisAt = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("sources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Source.DeserializeSource(item)); + } + sources = array; + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedLocation.DeserializeObservedLocation(item)); + } + location = array; + continue; + } + if (property.NameEquals("registrarExpiresAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedLong.DeserializeObservedLong(item)); + } + registrarExpiresAt = array; + continue; + } + if (property.NameEquals("registrantNames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + registrantNames = array; + continue; + } + if (property.NameEquals("adminNames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + adminNames = array; + continue; + } + if (property.NameEquals("technicalNames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + technicalNames = array; + continue; + } + if (property.NameEquals("adminOrgs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + adminOrgs = array; + continue; + } + if (property.NameEquals("technicalOrgs"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + technicalOrgs = array; + continue; + } + if (property.NameEquals("registrantPhones"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + registrantPhones = array; + continue; + } + if (property.NameEquals("adminPhones"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + adminPhones = array; + continue; + } + if (property.NameEquals("technicalPhones"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + technicalPhones = array; + continue; + } + if (property.NameEquals("ipv4"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ipv4 = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("ipv6"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + ipv6 = property.Value.GetBoolean(); + continue; + } + } + return new IpBlockAsset(ipBlock.Value, Optional.ToList(asns), Optional.ToList(bgpPrefixes), Optional.ToList(netNames), Optional.ToList(registrantContacts), Optional.ToList(registrantOrgs), Optional.ToList(adminContacts), Optional.ToList(technicalContacts), Optional.ToList(registrarCreatedAt), Optional.ToList(registrarUpdatedAt), Optional.ToList(netRanges), startIp.Value, endIp.Value, Optional.ToList(reputations), Optional.ToNullable(detailedFromWhoisAt), Optional.ToList(sources), Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(count), Optional.ToList(location), Optional.ToList(registrarExpiresAt), Optional.ToList(registrantNames), Optional.ToList(adminNames), Optional.ToList(technicalNames), Optional.ToList(adminOrgs), Optional.ToList(technicalOrgs), Optional.ToList(registrantPhones), Optional.ToList(adminPhones), Optional.ToList(technicalPhones), Optional.ToNullable(ipv4), Optional.ToNullable(ipv6)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static IpBlockAsset FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeIpBlockAsset(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/IpBlockAsset.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/IpBlockAsset.cs new file mode 100644 index 000000000000..a4ef6fcb8c25 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/IpBlockAsset.cs @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The IpBlockAsset. + public partial class IpBlockAsset : InventoryAsset + { + /// Initializes a new instance of IpBlockAsset. + public IpBlockAsset() + { + Asns = new ChangeTrackingList(); + BgpPrefixes = new ChangeTrackingList(); + NetNames = new ChangeTrackingList(); + RegistrantContacts = new ChangeTrackingList(); + RegistrantOrgs = new ChangeTrackingList(); + AdminContacts = new ChangeTrackingList(); + TechnicalContacts = new ChangeTrackingList(); + RegistrarCreatedAt = new ChangeTrackingList(); + RegistrarUpdatedAt = new ChangeTrackingList(); + NetRanges = new ChangeTrackingList(); + Reputations = new ChangeTrackingList(); + Sources = new ChangeTrackingList(); + Location = new ChangeTrackingList(); + RegistrarExpiresAt = new ChangeTrackingList(); + RegistrantNames = new ChangeTrackingList(); + AdminNames = new ChangeTrackingList(); + TechnicalNames = new ChangeTrackingList(); + AdminOrgs = new ChangeTrackingList(); + TechnicalOrgs = new ChangeTrackingList(); + RegistrantPhones = new ChangeTrackingList(); + AdminPhones = new ChangeTrackingList(); + TechnicalPhones = new ChangeTrackingList(); + } + + /// Initializes a new instance of IpBlockAsset. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + internal IpBlockAsset(string ipBlock, IList asns, IList bgpPrefixes, IList netNames, IList registrantContacts, IList registrantOrgs, IList adminContacts, IList technicalContacts, IList registrarCreatedAt, IList registrarUpdatedAt, IList netRanges, string startIp, string endIp, IList reputations, DateTimeOffset? detailedFromWhoisAt, IList sources, DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count, IList location, IList registrarExpiresAt, IList registrantNames, IList adminNames, IList technicalNames, IList adminOrgs, IList technicalOrgs, IList registrantPhones, IList adminPhones, IList technicalPhones, bool? ipv4, bool? ipv6) + { + IpBlock = ipBlock; + Asns = asns; + BgpPrefixes = bgpPrefixes; + NetNames = netNames; + RegistrantContacts = registrantContacts; + RegistrantOrgs = registrantOrgs; + AdminContacts = adminContacts; + TechnicalContacts = technicalContacts; + RegistrarCreatedAt = registrarCreatedAt; + RegistrarUpdatedAt = registrarUpdatedAt; + NetRanges = netRanges; + StartIp = startIp; + EndIp = endIp; + Reputations = reputations; + DetailedFromWhoisAt = detailedFromWhoisAt; + Sources = sources; + FirstSeen = firstSeen; + LastSeen = lastSeen; + Count = count; + Location = location; + RegistrarExpiresAt = registrarExpiresAt; + RegistrantNames = registrantNames; + AdminNames = adminNames; + TechnicalNames = technicalNames; + AdminOrgs = adminOrgs; + TechnicalOrgs = technicalOrgs; + RegistrantPhones = registrantPhones; + AdminPhones = adminPhones; + TechnicalPhones = technicalPhones; + Ipv4 = ipv4; + Ipv6 = ipv6; + } + + /// Gets or sets the ip block. + public string IpBlock { get; set; } + /// Gets the asns. + public IList Asns { get; } + /// Gets the bgp prefixes. + public IList BgpPrefixes { get; } + /// Gets the net names. + public IList NetNames { get; } + /// Gets the registrant contacts. + public IList RegistrantContacts { get; } + /// Gets the registrant orgs. + public IList RegistrantOrgs { get; } + /// Gets the admin contacts. + public IList AdminContacts { get; } + /// Gets the technical contacts. + public IList TechnicalContacts { get; } + /// Gets the registrar created at. + public IList RegistrarCreatedAt { get; } + /// Gets the registrar updated at. + public IList RegistrarUpdatedAt { get; } + /// Gets the net ranges. + public IList NetRanges { get; } + /// Gets or sets the start ip. + public string StartIp { get; set; } + /// Gets or sets the end ip. + public string EndIp { get; set; } + /// Gets the reputations. + public IList Reputations { get; } + /// Gets or sets the detailed from whois at. + public DateTimeOffset? DetailedFromWhoisAt { get; set; } + /// Gets the sources. + public IList Sources { get; } + /// Gets or sets the first seen. + public DateTimeOffset? FirstSeen { get; set; } + /// Gets or sets the last seen. + public DateTimeOffset? LastSeen { get; set; } + /// Gets or sets the count. + public long? Count { get; set; } + /// Gets the location. + public IList Location { get; } + /// Gets the registrar expires at. + public IList RegistrarExpiresAt { get; } + /// Gets the registrant names. + public IList RegistrantNames { get; } + /// Gets the admin names. + public IList AdminNames { get; } + /// Gets the technical names. + public IList TechnicalNames { get; } + /// Gets the admin orgs. + public IList AdminOrgs { get; } + /// Gets the technical orgs. + public IList TechnicalOrgs { get; } + /// Gets the registrant phones. + public IList RegistrantPhones { get; } + /// Gets the admin phones. + public IList AdminPhones { get; } + /// Gets the technical phones. + public IList TechnicalPhones { get; } + /// Gets or sets the ipv 4. + public bool? Ipv4 { get; set; } + /// Gets or sets the ipv 6. + public bool? Ipv6 { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/IpBlockAssetResource.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/IpBlockAssetResource.Serialization.cs new file mode 100644 index 000000000000..b6d5d5c810ff --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/IpBlockAssetResource.Serialization.cs @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class IpBlockAssetResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("asset"u8); + writer.WriteObjectValue(Asset); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Uuid)) + { + writer.WritePropertyName("uuid"u8); + writer.WriteStringValue(Uuid.Value); + } + if (Optional.IsDefined(CreatedDate)) + { + writer.WritePropertyName("createdDate"u8); + writer.WriteStringValue(CreatedDate.Value, "O"); + } + if (Optional.IsDefined(UpdatedDate)) + { + writer.WritePropertyName("updatedDate"u8); + writer.WriteStringValue(UpdatedDate.Value, "O"); + } + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"u8); + writer.WriteStringValue(State.Value.ToString()); + } + if (Optional.IsDefined(ExternalId)) + { + writer.WritePropertyName("externalId"u8); + writer.WriteStringValue(ExternalId); + } + if (Optional.IsCollectionDefined(Labels)) + { + writer.WritePropertyName("labels"u8); + writer.WriteStartArray(); + foreach (var item in Labels) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Wildcard)) + { + writer.WritePropertyName("wildcard"u8); + writer.WriteBooleanValue(Wildcard.Value); + } + if (Optional.IsDefined(DiscoGroupName)) + { + writer.WritePropertyName("discoGroupName"u8); + writer.WriteStringValue(DiscoGroupName); + } + if (Optional.IsCollectionDefined(AuditTrail)) + { + writer.WritePropertyName("auditTrail"u8); + writer.WriteStartArray(); + foreach (var item in AuditTrail) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Reason)) + { + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason); + } + writer.WriteEndObject(); + } + + internal static IpBlockAssetResource DeserializeIpBlockAssetResource(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IpBlockAsset asset = default; + string kind = default; + string id = default; + Optional name = default; + Optional displayName = default; + Optional uuid = default; + Optional createdDate = default; + Optional updatedDate = default; + Optional state = default; + Optional externalId = default; + Optional> labels = default; + Optional wildcard = default; + Optional discoGroupName = default; + Optional> auditTrail = default; + Optional reason = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("asset"u8)) + { + asset = IpBlockAsset.DeserializeIpBlockAsset(property.Value); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("uuid"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + uuid = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("createdDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("updatedDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + updatedDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("state"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = new AssetState(property.Value.GetString()); + continue; + } + if (property.NameEquals("externalId"u8)) + { + externalId = property.Value.GetString(); + continue; + } + if (property.NameEquals("labels"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + labels = array; + continue; + } + if (property.NameEquals("wildcard"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + wildcard = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("discoGroupName"u8)) + { + discoGroupName = property.Value.GetString(); + continue; + } + if (property.NameEquals("auditTrail"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AuditTrailItem.DeserializeAuditTrailItem(item)); + } + auditTrail = array; + continue; + } + if (property.NameEquals("reason"u8)) + { + reason = property.Value.GetString(); + continue; + } + } + return new IpBlockAssetResource(kind, id, name.Value, displayName.Value, Optional.ToNullable(uuid), Optional.ToNullable(createdDate), Optional.ToNullable(updatedDate), Optional.ToNullable(state), externalId.Value, Optional.ToList(labels), Optional.ToNullable(wildcard), discoGroupName.Value, Optional.ToList(auditTrail), reason.Value, asset); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new IpBlockAssetResource FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeIpBlockAssetResource(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/IpBlockAssetResource.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/IpBlockAssetResource.cs new file mode 100644 index 000000000000..de337a594598 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/IpBlockAssetResource.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The IpBlockAssetResource. + public partial class IpBlockAssetResource : AssetResource + { + /// Initializes a new instance of IpBlockAssetResource. + /// asset. + /// is null. + public IpBlockAssetResource(IpBlockAsset asset) + { + Argument.AssertNotNull(asset, nameof(asset)); + + Kind = "ipBlock"; + Asset = asset; + } + + /// Initializes a new instance of IpBlockAssetResource. + /// Discriminator. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// Global UUID for the asset. + /// The date this asset was first added to this workspace. + /// The date this asset was last updated for this workspace. + /// + /// An optional customer provided identifier for this asset. + /// Customer labels assigned to this asset. + /// An indicator of whether this asset represents a wildcard rollup of assets on this domain. + /// The name of the DiscoGroup that brought added this asset to the workspace. + /// The history of how this asset was pulled into the workspace through the discovery process. + /// + /// asset. + internal IpBlockAssetResource(string kind, string id, string name, string displayName, Guid? uuid, DateTimeOffset? createdDate, DateTimeOffset? updatedDate, AssetState? state, string externalId, IList labels, bool? wildcard, string discoGroupName, IList auditTrail, string reason, IpBlockAsset asset) : base(kind, id, name, displayName, uuid, createdDate, updatedDate, state, externalId, labels, wildcard, discoGroupName, auditTrail, reason) + { + Asset = asset; + } + + /// asset. + public IpBlockAsset Asset { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Location.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Location.Serialization.cs new file mode 100644 index 000000000000..ce73fa3a00a5 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Location.Serialization.cs @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class Location : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(CountryCode)) + { + writer.WritePropertyName("countryCode"u8); + writer.WriteStringValue(CountryCode); + } + if (Optional.IsDefined(CountryName)) + { + writer.WritePropertyName("countryName"u8); + writer.WriteStringValue(CountryName); + } + if (Optional.IsDefined(Region)) + { + writer.WritePropertyName("region"u8); + writer.WriteStringValue(Region); + } + if (Optional.IsDefined(RegionName)) + { + writer.WritePropertyName("regionName"u8); + writer.WriteStringValue(RegionName); + } + if (Optional.IsDefined(City)) + { + writer.WritePropertyName("city"u8); + writer.WriteStringValue(City); + } + if (Optional.IsDefined(AreaCode)) + { + writer.WritePropertyName("areaCode"u8); + writer.WriteNumberValue(AreaCode.Value); + } + if (Optional.IsDefined(PostalCode)) + { + writer.WritePropertyName("postalCode"u8); + writer.WriteStringValue(PostalCode); + } + if (Optional.IsDefined(Latitude)) + { + writer.WritePropertyName("latitude"u8); + writer.WriteNumberValue(Latitude.Value); + } + if (Optional.IsDefined(Longitude)) + { + writer.WritePropertyName("longitude"u8); + writer.WriteNumberValue(Longitude.Value); + } + if (Optional.IsDefined(DmaCode)) + { + writer.WritePropertyName("dmaCode"u8); + writer.WriteNumberValue(DmaCode.Value); + } + if (Optional.IsDefined(MetroCodeId)) + { + writer.WritePropertyName("metroCodeId"u8); + writer.WriteNumberValue(MetroCodeId.Value); + } + writer.WriteEndObject(); + } + + internal static Location DeserializeLocation(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional countryCode = default; + Optional countryName = default; + Optional region = default; + Optional regionName = default; + Optional city = default; + Optional areaCode = default; + Optional postalCode = default; + Optional latitude = default; + Optional longitude = default; + Optional dmaCode = default; + Optional metroCodeId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("countryCode"u8)) + { + countryCode = property.Value.GetString(); + continue; + } + if (property.NameEquals("countryName"u8)) + { + countryName = property.Value.GetString(); + continue; + } + if (property.NameEquals("region"u8)) + { + region = property.Value.GetString(); + continue; + } + if (property.NameEquals("regionName"u8)) + { + regionName = property.Value.GetString(); + continue; + } + if (property.NameEquals("city"u8)) + { + city = property.Value.GetString(); + continue; + } + if (property.NameEquals("areaCode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + areaCode = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("postalCode"u8)) + { + postalCode = property.Value.GetString(); + continue; + } + if (property.NameEquals("latitude"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + latitude = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("longitude"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + longitude = property.Value.GetSingle(); + continue; + } + if (property.NameEquals("dmaCode"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + dmaCode = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("metroCodeId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + metroCodeId = property.Value.GetInt32(); + continue; + } + } + return new Location(countryCode.Value, countryName.Value, region.Value, regionName.Value, city.Value, Optional.ToNullable(areaCode), postalCode.Value, Optional.ToNullable(latitude), Optional.ToNullable(longitude), Optional.ToNullable(dmaCode), Optional.ToNullable(metroCodeId)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static Location FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeLocation(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Location.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Location.cs new file mode 100644 index 000000000000..9132246c0451 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Location.cs @@ -0,0 +1,68 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Analytics.Defender.Easm +{ + /// The Location. + public partial class Location + { + /// Initializes a new instance of Location. + public Location() + { + } + + /// Initializes a new instance of Location. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + internal Location(string countryCode, string countryName, string region, string regionName, string city, int? areaCode, string postalCode, float? latitude, float? longitude, int? dmaCode, int? metroCodeId) + { + CountryCode = countryCode; + CountryName = countryName; + Region = region; + RegionName = regionName; + City = city; + AreaCode = areaCode; + PostalCode = postalCode; + Latitude = latitude; + Longitude = longitude; + DmaCode = dmaCode; + MetroCodeId = metroCodeId; + } + + /// Gets or sets the country code. + public string CountryCode { get; set; } + /// Gets or sets the country name. + public string CountryName { get; set; } + /// Gets or sets the region. + public string Region { get; set; } + /// Gets or sets the region name. + public string RegionName { get; set; } + /// Gets or sets the city. + public string City { get; set; } + /// Gets or sets the area code. + public int? AreaCode { get; set; } + /// Gets or sets the postal code. + public string PostalCode { get; set; } + /// Gets or sets the latitude. + public float? Latitude { get; set; } + /// Gets or sets the longitude. + public float? Longitude { get; set; } + /// Gets or sets the dma code. + public int? DmaCode { get; set; } + /// Gets or sets the metro code id. + public int? MetroCodeId { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/LogAnalyticsDataConnection.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/LogAnalyticsDataConnection.Serialization.cs new file mode 100644 index 000000000000..14c2ee433626 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/LogAnalyticsDataConnection.Serialization.cs @@ -0,0 +1,191 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class LogAnalyticsDataConnection : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Content)) + { + writer.WritePropertyName("content"u8); + writer.WriteStringValue(Content.Value.ToString()); + } + if (Optional.IsDefined(Frequency)) + { + writer.WritePropertyName("frequency"u8); + writer.WriteStringValue(Frequency.Value.ToString()); + } + if (Optional.IsDefined(FrequencyOffset)) + { + writer.WritePropertyName("frequencyOffset"u8); + writer.WriteNumberValue(FrequencyOffset.Value); + } + if (Optional.IsDefined(Active)) + { + writer.WritePropertyName("active"u8); + writer.WriteBooleanValue(Active.Value); + } + writer.WriteEndObject(); + } + + internal static LogAnalyticsDataConnection DeserializeLogAnalyticsDataConnection(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + LogAnalyticsDataConnectionProperties properties = default; + string kind = default; + Optional id = default; + string name = default; + Optional displayName = default; + Optional content = default; + Optional createdDate = default; + Optional frequency = default; + Optional frequencyOffset = default; + Optional updatedDate = default; + Optional userUpdatedAt = default; + Optional active = default; + Optional inactiveMessage = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("properties"u8)) + { + properties = LogAnalyticsDataConnectionProperties.DeserializeLogAnalyticsDataConnectionProperties(property.Value); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("content"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + content = new DataConnectionContent(property.Value.GetString()); + continue; + } + if (property.NameEquals("createdDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("frequency"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + frequency = new DataConnectionFrequency(property.Value.GetString()); + continue; + } + if (property.NameEquals("frequencyOffset"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + frequencyOffset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("updatedDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + updatedDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("userUpdatedAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + userUpdatedAt = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("active"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + active = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("inactiveMessage"u8)) + { + inactiveMessage = property.Value.GetString(); + continue; + } + } + return new LogAnalyticsDataConnection(kind, id.Value, name, displayName.Value, Optional.ToNullable(content), Optional.ToNullable(createdDate), Optional.ToNullable(frequency), Optional.ToNullable(frequencyOffset), Optional.ToNullable(updatedDate), Optional.ToNullable(userUpdatedAt), Optional.ToNullable(active), inactiveMessage.Value, properties); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new LogAnalyticsDataConnection FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeLogAnalyticsDataConnection(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/LogAnalyticsDataConnection.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/LogAnalyticsDataConnection.cs new file mode 100644 index 000000000000..62fb66fe9ed1 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/LogAnalyticsDataConnection.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The LogAnalyticsDataConnection. + public partial class LogAnalyticsDataConnection : DataConnection + { + /// Initializes a new instance of LogAnalyticsDataConnection. + /// properties. + /// is null. + public LogAnalyticsDataConnection(LogAnalyticsDataConnectionProperties properties) + { + Argument.AssertNotNull(properties, nameof(properties)); + + Kind = "logAnalytics"; + Properties = properties; + } + + /// Initializes a new instance of LogAnalyticsDataConnection. + /// Discriminator. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// The type of data the data connection will transfer. + /// The date the data connection was created. + /// The rate at which the data connection will receive updates. + /// The day to update the data connection on. + /// The date the data connection was last updated. + /// The date the data connection was last updated by user. + /// An indicator of whether the data connection is active. + /// A message that specifies details about data connection if inactive. + /// properties. + internal LogAnalyticsDataConnection(string kind, string id, string name, string displayName, DataConnectionContent? content, DateTimeOffset? createdDate, DataConnectionFrequency? frequency, int? frequencyOffset, DateTimeOffset? updatedDate, DateTimeOffset? userUpdatedAt, bool? active, string inactiveMessage, LogAnalyticsDataConnectionProperties properties) : base(kind, id, name, displayName, content, createdDate, frequency, frequencyOffset, updatedDate, userUpdatedAt, active, inactiveMessage) + { + Properties = properties; + } + + /// properties. + public LogAnalyticsDataConnectionProperties Properties { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/LogAnalyticsDataConnectionData.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/LogAnalyticsDataConnectionData.Serialization.cs new file mode 100644 index 000000000000..9ed1b6c7d6a6 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/LogAnalyticsDataConnectionData.Serialization.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class LogAnalyticsDataConnectionData : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteObjectValue(Properties); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Content)) + { + writer.WritePropertyName("content"u8); + writer.WriteStringValue(Content.Value.ToString()); + } + if (Optional.IsDefined(Frequency)) + { + writer.WritePropertyName("frequency"u8); + writer.WriteStringValue(Frequency.Value.ToString()); + } + if (Optional.IsDefined(FrequencyOffset)) + { + writer.WritePropertyName("frequencyOffset"u8); + writer.WriteNumberValue(FrequencyOffset.Value); + } + writer.WriteEndObject(); + } + + /// Convert into a Utf8JsonRequestContent. + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/LogAnalyticsDataConnectionData.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/LogAnalyticsDataConnectionData.cs new file mode 100644 index 000000000000..4605872914e7 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/LogAnalyticsDataConnectionData.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The LogAnalyticsDataConnectionData. + public partial class LogAnalyticsDataConnectionData : DataConnectionData + { + /// Initializes a new instance of LogAnalyticsDataConnectionData. + /// properties. + /// is null. + public LogAnalyticsDataConnectionData(LogAnalyticsDataConnectionProperties properties) + { + Argument.AssertNotNull(properties, nameof(properties)); + + Kind = "logAnalytics"; + Properties = properties; + } + + /// Initializes a new instance of LogAnalyticsDataConnectionData. + /// Discriminator. + /// The name of data connection. + /// The type of data the data connection will transfer. + /// The rate at which the data connection will receive updates. + /// The day to update the data connection on. (1-7 for weekly, 1-31 for monthly). + /// properties. + internal LogAnalyticsDataConnectionData(string kind, string name, DataConnectionContent? content, DataConnectionFrequency? frequency, int? frequencyOffset, LogAnalyticsDataConnectionProperties properties) : base(kind, name, content, frequency, frequencyOffset) + { + Properties = properties; + } + + /// properties. + public LogAnalyticsDataConnectionProperties Properties { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/LogAnalyticsDataConnectionProperties.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/LogAnalyticsDataConnectionProperties.Serialization.cs new file mode 100644 index 000000000000..076b837da647 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/LogAnalyticsDataConnectionProperties.Serialization.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class LogAnalyticsDataConnectionProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ApiKey)) + { + writer.WritePropertyName("apiKey"u8); + writer.WriteStringValue(ApiKey); + } + if (Optional.IsDefined(WorkspaceId)) + { + writer.WritePropertyName("workspaceId"u8); + writer.WriteStringValue(WorkspaceId); + } + writer.WriteEndObject(); + } + + internal static LogAnalyticsDataConnectionProperties DeserializeLogAnalyticsDataConnectionProperties(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional apiKey = default; + Optional workspaceId = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("apiKey"u8)) + { + apiKey = property.Value.GetString(); + continue; + } + if (property.NameEquals("workspaceId"u8)) + { + workspaceId = property.Value.GetString(); + continue; + } + } + return new LogAnalyticsDataConnectionProperties(apiKey.Value, workspaceId.Value); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static LogAnalyticsDataConnectionProperties FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeLogAnalyticsDataConnectionProperties(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/LogAnalyticsDataConnectionProperties.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/LogAnalyticsDataConnectionProperties.cs new file mode 100644 index 000000000000..7a929ec7c081 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/LogAnalyticsDataConnectionProperties.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Analytics.Defender.Easm +{ + /// The LogAnalyticsDataConnectionProperties. + public partial class LogAnalyticsDataConnectionProperties : DataConnectionProperties + { + /// Initializes a new instance of LogAnalyticsDataConnectionProperties. + public LogAnalyticsDataConnectionProperties() + { + } + + /// Initializes a new instance of LogAnalyticsDataConnectionProperties. + /// log analytics api key. + /// log analytics workspace id. + internal LogAnalyticsDataConnectionProperties(string apiKey, string workspaceId) + { + ApiKey = apiKey; + WorkspaceId = workspaceId; + } + + /// log analytics api key. + public string ApiKey { get; set; } + /// log analytics workspace id. + public string WorkspaceId { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedBoolean.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedBoolean.Serialization.cs new file mode 100644 index 000000000000..59fd70dc311f --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedBoolean.Serialization.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class ObservedBoolean : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteBooleanValue(Value.Value); + } + if (Optional.IsCollectionDefined(Sources)) + { + writer.WritePropertyName("sources"u8); + writer.WriteStartArray(); + foreach (var item in Sources) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(Recent)) + { + writer.WritePropertyName("recent"u8); + writer.WriteBooleanValue(Recent.Value); + } + writer.WriteEndObject(); + } + + internal static ObservedBoolean DeserializeObservedBoolean(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional value = default; + Optional> sources = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional count = default; + Optional recent = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + value = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("sources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Source.DeserializeSource(item)); + } + sources = array; + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("recent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + recent = property.Value.GetBoolean(); + continue; + } + } + return new ObservedBoolean(Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(count), Optional.ToNullable(recent), Optional.ToNullable(value), Optional.ToList(sources)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ObservedBoolean FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeObservedBoolean(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedBoolean.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedBoolean.cs new file mode 100644 index 000000000000..2eabea28ad21 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedBoolean.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The ObservedBoolean. + public partial class ObservedBoolean : ObservedValue + { + /// Initializes a new instance of ObservedBoolean. + public ObservedBoolean() + { + Sources = new ChangeTrackingList(); + } + + /// Initializes a new instance of ObservedBoolean. + /// + /// + /// + /// + /// + /// + internal ObservedBoolean(DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count, bool? recent, bool? value, IList sources) : base(firstSeen, lastSeen, count, recent) + { + Value = value; + Sources = sources; + } + + /// Gets or sets the value. + public bool? Value { get; set; } + /// Gets the sources. + public IList Sources { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedHeader.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedHeader.Serialization.cs new file mode 100644 index 000000000000..099716b27688 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedHeader.Serialization.cs @@ -0,0 +1,133 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class ObservedHeader : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(HeaderName)) + { + writer.WritePropertyName("headerName"u8); + writer.WriteStringValue(HeaderName); + } + if (Optional.IsDefined(HeaderValue)) + { + writer.WritePropertyName("headerValue"u8); + writer.WriteStringValue(HeaderValue); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(Recent)) + { + writer.WritePropertyName("recent"u8); + writer.WriteBooleanValue(Recent.Value); + } + writer.WriteEndObject(); + } + + internal static ObservedHeader DeserializeObservedHeader(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional headerName = default; + Optional headerValue = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional count = default; + Optional recent = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("headerName"u8)) + { + headerName = property.Value.GetString(); + continue; + } + if (property.NameEquals("headerValue"u8)) + { + headerValue = property.Value.GetString(); + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("recent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + recent = property.Value.GetBoolean(); + continue; + } + } + return new ObservedHeader(Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(count), Optional.ToNullable(recent), headerName.Value, headerValue.Value); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ObservedHeader FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeObservedHeader(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedHeader.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedHeader.cs new file mode 100644 index 000000000000..20b744522c93 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedHeader.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Analytics.Defender.Easm +{ + /// The ObservedHeader. + public partial class ObservedHeader : ObservedValue + { + /// Initializes a new instance of ObservedHeader. + public ObservedHeader() + { + } + + /// Initializes a new instance of ObservedHeader. + /// + /// + /// + /// + /// + /// + internal ObservedHeader(DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count, bool? recent, string headerName, string headerValue) : base(firstSeen, lastSeen, count, recent) + { + HeaderName = headerName; + HeaderValue = headerValue; + } + + /// Gets or sets the header name. + public string HeaderName { get; set; } + /// Gets or sets the header value. + public string HeaderValue { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedInteger.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedInteger.Serialization.cs new file mode 100644 index 000000000000..254a824127e3 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedInteger.Serialization.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class ObservedInteger : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value.Value); + } + if (Optional.IsCollectionDefined(Sources)) + { + writer.WritePropertyName("sources"u8); + writer.WriteStartArray(); + foreach (var item in Sources) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(Recent)) + { + writer.WritePropertyName("recent"u8); + writer.WriteBooleanValue(Recent.Value); + } + writer.WriteEndObject(); + } + + internal static ObservedInteger DeserializeObservedInteger(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional value = default; + Optional> sources = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional count = default; + Optional recent = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + value = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("sources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Source.DeserializeSource(item)); + } + sources = array; + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("recent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + recent = property.Value.GetBoolean(); + continue; + } + } + return new ObservedInteger(Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(count), Optional.ToNullable(recent), Optional.ToNullable(value), Optional.ToList(sources)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ObservedInteger FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeObservedInteger(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedInteger.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedInteger.cs new file mode 100644 index 000000000000..16c574c643fc --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedInteger.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The ObservedInteger. + public partial class ObservedInteger : ObservedValue + { + /// Initializes a new instance of ObservedInteger. + public ObservedInteger() + { + Sources = new ChangeTrackingList(); + } + + /// Initializes a new instance of ObservedInteger. + /// + /// + /// + /// + /// + /// + internal ObservedInteger(DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count, bool? recent, int? value, IList sources) : base(firstSeen, lastSeen, count, recent) + { + Value = value; + Sources = sources; + } + + /// Gets or sets the value. + public int? Value { get; set; } + /// Gets the sources. + public IList Sources { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedIntegers.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedIntegers.Serialization.cs new file mode 100644 index 000000000000..b8bbc6df7520 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedIntegers.Serialization.cs @@ -0,0 +1,162 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class ObservedIntegers : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Values)) + { + writer.WritePropertyName("values"u8); + writer.WriteStartArray(); + foreach (var item in Values) + { + writer.WriteNumberValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Sources)) + { + writer.WritePropertyName("sources"u8); + writer.WriteStartArray(); + foreach (var item in Sources) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(Recent)) + { + writer.WritePropertyName("recent"u8); + writer.WriteBooleanValue(Recent.Value); + } + writer.WriteEndObject(); + } + + internal static ObservedIntegers DeserializeObservedIntegers(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> values = default; + Optional> sources = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional count = default; + Optional recent = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("values"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetInt32()); + } + values = array; + continue; + } + if (property.NameEquals("sources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Source.DeserializeSource(item)); + } + sources = array; + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("recent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + recent = property.Value.GetBoolean(); + continue; + } + } + return new ObservedIntegers(Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(count), Optional.ToNullable(recent), Optional.ToList(values), Optional.ToList(sources)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ObservedIntegers FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeObservedIntegers(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedIntegers.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedIntegers.cs new file mode 100644 index 000000000000..4d977a6cd33b --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedIntegers.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The ObservedIntegers. + public partial class ObservedIntegers : ObservedValue + { + /// Initializes a new instance of ObservedIntegers. + public ObservedIntegers() + { + Values = new ChangeTrackingList(); + Sources = new ChangeTrackingList(); + } + + /// Initializes a new instance of ObservedIntegers. + /// + /// + /// + /// + /// + /// + internal ObservedIntegers(DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count, bool? recent, IList values, IList sources) : base(firstSeen, lastSeen, count, recent) + { + Values = values; + Sources = sources; + } + + /// Gets the values. + public IList Values { get; } + /// Gets the sources. + public IList Sources { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedLocation.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedLocation.Serialization.cs new file mode 100644 index 000000000000..0eb0903314ab --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedLocation.Serialization.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class ObservedLocation : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteObjectValue(Value); + } + if (Optional.IsCollectionDefined(Sources)) + { + writer.WritePropertyName("sources"u8); + writer.WriteStartArray(); + foreach (var item in Sources) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(Recent)) + { + writer.WritePropertyName("recent"u8); + writer.WriteBooleanValue(Recent.Value); + } + writer.WriteEndObject(); + } + + internal static ObservedLocation DeserializeObservedLocation(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional value = default; + Optional> sources = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional count = default; + Optional recent = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + value = Location.DeserializeLocation(property.Value); + continue; + } + if (property.NameEquals("sources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Source.DeserializeSource(item)); + } + sources = array; + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("recent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + recent = property.Value.GetBoolean(); + continue; + } + } + return new ObservedLocation(Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(count), Optional.ToNullable(recent), value.Value, Optional.ToList(sources)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ObservedLocation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeObservedLocation(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedLocation.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedLocation.cs new file mode 100644 index 000000000000..4018d4ab4955 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedLocation.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The ObservedLocation. + public partial class ObservedLocation : ObservedValue + { + /// Initializes a new instance of ObservedLocation. + public ObservedLocation() + { + Sources = new ChangeTrackingList(); + } + + /// Initializes a new instance of ObservedLocation. + /// + /// + /// + /// + /// + /// + internal ObservedLocation(DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count, bool? recent, Location value, IList sources) : base(firstSeen, lastSeen, count, recent) + { + Value = value; + Sources = sources; + } + + /// Gets or sets the value. + public Location Value { get; set; } + /// Gets the sources. + public IList Sources { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedLong.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedLong.Serialization.cs new file mode 100644 index 000000000000..b4def1816eb5 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedLong.Serialization.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class ObservedLong : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteNumberValue(Value.Value); + } + if (Optional.IsCollectionDefined(Sources)) + { + writer.WritePropertyName("sources"u8); + writer.WriteStartArray(); + foreach (var item in Sources) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(Recent)) + { + writer.WritePropertyName("recent"u8); + writer.WriteBooleanValue(Recent.Value); + } + writer.WriteEndObject(); + } + + internal static ObservedLong DeserializeObservedLong(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional value = default; + Optional> sources = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional count = default; + Optional recent = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + value = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("sources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Source.DeserializeSource(item)); + } + sources = array; + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("recent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + recent = property.Value.GetBoolean(); + continue; + } + } + return new ObservedLong(Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(count), Optional.ToNullable(recent), Optional.ToNullable(value), Optional.ToList(sources)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ObservedLong FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeObservedLong(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedLong.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedLong.cs new file mode 100644 index 000000000000..af49ca925748 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedLong.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The ObservedLong. + public partial class ObservedLong : ObservedValue + { + /// Initializes a new instance of ObservedLong. + public ObservedLong() + { + Sources = new ChangeTrackingList(); + } + + /// Initializes a new instance of ObservedLong. + /// + /// + /// + /// + /// + /// + internal ObservedLong(DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count, bool? recent, long? value, IList sources) : base(firstSeen, lastSeen, count, recent) + { + Value = value; + Sources = sources; + } + + /// Gets or sets the value. + public long? Value { get; set; } + /// Gets the sources. + public IList Sources { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedPortState.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedPortState.Serialization.cs new file mode 100644 index 000000000000..f9e392586bcb --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedPortState.Serialization.cs @@ -0,0 +1,141 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class ObservedPortState : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value.Value.ToString()); + } + if (Optional.IsDefined(Port)) + { + writer.WritePropertyName("port"u8); + writer.WriteNumberValue(Port.Value); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(Recent)) + { + writer.WritePropertyName("recent"u8); + writer.WriteBooleanValue(Recent.Value); + } + writer.WriteEndObject(); + } + + internal static ObservedPortState DeserializeObservedPortState(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional value = default; + Optional port = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional count = default; + Optional recent = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + value = new ObservedPortStateValue(property.Value.GetString()); + continue; + } + if (property.NameEquals("port"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + port = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("recent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + recent = property.Value.GetBoolean(); + continue; + } + } + return new ObservedPortState(Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(count), Optional.ToNullable(recent), Optional.ToNullable(value), Optional.ToNullable(port)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ObservedPortState FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeObservedPortState(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedPortState.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedPortState.cs new file mode 100644 index 000000000000..20e9232c998f --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedPortState.cs @@ -0,0 +1,38 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Analytics.Defender.Easm +{ + /// The ObservedPortState. + public partial class ObservedPortState : ObservedValue + { + /// Initializes a new instance of ObservedPortState. + public ObservedPortState() + { + } + + /// Initializes a new instance of ObservedPortState. + /// + /// + /// + /// + /// + /// + internal ObservedPortState(DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count, bool? recent, ObservedPortStateValue? value, int? port) : base(firstSeen, lastSeen, count, recent) + { + Value = value; + Port = port; + } + + /// Gets or sets the value. + public ObservedPortStateValue? Value { get; set; } + /// Gets or sets the port. + public int? Port { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedPortStateValue.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedPortStateValue.cs new file mode 100644 index 000000000000..d5c27f9db5aa --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedPortStateValue.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Analytics.Defender.Easm +{ + public readonly partial struct ObservedPortStateValue : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ObservedPortStateValue(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string OpenValue = "open"; + private const string ClosedValue = "closed"; + private const string FilteredValue = "filtered"; + + /// open. + public static ObservedPortStateValue Open { get; } = new ObservedPortStateValue(OpenValue); + /// closed. + public static ObservedPortStateValue Closed { get; } = new ObservedPortStateValue(ClosedValue); + /// filtered. + public static ObservedPortStateValue Filtered { get; } = new ObservedPortStateValue(FilteredValue); + /// Determines if two values are the same. + public static bool operator ==(ObservedPortStateValue left, ObservedPortStateValue right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ObservedPortStateValue left, ObservedPortStateValue right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ObservedPortStateValue(string value) => new ObservedPortStateValue(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ObservedPortStateValue other && Equals(other); + /// + public bool Equals(ObservedPortStateValue other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedString.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedString.Serialization.cs new file mode 100644 index 000000000000..7c3e36c9e780 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedString.Serialization.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class ObservedString : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (Optional.IsCollectionDefined(Sources)) + { + writer.WritePropertyName("sources"u8); + writer.WriteStartArray(); + foreach (var item in Sources) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(Recent)) + { + writer.WritePropertyName("recent"u8); + writer.WriteBooleanValue(Recent.Value); + } + writer.WriteEndObject(); + } + + internal static ObservedString DeserializeObservedString(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional value = default; + Optional> sources = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional count = default; + Optional recent = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (property.NameEquals("sources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Source.DeserializeSource(item)); + } + sources = array; + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("recent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + recent = property.Value.GetBoolean(); + continue; + } + } + return new ObservedString(Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(count), Optional.ToNullable(recent), value.Value, Optional.ToList(sources)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ObservedString FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeObservedString(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedString.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedString.cs new file mode 100644 index 000000000000..364594992da6 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedString.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The ObservedString. + public partial class ObservedString : ObservedValue + { + /// Initializes a new instance of ObservedString. + public ObservedString() + { + Sources = new ChangeTrackingList(); + } + + /// Initializes a new instance of ObservedString. + /// + /// + /// + /// + /// + /// + internal ObservedString(DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count, bool? recent, string value, IList sources) : base(firstSeen, lastSeen, count, recent) + { + Value = value; + Sources = sources; + } + + /// Gets or sets the value. + public string Value { get; set; } + /// Gets the sources. + public IList Sources { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedValue.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedValue.cs new file mode 100644 index 000000000000..3cc824df48f7 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservedValue.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Analytics.Defender.Easm +{ + /// Template model for observed values. + public partial class ObservedValue + { + /// Initializes a new instance of ObservedValue. + internal ObservedValue() + { + } + + /// Initializes a new instance of ObservedValue. + /// + /// + /// + /// + internal ObservedValue(DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count, bool? recent) + { + FirstSeen = firstSeen; + LastSeen = lastSeen; + Count = count; + Recent = recent; + } + + /// Gets the first seen. + public DateTimeOffset? FirstSeen { get; } + /// Gets the last seen. + public DateTimeOffset? LastSeen { get; } + /// Gets the count. + public long? Count { get; } + /// Gets the recent. + public bool? Recent { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/PageAsset.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/PageAsset.Serialization.cs new file mode 100644 index 000000000000..3f52df31316c --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/PageAsset.Serialization.cs @@ -0,0 +1,1403 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class PageAsset : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Url)) + { + writer.WritePropertyName("url"u8); + writer.WriteStringValue(Url.AbsoluteUri); + } + if (Optional.IsDefined(HttpMethod)) + { + writer.WritePropertyName("httpMethod"u8); + writer.WriteStringValue(HttpMethod); + } + if (Optional.IsDefined(Service)) + { + writer.WritePropertyName("service"u8); + writer.WriteStringValue(Service); + } + if (Optional.IsCollectionDefined(IpAddresses)) + { + writer.WritePropertyName("ipAddresses"u8); + writer.WriteStartArray(); + foreach (var item in IpAddresses) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Successful)) + { + writer.WritePropertyName("successful"u8); + writer.WriteStartArray(); + foreach (var item in Successful) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(HttpResponseCodes)) + { + writer.WritePropertyName("httpResponseCodes"u8); + writer.WriteStartArray(); + foreach (var item in HttpResponseCodes) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(HttpResponseMessages)) + { + writer.WritePropertyName("httpResponseMessages"u8); + writer.WriteStartArray(); + foreach (var item in HttpResponseMessages) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ResponseTimes)) + { + writer.WritePropertyName("responseTimes"u8); + writer.WriteStartArray(); + foreach (var item in ResponseTimes) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Frames)) + { + writer.WritePropertyName("frames"u8); + writer.WriteStartArray(); + foreach (var item in Frames) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Windows)) + { + writer.WritePropertyName("windows"u8); + writer.WriteStartArray(); + foreach (var item in Windows) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(NonHtmlFrames)) + { + writer.WritePropertyName("nonHtmlFrames"u8); + writer.WriteStartArray(); + foreach (var item in NonHtmlFrames) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(UndirectedContent)) + { + writer.WritePropertyName("undirectedContent"u8); + writer.WriteStartArray(); + foreach (var item in UndirectedContent) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ContentTypes)) + { + writer.WritePropertyName("contentTypes"u8); + writer.WriteStartArray(); + foreach (var item in ContentTypes) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ContentLengths)) + { + writer.WritePropertyName("contentLengths"u8); + writer.WriteStartArray(); + foreach (var item in ContentLengths) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(WindowNames)) + { + writer.WritePropertyName("windowNames"u8); + writer.WriteStartArray(); + foreach (var item in WindowNames) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Charsets)) + { + writer.WritePropertyName("charsets"u8); + writer.WriteStartArray(); + foreach (var item in Charsets) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Titles)) + { + writer.WritePropertyName("titles"u8); + writer.WriteStartArray(); + foreach (var item in Titles) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Languages)) + { + writer.WritePropertyName("languages"u8); + writer.WriteStartArray(); + foreach (var item in Languages) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ResponseHeaders)) + { + writer.WritePropertyName("responseHeaders"u8); + writer.WriteStartArray(); + foreach (var item in ResponseHeaders) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Cookies)) + { + writer.WritePropertyName("cookies"u8); + writer.WriteStartArray(); + foreach (var item in Cookies) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(WebComponents)) + { + writer.WritePropertyName("webComponents"u8); + writer.WriteStartArray(); + foreach (var item in WebComponents) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Attributes)) + { + writer.WritePropertyName("attributes"u8); + writer.WriteStartArray(); + foreach (var item in Attributes) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(AssetSecurityPolicies)) + { + writer.WritePropertyName("assetSecurityPolicies"u8); + writer.WriteStartArray(); + foreach (var item in AssetSecurityPolicies) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ResponseBodyMinhashSignatures)) + { + writer.WritePropertyName("responseBodyMinhashSignatures"u8); + writer.WriteStartArray(); + foreach (var item in ResponseBodyMinhashSignatures) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(FullDomMinhashSignatures)) + { + writer.WritePropertyName("fullDomMinhashSignatures"u8); + writer.WriteStartArray(); + foreach (var item in FullDomMinhashSignatures) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ResponseBodyHashSignatures)) + { + writer.WritePropertyName("responseBodyHashSignatures"u8); + writer.WriteStartArray(); + foreach (var item in ResponseBodyHashSignatures) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Errors)) + { + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(SslCerts)) + { + writer.WritePropertyName("sslCerts"u8); + writer.WriteStartArray(); + foreach (var item in SslCerts) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Sources)) + { + writer.WritePropertyName("sources"u8); + writer.WriteStartArray(); + foreach (var item in Sources) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(Cause)) + { + writer.WritePropertyName("cause"u8); + writer.WriteObjectValue(Cause); + } + if (Optional.IsDefined(Referrer)) + { + writer.WritePropertyName("referrer"u8); + writer.WriteStringValue(Referrer); + } + if (Optional.IsCollectionDefined(RedirectUrls)) + { + writer.WritePropertyName("redirectUrls"u8); + writer.WriteStartArray(); + foreach (var item in RedirectUrls) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(RedirectType)) + { + writer.WritePropertyName("redirectType"u8); + writer.WriteStringValue(RedirectType.Value.ToString()); + } + if (Optional.IsCollectionDefined(FinalUrls)) + { + writer.WritePropertyName("finalUrls"u8); + writer.WriteStartArray(); + foreach (var item in FinalUrls) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(FinalResponseCodes)) + { + writer.WritePropertyName("finalResponseCodes"u8); + writer.WriteStartArray(); + foreach (var item in FinalResponseCodes) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ParkedPage)) + { + writer.WritePropertyName("parkedPage"u8); + writer.WriteStartArray(); + foreach (var item in ParkedPage) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ResourceUrls)) + { + writer.WritePropertyName("resourceUrls"u8); + writer.WriteStartArray(); + foreach (var item in ResourceUrls) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Guids)) + { + writer.WritePropertyName("guids"u8); + writer.WriteStartArray(); + foreach (var item in Guids) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(FinalIpAddresses)) + { + writer.WritePropertyName("finalIpAddresses"u8); + writer.WriteStartArray(); + foreach (var item in FinalIpAddresses) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Asns)) + { + writer.WritePropertyName("asns"u8); + writer.WriteStartArray(); + foreach (var item in Asns) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(IpBlocks)) + { + writer.WritePropertyName("ipBlocks"u8); + writer.WriteStartArray(); + foreach (var item in IpBlocks) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(FinalAsns)) + { + writer.WritePropertyName("finalAsns"u8); + writer.WriteStartArray(); + foreach (var item in FinalAsns) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(FinalIpBlocks)) + { + writer.WritePropertyName("finalIpBlocks"u8); + writer.WriteStartArray(); + foreach (var item in FinalIpBlocks) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(ResponseBodies)) + { + writer.WritePropertyName("responseBodies"u8); + writer.WriteStartArray(); + foreach (var item in ResponseBodies) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(DomainAsset)) + { + writer.WritePropertyName("domainAsset"u8); + writer.WriteObjectValue(DomainAsset); + } + if (Optional.IsDefined(RootUrl)) + { + writer.WritePropertyName("rootUrl"u8); + writer.WriteObjectValue(RootUrl); + } + if (Optional.IsDefined(IsRootUrl)) + { + writer.WritePropertyName("isRootUrl"u8); + writer.WriteBooleanValue(IsRootUrl.Value); + } + if (Optional.IsCollectionDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStartArray(); + foreach (var item in Location) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Services)) + { + writer.WritePropertyName("services"u8); + writer.WriteStartArray(); + foreach (var item in Services) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(SiteStatus)) + { + writer.WritePropertyName("siteStatus"u8); + writer.WriteStringValue(SiteStatus); + } + if (Optional.IsCollectionDefined(Cnames)) + { + writer.WritePropertyName("cnames"u8); + writer.WriteStartArray(); + foreach (var item in Cnames) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Cdns)) + { + writer.WritePropertyName("cdns"u8); + writer.WriteStartArray(); + foreach (var item in Cdns) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Host)) + { + writer.WritePropertyName("host"u8); + writer.WriteStringValue(Host); + } + if (Optional.IsDefined(Domain)) + { + writer.WritePropertyName("domain"u8); + writer.WriteStringValue(Domain); + } + if (Optional.IsCollectionDefined(SslServerConfig)) + { + writer.WritePropertyName("sslServerConfig"u8); + writer.WriteStartArray(); + foreach (var item in SslServerConfig) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(GdprAssetSecurityPolicies)) + { + writer.WritePropertyName("gdprAssetSecurityPolicies"u8); + writer.WriteStartArray(); + foreach (var item in GdprAssetSecurityPolicies) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Ipv4)) + { + writer.WritePropertyName("ipv4"u8); + writer.WriteStartArray(); + foreach (var item in Ipv4) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Ipv6)) + { + writer.WritePropertyName("ipv6"u8); + writer.WriteStartArray(); + foreach (var item in Ipv6) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static PageAsset DeserializePageAsset(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional url = default; + Optional httpMethod = default; + Optional service = default; + Optional> ipAddresses = default; + Optional> successful = default; + Optional> httpResponseCodes = default; + Optional> httpResponseMessages = default; + Optional> responseTimes = default; + Optional> frames = default; + Optional> windows = default; + Optional> nonHtmlFrames = default; + Optional> undirectedContent = default; + Optional> contentTypes = default; + Optional> contentLengths = default; + Optional> windowNames = default; + Optional> charsets = default; + Optional> titles = default; + Optional> languages = default; + Optional> responseHeaders = default; + Optional> cookies = default; + Optional> webComponents = default; + Optional> attributes = default; + Optional> assetSecurityPolicies = default; + Optional> responseBodyMinhashSignatures = default; + Optional> fullDomMinhashSignatures = default; + Optional> responseBodyHashSignatures = default; + Optional> errors = default; + Optional> sslCerts = default; + Optional> sources = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional count = default; + Optional cause = default; + Optional referrer = default; + Optional> redirectUrls = default; + Optional redirectType = default; + Optional> finalUrls = default; + Optional> finalResponseCodes = default; + Optional> parkedPage = default; + Optional> resourceUrls = default; + Optional> guids = default; + Optional> finalIpAddresses = default; + Optional> asns = default; + Optional> ipBlocks = default; + Optional> finalAsns = default; + Optional> finalIpBlocks = default; + Optional> responseBodies = default; + Optional domainAsset = default; + Optional rootUrl = default; + Optional isRootUrl = default; + Optional> location = default; + Optional> services = default; + Optional siteStatus = default; + Optional> cnames = default; + Optional> cdns = default; + Optional host = default; + Optional domain = default; + Optional> sslServerConfig = default; + Optional> gdprAssetSecurityPolicies = default; + Optional> ipv4 = default; + Optional> ipv6 = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("url"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + url = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("httpMethod"u8)) + { + httpMethod = property.Value.GetString(); + continue; + } + if (property.NameEquals("service"u8)) + { + service = property.Value.GetString(); + continue; + } + if (property.NameEquals("ipAddresses"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + ipAddresses = array; + continue; + } + if (property.NameEquals("successful"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedBoolean.DeserializeObservedBoolean(item)); + } + successful = array; + continue; + } + if (property.NameEquals("httpResponseCodes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedInteger.DeserializeObservedInteger(item)); + } + httpResponseCodes = array; + continue; + } + if (property.NameEquals("httpResponseMessages"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + httpResponseMessages = array; + continue; + } + if (property.NameEquals("responseTimes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedLong.DeserializeObservedLong(item)); + } + responseTimes = array; + continue; + } + if (property.NameEquals("frames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedBoolean.DeserializeObservedBoolean(item)); + } + frames = array; + continue; + } + if (property.NameEquals("windows"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedBoolean.DeserializeObservedBoolean(item)); + } + windows = array; + continue; + } + if (property.NameEquals("nonHtmlFrames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedBoolean.DeserializeObservedBoolean(item)); + } + nonHtmlFrames = array; + continue; + } + if (property.NameEquals("undirectedContent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedBoolean.DeserializeObservedBoolean(item)); + } + undirectedContent = array; + continue; + } + if (property.NameEquals("contentTypes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + contentTypes = array; + continue; + } + if (property.NameEquals("contentLengths"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedLong.DeserializeObservedLong(item)); + } + contentLengths = array; + continue; + } + if (property.NameEquals("windowNames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + windowNames = array; + continue; + } + if (property.NameEquals("charsets"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + charsets = array; + continue; + } + if (property.NameEquals("titles"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + titles = array; + continue; + } + if (property.NameEquals("languages"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + languages = array; + continue; + } + if (property.NameEquals("responseHeaders"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedHeader.DeserializeObservedHeader(item)); + } + responseHeaders = array; + continue; + } + if (property.NameEquals("cookies"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Cookie.DeserializeCookie(item)); + } + cookies = array; + continue; + } + if (property.NameEquals("webComponents"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(WebComponent.DeserializeWebComponent(item)); + } + webComponents = array; + continue; + } + if (property.NameEquals("attributes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Attribute.DeserializeAttribute(item)); + } + attributes = array; + continue; + } + if (property.NameEquals("assetSecurityPolicies"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AssetSecurityPolicy.DeserializeAssetSecurityPolicy(item)); + } + assetSecurityPolicies = array; + continue; + } + if (property.NameEquals("responseBodyMinhashSignatures"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedIntegers.DeserializeObservedIntegers(item)); + } + responseBodyMinhashSignatures = array; + continue; + } + if (property.NameEquals("fullDomMinhashSignatures"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedIntegers.DeserializeObservedIntegers(item)); + } + fullDomMinhashSignatures = array; + continue; + } + if (property.NameEquals("responseBodyHashSignatures"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + responseBodyHashSignatures = array; + continue; + } + if (property.NameEquals("errors"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + errors = array; + continue; + } + if (property.NameEquals("sslCerts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SslCertAsset.DeserializeSslCertAsset(item)); + } + sslCerts = array; + continue; + } + if (property.NameEquals("sources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Source.DeserializeSource(item)); + } + sources = array; + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("cause"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + cause = PageCause.DeserializePageCause(property.Value); + continue; + } + if (property.NameEquals("referrer"u8)) + { + referrer = property.Value.GetString(); + continue; + } + if (property.NameEquals("redirectUrls"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + redirectUrls = array; + continue; + } + if (property.NameEquals("redirectType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + redirectType = new PageAssetRedirectType(property.Value.GetString()); + continue; + } + if (property.NameEquals("finalUrls"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + finalUrls = array; + continue; + } + if (property.NameEquals("finalResponseCodes"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedInteger.DeserializeObservedInteger(item)); + } + finalResponseCodes = array; + continue; + } + if (property.NameEquals("parkedPage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedBoolean.DeserializeObservedBoolean(item)); + } + parkedPage = array; + continue; + } + if (property.NameEquals("resourceUrls"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ResourceUrl.DeserializeResourceUrl(item)); + } + resourceUrls = array; + continue; + } + if (property.NameEquals("guids"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(GuidPair.DeserializeGuidPair(item)); + } + guids = array; + continue; + } + if (property.NameEquals("finalIpAddresses"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + finalIpAddresses = array; + continue; + } + if (property.NameEquals("asns"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedLong.DeserializeObservedLong(item)); + } + asns = array; + continue; + } + if (property.NameEquals("ipBlocks"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(IpBlock.DeserializeIpBlock(item)); + } + ipBlocks = array; + continue; + } + if (property.NameEquals("finalAsns"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedLong.DeserializeObservedLong(item)); + } + finalAsns = array; + continue; + } + if (property.NameEquals("finalIpBlocks"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(IpBlock.DeserializeIpBlock(item)); + } + finalIpBlocks = array; + continue; + } + if (property.NameEquals("responseBodies"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + responseBodies = array; + continue; + } + if (property.NameEquals("domainAsset"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + domainAsset = DomainAsset.DeserializeDomainAsset(property.Value); + continue; + } + if (property.NameEquals("rootUrl"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + rootUrl = ObservedBoolean.DeserializeObservedBoolean(property.Value); + continue; + } + if (property.NameEquals("isRootUrl"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + isRootUrl = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("location"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedLocation.DeserializeObservedLocation(item)); + } + location = array; + continue; + } + if (property.NameEquals("services"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Easm.Service.DeserializeService(item)); + } + services = array; + continue; + } + if (property.NameEquals("siteStatus"u8)) + { + siteStatus = property.Value.GetString(); + continue; + } + if (property.NameEquals("cnames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + cnames = array; + continue; + } + if (property.NameEquals("cdns"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + cdns = array; + continue; + } + if (property.NameEquals("host"u8)) + { + host = property.Value.GetString(); + continue; + } + if (property.NameEquals("domain"u8)) + { + domain = property.Value.GetString(); + continue; + } + if (property.NameEquals("sslServerConfig"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Easm.SslServerConfig.DeserializeSslServerConfig(item)); + } + sslServerConfig = array; + continue; + } + if (property.NameEquals("gdprAssetSecurityPolicies"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AssetSecurityPolicy.DeserializeAssetSecurityPolicy(item)); + } + gdprAssetSecurityPolicies = array; + continue; + } + if (property.NameEquals("ipv4"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedBoolean.DeserializeObservedBoolean(item)); + } + ipv4 = array; + continue; + } + if (property.NameEquals("ipv6"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedBoolean.DeserializeObservedBoolean(item)); + } + ipv6 = array; + continue; + } + } + return new PageAsset(url.Value, httpMethod.Value, service.Value, Optional.ToList(ipAddresses), Optional.ToList(successful), Optional.ToList(httpResponseCodes), Optional.ToList(httpResponseMessages), Optional.ToList(responseTimes), Optional.ToList(frames), Optional.ToList(windows), Optional.ToList(nonHtmlFrames), Optional.ToList(undirectedContent), Optional.ToList(contentTypes), Optional.ToList(contentLengths), Optional.ToList(windowNames), Optional.ToList(charsets), Optional.ToList(titles), Optional.ToList(languages), Optional.ToList(responseHeaders), Optional.ToList(cookies), Optional.ToList(webComponents), Optional.ToList(attributes), Optional.ToList(assetSecurityPolicies), Optional.ToList(responseBodyMinhashSignatures), Optional.ToList(fullDomMinhashSignatures), Optional.ToList(responseBodyHashSignatures), Optional.ToList(errors), Optional.ToList(sslCerts), Optional.ToList(sources), Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(count), cause.Value, referrer.Value, Optional.ToList(redirectUrls), Optional.ToNullable(redirectType), Optional.ToList(finalUrls), Optional.ToList(finalResponseCodes), Optional.ToList(parkedPage), Optional.ToList(resourceUrls), Optional.ToList(guids), Optional.ToList(finalIpAddresses), Optional.ToList(asns), Optional.ToList(ipBlocks), Optional.ToList(finalAsns), Optional.ToList(finalIpBlocks), Optional.ToList(responseBodies), domainAsset.Value, rootUrl.Value, Optional.ToNullable(isRootUrl), Optional.ToList(location), Optional.ToList(services), siteStatus.Value, Optional.ToList(cnames), Optional.ToList(cdns), host.Value, domain.Value, Optional.ToList(sslServerConfig), Optional.ToList(gdprAssetSecurityPolicies), Optional.ToList(ipv4), Optional.ToList(ipv6)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static PageAsset FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializePageAsset(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/PageAsset.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/PageAsset.cs new file mode 100644 index 000000000000..f10ee7c54633 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/PageAsset.cs @@ -0,0 +1,318 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The PageAsset. + public partial class PageAsset : InventoryAsset + { + /// Initializes a new instance of PageAsset. + public PageAsset() + { + IpAddresses = new ChangeTrackingList(); + Successful = new ChangeTrackingList(); + HttpResponseCodes = new ChangeTrackingList(); + HttpResponseMessages = new ChangeTrackingList(); + ResponseTimes = new ChangeTrackingList(); + Frames = new ChangeTrackingList(); + Windows = new ChangeTrackingList(); + NonHtmlFrames = new ChangeTrackingList(); + UndirectedContent = new ChangeTrackingList(); + ContentTypes = new ChangeTrackingList(); + ContentLengths = new ChangeTrackingList(); + WindowNames = new ChangeTrackingList(); + Charsets = new ChangeTrackingList(); + Titles = new ChangeTrackingList(); + Languages = new ChangeTrackingList(); + ResponseHeaders = new ChangeTrackingList(); + Cookies = new ChangeTrackingList(); + WebComponents = new ChangeTrackingList(); + Attributes = new ChangeTrackingList(); + AssetSecurityPolicies = new ChangeTrackingList(); + ResponseBodyMinhashSignatures = new ChangeTrackingList(); + FullDomMinhashSignatures = new ChangeTrackingList(); + ResponseBodyHashSignatures = new ChangeTrackingList(); + Errors = new ChangeTrackingList(); + SslCerts = new ChangeTrackingList(); + Sources = new ChangeTrackingList(); + RedirectUrls = new ChangeTrackingList(); + FinalUrls = new ChangeTrackingList(); + FinalResponseCodes = new ChangeTrackingList(); + ParkedPage = new ChangeTrackingList(); + ResourceUrls = new ChangeTrackingList(); + Guids = new ChangeTrackingList(); + FinalIpAddresses = new ChangeTrackingList(); + Asns = new ChangeTrackingList(); + IpBlocks = new ChangeTrackingList(); + FinalAsns = new ChangeTrackingList(); + FinalIpBlocks = new ChangeTrackingList(); + ResponseBodies = new ChangeTrackingList(); + Location = new ChangeTrackingList(); + Services = new ChangeTrackingList(); + Cnames = new ChangeTrackingList(); + Cdns = new ChangeTrackingList(); + SslServerConfig = new ChangeTrackingList(); + GdprAssetSecurityPolicies = new ChangeTrackingList(); + Ipv4 = new ChangeTrackingList(); + Ipv6 = new ChangeTrackingList(); + } + + /// Initializes a new instance of PageAsset. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + internal PageAsset(Uri url, string httpMethod, string service, IList ipAddresses, IList successful, IList httpResponseCodes, IList httpResponseMessages, IList responseTimes, IList frames, IList windows, IList nonHtmlFrames, IList undirectedContent, IList contentTypes, IList contentLengths, IList windowNames, IList charsets, IList titles, IList languages, IList responseHeaders, IList cookies, IList webComponents, IList attributes, IList assetSecurityPolicies, IList responseBodyMinhashSignatures, IList fullDomMinhashSignatures, IList responseBodyHashSignatures, IList errors, IList sslCerts, IList sources, DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count, PageCause cause, string referrer, IList redirectUrls, PageAssetRedirectType? redirectType, IList finalUrls, IList finalResponseCodes, IList parkedPage, IList resourceUrls, IList guids, IList finalIpAddresses, IList asns, IList ipBlocks, IList finalAsns, IList finalIpBlocks, IList responseBodies, DomainAsset domainAsset, ObservedBoolean rootUrl, bool? isRootUrl, IList location, IList services, string siteStatus, IList cnames, IList cdns, string host, string domain, IList sslServerConfig, IList gdprAssetSecurityPolicies, IList ipv4, IList ipv6) + { + Url = url; + HttpMethod = httpMethod; + Service = service; + IpAddresses = ipAddresses; + Successful = successful; + HttpResponseCodes = httpResponseCodes; + HttpResponseMessages = httpResponseMessages; + ResponseTimes = responseTimes; + Frames = frames; + Windows = windows; + NonHtmlFrames = nonHtmlFrames; + UndirectedContent = undirectedContent; + ContentTypes = contentTypes; + ContentLengths = contentLengths; + WindowNames = windowNames; + Charsets = charsets; + Titles = titles; + Languages = languages; + ResponseHeaders = responseHeaders; + Cookies = cookies; + WebComponents = webComponents; + Attributes = attributes; + AssetSecurityPolicies = assetSecurityPolicies; + ResponseBodyMinhashSignatures = responseBodyMinhashSignatures; + FullDomMinhashSignatures = fullDomMinhashSignatures; + ResponseBodyHashSignatures = responseBodyHashSignatures; + Errors = errors; + SslCerts = sslCerts; + Sources = sources; + FirstSeen = firstSeen; + LastSeen = lastSeen; + Count = count; + Cause = cause; + Referrer = referrer; + RedirectUrls = redirectUrls; + RedirectType = redirectType; + FinalUrls = finalUrls; + FinalResponseCodes = finalResponseCodes; + ParkedPage = parkedPage; + ResourceUrls = resourceUrls; + Guids = guids; + FinalIpAddresses = finalIpAddresses; + Asns = asns; + IpBlocks = ipBlocks; + FinalAsns = finalAsns; + FinalIpBlocks = finalIpBlocks; + ResponseBodies = responseBodies; + DomainAsset = domainAsset; + RootUrl = rootUrl; + IsRootUrl = isRootUrl; + Location = location; + Services = services; + SiteStatus = siteStatus; + Cnames = cnames; + Cdns = cdns; + Host = host; + Domain = domain; + SslServerConfig = sslServerConfig; + GdprAssetSecurityPolicies = gdprAssetSecurityPolicies; + Ipv4 = ipv4; + Ipv6 = ipv6; + } + + /// Gets or sets the url. + public Uri Url { get; set; } + /// Gets or sets the http method. + public string HttpMethod { get; set; } + /// Gets or sets the service. + public string Service { get; set; } + /// Gets the ip addresses. + public IList IpAddresses { get; } + /// Gets the successful. + public IList Successful { get; } + /// Gets the http response codes. + public IList HttpResponseCodes { get; } + /// Gets the http response messages. + public IList HttpResponseMessages { get; } + /// Gets the response times. + public IList ResponseTimes { get; } + /// Gets the frames. + public IList Frames { get; } + /// Gets the windows. + public IList Windows { get; } + /// Gets the non html frames. + public IList NonHtmlFrames { get; } + /// Gets the undirected content. + public IList UndirectedContent { get; } + /// Gets the content types. + public IList ContentTypes { get; } + /// Gets the content lengths. + public IList ContentLengths { get; } + /// Gets the window names. + public IList WindowNames { get; } + /// Gets the charsets. + public IList Charsets { get; } + /// Gets the titles. + public IList Titles { get; } + /// Gets the languages. + public IList Languages { get; } + /// Gets the response headers. + public IList ResponseHeaders { get; } + /// Gets the cookies. + public IList Cookies { get; } + /// Gets the web components. + public IList WebComponents { get; } + /// Gets the attributes. + public IList Attributes { get; } + /// Gets the asset security policies. + public IList AssetSecurityPolicies { get; } + /// Gets the response body minhash signatures. + public IList ResponseBodyMinhashSignatures { get; } + /// Gets the full dom minhash signatures. + public IList FullDomMinhashSignatures { get; } + /// Gets the response body hash signatures. + public IList ResponseBodyHashSignatures { get; } + /// Gets the errors. + public IList Errors { get; } + /// Gets the ssl certs. + public IList SslCerts { get; } + /// Gets the sources. + public IList Sources { get; } + /// Gets or sets the first seen. + public DateTimeOffset? FirstSeen { get; set; } + /// Gets or sets the last seen. + public DateTimeOffset? LastSeen { get; set; } + /// Gets or sets the count. + public long? Count { get; set; } + /// Gets or sets the cause. + public PageCause Cause { get; set; } + /// Gets or sets the referrer. + public string Referrer { get; set; } + /// Gets the redirect urls. + public IList RedirectUrls { get; } + /// Gets or sets the redirect type. + public PageAssetRedirectType? RedirectType { get; set; } + /// Gets the final urls. + public IList FinalUrls { get; } + /// Gets the final response codes. + public IList FinalResponseCodes { get; } + /// Gets the parked page. + public IList ParkedPage { get; } + /// Gets the resource urls. + public IList ResourceUrls { get; } + /// Gets the guids. + public IList Guids { get; } + /// Gets the final ip addresses. + public IList FinalIpAddresses { get; } + /// Gets the asns. + public IList Asns { get; } + /// Gets the ip blocks. + public IList IpBlocks { get; } + /// Gets the final asns. + public IList FinalAsns { get; } + /// Gets the final ip blocks. + public IList FinalIpBlocks { get; } + /// Gets the response bodies. + public IList ResponseBodies { get; } + /// Gets or sets the domain asset. + public DomainAsset DomainAsset { get; set; } + /// Gets or sets the root url. + public ObservedBoolean RootUrl { get; set; } + /// Gets or sets the is root url. + public bool? IsRootUrl { get; set; } + /// Gets the location. + public IList Location { get; } + /// Gets the services. + public IList Services { get; } + /// Gets or sets the site status. + public string SiteStatus { get; set; } + /// Gets the cnames. + public IList Cnames { get; } + /// Gets the cdns. + public IList Cdns { get; } + /// Gets or sets the host. + public string Host { get; set; } + /// Gets or sets the domain. + public string Domain { get; set; } + /// Gets the ssl server config. + public IList SslServerConfig { get; } + /// Gets the gdpr asset security policies. + public IList GdprAssetSecurityPolicies { get; } + /// Gets the ipv 4. + public IList Ipv4 { get; } + /// Gets the ipv 6. + public IList Ipv6 { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/PageAssetRedirectType.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/PageAssetRedirectType.cs new file mode 100644 index 000000000000..28f1d4d7356f --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/PageAssetRedirectType.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Analytics.Defender.Easm +{ + public readonly partial struct PageAssetRedirectType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PageAssetRedirectType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string HttpHeaderValue = "httpHeader"; + private const string MetaRefreshValue = "metaRefresh"; + private const string JavascriptValue = "javascript"; + private const string FinalValue = "final"; + + /// httpHeader. + public static PageAssetRedirectType HttpHeader { get; } = new PageAssetRedirectType(HttpHeaderValue); + /// metaRefresh. + public static PageAssetRedirectType MetaRefresh { get; } = new PageAssetRedirectType(MetaRefreshValue); + /// javascript. + public static PageAssetRedirectType Javascript { get; } = new PageAssetRedirectType(JavascriptValue); + /// final. + public static PageAssetRedirectType Final { get; } = new PageAssetRedirectType(FinalValue); + /// Determines if two values are the same. + public static bool operator ==(PageAssetRedirectType left, PageAssetRedirectType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PageAssetRedirectType left, PageAssetRedirectType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator PageAssetRedirectType(string value) => new PageAssetRedirectType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PageAssetRedirectType other && Equals(other); + /// + public bool Equals(PageAssetRedirectType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/PageAssetResource.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/PageAssetResource.Serialization.cs new file mode 100644 index 000000000000..242161408591 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/PageAssetResource.Serialization.cs @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class PageAssetResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("asset"u8); + writer.WriteObjectValue(Asset); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Uuid)) + { + writer.WritePropertyName("uuid"u8); + writer.WriteStringValue(Uuid.Value); + } + if (Optional.IsDefined(CreatedDate)) + { + writer.WritePropertyName("createdDate"u8); + writer.WriteStringValue(CreatedDate.Value, "O"); + } + if (Optional.IsDefined(UpdatedDate)) + { + writer.WritePropertyName("updatedDate"u8); + writer.WriteStringValue(UpdatedDate.Value, "O"); + } + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"u8); + writer.WriteStringValue(State.Value.ToString()); + } + if (Optional.IsDefined(ExternalId)) + { + writer.WritePropertyName("externalId"u8); + writer.WriteStringValue(ExternalId); + } + if (Optional.IsCollectionDefined(Labels)) + { + writer.WritePropertyName("labels"u8); + writer.WriteStartArray(); + foreach (var item in Labels) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Wildcard)) + { + writer.WritePropertyName("wildcard"u8); + writer.WriteBooleanValue(Wildcard.Value); + } + if (Optional.IsDefined(DiscoGroupName)) + { + writer.WritePropertyName("discoGroupName"u8); + writer.WriteStringValue(DiscoGroupName); + } + if (Optional.IsCollectionDefined(AuditTrail)) + { + writer.WritePropertyName("auditTrail"u8); + writer.WriteStartArray(); + foreach (var item in AuditTrail) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Reason)) + { + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason); + } + writer.WriteEndObject(); + } + + internal static PageAssetResource DeserializePageAssetResource(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + PageAsset asset = default; + string kind = default; + string id = default; + Optional name = default; + Optional displayName = default; + Optional uuid = default; + Optional createdDate = default; + Optional updatedDate = default; + Optional state = default; + Optional externalId = default; + Optional> labels = default; + Optional wildcard = default; + Optional discoGroupName = default; + Optional> auditTrail = default; + Optional reason = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("asset"u8)) + { + asset = PageAsset.DeserializePageAsset(property.Value); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("uuid"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + uuid = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("createdDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("updatedDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + updatedDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("state"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = new AssetState(property.Value.GetString()); + continue; + } + if (property.NameEquals("externalId"u8)) + { + externalId = property.Value.GetString(); + continue; + } + if (property.NameEquals("labels"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + labels = array; + continue; + } + if (property.NameEquals("wildcard"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + wildcard = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("discoGroupName"u8)) + { + discoGroupName = property.Value.GetString(); + continue; + } + if (property.NameEquals("auditTrail"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AuditTrailItem.DeserializeAuditTrailItem(item)); + } + auditTrail = array; + continue; + } + if (property.NameEquals("reason"u8)) + { + reason = property.Value.GetString(); + continue; + } + } + return new PageAssetResource(kind, id, name.Value, displayName.Value, Optional.ToNullable(uuid), Optional.ToNullable(createdDate), Optional.ToNullable(updatedDate), Optional.ToNullable(state), externalId.Value, Optional.ToList(labels), Optional.ToNullable(wildcard), discoGroupName.Value, Optional.ToList(auditTrail), reason.Value, asset); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new PageAssetResource FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializePageAssetResource(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/PageAssetResource.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/PageAssetResource.cs new file mode 100644 index 000000000000..bb73747bdb29 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/PageAssetResource.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The PageAssetResource. + public partial class PageAssetResource : AssetResource + { + /// Initializes a new instance of PageAssetResource. + /// asset. + /// is null. + public PageAssetResource(PageAsset asset) + { + Argument.AssertNotNull(asset, nameof(asset)); + + Kind = "page"; + Asset = asset; + } + + /// Initializes a new instance of PageAssetResource. + /// Discriminator. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// Global UUID for the asset. + /// The date this asset was first added to this workspace. + /// The date this asset was last updated for this workspace. + /// + /// An optional customer provided identifier for this asset. + /// Customer labels assigned to this asset. + /// An indicator of whether this asset represents a wildcard rollup of assets on this domain. + /// The name of the DiscoGroup that brought added this asset to the workspace. + /// The history of how this asset was pulled into the workspace through the discovery process. + /// + /// asset. + internal PageAssetResource(string kind, string id, string name, string displayName, Guid? uuid, DateTimeOffset? createdDate, DateTimeOffset? updatedDate, AssetState? state, string externalId, IList labels, bool? wildcard, string discoGroupName, IList auditTrail, string reason, PageAsset asset) : base(kind, id, name, displayName, uuid, createdDate, updatedDate, state, externalId, labels, wildcard, discoGroupName, auditTrail, reason) + { + Asset = asset; + } + + /// asset. + public PageAsset Asset { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/PageCause.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/PageCause.Serialization.cs new file mode 100644 index 000000000000..0cdcfb70ea3d --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/PageCause.Serialization.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class PageCause : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Cause)) + { + writer.WritePropertyName("cause"u8); + writer.WriteStringValue(Cause); + } + if (Optional.IsDefined(CauseElementXPath)) + { + writer.WritePropertyName("causeElementXPath"u8); + writer.WriteStringValue(CauseElementXPath); + } + if (Optional.IsDefined(Location)) + { + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + } + if (Optional.IsDefined(PossibleMatches)) + { + writer.WritePropertyName("possibleMatches"u8); + writer.WriteNumberValue(PossibleMatches.Value); + } + if (Optional.IsDefined(LoopDetected)) + { + writer.WritePropertyName("loopDetected"u8); + writer.WriteBooleanValue(LoopDetected.Value); + } + if (Optional.IsDefined(Version)) + { + writer.WritePropertyName("version"u8); + writer.WriteNumberValue(Version.Value); + } + if (Optional.IsDefined(DomChangeIndex)) + { + writer.WritePropertyName("domChangeIndex"u8); + writer.WriteNumberValue(DomChangeIndex.Value); + } + writer.WriteEndObject(); + } + + internal static PageCause DeserializePageCause(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional cause = default; + Optional causeElementXPath = default; + Optional location = default; + Optional possibleMatches = default; + Optional loopDetected = default; + Optional version = default; + Optional domChangeIndex = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("cause"u8)) + { + cause = property.Value.GetString(); + continue; + } + if (property.NameEquals("causeElementXPath"u8)) + { + causeElementXPath = property.Value.GetString(); + continue; + } + if (property.NameEquals("location"u8)) + { + location = property.Value.GetString(); + continue; + } + if (property.NameEquals("possibleMatches"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + possibleMatches = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("loopDetected"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + loopDetected = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("version"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + version = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("domChangeIndex"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + domChangeIndex = property.Value.GetInt32(); + continue; + } + } + return new PageCause(cause.Value, causeElementXPath.Value, location.Value, Optional.ToNullable(possibleMatches), Optional.ToNullable(loopDetected), Optional.ToNullable(version), Optional.ToNullable(domChangeIndex)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static PageCause FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializePageCause(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/PageCause.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/PageCause.cs new file mode 100644 index 000000000000..745b8ce8aa82 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/PageCause.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Analytics.Defender.Easm +{ + /// The PageCause. + public partial class PageCause + { + /// Initializes a new instance of PageCause. + public PageCause() + { + } + + /// Initializes a new instance of PageCause. + /// + /// + /// + /// + /// + /// + /// + internal PageCause(string cause, string causeElementXPath, string location, int? possibleMatches, bool? loopDetected, int? version, int? domChangeIndex) + { + Cause = cause; + CauseElementXPath = causeElementXPath; + Location = location; + PossibleMatches = possibleMatches; + LoopDetected = loopDetected; + Version = version; + DomChangeIndex = domChangeIndex; + } + + /// Gets or sets the cause. + public string Cause { get; set; } + /// Gets or sets the cause element x path. + public string CauseElementXPath { get; set; } + /// Gets or sets the location. + public string Location { get; set; } + /// Gets or sets the possible matches. + public int? PossibleMatches { get; set; } + /// Gets or sets the loop detected. + public bool? LoopDetected { get; set; } + /// Gets or sets the version. + public int? Version { get; set; } + /// Gets or sets the dom change index. + public int? DomChangeIndex { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Port.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Port.Serialization.cs new file mode 100644 index 000000000000..fb1eb588ecdd --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Port.Serialization.cs @@ -0,0 +1,111 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class Port : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(PortProperty)) + { + writer.WritePropertyName("port"u8); + writer.WriteNumberValue(PortProperty.Value); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + writer.WriteEndObject(); + } + + internal static Port DeserializePort(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional port = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional count = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("port"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + port = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + } + return new Port(Optional.ToNullable(port), Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(count)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static Port FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializePort(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Port.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Port.cs new file mode 100644 index 000000000000..337194325560 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Port.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Analytics.Defender.Easm +{ + /// The Port. + public partial class Port + { + /// Initializes a new instance of Port. + public Port() + { + } + + /// Initializes a new instance of Port. + /// + /// + /// + /// + internal Port(int? portProperty, DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count) + { + PortProperty = portProperty; + FirstSeen = firstSeen; + LastSeen = lastSeen; + Count = count; + } + + /// Gets or sets the port property. + public int? PortProperty { get; set; } + /// Gets or sets the first seen. + public DateTimeOffset? FirstSeen { get; set; } + /// Gets or sets the last seen. + public DateTimeOffset? LastSeen { get; set; } + /// Gets or sets the count. + public long? Count { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportAssetSnapshotRequest.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportAssetSnapshotRequest.Serialization.cs new file mode 100644 index 000000000000..0de153a33274 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportAssetSnapshotRequest.Serialization.cs @@ -0,0 +1,49 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class ReportAssetSnapshotRequest : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Metric)) + { + writer.WritePropertyName("metric"u8); + writer.WriteStringValue(Metric); + } + if (Optional.IsDefined(LabelName)) + { + writer.WritePropertyName("labelName"u8); + writer.WriteStringValue(LabelName); + } + if (Optional.IsDefined(Size)) + { + writer.WritePropertyName("size"u8); + writer.WriteNumberValue(Size.Value); + } + if (Optional.IsDefined(Page)) + { + writer.WritePropertyName("page"u8); + writer.WriteNumberValue(Page.Value); + } + writer.WriteEndObject(); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportAssetSnapshotRequest.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportAssetSnapshotRequest.cs new file mode 100644 index 000000000000..a987d441e26b --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportAssetSnapshotRequest.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Analytics.Defender.Easm +{ + /// A request body used to retrieve an asset report snapshot. + public partial class ReportAssetSnapshotRequest + { + /// Initializes a new instance of ReportAssetSnapshotRequest. + public ReportAssetSnapshotRequest() + { + } + + /// Initializes a new instance of ReportAssetSnapshotRequest. + /// The metric to retrieve a snapshot for. + /// The name of the label to retrieve a snapshot for. + /// The number of assets per page. + /// The page to retrieve. + internal ReportAssetSnapshotRequest(string metric, string labelName, int? size, int? page) + { + Metric = metric; + LabelName = labelName; + Size = size; + Page = page; + } + + /// The metric to retrieve a snapshot for. + public string Metric { get; set; } + /// The name of the label to retrieve a snapshot for. + public string LabelName { get; set; } + /// The number of assets per page. + public int? Size { get; set; } + /// The page to retrieve. + public int? Page { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportAssetSnapshotResult.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportAssetSnapshotResult.Serialization.cs new file mode 100644 index 000000000000..0802bee938ec --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportAssetSnapshotResult.Serialization.cs @@ -0,0 +1,81 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class ReportAssetSnapshotResult + { + internal static ReportAssetSnapshotResult DeserializeReportAssetSnapshotResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional displayName = default; + Optional metric = default; + Optional labelName = default; + Optional updatedAt = default; + Optional description = default; + Optional assets = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("metric"u8)) + { + metric = property.Value.GetString(); + continue; + } + if (property.NameEquals("labelName"u8)) + { + labelName = property.Value.GetString(); + continue; + } + if (property.NameEquals("updatedAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + updatedAt = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("assets"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + assets = AssetPageResult.DeserializeAssetPageResult(property.Value); + continue; + } + } + return new ReportAssetSnapshotResult(displayName.Value, metric.Value, labelName.Value, Optional.ToNullable(updatedAt), description.Value, assets.Value); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ReportAssetSnapshotResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeReportAssetSnapshotResult(document.RootElement); + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportAssetSnapshotResult.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportAssetSnapshotResult.cs new file mode 100644 index 000000000000..25a5e71d5ba3 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportAssetSnapshotResult.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Analytics.Defender.Easm +{ + /// A snapshot of assets captured daily for the provided metric. Asset details only contain primary properties. Detailed asset data can be retrieved from the asset endpoints. + public partial class ReportAssetSnapshotResult + { + /// Initializes a new instance of ReportAssetSnapshotResult. + internal ReportAssetSnapshotResult() + { + } + + /// Initializes a new instance of ReportAssetSnapshotResult. + /// The name of the metric. + /// The unique metric name. + /// The customer label that was filtered on, if one was provided. + /// The last time this asset data was updated on this metric. + /// A description of what the metric represents. + /// The page of assets that match the provided metric. + internal ReportAssetSnapshotResult(string displayName, string metric, string labelName, DateTimeOffset? updatedAt, string description, AssetPageResult assets) + { + DisplayName = displayName; + Metric = metric; + LabelName = labelName; + UpdatedAt = updatedAt; + Description = description; + Assets = assets; + } + + /// The name of the metric. + public string DisplayName { get; } + /// The unique metric name. + public string Metric { get; } + /// The customer label that was filtered on, if one was provided. + public string LabelName { get; } + /// The last time this asset data was updated on this metric. + public DateTimeOffset? UpdatedAt { get; } + /// A description of what the metric represents. + public string Description { get; } + /// The page of assets that match the provided metric. + public AssetPageResult Assets { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportAssetSummaryRequest.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportAssetSummaryRequest.Serialization.cs new file mode 100644 index 000000000000..a8422622fb67 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportAssetSummaryRequest.Serialization.cs @@ -0,0 +1,74 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class ReportAssetSummaryRequest : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(MetricCategories)) + { + writer.WritePropertyName("metricCategories"u8); + writer.WriteStartArray(); + foreach (var item in MetricCategories) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Metrics)) + { + writer.WritePropertyName("metrics"u8); + writer.WriteStartArray(); + foreach (var item in Metrics) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Filters)) + { + writer.WritePropertyName("filters"u8); + writer.WriteStartArray(); + foreach (var item in Filters) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(GroupBy)) + { + writer.WritePropertyName("groupBy"u8); + writer.WriteStringValue(GroupBy); + } + if (Optional.IsDefined(SegmentBy)) + { + writer.WritePropertyName("segmentBy"u8); + writer.WriteStringValue(SegmentBy); + } + if (Optional.IsDefined(LabelName)) + { + writer.WritePropertyName("labelName"u8); + writer.WriteStringValue(LabelName); + } + writer.WriteEndObject(); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportAssetSummaryRequest.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportAssetSummaryRequest.cs new file mode 100644 index 000000000000..7405807fbfa7 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportAssetSummaryRequest.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// A request body used to retrieve summary asset information. One and only one collection of summary identifiers must be provided: filters, metrics, or metricCategories. + public partial class ReportAssetSummaryRequest + { + /// Initializes a new instance of ReportAssetSummaryRequest. + public ReportAssetSummaryRequest() + { + MetricCategories = new ChangeTrackingList(); + Metrics = new ChangeTrackingList(); + Filters = new ChangeTrackingList(); + } + + /// Initializes a new instance of ReportAssetSummaryRequest. + /// Categories to retrieve risk reporting data for. + /// Metrics to retrieve risk reporting data for. + /// Query filters to apply to the asset summary. + /// A parameter to group the assets by (first level facet field), only used when the chosen summary identifier is filters. + /// A parameter to segment the assets by (second level facet field), only used when the chosen summary identifier is filters. + /// Currently unused. + internal ReportAssetSummaryRequest(IList metricCategories, IList metrics, IList filters, string groupBy, string segmentBy, string labelName) + { + MetricCategories = metricCategories; + Metrics = metrics; + Filters = filters; + GroupBy = groupBy; + SegmentBy = segmentBy; + LabelName = labelName; + } + + /// Categories to retrieve risk reporting data for. + public IList MetricCategories { get; } + /// Metrics to retrieve risk reporting data for. + public IList Metrics { get; } + /// Query filters to apply to the asset summary. + public IList Filters { get; } + /// A parameter to group the assets by (first level facet field), only used when the chosen summary identifier is filters. + public string GroupBy { get; set; } + /// A parameter to segment the assets by (second level facet field), only used when the chosen summary identifier is filters. + public string SegmentBy { get; set; } + /// Currently unused. + public string LabelName { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportAssetSummaryResult.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportAssetSummaryResult.Serialization.cs new file mode 100644 index 000000000000..326af02d263e --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportAssetSummaryResult.Serialization.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class ReportAssetSummaryResult + { + internal static ReportAssetSummaryResult DeserializeReportAssetSummaryResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> assetSummaries = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("assetSummaries"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AssetSummaryResult.DeserializeAssetSummaryResult(item)); + } + assetSummaries = array; + continue; + } + } + return new ReportAssetSummaryResult(Optional.ToList(assetSummaries)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ReportAssetSummaryResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeReportAssetSummaryResult(document.RootElement); + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportAssetSummaryResult.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportAssetSummaryResult.cs new file mode 100644 index 000000000000..4dd374eebb12 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportAssetSummaryResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The ReportAssetSummaryResult. + public partial class ReportAssetSummaryResult + { + /// Initializes a new instance of ReportAssetSummaryResult. + internal ReportAssetSummaryResult() + { + AssetSummaries = new ChangeTrackingList(); + } + + /// Initializes a new instance of ReportAssetSummaryResult. + /// The collection of asset summaries. + internal ReportAssetSummaryResult(IReadOnlyList assetSummaries) + { + AssetSummaries = assetSummaries; + } + + /// The collection of asset summaries. + public IReadOnlyList AssetSummaries { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportBillableAssetBreakdown.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportBillableAssetBreakdown.Serialization.cs new file mode 100644 index 000000000000..7efc8e3e81e5 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportBillableAssetBreakdown.Serialization.cs @@ -0,0 +1,56 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class ReportBillableAssetBreakdown + { + internal static ReportBillableAssetBreakdown DeserializeReportBillableAssetBreakdown(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional kind = default; + Optional count = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + kind = new ReportBillableAssetBreakdownKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + } + return new ReportBillableAssetBreakdown(Optional.ToNullable(kind), Optional.ToNullable(count)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ReportBillableAssetBreakdown FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeReportBillableAssetBreakdown(document.RootElement); + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportBillableAssetBreakdown.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportBillableAssetBreakdown.cs new file mode 100644 index 000000000000..81d93049e166 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportBillableAssetBreakdown.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Analytics.Defender.Easm +{ + /// The breakdown of billable asset counts for each asset type. + public partial class ReportBillableAssetBreakdown + { + /// Initializes a new instance of ReportBillableAssetBreakdown. + internal ReportBillableAssetBreakdown() + { + } + + /// Initializes a new instance of ReportBillableAssetBreakdown. + /// The kind of billable asset. + /// The number of assets of this type. + internal ReportBillableAssetBreakdown(ReportBillableAssetBreakdownKind? kind, long? count) + { + Kind = kind; + Count = count; + } + + /// The kind of billable asset. + public ReportBillableAssetBreakdownKind? Kind { get; } + /// The number of assets of this type. + public long? Count { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportBillableAssetBreakdownKind.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportBillableAssetBreakdownKind.cs new file mode 100644 index 000000000000..f96ed015ab52 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportBillableAssetBreakdownKind.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.Analytics.Defender.Easm +{ + /// The kind of billable asset. + public readonly partial struct ReportBillableAssetBreakdownKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ReportBillableAssetBreakdownKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DomainValue = "domain"; + private const string HostValue = "host"; + private const string IpAddressValue = "ipAddress"; + + /// domain. + public static ReportBillableAssetBreakdownKind Domain { get; } = new ReportBillableAssetBreakdownKind(DomainValue); + /// host. + public static ReportBillableAssetBreakdownKind Host { get; } = new ReportBillableAssetBreakdownKind(HostValue); + /// ipAddress. + public static ReportBillableAssetBreakdownKind IpAddress { get; } = new ReportBillableAssetBreakdownKind(IpAddressValue); + /// Determines if two values are the same. + public static bool operator ==(ReportBillableAssetBreakdownKind left, ReportBillableAssetBreakdownKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ReportBillableAssetBreakdownKind left, ReportBillableAssetBreakdownKind right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator ReportBillableAssetBreakdownKind(string value) => new ReportBillableAssetBreakdownKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ReportBillableAssetBreakdownKind other && Equals(other); + /// + public bool Equals(ReportBillableAssetBreakdownKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportBillableAssetSnapshotResult.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportBillableAssetSnapshotResult.Serialization.cs new file mode 100644 index 000000000000..b4779f081bf0 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportBillableAssetSnapshotResult.Serialization.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class ReportBillableAssetSnapshotResult + { + internal static ReportBillableAssetSnapshotResult DeserializeReportBillableAssetSnapshotResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional date = default; + Optional total = default; + Optional> assetBreakdown = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("date"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + date = property.Value.GetDateTimeOffset("D"); + continue; + } + if (property.NameEquals("total"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + total = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("assetBreakdown"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ReportBillableAssetBreakdown.DeserializeReportBillableAssetBreakdown(item)); + } + assetBreakdown = array; + continue; + } + } + return new ReportBillableAssetSnapshotResult(Optional.ToNullable(date), Optional.ToNullable(total), Optional.ToList(assetBreakdown)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ReportBillableAssetSnapshotResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeReportBillableAssetSnapshotResult(document.RootElement); + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportBillableAssetSnapshotResult.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportBillableAssetSnapshotResult.cs new file mode 100644 index 000000000000..a7fccee06077 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportBillableAssetSnapshotResult.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The ReportBillableAssetSnapshotResult. + public partial class ReportBillableAssetSnapshotResult + { + /// Initializes a new instance of ReportBillableAssetSnapshotResult. + internal ReportBillableAssetSnapshotResult() + { + AssetBreakdown = new ChangeTrackingList(); + } + + /// Initializes a new instance of ReportBillableAssetSnapshotResult. + /// The date these assets were billed on. + /// The total number of billable assets for this date. + /// The breakdown of billable asset counts for each asset type. + internal ReportBillableAssetSnapshotResult(DateTimeOffset? date, long? total, IReadOnlyList assetBreakdown) + { + Date = date; + Total = total; + AssetBreakdown = assetBreakdown; + } + + /// The date these assets were billed on. + public DateTimeOffset? Date { get; } + /// The total number of billable assets for this date. + public long? Total { get; } + /// The breakdown of billable asset counts for each asset type. + public IReadOnlyList AssetBreakdown { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportBillableAssetSummaryResult.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportBillableAssetSummaryResult.Serialization.cs new file mode 100644 index 000000000000..3856427f01c3 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportBillableAssetSummaryResult.Serialization.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class ReportBillableAssetSummaryResult + { + internal static ReportBillableAssetSummaryResult DeserializeReportBillableAssetSummaryResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> assetSummaries = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("assetSummaries"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ReportBillableAssetSnapshotResult.DeserializeReportBillableAssetSnapshotResult(item)); + } + assetSummaries = array; + continue; + } + } + return new ReportBillableAssetSummaryResult(Optional.ToList(assetSummaries)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ReportBillableAssetSummaryResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeReportBillableAssetSummaryResult(document.RootElement); + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportBillableAssetSummaryResult.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportBillableAssetSummaryResult.cs new file mode 100644 index 000000000000..7fe9193e1fb9 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportBillableAssetSummaryResult.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The ReportBillableAssetSummaryResult. + public partial class ReportBillableAssetSummaryResult + { + /// Initializes a new instance of ReportBillableAssetSummaryResult. + internal ReportBillableAssetSummaryResult() + { + AssetSummaries = new ChangeTrackingList(); + } + + /// Initializes a new instance of ReportBillableAssetSummaryResult. + /// + internal ReportBillableAssetSummaryResult(IReadOnlyList assetSummaries) + { + AssetSummaries = assetSummaries; + } + + /// Gets the asset summaries. + public IReadOnlyList AssetSummaries { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Reputation.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Reputation.Serialization.cs new file mode 100644 index 000000000000..7a03653f97b5 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Reputation.Serialization.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class Reputation : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ListName)) + { + writer.WritePropertyName("listName"u8); + writer.WriteStringValue(ListName); + } + if (Optional.IsDefined(ThreatType)) + { + writer.WritePropertyName("threatType"u8); + writer.WriteStringValue(ThreatType); + } + if (Optional.IsDefined(Trusted)) + { + writer.WritePropertyName("trusted"u8); + writer.WriteBooleanValue(Trusted.Value); + } + if (Optional.IsDefined(Cidr)) + { + writer.WritePropertyName("cidr"u8); + writer.WriteStringValue(Cidr); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(ListUpdatedAt)) + { + writer.WritePropertyName("listUpdatedAt"u8); + writer.WriteStringValue(ListUpdatedAt.Value, "O"); + } + if (Optional.IsDefined(Recent)) + { + writer.WritePropertyName("recent"u8); + writer.WriteBooleanValue(Recent.Value); + } + writer.WriteEndObject(); + } + + internal static Reputation DeserializeReputation(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional listName = default; + Optional threatType = default; + Optional trusted = default; + Optional cidr = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional listUpdatedAt = default; + Optional recent = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("listName"u8)) + { + listName = property.Value.GetString(); + continue; + } + if (property.NameEquals("threatType"u8)) + { + threatType = property.Value.GetString(); + continue; + } + if (property.NameEquals("trusted"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + trusted = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("cidr"u8)) + { + cidr = property.Value.GetString(); + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("listUpdatedAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + listUpdatedAt = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("recent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + recent = property.Value.GetBoolean(); + continue; + } + } + return new Reputation(listName.Value, threatType.Value, Optional.ToNullable(trusted), cidr.Value, Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(listUpdatedAt), Optional.ToNullable(recent)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static Reputation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeReputation(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Reputation.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Reputation.cs new file mode 100644 index 000000000000..9e5cae46309e --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Reputation.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Analytics.Defender.Easm +{ + /// The Reputation. + public partial class Reputation + { + /// Initializes a new instance of Reputation. + public Reputation() + { + } + + /// Initializes a new instance of Reputation. + /// + /// + /// + /// + /// + /// + /// + /// + internal Reputation(string listName, string threatType, bool? trusted, string cidr, DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, DateTimeOffset? listUpdatedAt, bool? recent) + { + ListName = listName; + ThreatType = threatType; + Trusted = trusted; + Cidr = cidr; + FirstSeen = firstSeen; + LastSeen = lastSeen; + ListUpdatedAt = listUpdatedAt; + Recent = recent; + } + + /// Gets or sets the list name. + public string ListName { get; set; } + /// Gets or sets the threat type. + public string ThreatType { get; set; } + /// Gets or sets the trusted. + public bool? Trusted { get; set; } + /// Gets or sets the cidr. + public string Cidr { get; set; } + /// Gets or sets the first seen. + public DateTimeOffset? FirstSeen { get; set; } + /// Gets or sets the last seen. + public DateTimeOffset? LastSeen { get; set; } + /// Gets or sets the list updated at. + public DateTimeOffset? ListUpdatedAt { get; set; } + /// Gets or sets the recent. + public bool? Recent { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ResourceUrl.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ResourceUrl.Serialization.cs new file mode 100644 index 000000000000..e539ff9f1517 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ResourceUrl.Serialization.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class ResourceUrl : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Url)) + { + writer.WritePropertyName("url"u8); + writer.WriteStringValue(Url.AbsoluteUri); + } + if (Optional.IsCollectionDefined(Resources)) + { + writer.WritePropertyName("resources"u8); + writer.WriteStartArray(); + foreach (var item in Resources) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(Recent)) + { + writer.WritePropertyName("recent"u8); + writer.WriteBooleanValue(Recent.Value); + } + writer.WriteEndObject(); + } + + internal static ResourceUrl DeserializeResourceUrl(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional url = default; + Optional> resources = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional count = default; + Optional recent = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("url"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + url = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("resources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DependentResource.DeserializeDependentResource(item)); + } + resources = array; + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("recent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + recent = property.Value.GetBoolean(); + continue; + } + } + return new ResourceUrl(url.Value, Optional.ToList(resources), Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(count), Optional.ToNullable(recent)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ResourceUrl FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeResourceUrl(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ResourceUrl.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ResourceUrl.cs new file mode 100644 index 000000000000..9eaa1ae88b35 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ResourceUrl.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The ResourceUrl. + public partial class ResourceUrl + { + /// Initializes a new instance of ResourceUrl. + public ResourceUrl() + { + Resources = new ChangeTrackingList(); + } + + /// Initializes a new instance of ResourceUrl. + /// + /// + /// + /// + /// + /// + internal ResourceUrl(Uri url, IList resources, DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count, bool? recent) + { + Url = url; + Resources = resources; + FirstSeen = firstSeen; + LastSeen = lastSeen; + Count = count; + Recent = recent; + } + + /// Gets or sets the url. + public Uri Url { get; set; } + /// Gets the resources. + public IList Resources { get; } + /// Gets or sets the first seen. + public DateTimeOffset? FirstSeen { get; set; } + /// Gets or sets the last seen. + public DateTimeOffset? LastSeen { get; set; } + /// Gets or sets the count. + public long? Count { get; set; } + /// Gets or sets the recent. + public bool? Recent { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SavedFilter.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SavedFilter.Serialization.cs new file mode 100644 index 000000000000..c573452173f4 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SavedFilter.Serialization.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class SavedFilter : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Filter)) + { + writer.WritePropertyName("filter"u8); + writer.WriteStringValue(Filter); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WriteEndObject(); + } + + internal static SavedFilter DeserializeSavedFilter(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional id = default; + string name = default; + Optional displayName = default; + Optional filter = default; + Optional description = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("filter"u8)) + { + filter = property.Value.GetString(); + continue; + } + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + } + return new SavedFilter(id.Value, name, displayName.Value, filter.Value, description.Value); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static SavedFilter FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSavedFilter(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SavedFilter.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SavedFilter.cs new file mode 100644 index 000000000000..5aecee042c0f --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SavedFilter.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Analytics.Defender.Easm +{ + /// The SavedFilter. + public partial class SavedFilter + { + /// Initializes a new instance of SavedFilter. + public SavedFilter() + { + } + + /// Initializes a new instance of SavedFilter. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// + /// + internal SavedFilter(string id, string name, string displayName, string filter, string description) + { + Id = id; + Name = name; + DisplayName = displayName; + Filter = filter; + Description = description; + } + + /// The system generated unique id for the resource. + public string Id { get; set; } + /// The caller provided unique name for the resource. + public string Name { get; } + /// The name that can be used for display purposes. + public string DisplayName { get; set; } + /// Gets or sets the filter. + public string Filter { get; set; } + /// Gets or sets the description. + public string Description { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ScanMetadata.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ScanMetadata.Serialization.cs new file mode 100644 index 000000000000..4cc21a4c10db --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ScanMetadata.Serialization.cs @@ -0,0 +1,107 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class ScanMetadata : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Port)) + { + writer.WritePropertyName("port"u8); + writer.WriteNumberValue(Port.Value); + } + if (Optional.IsDefined(BannerMetadata)) + { + writer.WritePropertyName("bannerMetadata"u8); + writer.WriteStringValue(BannerMetadata); + } + if (Optional.IsDefined(StartScan)) + { + writer.WritePropertyName("startScan"u8); + writer.WriteStringValue(StartScan.Value, "O"); + } + if (Optional.IsDefined(EndScan)) + { + writer.WritePropertyName("endScan"u8); + writer.WriteStringValue(EndScan.Value, "O"); + } + writer.WriteEndObject(); + } + + internal static ScanMetadata DeserializeScanMetadata(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional port = default; + Optional bannerMetadata = default; + Optional startScan = default; + Optional endScan = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("port"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + port = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("bannerMetadata"u8)) + { + bannerMetadata = property.Value.GetString(); + continue; + } + if (property.NameEquals("startScan"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startScan = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("endScan"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endScan = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new ScanMetadata(Optional.ToNullable(port), bannerMetadata.Value, Optional.ToNullable(startScan), Optional.ToNullable(endScan)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ScanMetadata FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeScanMetadata(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ScanMetadata.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ScanMetadata.cs new file mode 100644 index 000000000000..047bc18f43ad --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ScanMetadata.cs @@ -0,0 +1,42 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Analytics.Defender.Easm +{ + /// The ScanMetadata. + public partial class ScanMetadata + { + /// Initializes a new instance of ScanMetadata. + public ScanMetadata() + { + } + + /// Initializes a new instance of ScanMetadata. + /// + /// + /// + /// + internal ScanMetadata(int? port, string bannerMetadata, DateTimeOffset? startScan, DateTimeOffset? endScan) + { + Port = port; + BannerMetadata = bannerMetadata; + StartScan = startScan; + EndScan = endScan; + } + + /// Gets or sets the port. + public int? Port { get; set; } + /// Gets or sets the banner metadata. + public string BannerMetadata { get; set; } + /// Gets or sets the start scan. + public DateTimeOffset? StartScan { get; set; } + /// Gets or sets the end scan. + public DateTimeOffset? EndScan { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Service.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Service.Serialization.cs new file mode 100644 index 000000000000..a6e70c10b46c --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Service.Serialization.cs @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class Service : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Scheme)) + { + writer.WritePropertyName("scheme"u8); + writer.WriteStringValue(Scheme); + } + if (Optional.IsDefined(Port)) + { + writer.WritePropertyName("port"u8); + writer.WriteNumberValue(Port.Value); + } + if (Optional.IsCollectionDefined(WebComponents)) + { + writer.WritePropertyName("webComponents"u8); + writer.WriteStartArray(); + foreach (var item in WebComponents) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(SslCerts)) + { + writer.WritePropertyName("sslCerts"u8); + writer.WriteStartArray(); + foreach (var item in SslCerts) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Exceptions)) + { + writer.WritePropertyName("exceptions"u8); + writer.WriteStartArray(); + foreach (var item in Exceptions) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Sources)) + { + writer.WritePropertyName("sources"u8); + writer.WriteStartArray(); + foreach (var item in Sources) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(Recent)) + { + writer.WritePropertyName("recent"u8); + writer.WriteBooleanValue(Recent.Value); + } + if (Optional.IsCollectionDefined(PortStates)) + { + writer.WritePropertyName("portStates"u8); + writer.WriteStartArray(); + foreach (var item in PortStates) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static Service DeserializeService(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional scheme = default; + Optional port = default; + Optional> webComponents = default; + Optional> sslCerts = default; + Optional> exceptions = default; + Optional> sources = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional count = default; + Optional recent = default; + Optional> portStates = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("scheme"u8)) + { + scheme = property.Value.GetString(); + continue; + } + if (property.NameEquals("port"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + port = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("webComponents"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(WebComponent.DeserializeWebComponent(item)); + } + webComponents = array; + continue; + } + if (property.NameEquals("sslCerts"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(SslCertAsset.DeserializeSslCertAsset(item)); + } + sslCerts = array; + continue; + } + if (property.NameEquals("exceptions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedString.DeserializeObservedString(item)); + } + exceptions = array; + continue; + } + if (property.NameEquals("sources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Source.DeserializeSource(item)); + } + sources = array; + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("recent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + recent = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("portStates"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservedPortState.DeserializeObservedPortState(item)); + } + portStates = array; + continue; + } + } + return new Service(scheme.Value, Optional.ToNullable(port), Optional.ToList(webComponents), Optional.ToList(sslCerts), Optional.ToList(exceptions), Optional.ToList(sources), Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(count), Optional.ToNullable(recent), Optional.ToList(portStates)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static Service FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeService(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Service.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Service.cs new file mode 100644 index 000000000000..9a84d80c5aab --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Service.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The Service. + public partial class Service + { + /// Initializes a new instance of Service. + public Service() + { + WebComponents = new ChangeTrackingList(); + SslCerts = new ChangeTrackingList(); + Exceptions = new ChangeTrackingList(); + Sources = new ChangeTrackingList(); + PortStates = new ChangeTrackingList(); + } + + /// Initializes a new instance of Service. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + internal Service(string scheme, int? port, IList webComponents, IList sslCerts, IList exceptions, IList sources, DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count, bool? recent, IList portStates) + { + Scheme = scheme; + Port = port; + WebComponents = webComponents; + SslCerts = sslCerts; + Exceptions = exceptions; + Sources = sources; + FirstSeen = firstSeen; + LastSeen = lastSeen; + Count = count; + Recent = recent; + PortStates = portStates; + } + + /// Gets or sets the scheme. + public string Scheme { get; set; } + /// Gets or sets the port. + public int? Port { get; set; } + /// Gets the web components. + public IList WebComponents { get; } + /// Gets the ssl certs. + public IList SslCerts { get; } + /// Gets the exceptions. + public IList Exceptions { get; } + /// Gets the sources. + public IList Sources { get; } + /// Gets or sets the first seen. + public DateTimeOffset? FirstSeen { get; set; } + /// Gets or sets the last seen. + public DateTimeOffset? LastSeen { get; set; } + /// Gets or sets the count. + public long? Count { get; set; } + /// Gets or sets the recent. + public bool? Recent { get; set; } + /// Gets the port states. + public IList PortStates { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SoaRecord.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SoaRecord.Serialization.cs new file mode 100644 index 000000000000..f765ef9fcd37 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SoaRecord.Serialization.cs @@ -0,0 +1,148 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class SoaRecord : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(NameServer)) + { + writer.WritePropertyName("nameServer"u8); + writer.WriteStringValue(NameServer); + } + if (Optional.IsDefined(Email)) + { + writer.WritePropertyName("email"u8); + writer.WriteStringValue(Email); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(SerialNumber)) + { + writer.WritePropertyName("serialNumber"u8); + writer.WriteNumberValue(SerialNumber.Value); + } + if (Optional.IsDefined(Recent)) + { + writer.WritePropertyName("recent"u8); + writer.WriteBooleanValue(Recent.Value); + } + writer.WriteEndObject(); + } + + internal static SoaRecord DeserializeSoaRecord(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional nameServer = default; + Optional email = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional count = default; + Optional serialNumber = default; + Optional recent = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("nameServer"u8)) + { + nameServer = property.Value.GetString(); + continue; + } + if (property.NameEquals("email"u8)) + { + email = property.Value.GetString(); + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("serialNumber"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + serialNumber = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("recent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + recent = property.Value.GetBoolean(); + continue; + } + } + return new SoaRecord(nameServer.Value, email.Value, Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(count), Optional.ToNullable(serialNumber), Optional.ToNullable(recent)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static SoaRecord FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSoaRecord(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SoaRecord.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SoaRecord.cs new file mode 100644 index 000000000000..9ad175fd1457 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SoaRecord.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Analytics.Defender.Easm +{ + /// The SoaRecord. + public partial class SoaRecord + { + /// Initializes a new instance of SoaRecord. + public SoaRecord() + { + } + + /// Initializes a new instance of SoaRecord. + /// + /// + /// + /// + /// + /// + /// + internal SoaRecord(string nameServer, string email, DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count, long? serialNumber, bool? recent) + { + NameServer = nameServer; + Email = email; + FirstSeen = firstSeen; + LastSeen = lastSeen; + Count = count; + SerialNumber = serialNumber; + Recent = recent; + } + + /// Gets or sets the name server. + public string NameServer { get; set; } + /// Gets or sets the email. + public string Email { get; set; } + /// Gets or sets the first seen. + public DateTimeOffset? FirstSeen { get; set; } + /// Gets or sets the last seen. + public DateTimeOffset? LastSeen { get; set; } + /// Gets or sets the count. + public long? Count { get; set; } + /// Gets or sets the serial number. + public long? SerialNumber { get; set; } + /// Gets or sets the recent. + public bool? Recent { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Source.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Source.Serialization.cs new file mode 100644 index 000000000000..7b3e8783be28 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Source.Serialization.cs @@ -0,0 +1,118 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class Source : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(SourceProperty)) + { + writer.WritePropertyName("source"u8); + writer.WriteStringValue(SourceProperty); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(Reason)) + { + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason); + } + writer.WriteEndObject(); + } + + internal static Source DeserializeSource(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional source = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional count = default; + Optional reason = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("source"u8)) + { + source = property.Value.GetString(); + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("reason"u8)) + { + reason = property.Value.GetString(); + continue; + } + } + return new Source(source.Value, Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(count), reason.Value); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static Source FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSource(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Source.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Source.cs new file mode 100644 index 000000000000..c96f42a10ac0 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Source.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Analytics.Defender.Easm +{ + /// The Source. + public partial class Source + { + /// Initializes a new instance of Source. + public Source() + { + } + + /// Initializes a new instance of Source. + /// + /// + /// + /// + /// + internal Source(string sourceProperty, DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count, string reason) + { + SourceProperty = sourceProperty; + FirstSeen = firstSeen; + LastSeen = lastSeen; + Count = count; + Reason = reason; + } + + /// Gets or sets the source property. + public string SourceProperty { get; set; } + /// Gets or sets the first seen. + public DateTimeOffset? FirstSeen { get; set; } + /// Gets or sets the last seen. + public DateTimeOffset? LastSeen { get; set; } + /// Gets or sets the count. + public long? Count { get; set; } + /// Gets or sets the reason. + public string Reason { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SslCertAsset.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SslCertAsset.Serialization.cs new file mode 100644 index 000000000000..36c4b9b25ba9 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SslCertAsset.Serialization.cs @@ -0,0 +1,697 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class SslCertAsset : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Sha1)) + { + writer.WritePropertyName("sha1"u8); + writer.WriteStringValue(Sha1); + } + if (Optional.IsCollectionDefined(SubjectCommonNames)) + { + writer.WritePropertyName("subjectCommonNames"u8); + writer.WriteStartArray(); + foreach (var item in SubjectCommonNames) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Organizations)) + { + writer.WritePropertyName("organizations"u8); + writer.WriteStartArray(); + foreach (var item in Organizations) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(OrganizationalUnits)) + { + writer.WritePropertyName("organizationalUnits"u8); + writer.WriteStartArray(); + foreach (var item in OrganizationalUnits) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(IssuerCommonNames)) + { + writer.WritePropertyName("issuerCommonNames"u8); + writer.WriteStartArray(); + foreach (var item in IssuerCommonNames) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(SigAlgName)) + { + writer.WritePropertyName("sigAlgName"u8); + writer.WriteStringValue(SigAlgName); + } + if (Optional.IsDefined(InvalidAfter)) + { + writer.WritePropertyName("invalidAfter"u8); + writer.WriteStringValue(InvalidAfter.Value, "O"); + } + if (Optional.IsDefined(SerialNumber)) + { + writer.WritePropertyName("serialNumber"u8); + writer.WriteStringValue(SerialNumber); + } + if (Optional.IsCollectionDefined(SubjectAlternativeNames)) + { + writer.WritePropertyName("subjectAlternativeNames"u8); + writer.WriteStartArray(); + foreach (var item in SubjectAlternativeNames) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(IssuerAlternativeNames)) + { + writer.WritePropertyName("issuerAlternativeNames"u8); + writer.WriteStartArray(); + foreach (var item in IssuerAlternativeNames) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Sources)) + { + writer.WritePropertyName("sources"u8); + writer.WriteStartArray(); + foreach (var item in Sources) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(InvalidBefore)) + { + writer.WritePropertyName("invalidBefore"u8); + writer.WriteStringValue(InvalidBefore.Value, "O"); + } + if (Optional.IsDefined(KeySize)) + { + writer.WritePropertyName("keySize"u8); + writer.WriteNumberValue(KeySize.Value); + } + if (Optional.IsDefined(KeyAlgorithm)) + { + writer.WritePropertyName("keyAlgorithm"u8); + writer.WriteStringValue(KeyAlgorithm); + } + if (Optional.IsCollectionDefined(SubjectLocality)) + { + writer.WritePropertyName("subjectLocality"u8); + writer.WriteStartArray(); + foreach (var item in SubjectLocality) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(SubjectState)) + { + writer.WritePropertyName("subjectState"u8); + writer.WriteStartArray(); + foreach (var item in SubjectState) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(SubjectCountry)) + { + writer.WritePropertyName("subjectCountry"u8); + writer.WriteStartArray(); + foreach (var item in SubjectCountry) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(IssuerLocality)) + { + writer.WritePropertyName("issuerLocality"u8); + writer.WriteStartArray(); + foreach (var item in IssuerLocality) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(IssuerState)) + { + writer.WritePropertyName("issuerState"u8); + writer.WriteStartArray(); + foreach (var item in IssuerState) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(IssuerCountry)) + { + writer.WritePropertyName("issuerCountry"u8); + writer.WriteStartArray(); + foreach (var item in IssuerCountry) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(SubjectOrganizations)) + { + writer.WritePropertyName("subjectOrganizations"u8); + writer.WriteStartArray(); + foreach (var item in SubjectOrganizations) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(SubjectOrganizationalUnits)) + { + writer.WritePropertyName("subjectOrganizationalUnits"u8); + writer.WriteStartArray(); + foreach (var item in SubjectOrganizationalUnits) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(IssuerOrganizations)) + { + writer.WritePropertyName("issuerOrganizations"u8); + writer.WriteStartArray(); + foreach (var item in IssuerOrganizations) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(IssuerOrganizationalUnits)) + { + writer.WritePropertyName("issuerOrganizationalUnits"u8); + writer.WriteStartArray(); + foreach (var item in IssuerOrganizationalUnits) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Version)) + { + writer.WritePropertyName("version"u8); + writer.WriteNumberValue(Version.Value); + } + if (Optional.IsDefined(CertificateAuthority)) + { + writer.WritePropertyName("certificateAuthority"u8); + writer.WriteBooleanValue(CertificateAuthority.Value); + } + if (Optional.IsDefined(SelfSigned)) + { + writer.WritePropertyName("selfSigned"u8); + writer.WriteBooleanValue(SelfSigned.Value); + } + if (Optional.IsDefined(SigAlgOid)) + { + writer.WritePropertyName("sigAlgOid"u8); + writer.WriteStringValue(SigAlgOid); + } + if (Optional.IsDefined(Recent)) + { + writer.WritePropertyName("recent"u8); + writer.WriteBooleanValue(Recent.Value); + } + if (Optional.IsDefined(ValidationType)) + { + writer.WritePropertyName("validationType"u8); + writer.WriteStringValue(ValidationType.Value.ToString()); + } + writer.WriteEndObject(); + } + + internal static SslCertAsset DeserializeSslCertAsset(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional sha1 = default; + Optional> subjectCommonNames = default; + Optional> organizations = default; + Optional> organizationalUnits = default; + Optional> issuerCommonNames = default; + Optional sigAlgName = default; + Optional invalidAfter = default; + Optional serialNumber = default; + Optional> subjectAlternativeNames = default; + Optional> issuerAlternativeNames = default; + Optional> sources = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional count = default; + Optional invalidBefore = default; + Optional keySize = default; + Optional keyAlgorithm = default; + Optional> subjectLocality = default; + Optional> subjectState = default; + Optional> subjectCountry = default; + Optional> issuerLocality = default; + Optional> issuerState = default; + Optional> issuerCountry = default; + Optional> subjectOrganizations = default; + Optional> subjectOrganizationalUnits = default; + Optional> issuerOrganizations = default; + Optional> issuerOrganizationalUnits = default; + Optional version = default; + Optional certificateAuthority = default; + Optional selfSigned = default; + Optional sigAlgOid = default; + Optional recent = default; + Optional validationType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sha1"u8)) + { + sha1 = property.Value.GetString(); + continue; + } + if (property.NameEquals("subjectCommonNames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + subjectCommonNames = array; + continue; + } + if (property.NameEquals("organizations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + organizations = array; + continue; + } + if (property.NameEquals("organizationalUnits"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + organizationalUnits = array; + continue; + } + if (property.NameEquals("issuerCommonNames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + issuerCommonNames = array; + continue; + } + if (property.NameEquals("sigAlgName"u8)) + { + sigAlgName = property.Value.GetString(); + continue; + } + if (property.NameEquals("invalidAfter"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + invalidAfter = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("serialNumber"u8)) + { + serialNumber = property.Value.GetString(); + continue; + } + if (property.NameEquals("subjectAlternativeNames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + subjectAlternativeNames = array; + continue; + } + if (property.NameEquals("issuerAlternativeNames"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + issuerAlternativeNames = array; + continue; + } + if (property.NameEquals("sources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Source.DeserializeSource(item)); + } + sources = array; + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("invalidBefore"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + invalidBefore = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("keySize"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + keySize = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("keyAlgorithm"u8)) + { + keyAlgorithm = property.Value.GetString(); + continue; + } + if (property.NameEquals("subjectLocality"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + subjectLocality = array; + continue; + } + if (property.NameEquals("subjectState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + subjectState = array; + continue; + } + if (property.NameEquals("subjectCountry"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + subjectCountry = array; + continue; + } + if (property.NameEquals("issuerLocality"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + issuerLocality = array; + continue; + } + if (property.NameEquals("issuerState"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + issuerState = array; + continue; + } + if (property.NameEquals("issuerCountry"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + issuerCountry = array; + continue; + } + if (property.NameEquals("subjectOrganizations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + subjectOrganizations = array; + continue; + } + if (property.NameEquals("subjectOrganizationalUnits"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + subjectOrganizationalUnits = array; + continue; + } + if (property.NameEquals("issuerOrganizations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + issuerOrganizations = array; + continue; + } + if (property.NameEquals("issuerOrganizationalUnits"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + issuerOrganizationalUnits = array; + continue; + } + if (property.NameEquals("version"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + version = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("certificateAuthority"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + certificateAuthority = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("selfSigned"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + selfSigned = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("sigAlgOid"u8)) + { + sigAlgOid = property.Value.GetString(); + continue; + } + if (property.NameEquals("recent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + recent = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("validationType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + validationType = new SslCertAssetValidationType(property.Value.GetString()); + continue; + } + } + return new SslCertAsset(sha1.Value, Optional.ToList(subjectCommonNames), Optional.ToList(organizations), Optional.ToList(organizationalUnits), Optional.ToList(issuerCommonNames), sigAlgName.Value, Optional.ToNullable(invalidAfter), serialNumber.Value, Optional.ToList(subjectAlternativeNames), Optional.ToList(issuerAlternativeNames), Optional.ToList(sources), Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(count), Optional.ToNullable(invalidBefore), Optional.ToNullable(keySize), keyAlgorithm.Value, Optional.ToList(subjectLocality), Optional.ToList(subjectState), Optional.ToList(subjectCountry), Optional.ToList(issuerLocality), Optional.ToList(issuerState), Optional.ToList(issuerCountry), Optional.ToList(subjectOrganizations), Optional.ToList(subjectOrganizationalUnits), Optional.ToList(issuerOrganizations), Optional.ToList(issuerOrganizationalUnits), Optional.ToNullable(version), Optional.ToNullable(certificateAuthority), Optional.ToNullable(selfSigned), sigAlgOid.Value, Optional.ToNullable(recent), Optional.ToNullable(validationType)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static SslCertAsset FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSslCertAsset(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SslCertAsset.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SslCertAsset.cs new file mode 100644 index 000000000000..185b28a196e5 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SslCertAsset.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The SslCertAsset. + public partial class SslCertAsset : InventoryAsset + { + /// Initializes a new instance of SslCertAsset. + public SslCertAsset() + { + SubjectCommonNames = new ChangeTrackingList(); + Organizations = new ChangeTrackingList(); + OrganizationalUnits = new ChangeTrackingList(); + IssuerCommonNames = new ChangeTrackingList(); + SubjectAlternativeNames = new ChangeTrackingList(); + IssuerAlternativeNames = new ChangeTrackingList(); + Sources = new ChangeTrackingList(); + SubjectLocality = new ChangeTrackingList(); + SubjectState = new ChangeTrackingList(); + SubjectCountry = new ChangeTrackingList(); + IssuerLocality = new ChangeTrackingList(); + IssuerState = new ChangeTrackingList(); + IssuerCountry = new ChangeTrackingList(); + SubjectOrganizations = new ChangeTrackingList(); + SubjectOrganizationalUnits = new ChangeTrackingList(); + IssuerOrganizations = new ChangeTrackingList(); + IssuerOrganizationalUnits = new ChangeTrackingList(); + } + + /// Initializes a new instance of SslCertAsset. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + internal SslCertAsset(string sha1, IList subjectCommonNames, IList organizations, IList organizationalUnits, IList issuerCommonNames, string sigAlgName, DateTimeOffset? invalidAfter, string serialNumber, IList subjectAlternativeNames, IList issuerAlternativeNames, IList sources, DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count, DateTimeOffset? invalidBefore, int? keySize, string keyAlgorithm, IList subjectLocality, IList subjectState, IList subjectCountry, IList issuerLocality, IList issuerState, IList issuerCountry, IList subjectOrganizations, IList subjectOrganizationalUnits, IList issuerOrganizations, IList issuerOrganizationalUnits, int? version, bool? certificateAuthority, bool? selfSigned, string sigAlgOid, bool? recent, SslCertAssetValidationType? validationType) + { + Sha1 = sha1; + SubjectCommonNames = subjectCommonNames; + Organizations = organizations; + OrganizationalUnits = organizationalUnits; + IssuerCommonNames = issuerCommonNames; + SigAlgName = sigAlgName; + InvalidAfter = invalidAfter; + SerialNumber = serialNumber; + SubjectAlternativeNames = subjectAlternativeNames; + IssuerAlternativeNames = issuerAlternativeNames; + Sources = sources; + FirstSeen = firstSeen; + LastSeen = lastSeen; + Count = count; + InvalidBefore = invalidBefore; + KeySize = keySize; + KeyAlgorithm = keyAlgorithm; + SubjectLocality = subjectLocality; + SubjectState = subjectState; + SubjectCountry = subjectCountry; + IssuerLocality = issuerLocality; + IssuerState = issuerState; + IssuerCountry = issuerCountry; + SubjectOrganizations = subjectOrganizations; + SubjectOrganizationalUnits = subjectOrganizationalUnits; + IssuerOrganizations = issuerOrganizations; + IssuerOrganizationalUnits = issuerOrganizationalUnits; + Version = version; + CertificateAuthority = certificateAuthority; + SelfSigned = selfSigned; + SigAlgOid = sigAlgOid; + Recent = recent; + ValidationType = validationType; + } + + /// Gets or sets the sha 1. + public string Sha1 { get; set; } + /// Gets the subject common names. + public IList SubjectCommonNames { get; } + /// Gets the organizations. + public IList Organizations { get; } + /// Gets the organizational units. + public IList OrganizationalUnits { get; } + /// Gets the issuer common names. + public IList IssuerCommonNames { get; } + /// Gets or sets the sig alg name. + public string SigAlgName { get; set; } + /// Gets or sets the invalid after. + public DateTimeOffset? InvalidAfter { get; set; } + /// Gets or sets the serial number. + public string SerialNumber { get; set; } + /// Gets the subject alternative names. + public IList SubjectAlternativeNames { get; } + /// Gets the issuer alternative names. + public IList IssuerAlternativeNames { get; } + /// Gets the sources. + public IList Sources { get; } + /// Gets or sets the first seen. + public DateTimeOffset? FirstSeen { get; set; } + /// Gets or sets the last seen. + public DateTimeOffset? LastSeen { get; set; } + /// Gets or sets the count. + public long? Count { get; set; } + /// Gets or sets the invalid before. + public DateTimeOffset? InvalidBefore { get; set; } + /// Gets or sets the key size. + public int? KeySize { get; set; } + /// Gets or sets the key algorithm. + public string KeyAlgorithm { get; set; } + /// Gets the subject locality. + public IList SubjectLocality { get; } + /// Gets the subject state. + public IList SubjectState { get; } + /// Gets the subject country. + public IList SubjectCountry { get; } + /// Gets the issuer locality. + public IList IssuerLocality { get; } + /// Gets the issuer state. + public IList IssuerState { get; } + /// Gets the issuer country. + public IList IssuerCountry { get; } + /// Gets the subject organizations. + public IList SubjectOrganizations { get; } + /// Gets the subject organizational units. + public IList SubjectOrganizationalUnits { get; } + /// Gets the issuer organizations. + public IList IssuerOrganizations { get; } + /// Gets the issuer organizational units. + public IList IssuerOrganizationalUnits { get; } + /// Gets or sets the version. + public int? Version { get; set; } + /// Gets or sets the certificate authority. + public bool? CertificateAuthority { get; set; } + /// Gets or sets the self signed. + public bool? SelfSigned { get; set; } + /// Gets or sets the sig alg oid. + public string SigAlgOid { get; set; } + /// Gets or sets the recent. + public bool? Recent { get; set; } + /// Gets or sets the validation type. + public SslCertAssetValidationType? ValidationType { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SslCertAssetResource.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SslCertAssetResource.Serialization.cs new file mode 100644 index 000000000000..b68d9b5105c5 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SslCertAssetResource.Serialization.cs @@ -0,0 +1,254 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class SslCertAssetResource : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("asset"u8); + writer.WriteObjectValue(Asset); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Uuid)) + { + writer.WritePropertyName("uuid"u8); + writer.WriteStringValue(Uuid.Value); + } + if (Optional.IsDefined(CreatedDate)) + { + writer.WritePropertyName("createdDate"u8); + writer.WriteStringValue(CreatedDate.Value, "O"); + } + if (Optional.IsDefined(UpdatedDate)) + { + writer.WritePropertyName("updatedDate"u8); + writer.WriteStringValue(UpdatedDate.Value, "O"); + } + if (Optional.IsDefined(State)) + { + writer.WritePropertyName("state"u8); + writer.WriteStringValue(State.Value.ToString()); + } + if (Optional.IsDefined(ExternalId)) + { + writer.WritePropertyName("externalId"u8); + writer.WriteStringValue(ExternalId); + } + if (Optional.IsCollectionDefined(Labels)) + { + writer.WritePropertyName("labels"u8); + writer.WriteStartArray(); + foreach (var item in Labels) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Wildcard)) + { + writer.WritePropertyName("wildcard"u8); + writer.WriteBooleanValue(Wildcard.Value); + } + if (Optional.IsDefined(DiscoGroupName)) + { + writer.WritePropertyName("discoGroupName"u8); + writer.WriteStringValue(DiscoGroupName); + } + if (Optional.IsCollectionDefined(AuditTrail)) + { + writer.WritePropertyName("auditTrail"u8); + writer.WriteStartArray(); + foreach (var item in AuditTrail) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Reason)) + { + writer.WritePropertyName("reason"u8); + writer.WriteStringValue(Reason); + } + writer.WriteEndObject(); + } + + internal static SslCertAssetResource DeserializeSslCertAssetResource(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + SslCertAsset asset = default; + string kind = default; + string id = default; + Optional name = default; + Optional displayName = default; + Optional uuid = default; + Optional createdDate = default; + Optional updatedDate = default; + Optional state = default; + Optional externalId = default; + Optional> labels = default; + Optional wildcard = default; + Optional discoGroupName = default; + Optional> auditTrail = default; + Optional reason = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("asset"u8)) + { + asset = SslCertAsset.DeserializeSslCertAsset(property.Value); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("uuid"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + uuid = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("createdDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("updatedDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + updatedDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("state"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = new AssetState(property.Value.GetString()); + continue; + } + if (property.NameEquals("externalId"u8)) + { + externalId = property.Value.GetString(); + continue; + } + if (property.NameEquals("labels"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + labels = array; + continue; + } + if (property.NameEquals("wildcard"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + wildcard = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("discoGroupName"u8)) + { + discoGroupName = property.Value.GetString(); + continue; + } + if (property.NameEquals("auditTrail"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AuditTrailItem.DeserializeAuditTrailItem(item)); + } + auditTrail = array; + continue; + } + if (property.NameEquals("reason"u8)) + { + reason = property.Value.GetString(); + continue; + } + } + return new SslCertAssetResource(kind, id, name.Value, displayName.Value, Optional.ToNullable(uuid), Optional.ToNullable(createdDate), Optional.ToNullable(updatedDate), Optional.ToNullable(state), externalId.Value, Optional.ToList(labels), Optional.ToNullable(wildcard), discoGroupName.Value, Optional.ToList(auditTrail), reason.Value, asset); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new SslCertAssetResource FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSslCertAssetResource(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SslCertAssetResource.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SslCertAssetResource.cs new file mode 100644 index 000000000000..687d0ad9a9dd --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SslCertAssetResource.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The SslCertAssetResource. + public partial class SslCertAssetResource : AssetResource + { + /// Initializes a new instance of SslCertAssetResource. + /// asset. + /// is null. + public SslCertAssetResource(SslCertAsset asset) + { + Argument.AssertNotNull(asset, nameof(asset)); + + Kind = "sslCert"; + Asset = asset; + } + + /// Initializes a new instance of SslCertAssetResource. + /// Discriminator. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// Global UUID for the asset. + /// The date this asset was first added to this workspace. + /// The date this asset was last updated for this workspace. + /// + /// An optional customer provided identifier for this asset. + /// Customer labels assigned to this asset. + /// An indicator of whether this asset represents a wildcard rollup of assets on this domain. + /// The name of the DiscoGroup that brought added this asset to the workspace. + /// The history of how this asset was pulled into the workspace through the discovery process. + /// + /// asset. + internal SslCertAssetResource(string kind, string id, string name, string displayName, Guid? uuid, DateTimeOffset? createdDate, DateTimeOffset? updatedDate, AssetState? state, string externalId, IList labels, bool? wildcard, string discoGroupName, IList auditTrail, string reason, SslCertAsset asset) : base(kind, id, name, displayName, uuid, createdDate, updatedDate, state, externalId, labels, wildcard, discoGroupName, auditTrail, reason) + { + Asset = asset; + } + + /// asset. + public SslCertAsset Asset { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SslCertAssetValidationType.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SslCertAssetValidationType.cs new file mode 100644 index 000000000000..753661e2ac37 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SslCertAssetValidationType.cs @@ -0,0 +1,53 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Analytics.Defender.Easm +{ + public readonly partial struct SslCertAssetValidationType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public SslCertAssetValidationType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DomainValidationValue = "domainValidation"; + private const string OrganizationValidationValue = "organizationValidation"; + private const string ExtendedValidationValue = "extendedValidation"; + + /// domainValidation. + public static SslCertAssetValidationType DomainValidation { get; } = new SslCertAssetValidationType(DomainValidationValue); + /// organizationValidation. + public static SslCertAssetValidationType OrganizationValidation { get; } = new SslCertAssetValidationType(OrganizationValidationValue); + /// extendedValidation. + public static SslCertAssetValidationType ExtendedValidation { get; } = new SslCertAssetValidationType(ExtendedValidationValue); + /// Determines if two values are the same. + public static bool operator ==(SslCertAssetValidationType left, SslCertAssetValidationType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(SslCertAssetValidationType left, SslCertAssetValidationType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator SslCertAssetValidationType(string value) => new SslCertAssetValidationType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is SslCertAssetValidationType other && Equals(other); + /// + public bool Equals(SslCertAssetValidationType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SslServerConfig.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SslServerConfig.Serialization.cs new file mode 100644 index 000000000000..62ba2c64db8e --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SslServerConfig.Serialization.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class SslServerConfig : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(TlsVersions)) + { + writer.WritePropertyName("tlsVersions"u8); + writer.WriteStartArray(); + foreach (var item in TlsVersions) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(CipherSuites)) + { + writer.WritePropertyName("cipherSuites"u8); + writer.WriteStartArray(); + foreach (var item in CipherSuites) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsCollectionDefined(Sources)) + { + writer.WritePropertyName("sources"u8); + writer.WriteStartArray(); + foreach (var item in Sources) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static SslServerConfig DeserializeSslServerConfig(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> tlsVersions = default; + Optional> cipherSuites = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional count = default; + Optional> sources = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("tlsVersions"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + tlsVersions = array; + continue; + } + if (property.NameEquals("cipherSuites"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + cipherSuites = array; + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("sources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Source.DeserializeSource(item)); + } + sources = array; + continue; + } + } + return new SslServerConfig(Optional.ToList(tlsVersions), Optional.ToList(cipherSuites), Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(count), Optional.ToList(sources)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static SslServerConfig FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSslServerConfig(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SslServerConfig.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SslServerConfig.cs new file mode 100644 index 000000000000..b01ede9cce4b --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SslServerConfig.cs @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The SslServerConfig. + public partial class SslServerConfig + { + /// Initializes a new instance of SslServerConfig. + public SslServerConfig() + { + TlsVersions = new ChangeTrackingList(); + CipherSuites = new ChangeTrackingList(); + Sources = new ChangeTrackingList(); + } + + /// Initializes a new instance of SslServerConfig. + /// + /// + /// + /// + /// + /// + internal SslServerConfig(IList tlsVersions, IList cipherSuites, DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count, IList sources) + { + TlsVersions = tlsVersions; + CipherSuites = cipherSuites; + FirstSeen = firstSeen; + LastSeen = lastSeen; + Count = count; + Sources = sources; + } + + /// Gets the tls versions. + public IList TlsVersions { get; } + /// Gets the cipher suites. + public IList CipherSuites { get; } + /// Gets or sets the first seen. + public DateTimeOffset? FirstSeen { get; set; } + /// Gets or sets the last seen. + public DateTimeOffset? LastSeen { get; set; } + /// Gets or sets the count. + public long? Count { get; set; } + /// Gets the sources. + public IList Sources { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SubResourceIntegrityCheck.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SubResourceIntegrityCheck.Serialization.cs new file mode 100644 index 000000000000..5829dd8f68b5 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SubResourceIntegrityCheck.Serialization.cs @@ -0,0 +1,166 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class SubResourceIntegrityCheck : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Violation)) + { + writer.WritePropertyName("violation"u8); + writer.WriteBooleanValue(Violation.Value); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsDefined(CausePageUrl)) + { + writer.WritePropertyName("causePageUrl"u8); + writer.WriteStringValue(CausePageUrl); + } + if (Optional.IsDefined(CrawlGuid)) + { + writer.WritePropertyName("crawlGuid"u8); + writer.WriteStringValue(CrawlGuid); + } + if (Optional.IsDefined(PageGuid)) + { + writer.WritePropertyName("pageGuid"u8); + writer.WriteStringValue(PageGuid); + } + if (Optional.IsDefined(ResourceGuid)) + { + writer.WritePropertyName("resourceGuid"u8); + writer.WriteStringValue(ResourceGuid); + } + if (Optional.IsDefined(ExpectedHash)) + { + writer.WritePropertyName("expectedHash"u8); + writer.WriteStringValue(ExpectedHash); + } + writer.WriteEndObject(); + } + + internal static SubResourceIntegrityCheck DeserializeSubResourceIntegrityCheck(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional violation = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional count = default; + Optional causePageUrl = default; + Optional crawlGuid = default; + Optional pageGuid = default; + Optional resourceGuid = default; + Optional expectedHash = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("violation"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + violation = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("causePageUrl"u8)) + { + causePageUrl = property.Value.GetString(); + continue; + } + if (property.NameEquals("crawlGuid"u8)) + { + crawlGuid = property.Value.GetString(); + continue; + } + if (property.NameEquals("pageGuid"u8)) + { + pageGuid = property.Value.GetString(); + continue; + } + if (property.NameEquals("resourceGuid"u8)) + { + resourceGuid = property.Value.GetString(); + continue; + } + if (property.NameEquals("expectedHash"u8)) + { + expectedHash = property.Value.GetString(); + continue; + } + } + return new SubResourceIntegrityCheck(Optional.ToNullable(violation), Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(count), causePageUrl.Value, crawlGuid.Value, pageGuid.Value, resourceGuid.Value, expectedHash.Value); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static SubResourceIntegrityCheck FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSubResourceIntegrityCheck(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SubResourceIntegrityCheck.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SubResourceIntegrityCheck.cs new file mode 100644 index 000000000000..93f9a92f45c7 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SubResourceIntegrityCheck.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Analytics.Defender.Easm +{ + /// The SubResourceIntegrityCheck. + public partial class SubResourceIntegrityCheck + { + /// Initializes a new instance of SubResourceIntegrityCheck. + public SubResourceIntegrityCheck() + { + } + + /// Initializes a new instance of SubResourceIntegrityCheck. + /// + /// + /// + /// + /// + /// + /// + /// + /// + internal SubResourceIntegrityCheck(bool? violation, DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count, string causePageUrl, string crawlGuid, string pageGuid, string resourceGuid, string expectedHash) + { + Violation = violation; + FirstSeen = firstSeen; + LastSeen = lastSeen; + Count = count; + CausePageUrl = causePageUrl; + CrawlGuid = crawlGuid; + PageGuid = pageGuid; + ResourceGuid = resourceGuid; + ExpectedHash = expectedHash; + } + + /// Gets or sets the violation. + public bool? Violation { get; set; } + /// Gets or sets the first seen. + public DateTimeOffset? FirstSeen { get; set; } + /// Gets or sets the last seen. + public DateTimeOffset? LastSeen { get; set; } + /// Gets or sets the count. + public long? Count { get; set; } + /// Gets or sets the cause page url. + public string CausePageUrl { get; set; } + /// Gets or sets the crawl guid. + public string CrawlGuid { get; set; } + /// Gets or sets the page guid. + public string PageGuid { get; set; } + /// Gets or sets the resource guid. + public string ResourceGuid { get; set; } + /// Gets or sets the expected hash. + public string ExpectedHash { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Task.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Task.Serialization.cs new file mode 100644 index 000000000000..0d000c5d2cc6 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Task.Serialization.cs @@ -0,0 +1,122 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class Task + { + internal static Task DeserializeTask(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + Optional startedAt = default; + Optional completedAt = default; + Optional lastPolledAt = default; + Optional state = default; + Optional phase = default; + Optional reason = default; + Optional> metadata = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("startedAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + startedAt = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("completedAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + completedAt = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastPolledAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastPolledAt = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("state"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = new TaskState(property.Value.GetString()); + continue; + } + if (property.NameEquals("phase"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + phase = new TaskPhase(property.Value.GetString()); + continue; + } + if (property.NameEquals("reason"u8)) + { + reason = property.Value.GetString(); + continue; + } + if (property.NameEquals("metadata"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + dictionary.Add(property0.Name, null); + } + else + { + dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); + } + } + metadata = dictionary; + continue; + } + } + return new Task(id, Optional.ToNullable(startedAt), Optional.ToNullable(completedAt), Optional.ToNullable(lastPolledAt), Optional.ToNullable(state), Optional.ToNullable(phase), reason.Value, Optional.ToDictionary(metadata)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static Task FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeTask(document.RootElement); + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Task.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Task.cs new file mode 100644 index 000000000000..72fc1b01fb5a --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Task.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The Task. + public partial class Task + { + /// Initializes a new instance of Task. + internal Task() + { + Metadata = new ChangeTrackingDictionary(); + } + + /// Initializes a new instance of Task. + /// The unique identifier of the task. + /// The time the task started. + /// The time the task completed. + /// The last time the status of the task was updated. + /// The state the task is in. + /// The phase the task is in. + /// The reason the task was moved into its current state, if the task wasn't completed. + /// Attributes unique to the task. This differs by task type. + internal Task(string id, DateTimeOffset? startedAt, DateTimeOffset? completedAt, DateTimeOffset? lastPolledAt, TaskState? state, TaskPhase? phase, string reason, IReadOnlyDictionary metadata) + { + Id = id; + StartedAt = startedAt; + CompletedAt = completedAt; + LastPolledAt = lastPolledAt; + State = state; + Phase = phase; + Reason = reason; + Metadata = metadata; + } + + /// The unique identifier of the task. + public string Id { get; } + /// The time the task started. + public DateTimeOffset? StartedAt { get; } + /// The time the task completed. + public DateTimeOffset? CompletedAt { get; } + /// The last time the status of the task was updated. + public DateTimeOffset? LastPolledAt { get; } + /// The state the task is in. + public TaskState? State { get; } + /// The phase the task is in. + public TaskPhase? Phase { get; } + /// The reason the task was moved into its current state, if the task wasn't completed. + public string Reason { get; } + /// + /// Attributes unique to the task. This differs by task type. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formated 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" }. + /// + /// + /// + /// + public IReadOnlyDictionary Metadata { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/TaskPhase.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/TaskPhase.cs new file mode 100644 index 000000000000..31702f3728b4 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/TaskPhase.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.Analytics.Defender.Easm +{ + /// The phase the task is in. + public readonly partial struct TaskPhase : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TaskPhase(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string RunningValue = "running"; + private const string PollingValue = "polling"; + private const string CompleteValue = "complete"; + + /// running. + public static TaskPhase Running { get; } = new TaskPhase(RunningValue); + /// polling. + public static TaskPhase Polling { get; } = new TaskPhase(PollingValue); + /// complete. + public static TaskPhase Complete { get; } = new TaskPhase(CompleteValue); + /// Determines if two values are the same. + public static bool operator ==(TaskPhase left, TaskPhase right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TaskPhase left, TaskPhase right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator TaskPhase(string value) => new TaskPhase(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TaskPhase other && Equals(other); + /// + public bool Equals(TaskPhase other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/TaskState.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/TaskState.cs new file mode 100644 index 000000000000..3eb2013794e4 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/TaskState.cs @@ -0,0 +1,66 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Analytics.Defender.Easm +{ + /// The state the task is in. + public readonly partial struct TaskState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public TaskState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PendingValue = "pending"; + private const string RunningValue = "running"; + private const string PausedValue = "paused"; + private const string CompleteValue = "complete"; + private const string IncompleteValue = "incomplete"; + private const string FailedValue = "failed"; + private const string WarningValue = "warning"; + + /// pending. + public static TaskState Pending { get; } = new TaskState(PendingValue); + /// running. + public static TaskState Running { get; } = new TaskState(RunningValue); + /// paused. + public static TaskState Paused { get; } = new TaskState(PausedValue); + /// complete. + public static TaskState Complete { get; } = new TaskState(CompleteValue); + /// incomplete. + public static TaskState Incomplete { get; } = new TaskState(IncompleteValue); + /// failed. + public static TaskState Failed { get; } = new TaskState(FailedValue); + /// warning. + public static TaskState Warning { get; } = new TaskState(WarningValue); + /// Determines if two values are the same. + public static bool operator ==(TaskState left, TaskState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(TaskState left, TaskState right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator TaskState(string value) => new TaskState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is TaskState other && Equals(other); + /// + public bool Equals(TaskState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/UnknownAssetResource.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/UnknownAssetResource.Serialization.cs new file mode 100644 index 000000000000..a6a68723d7f8 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/UnknownAssetResource.Serialization.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + internal partial class UnknownAssetResource + { + internal static UnknownAssetResource DeserializeUnknownAssetResource(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string kind = "Unknown"; + string id = default; + Optional name = default; + Optional displayName = default; + Optional uuid = default; + Optional createdDate = default; + Optional updatedDate = default; + Optional state = default; + Optional externalId = default; + Optional> labels = default; + Optional wildcard = default; + Optional discoGroupName = default; + Optional> auditTrail = default; + Optional reason = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("uuid"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + uuid = property.Value.GetGuid(); + continue; + } + if (property.NameEquals("createdDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("updatedDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + updatedDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("state"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + state = new AssetState(property.Value.GetString()); + continue; + } + if (property.NameEquals("externalId"u8)) + { + externalId = property.Value.GetString(); + continue; + } + if (property.NameEquals("labels"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + labels = array; + continue; + } + if (property.NameEquals("wildcard"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + wildcard = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("discoGroupName"u8)) + { + discoGroupName = property.Value.GetString(); + continue; + } + if (property.NameEquals("auditTrail"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AuditTrailItem.DeserializeAuditTrailItem(item)); + } + auditTrail = array; + continue; + } + if (property.NameEquals("reason"u8)) + { + reason = property.Value.GetString(); + continue; + } + } + return new UnknownAssetResource(kind, id, name.Value, displayName.Value, Optional.ToNullable(uuid), Optional.ToNullable(createdDate), Optional.ToNullable(updatedDate), Optional.ToNullable(state), externalId.Value, Optional.ToList(labels), Optional.ToNullable(wildcard), discoGroupName.Value, Optional.ToList(auditTrail), reason.Value); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownAssetResource FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownAssetResource(document.RootElement); + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/UnknownAssetResource.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/UnknownAssetResource.cs new file mode 100644 index 000000000000..78a7554dfd08 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/UnknownAssetResource.cs @@ -0,0 +1,40 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Analytics.Defender.Easm +{ + /// Unknown version of AssetResource. + internal partial class UnknownAssetResource : AssetResource + { + /// Initializes a new instance of UnknownAssetResource. + internal UnknownAssetResource() + { + } + + /// Initializes a new instance of UnknownAssetResource. + /// Discriminator. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// Global UUID for the asset. + /// The date this asset was first added to this workspace. + /// The date this asset was last updated for this workspace. + /// + /// An optional customer provided identifier for this asset. + /// Customer labels assigned to this asset. + /// An indicator of whether this asset represents a wildcard rollup of assets on this domain. + /// The name of the DiscoGroup that brought added this asset to the workspace. + /// The history of how this asset was pulled into the workspace through the discovery process. + /// + internal UnknownAssetResource(string kind, string id, string name, string displayName, Guid? uuid, DateTimeOffset? createdDate, DateTimeOffset? updatedDate, AssetState? state, string externalId, IList labels, bool? wildcard, string discoGroupName, IList auditTrail, string reason) : base(kind, id, name, displayName, uuid, createdDate, updatedDate, state, externalId, labels, wildcard, discoGroupName, auditTrail, reason) + { + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/UnknownDataConnection.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/UnknownDataConnection.Serialization.cs new file mode 100644 index 000000000000..637524646832 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/UnknownDataConnection.Serialization.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + internal partial class UnknownDataConnection + { + internal static UnknownDataConnection DeserializeUnknownDataConnection(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string kind = "Unknown"; + Optional id = default; + string name = default; + Optional displayName = default; + Optional content = default; + Optional createdDate = default; + Optional frequency = default; + Optional frequencyOffset = default; + Optional updatedDate = default; + Optional userUpdatedAt = default; + Optional active = default; + Optional inactiveMessage = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("content"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + content = new DataConnectionContent(property.Value.GetString()); + continue; + } + if (property.NameEquals("createdDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + createdDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("frequency"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + frequency = new DataConnectionFrequency(property.Value.GetString()); + continue; + } + if (property.NameEquals("frequencyOffset"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + frequencyOffset = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("updatedDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + updatedDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("userUpdatedAt"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + userUpdatedAt = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("active"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + active = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("inactiveMessage"u8)) + { + inactiveMessage = property.Value.GetString(); + continue; + } + } + return new UnknownDataConnection(kind, id.Value, name, displayName.Value, Optional.ToNullable(content), Optional.ToNullable(createdDate), Optional.ToNullable(frequency), Optional.ToNullable(frequencyOffset), Optional.ToNullable(updatedDate), Optional.ToNullable(userUpdatedAt), Optional.ToNullable(active), inactiveMessage.Value); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownDataConnection FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownDataConnection(document.RootElement); + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/UnknownDataConnection.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/UnknownDataConnection.cs new file mode 100644 index 000000000000..58a044f81403 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/UnknownDataConnection.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Analytics.Defender.Easm +{ + /// Unknown version of DataConnection. + internal partial class UnknownDataConnection : DataConnection + { + /// Initializes a new instance of UnknownDataConnection. + internal UnknownDataConnection() + { + } + + /// Initializes a new instance of UnknownDataConnection. + /// Discriminator. + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// The type of data the data connection will transfer. + /// The date the data connection was created. + /// The rate at which the data connection will receive updates. + /// The day to update the data connection on. + /// The date the data connection was last updated. + /// The date the data connection was last updated by user. + /// An indicator of whether the data connection is active. + /// A message that specifies details about data connection if inactive. + internal UnknownDataConnection(string kind, string id, string name, string displayName, DataConnectionContent? content, DateTimeOffset? createdDate, DataConnectionFrequency? frequency, int? frequencyOffset, DateTimeOffset? updatedDate, DateTimeOffset? userUpdatedAt, bool? active, string inactiveMessage) : base(kind, id, name, displayName, content, createdDate, frequency, frequencyOffset, updatedDate, userUpdatedAt, active, inactiveMessage) + { + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ValidateResult.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ValidateResult.Serialization.cs new file mode 100644 index 000000000000..aca4b35729a5 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ValidateResult.Serialization.cs @@ -0,0 +1,46 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class ValidateResult + { + internal static ValidateResult DeserializeValidateResult(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional error = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = ErrorDetail.DeserializeErrorDetail(property.Value); + continue; + } + } + return new ValidateResult(error.Value); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ValidateResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeValidateResult(document.RootElement); + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ValidateResult.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ValidateResult.cs new file mode 100644 index 000000000000..92c40a8773ef --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ValidateResult.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Analytics.Defender.Easm +{ + /// The ValidateResult. + public partial class ValidateResult + { + /// Initializes a new instance of ValidateResult. + internal ValidateResult() + { + } + + /// Initializes a new instance of ValidateResult. + /// This is the top-level error object whose code matches the x-ms-error-code response header. + internal ValidateResult(ErrorDetail error) + { + Error = error; + } + + /// This is the top-level error object whose code matches the x-ms-error-code response header. + public ErrorDetail Error { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/WebComponent.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/WebComponent.Serialization.cs new file mode 100644 index 000000000000..719d1b6bdb12 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/WebComponent.Serialization.cs @@ -0,0 +1,271 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Text.Json; +using Azure; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class WebComponent : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(Type)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); + } + if (Optional.IsDefined(Version)) + { + writer.WritePropertyName("version"u8); + writer.WriteStringValue(Version); + } + if (Optional.IsCollectionDefined(RuleId)) + { + writer.WritePropertyName("ruleId"u8); + writer.WriteStartArray(); + foreach (var item in RuleId) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(FirstSeen)) + { + writer.WritePropertyName("firstSeen"u8); + writer.WriteStringValue(FirstSeen.Value, "O"); + } + if (Optional.IsDefined(LastSeen)) + { + writer.WritePropertyName("lastSeen"u8); + writer.WriteStringValue(LastSeen.Value, "O"); + } + if (Optional.IsDefined(Count)) + { + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count.Value); + } + if (Optional.IsCollectionDefined(Cve)) + { + writer.WritePropertyName("cve"u8); + writer.WriteStartArray(); + foreach (var item in Cve) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(EndOfLife)) + { + writer.WritePropertyName("endOfLife"u8); + writer.WriteNumberValue(EndOfLife.Value); + } + if (Optional.IsDefined(Recent)) + { + writer.WritePropertyName("recent"u8); + writer.WriteBooleanValue(Recent.Value); + } + if (Optional.IsCollectionDefined(Ports)) + { + writer.WritePropertyName("ports"u8); + writer.WriteStartArray(); + foreach (var item in Ports) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(Sources)) + { + writer.WritePropertyName("sources"u8); + writer.WriteStartArray(); + foreach (var item in Sources) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(Service)) + { + writer.WritePropertyName("service"u8); + writer.WriteStringValue(Service); + } + writer.WriteEndObject(); + } + + internal static WebComponent DeserializeWebComponent(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional name = default; + Optional type = default; + Optional version = default; + Optional> ruleId = default; + Optional firstSeen = default; + Optional lastSeen = default; + Optional count = default; + Optional> cve = default; + Optional endOfLife = default; + Optional recent = default; + Optional> ports = default; + Optional> sources = default; + Optional service = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("version"u8)) + { + version = property.Value.GetString(); + continue; + } + if (property.NameEquals("ruleId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + ruleId = array; + continue; + } + if (property.NameEquals("firstSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + firstSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("lastSeen"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + lastSeen = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("cve"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Easm.Cve.DeserializeCve(item)); + } + cve = array; + continue; + } + if (property.NameEquals("endOfLife"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + endOfLife = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("recent"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + recent = property.Value.GetBoolean(); + continue; + } + if (property.NameEquals("ports"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Port.DeserializePort(item)); + } + ports = array; + continue; + } + if (property.NameEquals("sources"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Source.DeserializeSource(item)); + } + sources = array; + continue; + } + if (property.NameEquals("service"u8)) + { + service = property.Value.GetString(); + continue; + } + } + return new WebComponent(name.Value, type.Value, version.Value, Optional.ToList(ruleId), Optional.ToNullable(firstSeen), Optional.ToNullable(lastSeen), Optional.ToNullable(count), Optional.ToList(cve), Optional.ToNullable(endOfLife), Optional.ToNullable(recent), Optional.ToList(ports), Optional.ToList(sources), service.Value); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static WebComponent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeWebComponent(document.RootElement); + } + + /// Convert into a Utf8JsonRequestContent. + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/WebComponent.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/WebComponent.cs new file mode 100644 index 000000000000..6adf10096608 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/WebComponent.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + /// The WebComponent. + public partial class WebComponent + { + /// Initializes a new instance of WebComponent. + public WebComponent() + { + RuleId = new ChangeTrackingList(); + Cve = new ChangeTrackingList(); + Ports = new ChangeTrackingList(); + Sources = new ChangeTrackingList(); + } + + /// Initializes a new instance of WebComponent. + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + /// + internal WebComponent(string name, string type, string version, IList ruleId, DateTimeOffset? firstSeen, DateTimeOffset? lastSeen, long? count, IList cve, long? endOfLife, bool? recent, IList ports, IList sources, string service) + { + Name = name; + Type = type; + Version = version; + RuleId = ruleId; + FirstSeen = firstSeen; + LastSeen = lastSeen; + Count = count; + Cve = cve; + EndOfLife = endOfLife; + Recent = recent; + Ports = ports; + Sources = sources; + Service = service; + } + + /// Gets or sets the name. + public string Name { get; set; } + /// Gets or sets the type. + public string Type { get; set; } + /// Gets or sets the version. + public string Version { get; set; } + /// Gets the rule id. + public IList RuleId { get; } + /// Gets or sets the first seen. + public DateTimeOffset? FirstSeen { get; set; } + /// Gets or sets the last seen. + public DateTimeOffset? LastSeen { get; set; } + /// Gets or sets the count. + public long? Count { get; set; } + /// Gets the cve. + public IList Cve { get; } + /// Gets or sets the end of life. + public long? EndOfLife { get; set; } + /// Gets or sets the recent. + public bool? Recent { get; set; } + /// Gets the ports. + public IList Ports { get; } + /// Gets the sources. + public IList Sources { get; } + /// Gets or sets the service. + public string Service { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Properties/AssemblyInfo.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Properties/AssemblyInfo.cs new file mode 100644 index 000000000000..9449acb13dd0 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/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.Analytics.Defender.Easm.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100d15ddcb29688295338af4b7686603fe614abd555e09efba8fb88ee09e1f7b1ccaeed2e8f823fa9eef3fdd60217fc012ea67d2479751a0b8c087a4185541b851bd8b16f8d91b840e51b1cb0ba6fe647997e57429265e85ef62d565db50a69ae1647d54d7bd855e4db3d8a91510e5bcbd0edfbbecaa20a7bd9ae74593daa7b11b4")] + +// Replace Microsoft.Test with the correct resource provider namepace for your service and uncomment. +// See https://docs.microsoft.com/en-us/azure/azure-resource-manager/management/azure-services-resource-providers +// for the list of possible values. +[assembly: Azure.Core.AzureResourceProviderNamespace("Microsoft.Template")] diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/tests/Azure.Analytics.Defender.Easm.Tests.csproj b/sdk/easm/Azure.Analytics.Defender.Easm/tests/Azure.Analytics.Defender.Easm.Tests.csproj new file mode 100644 index 000000000000..3edfdfd718b9 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/tests/Azure.Analytics.Defender.Easm.Tests.csproj @@ -0,0 +1,29 @@ + + + $(RequiredTargetFrameworks) + + + $(NoWarn);CS1591 + + + + + + + + + + + + + + + + + + + + + + + diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/tests/Generated/Samples/Samples_EasmClient.cs b/sdk/easm/Azure.Analytics.Defender.Easm/tests/Generated/Samples/Samples_EasmClient.cs new file mode 100644 index 000000000000..eca434bb6341 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/tests/Generated/Samples/Samples_EasmClient.cs @@ -0,0 +1,4013 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading.Tasks; +using Azure; +using Azure.Analytics.Defender.Easm; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Analytics.Defender.Easm.Samples +{ + public partial class Samples_EasmClient + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_UpdateAssets_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + using RequestContent content = RequestContent.Create(new + { + asset = new object(), + kind = "as", + }); + Response response = client.UpdateAssets("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_UpdateAssets_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + using RequestContent content = RequestContent.Create(new + { + asset = new object(), + kind = "as", + }); + Response response = await client.UpdateAssetsAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_UpdateAssets_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + AssetResource assetResource = new AsAssetResource(new AsAsset()); + Response response = client.UpdateAssets("", assetResource); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_UpdateAssets_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + AssetResource assetResource = new AsAssetResource(new AsAsset()); + Response response = await client.UpdateAssetsAsync("", assetResource); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_UpdateAssets_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + using RequestContent content = RequestContent.Create(new + { + asset = new + { + asn = 1234L, + asNames = new object[] + { +new +{ +value = "", +sources = new object[] +{ +new +{ +source = "", +firstSeen = "2022-05-10T14:57:31.2311892-04:00", +lastSeen = "2022-05-10T14:57:31.2311892-04:00", +count = 1234L, +reason = "", +} +}, +firstSeen = "2022-05-10T14:57:31.2311892-04:00", +lastSeen = "2022-05-10T14:57:31.2311892-04:00", +count = 1234L, +recent = true, +} + }, + orgNames = new object[] + { +null + }, + orgIds = new object[] + { +null + }, + countries = new object[] + { +null + }, + registries = new object[] + { +null + }, + sources = new object[] + { +null + }, + firstSeen = "2022-05-10T14:57:31.2311892-04:00", + lastSeen = "2022-05-10T14:57:31.2311892-04:00", + count = 1234L, + registrarCreatedAt = new object[] + { +new +{ +value = 1234L, +sources = new object[] +{ +null +}, +firstSeen = "2022-05-10T14:57:31.2311892-04:00", +lastSeen = "2022-05-10T14:57:31.2311892-04:00", +count = 1234L, +recent = true, +} + }, + registrarUpdatedAt = new object[] + { +null + }, + registrantContacts = new object[] + { +null + }, + adminContacts = new object[] + { +null + }, + technicalContacts = new object[] + { +null + }, + registrarNames = new object[] + { +null + }, + registrantNames = new object[] + { +null + }, + adminNames = new object[] + { +null + }, + technicalNames = new object[] + { +null + }, + adminOrgs = new object[] + { +null + }, + technicalOrgs = new object[] + { +null + }, + registrantPhones = new object[] + { +null + }, + adminPhones = new object[] + { +null + }, + technicalPhones = new object[] + { +null + }, + detailedFromWhoisAt = "2022-05-10T14:57:31.2311892-04:00", + }, + kind = "as", + name = "", + displayName = "", + uuid = "73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a", + createdDate = "2022-05-10T14:57:31.2311892-04:00", + updatedDate = "2022-05-10T14:57:31.2311892-04:00", + state = "candidate", + externalId = "", + labels = new object[] + { +"" + }, + wildcard = true, + discoGroupName = "", + auditTrail = new object[] + { +new +{ +id = "", +name = "", +displayName = "", +kind = "as", +reason = "", +} + }, + reason = "", + }); + Response response = client.UpdateAssets("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("uuid").ToString()); + Console.WriteLine(result.GetProperty("createdDate").ToString()); + Console.WriteLine(result.GetProperty("updatedDate").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("externalId").ToString()); + Console.WriteLine(result.GetProperty("labels")[0].ToString()); + Console.WriteLine(result.GetProperty("wildcard").ToString()); + Console.WriteLine(result.GetProperty("discoGroupName").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("reason").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_UpdateAssets_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + using RequestContent content = RequestContent.Create(new + { + asset = new + { + asn = 1234L, + asNames = new object[] + { +new +{ +value = "", +sources = new object[] +{ +new +{ +source = "", +firstSeen = "2022-05-10T14:57:31.2311892-04:00", +lastSeen = "2022-05-10T14:57:31.2311892-04:00", +count = 1234L, +reason = "", +} +}, +firstSeen = "2022-05-10T14:57:31.2311892-04:00", +lastSeen = "2022-05-10T14:57:31.2311892-04:00", +count = 1234L, +recent = true, +} + }, + orgNames = new object[] + { +null + }, + orgIds = new object[] + { +null + }, + countries = new object[] + { +null + }, + registries = new object[] + { +null + }, + sources = new object[] + { +null + }, + firstSeen = "2022-05-10T14:57:31.2311892-04:00", + lastSeen = "2022-05-10T14:57:31.2311892-04:00", + count = 1234L, + registrarCreatedAt = new object[] + { +new +{ +value = 1234L, +sources = new object[] +{ +null +}, +firstSeen = "2022-05-10T14:57:31.2311892-04:00", +lastSeen = "2022-05-10T14:57:31.2311892-04:00", +count = 1234L, +recent = true, +} + }, + registrarUpdatedAt = new object[] + { +null + }, + registrantContacts = new object[] + { +null + }, + adminContacts = new object[] + { +null + }, + technicalContacts = new object[] + { +null + }, + registrarNames = new object[] + { +null + }, + registrantNames = new object[] + { +null + }, + adminNames = new object[] + { +null + }, + technicalNames = new object[] + { +null + }, + adminOrgs = new object[] + { +null + }, + technicalOrgs = new object[] + { +null + }, + registrantPhones = new object[] + { +null + }, + adminPhones = new object[] + { +null + }, + technicalPhones = new object[] + { +null + }, + detailedFromWhoisAt = "2022-05-10T14:57:31.2311892-04:00", + }, + kind = "as", + name = "", + displayName = "", + uuid = "73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a", + createdDate = "2022-05-10T14:57:31.2311892-04:00", + updatedDate = "2022-05-10T14:57:31.2311892-04:00", + state = "candidate", + externalId = "", + labels = new object[] + { +"" + }, + wildcard = true, + discoGroupName = "", + auditTrail = new object[] + { +new +{ +id = "", +name = "", +displayName = "", +kind = "as", +reason = "", +} + }, + reason = "", + }); + Response response = await client.UpdateAssetsAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("uuid").ToString()); + Console.WriteLine(result.GetProperty("createdDate").ToString()); + Console.WriteLine(result.GetProperty("updatedDate").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("externalId").ToString()); + Console.WriteLine(result.GetProperty("labels")[0].ToString()); + Console.WriteLine(result.GetProperty("wildcard").ToString()); + Console.WriteLine(result.GetProperty("discoGroupName").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("reason").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_UpdateAssets_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + AssetResource assetResource = new AsAssetResource(new AsAsset + { + Asn = 1234L, + AsNames = {new ObservedString +{ +Value = "", +Sources = {new Source +{ +SourceProperty = "", +FirstSeen = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), +LastSeen = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), +Count = 1234L, +Reason = "", +}}, +}}, + OrgNames = { default }, + OrgIds = { default }, + Countries = { default }, + Registries = { default }, + Sources = { default }, + FirstSeen = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + LastSeen = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + Count = 1234L, + RegistrarCreatedAt = {new ObservedLong +{ +Value = 1234L, +Sources = {default}, +}}, + RegistrarUpdatedAt = { default }, + RegistrantContacts = { default }, + AdminContacts = { default }, + TechnicalContacts = { default }, + RegistrarNames = { default }, + RegistrantNames = { default }, + AdminNames = { default }, + TechnicalNames = { default }, + AdminOrgs = { default }, + TechnicalOrgs = { default }, + RegistrantPhones = { default }, + AdminPhones = { default }, + TechnicalPhones = { default }, + DetailedFromWhoisAt = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + }) + { + Name = "", + DisplayName = "", + Uuid = Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), + CreatedDate = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + UpdatedDate = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + State = AssetState.Candidate, + ExternalId = "", + Labels = { "" }, + Wildcard = true, + DiscoGroupName = "", + AuditTrail = {new AuditTrailItem +{ +Id = "", +Name = "", +DisplayName = "", +Kind = AuditTrailItemKind.As, +Reason = "", +}}, + Reason = "", + }; + Response response = client.UpdateAssets("", assetResource); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_UpdateAssets_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + AssetResource assetResource = new AsAssetResource(new AsAsset + { + Asn = 1234L, + AsNames = {new ObservedString +{ +Value = "", +Sources = {new Source +{ +SourceProperty = "", +FirstSeen = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), +LastSeen = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), +Count = 1234L, +Reason = "", +}}, +}}, + OrgNames = { default }, + OrgIds = { default }, + Countries = { default }, + Registries = { default }, + Sources = { default }, + FirstSeen = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + LastSeen = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + Count = 1234L, + RegistrarCreatedAt = {new ObservedLong +{ +Value = 1234L, +Sources = {default}, +}}, + RegistrarUpdatedAt = { default }, + RegistrantContacts = { default }, + AdminContacts = { default }, + TechnicalContacts = { default }, + RegistrarNames = { default }, + RegistrantNames = { default }, + AdminNames = { default }, + TechnicalNames = { default }, + AdminOrgs = { default }, + TechnicalOrgs = { default }, + RegistrantPhones = { default }, + AdminPhones = { default }, + TechnicalPhones = { default }, + DetailedFromWhoisAt = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + }) + { + Name = "", + DisplayName = "", + Uuid = Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), + CreatedDate = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + UpdatedDate = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + State = AssetState.Candidate, + ExternalId = "", + Labels = { "" }, + Wildcard = true, + DiscoGroupName = "", + AuditTrail = {new AuditTrailItem +{ +Id = "", +Name = "", +DisplayName = "", +Kind = AuditTrailItemKind.As, +Reason = "", +}}, + Reason = "", + }; + Response response = await client.UpdateAssetsAsync("", assetResource); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetAssetResource_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.GetAssetResource("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetAssetResource_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.GetAssetResourceAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetAssetResource_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.GetAssetResource(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetAssetResource_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.GetAssetResourceAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetAssetResource_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.GetAssetResource("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("uuid").ToString()); + Console.WriteLine(result.GetProperty("createdDate").ToString()); + Console.WriteLine(result.GetProperty("updatedDate").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("externalId").ToString()); + Console.WriteLine(result.GetProperty("labels")[0].ToString()); + Console.WriteLine(result.GetProperty("wildcard").ToString()); + Console.WriteLine(result.GetProperty("discoGroupName").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("reason").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetAssetResource_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.GetAssetResourceAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("uuid").ToString()); + Console.WriteLine(result.GetProperty("createdDate").ToString()); + Console.WriteLine(result.GetProperty("updatedDate").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("externalId").ToString()); + Console.WriteLine(result.GetProperty("labels")[0].ToString()); + Console.WriteLine(result.GetProperty("wildcard").ToString()); + Console.WriteLine(result.GetProperty("discoGroupName").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("reason").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetAssetResource_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.GetAssetResource(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetAssetResource_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.GetAssetResourceAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ValidateDataConnection_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + using RequestContent content = RequestContent.Create(new + { + properties = new object(), + kind = "logAnalytics", + }); + Response response = client.ValidateDataConnection(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_ValidateDataConnection_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + using RequestContent content = RequestContent.Create(new + { + properties = new object(), + kind = "logAnalytics", + }); + Response response = await client.ValidateDataConnectionAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ValidateDataConnection_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + DataConnectionData dataConnectionData = new LogAnalyticsDataConnectionData(new LogAnalyticsDataConnectionProperties()); + Response response = client.ValidateDataConnection(dataConnectionData); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_ValidateDataConnection_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + DataConnectionData dataConnectionData = new LogAnalyticsDataConnectionData(new LogAnalyticsDataConnectionProperties()); + Response response = await client.ValidateDataConnectionAsync(dataConnectionData); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ValidateDataConnection_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + using RequestContent content = RequestContent.Create(new + { + properties = new + { + apiKey = "", + workspaceId = "", + }, + kind = "logAnalytics", + name = "", + content = "assets", + frequency = "daily", + frequencyOffset = 1234, + }); + Response response = client.ValidateDataConnection(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("value").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_ValidateDataConnection_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + using RequestContent content = RequestContent.Create(new + { + properties = new + { + apiKey = "", + workspaceId = "", + }, + kind = "logAnalytics", + name = "", + content = "assets", + frequency = "daily", + frequencyOffset = 1234, + }); + Response response = await client.ValidateDataConnectionAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("value").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ValidateDataConnection_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + DataConnectionData dataConnectionData = new LogAnalyticsDataConnectionData(new LogAnalyticsDataConnectionProperties + { + ApiKey = "", + WorkspaceId = "", + }) + { + Name = "", + Content = DataConnectionContent.Assets, + Frequency = DataConnectionFrequency.Daily, + FrequencyOffset = 1234, + }; + Response response = client.ValidateDataConnection(dataConnectionData); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_ValidateDataConnection_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + DataConnectionData dataConnectionData = new LogAnalyticsDataConnectionData(new LogAnalyticsDataConnectionProperties + { + ApiKey = "", + WorkspaceId = "", + }) + { + Name = "", + Content = DataConnectionContent.Assets, + Frequency = DataConnectionFrequency.Daily, + FrequencyOffset = 1234, + }; + Response response = await client.ValidateDataConnectionAsync(dataConnectionData); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDataConnection_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.GetDataConnection("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetDataConnection_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.GetDataConnectionAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDataConnection_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.GetDataConnection(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetDataConnection_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.GetDataConnectionAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDataConnection_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.GetDataConnection("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("content").ToString()); + Console.WriteLine(result.GetProperty("createdDate").ToString()); + Console.WriteLine(result.GetProperty("frequency").ToString()); + Console.WriteLine(result.GetProperty("frequencyOffset").ToString()); + Console.WriteLine(result.GetProperty("updatedDate").ToString()); + Console.WriteLine(result.GetProperty("userUpdatedAt").ToString()); + Console.WriteLine(result.GetProperty("active").ToString()); + Console.WriteLine(result.GetProperty("inactiveMessage").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetDataConnection_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.GetDataConnectionAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("content").ToString()); + Console.WriteLine(result.GetProperty("createdDate").ToString()); + Console.WriteLine(result.GetProperty("frequency").ToString()); + Console.WriteLine(result.GetProperty("frequencyOffset").ToString()); + Console.WriteLine(result.GetProperty("updatedDate").ToString()); + Console.WriteLine(result.GetProperty("userUpdatedAt").ToString()); + Console.WriteLine(result.GetProperty("active").ToString()); + Console.WriteLine(result.GetProperty("inactiveMessage").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDataConnection_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.GetDataConnection(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetDataConnection_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.GetDataConnectionAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CreateOrReplaceDataConnection_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + using RequestContent content = RequestContent.Create(new + { + properties = new object(), + kind = "logAnalytics", + }); + Response response = client.CreateOrReplaceDataConnection("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_CreateOrReplaceDataConnection_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + using RequestContent content = RequestContent.Create(new + { + properties = new object(), + kind = "logAnalytics", + }); + Response response = await client.CreateOrReplaceDataConnectionAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CreateOrReplaceDataConnection_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + DataConnection dataConnection = new LogAnalyticsDataConnection(new LogAnalyticsDataConnectionProperties()); + Response response = client.CreateOrReplaceDataConnection("", dataConnection); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_CreateOrReplaceDataConnection_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + DataConnection dataConnection = new LogAnalyticsDataConnection(new LogAnalyticsDataConnectionProperties()); + Response response = await client.CreateOrReplaceDataConnectionAsync("", dataConnection); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CreateOrReplaceDataConnection_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + using RequestContent content = RequestContent.Create(new + { + properties = new + { + apiKey = "", + workspaceId = "", + }, + kind = "logAnalytics", + id = "", + displayName = "", + content = "assets", + frequency = "daily", + frequencyOffset = 1234, + active = true, + }); + Response response = client.CreateOrReplaceDataConnection("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("content").ToString()); + Console.WriteLine(result.GetProperty("createdDate").ToString()); + Console.WriteLine(result.GetProperty("frequency").ToString()); + Console.WriteLine(result.GetProperty("frequencyOffset").ToString()); + Console.WriteLine(result.GetProperty("updatedDate").ToString()); + Console.WriteLine(result.GetProperty("userUpdatedAt").ToString()); + Console.WriteLine(result.GetProperty("active").ToString()); + Console.WriteLine(result.GetProperty("inactiveMessage").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_CreateOrReplaceDataConnection_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + using RequestContent content = RequestContent.Create(new + { + properties = new + { + apiKey = "", + workspaceId = "", + }, + kind = "logAnalytics", + id = "", + displayName = "", + content = "assets", + frequency = "daily", + frequencyOffset = 1234, + active = true, + }); + Response response = await client.CreateOrReplaceDataConnectionAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("content").ToString()); + Console.WriteLine(result.GetProperty("createdDate").ToString()); + Console.WriteLine(result.GetProperty("frequency").ToString()); + Console.WriteLine(result.GetProperty("frequencyOffset").ToString()); + Console.WriteLine(result.GetProperty("updatedDate").ToString()); + Console.WriteLine(result.GetProperty("userUpdatedAt").ToString()); + Console.WriteLine(result.GetProperty("active").ToString()); + Console.WriteLine(result.GetProperty("inactiveMessage").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CreateOrReplaceDataConnection_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + DataConnection dataConnection = new LogAnalyticsDataConnection(new LogAnalyticsDataConnectionProperties + { + ApiKey = "", + WorkspaceId = "", + }) + { + Id = "", + DisplayName = "", + Content = DataConnectionContent.Assets, + Frequency = DataConnectionFrequency.Daily, + FrequencyOffset = 1234, + Active = true, + }; + Response response = client.CreateOrReplaceDataConnection("", dataConnection); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_CreateOrReplaceDataConnection_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + DataConnection dataConnection = new LogAnalyticsDataConnection(new LogAnalyticsDataConnectionProperties + { + ApiKey = "", + WorkspaceId = "", + }) + { + Id = "", + DisplayName = "", + Content = DataConnectionContent.Assets, + Frequency = DataConnectionFrequency.Daily, + FrequencyOffset = 1234, + Active = true, + }; + Response response = await client.CreateOrReplaceDataConnectionAsync("", dataConnection); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeleteDataConnection_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.DeleteDataConnection(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_DeleteDataConnection_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.DeleteDataConnectionAsync(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeleteDataConnection_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.DeleteDataConnection(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_DeleteDataConnection_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.DeleteDataConnectionAsync(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ValidateDiscoGroup_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = client.ValidateDiscoGroup(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_ValidateDiscoGroup_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = await client.ValidateDiscoGroupAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ValidateDiscoGroup_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + DiscoGroupData discoGroupData = new DiscoGroupData(); + Response response = client.ValidateDiscoGroup(discoGroupData); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_ValidateDiscoGroup_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + DiscoGroupData discoGroupData = new DiscoGroupData(); + Response response = await client.ValidateDiscoGroupAsync(discoGroupData); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ValidateDiscoGroup_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + using RequestContent content = RequestContent.Create(new + { + name = "", + description = "", + tier = "", + frequencyMilliseconds = 1234L, + seeds = new object[] + { +new +{ +kind = "as", +name = "", +} + }, + names = new object[] + { +"" + }, + excludes = new object[] + { +null + }, + templateId = "", + }); + Response response = client.ValidateDiscoGroup(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("value").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_ValidateDiscoGroup_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + using RequestContent content = RequestContent.Create(new + { + name = "", + description = "", + tier = "", + frequencyMilliseconds = 1234L, + seeds = new object[] + { +new +{ +kind = "as", +name = "", +} + }, + names = new object[] + { +"" + }, + excludes = new object[] + { +null + }, + templateId = "", + }); + Response response = await client.ValidateDiscoGroupAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("error").GetProperty("innererror").GetProperty("value").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ValidateDiscoGroup_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + DiscoGroupData discoGroupData = new DiscoGroupData + { + Name = "", + Description = "", + Tier = "", + FrequencyMilliseconds = 1234L, + Seeds = {new DiscoSource +{ +Kind = DiscoSourceKind.As, +Name = "", +}}, + Names = { "" }, + Excludes = { default }, + TemplateId = "", + }; + Response response = client.ValidateDiscoGroup(discoGroupData); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_ValidateDiscoGroup_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + DiscoGroupData discoGroupData = new DiscoGroupData + { + Name = "", + Description = "", + Tier = "", + FrequencyMilliseconds = 1234L, + Seeds = {new DiscoSource +{ +Kind = DiscoSourceKind.As, +Name = "", +}}, + Names = { "" }, + Excludes = { default }, + TemplateId = "", + }; + Response response = await client.ValidateDiscoGroupAsync(discoGroupData); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDiscoGroup_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.GetDiscoGroup("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetDiscoGroup_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.GetDiscoGroupAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDiscoGroup_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.GetDiscoGroup(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetDiscoGroup_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.GetDiscoGroupAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDiscoGroup_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.GetDiscoGroup("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tier").ToString()); + Console.WriteLine(result.GetProperty("frequencyMilliseconds").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("names")[0].ToString()); + Console.WriteLine(result.GetProperty("excludes")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("excludes")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("submittedDate").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("startedDate").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("completedDate").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("tier").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("totalAssetsFoundCount").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("seeds")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("seeds")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("excludes")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("excludes")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("names")[0].ToString()); + Console.WriteLine(result.GetProperty("createdDate").ToString()); + Console.WriteLine(result.GetProperty("templateId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetDiscoGroup_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.GetDiscoGroupAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tier").ToString()); + Console.WriteLine(result.GetProperty("frequencyMilliseconds").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("names")[0].ToString()); + Console.WriteLine(result.GetProperty("excludes")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("excludes")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("submittedDate").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("startedDate").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("completedDate").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("tier").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("totalAssetsFoundCount").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("seeds")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("seeds")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("excludes")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("excludes")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("names")[0].ToString()); + Console.WriteLine(result.GetProperty("createdDate").ToString()); + Console.WriteLine(result.GetProperty("templateId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDiscoGroup_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.GetDiscoGroup(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetDiscoGroup_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.GetDiscoGroupAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CreateOrReplaceDiscoGroup_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = client.CreateOrReplaceDiscoGroup("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_CreateOrReplaceDiscoGroup_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = await client.CreateOrReplaceDiscoGroupAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CreateOrReplaceDiscoGroup_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + DiscoGroup discoGroup = new DiscoGroup(); + Response response = client.CreateOrReplaceDiscoGroup("", discoGroup); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_CreateOrReplaceDiscoGroup_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + DiscoGroup discoGroup = new DiscoGroup(); + Response response = await client.CreateOrReplaceDiscoGroupAsync("", discoGroup); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CreateOrReplaceDiscoGroup_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + using RequestContent content = RequestContent.Create(new + { + id = "", + displayName = "", + description = "", + tier = "", + frequencyMilliseconds = 1234L, + seeds = new object[] + { +new +{ +kind = "as", +name = "", +} + }, + names = new object[] + { +"" + }, + excludes = new object[] + { +null + }, + latestRun = new + { + submittedDate = "2022-05-10T14:57:31.2311892-04:00", + startedDate = "2022-05-10T14:57:31.2311892-04:00", + completedDate = "2022-05-10T14:57:31.2311892-04:00", + tier = "", + state = "pending", + totalAssetsFoundCount = 1234L, + seeds = new object[] + { +null + }, + excludes = new object[] + { +null + }, + names = new object[] + { +"" + }, + }, + createdDate = "2022-05-10T14:57:31.2311892-04:00", + templateId = "", + }); + Response response = client.CreateOrReplaceDiscoGroup("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tier").ToString()); + Console.WriteLine(result.GetProperty("frequencyMilliseconds").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("names")[0].ToString()); + Console.WriteLine(result.GetProperty("excludes")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("excludes")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("submittedDate").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("startedDate").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("completedDate").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("tier").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("totalAssetsFoundCount").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("seeds")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("seeds")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("excludes")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("excludes")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("names")[0].ToString()); + Console.WriteLine(result.GetProperty("createdDate").ToString()); + Console.WriteLine(result.GetProperty("templateId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_CreateOrReplaceDiscoGroup_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + using RequestContent content = RequestContent.Create(new + { + id = "", + displayName = "", + description = "", + tier = "", + frequencyMilliseconds = 1234L, + seeds = new object[] + { +new +{ +kind = "as", +name = "", +} + }, + names = new object[] + { +"" + }, + excludes = new object[] + { +null + }, + latestRun = new + { + submittedDate = "2022-05-10T14:57:31.2311892-04:00", + startedDate = "2022-05-10T14:57:31.2311892-04:00", + completedDate = "2022-05-10T14:57:31.2311892-04:00", + tier = "", + state = "pending", + totalAssetsFoundCount = 1234L, + seeds = new object[] + { +null + }, + excludes = new object[] + { +null + }, + names = new object[] + { +"" + }, + }, + createdDate = "2022-05-10T14:57:31.2311892-04:00", + templateId = "", + }); + Response response = await client.CreateOrReplaceDiscoGroupAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tier").ToString()); + Console.WriteLine(result.GetProperty("frequencyMilliseconds").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("names")[0].ToString()); + Console.WriteLine(result.GetProperty("excludes")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("excludes")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("submittedDate").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("startedDate").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("completedDate").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("tier").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("totalAssetsFoundCount").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("seeds")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("seeds")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("excludes")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("excludes")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("names")[0].ToString()); + Console.WriteLine(result.GetProperty("createdDate").ToString()); + Console.WriteLine(result.GetProperty("templateId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CreateOrReplaceDiscoGroup_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + DiscoGroup discoGroup = new DiscoGroup + { + Id = "", + DisplayName = "", + Description = "", + Tier = "", + FrequencyMilliseconds = 1234L, + Seeds = {new DiscoSource +{ +Kind = DiscoSourceKind.As, +Name = "", +}}, + Names = { "" }, + Excludes = { default }, + LatestRun = new DiscoRunResult + { + SubmittedDate = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + StartedDate = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + CompletedDate = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + Tier = "", + State = DiscoRunState.Pending, + TotalAssetsFoundCount = 1234L, + Seeds = { default }, + Excludes = { default }, + Names = { "" }, + }, + CreatedDate = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + TemplateId = "", + }; + Response response = client.CreateOrReplaceDiscoGroup("", discoGroup); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_CreateOrReplaceDiscoGroup_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + DiscoGroup discoGroup = new DiscoGroup + { + Id = "", + DisplayName = "", + Description = "", + Tier = "", + FrequencyMilliseconds = 1234L, + Seeds = {new DiscoSource +{ +Kind = DiscoSourceKind.As, +Name = "", +}}, + Names = { "" }, + Excludes = { default }, + LatestRun = new DiscoRunResult + { + SubmittedDate = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + StartedDate = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + CompletedDate = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + Tier = "", + State = DiscoRunState.Pending, + TotalAssetsFoundCount = 1234L, + Seeds = { default }, + Excludes = { default }, + Names = { "" }, + }, + CreatedDate = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + TemplateId = "", + }; + Response response = await client.CreateOrReplaceDiscoGroupAsync("", discoGroup); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_RunDiscoGroup_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.RunDiscoGroup(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_RunDiscoGroup_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.RunDiscoGroupAsync(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_RunDiscoGroup_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.RunDiscoGroup(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_RunDiscoGroup_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.RunDiscoGroupAsync(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDiscoTemplate_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.GetDiscoTemplate("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetDiscoTemplate_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.GetDiscoTemplateAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDiscoTemplate_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.GetDiscoTemplate(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetDiscoTemplate_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.GetDiscoTemplateAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDiscoTemplate_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.GetDiscoTemplate("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("industry").ToString()); + Console.WriteLine(result.GetProperty("region").ToString()); + Console.WriteLine(result.GetProperty("countryCode").ToString()); + Console.WriteLine(result.GetProperty("stateCode").ToString()); + Console.WriteLine(result.GetProperty("city").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("names")[0].ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetDiscoTemplate_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.GetDiscoTemplateAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("industry").ToString()); + Console.WriteLine(result.GetProperty("region").ToString()); + Console.WriteLine(result.GetProperty("countryCode").ToString()); + Console.WriteLine(result.GetProperty("stateCode").ToString()); + Console.WriteLine(result.GetProperty("city").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("names")[0].ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDiscoTemplate_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.GetDiscoTemplate(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetDiscoTemplate_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.GetDiscoTemplateAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetBillable_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.GetBillable(null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetBillable_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.GetBillableAsync(null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetBillable_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.GetBillable(); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetBillable_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.GetBillableAsync(); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetBillable_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.GetBillable(null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("date").ToString()); + Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("assetBreakdown")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("assetBreakdown")[0].GetProperty("count").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetBillable_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.GetBillableAsync(null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("date").ToString()); + Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("total").ToString()); + Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("assetBreakdown")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("assetBreakdown")[0].GetProperty("count").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetBillable_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.GetBillable(); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetBillable_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.GetBillableAsync(); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetSnapshot_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = client.GetSnapshot(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetSnapshot_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = await client.GetSnapshotAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetSnapshot_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + ReportAssetSnapshotRequest reportAssetSnapshotRequest = new ReportAssetSnapshotRequest(); + Response response = client.GetSnapshot(reportAssetSnapshotRequest); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetSnapshot_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + ReportAssetSnapshotRequest reportAssetSnapshotRequest = new ReportAssetSnapshotRequest(); + Response response = await client.GetSnapshotAsync(reportAssetSnapshotRequest); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetSnapshot_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + using RequestContent content = RequestContent.Create(new + { + metric = "", + labelName = "", + size = 1234, + page = 1234, + }); + Response response = client.GetSnapshot(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("metric").ToString()); + Console.WriteLine(result.GetProperty("labelName").ToString()); + Console.WriteLine(result.GetProperty("updatedAt").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("totalElements").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("mark").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("nextLink").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("uuid").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("createdDate").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("updatedDate").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("externalId").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("labels")[0].ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("wildcard").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("discoGroupName").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("auditTrail")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("auditTrail")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("auditTrail")[0].GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("auditTrail")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("auditTrail")[0].GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("reason").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetSnapshot_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + using RequestContent content = RequestContent.Create(new + { + metric = "", + labelName = "", + size = 1234, + page = 1234, + }); + Response response = await client.GetSnapshotAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("metric").ToString()); + Console.WriteLine(result.GetProperty("labelName").ToString()); + Console.WriteLine(result.GetProperty("updatedAt").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("totalElements").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("mark").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("nextLink").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("uuid").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("createdDate").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("updatedDate").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("externalId").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("labels")[0].ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("wildcard").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("discoGroupName").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("auditTrail")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("auditTrail")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("auditTrail")[0].GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("auditTrail")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("auditTrail")[0].GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("assets").GetProperty("value")[0].GetProperty("reason").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetSnapshot_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + ReportAssetSnapshotRequest reportAssetSnapshotRequest = new ReportAssetSnapshotRequest + { + Metric = "", + LabelName = "", + Size = 1234, + Page = 1234, + }; + Response response = client.GetSnapshot(reportAssetSnapshotRequest); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetSnapshot_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + ReportAssetSnapshotRequest reportAssetSnapshotRequest = new ReportAssetSnapshotRequest + { + Metric = "", + LabelName = "", + Size = 1234, + Page = 1234, + }; + Response response = await client.GetSnapshotAsync(reportAssetSnapshotRequest); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetSummary_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = client.GetSummary(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetSummary_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = await client.GetSummaryAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetSummary_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + ReportAssetSummaryRequest reportAssetSummaryRequest = new ReportAssetSummaryRequest(); + Response response = client.GetSummary(reportAssetSummaryRequest); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetSummary_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + ReportAssetSummaryRequest reportAssetSummaryRequest = new ReportAssetSummaryRequest(); + Response response = await client.GetSummaryAsync(reportAssetSummaryRequest); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetSummary_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + using RequestContent content = RequestContent.Create(new + { + metricCategories = new object[] + { +"" + }, + metrics = new object[] + { +"" + }, + filters = new object[] + { +"" + }, + groupBy = "", + segmentBy = "", + labelName = "", + }); + Response response = client.GetSummary(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("updatedAt").ToString()); + Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("metricCategory").ToString()); + Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("metric").ToString()); + Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("labelName").ToString()); + Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("count").ToString()); + Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("link").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetSummary_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + using RequestContent content = RequestContent.Create(new + { + metricCategories = new object[] + { +"" + }, + metrics = new object[] + { +"" + }, + filters = new object[] + { +"" + }, + groupBy = "", + segmentBy = "", + labelName = "", + }); + Response response = await client.GetSummaryAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("updatedAt").ToString()); + Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("metricCategory").ToString()); + Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("metric").ToString()); + Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("labelName").ToString()); + Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("count").ToString()); + Console.WriteLine(result.GetProperty("assetSummaries")[0].GetProperty("link").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetSummary_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + ReportAssetSummaryRequest reportAssetSummaryRequest = new ReportAssetSummaryRequest + { + MetricCategories = { "" }, + Metrics = { "" }, + Filters = { "" }, + GroupBy = "", + SegmentBy = "", + LabelName = "", + }; + Response response = client.GetSummary(reportAssetSummaryRequest); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetSummary_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + ReportAssetSummaryRequest reportAssetSummaryRequest = new ReportAssetSummaryRequest + { + MetricCategories = { "" }, + Metrics = { "" }, + Filters = { "" }, + GroupBy = "", + SegmentBy = "", + LabelName = "", + }; + Response response = await client.GetSummaryAsync(reportAssetSummaryRequest); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetSavedFilter_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.GetSavedFilter("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetSavedFilter_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.GetSavedFilterAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetSavedFilter_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.GetSavedFilter(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetSavedFilter_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.GetSavedFilterAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetSavedFilter_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.GetSavedFilter("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetSavedFilter_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.GetSavedFilterAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetSavedFilter_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.GetSavedFilter(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetSavedFilter_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.GetSavedFilterAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CreateOrReplaceSavedFilter_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = client.CreateOrReplaceSavedFilter("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_CreateOrReplaceSavedFilter_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + using RequestContent content = RequestContent.Create(new object()); + Response response = await client.CreateOrReplaceSavedFilterAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CreateOrReplaceSavedFilter_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + SavedFilter savedFilter = new SavedFilter(); + Response response = client.CreateOrReplaceSavedFilter("", savedFilter); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_CreateOrReplaceSavedFilter_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + SavedFilter savedFilter = new SavedFilter(); + Response response = await client.CreateOrReplaceSavedFilterAsync("", savedFilter); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CreateOrReplaceSavedFilter_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + using RequestContent content = RequestContent.Create(new + { + id = "", + displayName = "", + filter = "", + description = "", + }); + Response response = client.CreateOrReplaceSavedFilter("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_CreateOrReplaceSavedFilter_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + using RequestContent content = RequestContent.Create(new + { + id = "", + displayName = "", + filter = "", + description = "", + }); + Response response = await client.CreateOrReplaceSavedFilterAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CreateOrReplaceSavedFilter_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + SavedFilter savedFilter = new SavedFilter + { + Id = "", + DisplayName = "", + Filter = "", + Description = "", + }; + Response response = client.CreateOrReplaceSavedFilter("", savedFilter); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_CreateOrReplaceSavedFilter_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + SavedFilter savedFilter = new SavedFilter + { + Id = "", + DisplayName = "", + Filter = "", + Description = "", + }; + Response response = await client.CreateOrReplaceSavedFilterAsync("", savedFilter); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeleteSavedFilter_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.DeleteSavedFilter(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_DeleteSavedFilter_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.DeleteSavedFilterAsync(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeleteSavedFilter_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.DeleteSavedFilter(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_DeleteSavedFilter_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.DeleteSavedFilterAsync(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetTask_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.GetTask("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetTask_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.GetTaskAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetTask_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.GetTask(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetTask_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.GetTaskAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetTask_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.GetTask("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("startedAt").ToString()); + Console.WriteLine(result.GetProperty("completedAt").ToString()); + Console.WriteLine(result.GetProperty("lastPolledAt").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("phase").ToString()); + Console.WriteLine(result.GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetTask_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.GetTaskAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("startedAt").ToString()); + Console.WriteLine(result.GetProperty("completedAt").ToString()); + Console.WriteLine(result.GetProperty("lastPolledAt").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("phase").ToString()); + Console.WriteLine(result.GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetTask_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.GetTask(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetTask_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.GetTaskAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CancelTask_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.CancelTask("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_CancelTask_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.CancelTaskAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CancelTask_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.CancelTask(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_CancelTask_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.CancelTaskAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CancelTask_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.CancelTask("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("startedAt").ToString()); + Console.WriteLine(result.GetProperty("completedAt").ToString()); + Console.WriteLine(result.GetProperty("lastPolledAt").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("phase").ToString()); + Console.WriteLine(result.GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_CancelTask_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.CancelTaskAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("startedAt").ToString()); + Console.WriteLine(result.GetProperty("completedAt").ToString()); + Console.WriteLine(result.GetProperty("lastPolledAt").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("phase").ToString()); + Console.WriteLine(result.GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CancelTask_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = client.CancelTask(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_CancelTask_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + Response response = await client.CancelTaskAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetAssetResources_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + foreach (BinaryData item in client.GetAssetResources(null, null, null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetAssetResources_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + await foreach (BinaryData item in client.GetAssetResourcesAsync(null, null, null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetAssetResources_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + foreach (AssetResource item in client.GetAssetResources()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetAssetResources_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + await foreach (AssetResource item in client.GetAssetResourcesAsync()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetAssetResources_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + foreach (BinaryData item in client.GetAssetResources("", "", 1234, 1234, "", null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("uuid").ToString()); + Console.WriteLine(result.GetProperty("createdDate").ToString()); + Console.WriteLine(result.GetProperty("updatedDate").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("externalId").ToString()); + Console.WriteLine(result.GetProperty("labels")[0].ToString()); + Console.WriteLine(result.GetProperty("wildcard").ToString()); + Console.WriteLine(result.GetProperty("discoGroupName").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("reason").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetAssetResources_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + await foreach (BinaryData item in client.GetAssetResourcesAsync("", "", 1234, 1234, "", null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("uuid").ToString()); + Console.WriteLine(result.GetProperty("createdDate").ToString()); + Console.WriteLine(result.GetProperty("updatedDate").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("externalId").ToString()); + Console.WriteLine(result.GetProperty("labels")[0].ToString()); + Console.WriteLine(result.GetProperty("wildcard").ToString()); + Console.WriteLine(result.GetProperty("discoGroupName").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("auditTrail")[0].GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("reason").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetAssetResources_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + foreach (AssetResource item in client.GetAssetResources(filter: "", orderby: "", skip: 1234, maxpagesize: 1234, mark: "")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetAssetResources_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + await foreach (AssetResource item in client.GetAssetResourcesAsync(filter: "", orderby: "", skip: 1234, maxpagesize: 1234, mark: "")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDataConnections_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + foreach (BinaryData item in client.GetDataConnections(null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetDataConnections_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + await foreach (BinaryData item in client.GetDataConnectionsAsync(null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDataConnections_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + foreach (DataConnection item in client.GetDataConnections()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetDataConnections_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + await foreach (DataConnection item in client.GetDataConnectionsAsync()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDataConnections_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + foreach (BinaryData item in client.GetDataConnections(1234, 1234, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("content").ToString()); + Console.WriteLine(result.GetProperty("createdDate").ToString()); + Console.WriteLine(result.GetProperty("frequency").ToString()); + Console.WriteLine(result.GetProperty("frequencyOffset").ToString()); + Console.WriteLine(result.GetProperty("updatedDate").ToString()); + Console.WriteLine(result.GetProperty("userUpdatedAt").ToString()); + Console.WriteLine(result.GetProperty("active").ToString()); + Console.WriteLine(result.GetProperty("inactiveMessage").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetDataConnections_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + await foreach (BinaryData item in client.GetDataConnectionsAsync(1234, 1234, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("content").ToString()); + Console.WriteLine(result.GetProperty("createdDate").ToString()); + Console.WriteLine(result.GetProperty("frequency").ToString()); + Console.WriteLine(result.GetProperty("frequencyOffset").ToString()); + Console.WriteLine(result.GetProperty("updatedDate").ToString()); + Console.WriteLine(result.GetProperty("userUpdatedAt").ToString()); + Console.WriteLine(result.GetProperty("active").ToString()); + Console.WriteLine(result.GetProperty("inactiveMessage").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDataConnections_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + foreach (DataConnection item in client.GetDataConnections(skip: 1234, maxpagesize: 1234)) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetDataConnections_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + await foreach (DataConnection item in client.GetDataConnectionsAsync(skip: 1234, maxpagesize: 1234)) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDiscoGroups_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + foreach (BinaryData item in client.GetDiscoGroups(null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetDiscoGroups_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + await foreach (BinaryData item in client.GetDiscoGroupsAsync(null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDiscoGroups_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + foreach (DiscoGroup item in client.GetDiscoGroups()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetDiscoGroups_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + await foreach (DiscoGroup item in client.GetDiscoGroupsAsync()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDiscoGroups_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + foreach (BinaryData item in client.GetDiscoGroups("", 1234, 1234, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tier").ToString()); + Console.WriteLine(result.GetProperty("frequencyMilliseconds").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("names")[0].ToString()); + Console.WriteLine(result.GetProperty("excludes")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("excludes")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("submittedDate").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("startedDate").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("completedDate").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("tier").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("totalAssetsFoundCount").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("seeds")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("seeds")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("excludes")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("excludes")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("names")[0].ToString()); + Console.WriteLine(result.GetProperty("createdDate").ToString()); + Console.WriteLine(result.GetProperty("templateId").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetDiscoGroups_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + await foreach (BinaryData item in client.GetDiscoGroupsAsync("", 1234, 1234, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + Console.WriteLine(result.GetProperty("tier").ToString()); + Console.WriteLine(result.GetProperty("frequencyMilliseconds").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("names")[0].ToString()); + Console.WriteLine(result.GetProperty("excludes")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("excludes")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("submittedDate").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("startedDate").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("completedDate").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("tier").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("totalAssetsFoundCount").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("seeds")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("seeds")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("excludes")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("excludes")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("latestRun").GetProperty("names")[0].ToString()); + Console.WriteLine(result.GetProperty("createdDate").ToString()); + Console.WriteLine(result.GetProperty("templateId").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDiscoGroups_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + foreach (DiscoGroup item in client.GetDiscoGroups(filter: "", skip: 1234, maxpagesize: 1234)) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetDiscoGroups_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + await foreach (DiscoGroup item in client.GetDiscoGroupsAsync(filter: "", skip: 1234, maxpagesize: 1234)) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetRuns_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + foreach (BinaryData item in client.GetRuns("", null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetRuns_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + await foreach (BinaryData item in client.GetRunsAsync("", null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetRuns_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + foreach (DiscoRunResult item in client.GetRuns("")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetRuns_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + await foreach (DiscoRunResult item in client.GetRunsAsync("")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetRuns_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + foreach (BinaryData item in client.GetRuns("", "", 1234, 1234, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("submittedDate").ToString()); + Console.WriteLine(result.GetProperty("startedDate").ToString()); + Console.WriteLine(result.GetProperty("completedDate").ToString()); + Console.WriteLine(result.GetProperty("tier").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("totalAssetsFoundCount").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("excludes")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("excludes")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("names")[0].ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetRuns_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + await foreach (BinaryData item in client.GetRunsAsync("", "", 1234, 1234, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("submittedDate").ToString()); + Console.WriteLine(result.GetProperty("startedDate").ToString()); + Console.WriteLine(result.GetProperty("completedDate").ToString()); + Console.WriteLine(result.GetProperty("tier").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("totalAssetsFoundCount").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("excludes")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("excludes")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("names")[0].ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetRuns_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + foreach (DiscoRunResult item in client.GetRuns("", filter: "", skip: 1234, maxpagesize: 1234)) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetRuns_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + await foreach (DiscoRunResult item in client.GetRunsAsync("", filter: "", skip: 1234, maxpagesize: 1234)) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDiscoTemplates_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + foreach (BinaryData item in client.GetDiscoTemplates(null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetDiscoTemplates_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + await foreach (BinaryData item in client.GetDiscoTemplatesAsync(null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDiscoTemplates_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + foreach (DiscoTemplate item in client.GetDiscoTemplates()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetDiscoTemplates_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + await foreach (DiscoTemplate item in client.GetDiscoTemplatesAsync()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDiscoTemplates_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + foreach (BinaryData item in client.GetDiscoTemplates("", 1234, 1234, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("industry").ToString()); + Console.WriteLine(result.GetProperty("region").ToString()); + Console.WriteLine(result.GetProperty("countryCode").ToString()); + Console.WriteLine(result.GetProperty("stateCode").ToString()); + Console.WriteLine(result.GetProperty("city").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("names")[0].ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetDiscoTemplates_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + await foreach (BinaryData item in client.GetDiscoTemplatesAsync("", 1234, 1234, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("industry").ToString()); + Console.WriteLine(result.GetProperty("region").ToString()); + Console.WriteLine(result.GetProperty("countryCode").ToString()); + Console.WriteLine(result.GetProperty("stateCode").ToString()); + Console.WriteLine(result.GetProperty("city").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("seeds")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("names")[0].ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDiscoTemplates_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + foreach (DiscoTemplate item in client.GetDiscoTemplates(filter: "", skip: 1234, maxpagesize: 1234)) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetDiscoTemplates_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + await foreach (DiscoTemplate item in client.GetDiscoTemplatesAsync(filter: "", skip: 1234, maxpagesize: 1234)) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetSavedFilters_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + foreach (BinaryData item in client.GetSavedFilters(null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetSavedFilters_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + await foreach (BinaryData item in client.GetSavedFiltersAsync(null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetSavedFilters_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + foreach (SavedFilter item in client.GetSavedFilters()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetSavedFilters_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + await foreach (SavedFilter item in client.GetSavedFiltersAsync()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetSavedFilters_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + foreach (BinaryData item in client.GetSavedFilters("", 1234, 1234, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetSavedFilters_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + await foreach (BinaryData item in client.GetSavedFiltersAsync("", 1234, 1234, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("filter").ToString()); + Console.WriteLine(result.GetProperty("description").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetSavedFilters_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + foreach (SavedFilter item in client.GetSavedFilters(filter: "", skip: 1234, maxpagesize: 1234)) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetSavedFilters_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + await foreach (SavedFilter item in client.GetSavedFiltersAsync(filter: "", skip: 1234, maxpagesize: 1234)) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetTasks_ShortVersion() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + foreach (BinaryData item in client.GetTasks(null, null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetTasks_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + await foreach (BinaryData item in client.GetTasksAsync(null, null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetTasks_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + foreach (Task item in client.GetTasks()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetTasks_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + await foreach (Task item in client.GetTasksAsync()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetTasks_AllParameters() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + foreach (BinaryData item in client.GetTasks("", "", 1234, 1234, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("startedAt").ToString()); + Console.WriteLine(result.GetProperty("completedAt").ToString()); + Console.WriteLine(result.GetProperty("lastPolledAt").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("phase").ToString()); + Console.WriteLine(result.GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetTasks_AllParameters_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + await foreach (BinaryData item in client.GetTasksAsync("", "", 1234, 1234, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("startedAt").ToString()); + Console.WriteLine(result.GetProperty("completedAt").ToString()); + Console.WriteLine(result.GetProperty("lastPolledAt").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); + Console.WriteLine(result.GetProperty("phase").ToString()); + Console.WriteLine(result.GetProperty("reason").ToString()); + Console.WriteLine(result.GetProperty("metadata").GetProperty("").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetTasks_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + foreach (Task item in client.GetTasks(filter: "", orderby: "", skip: 1234, maxpagesize: 1234)) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async System.Threading.Tasks.Task Example_GetTasks_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, "", "", "", credential); + + await foreach (Task item in client.GetTasksAsync(filter: "", orderby: "", skip: 1234, maxpagesize: 1234)) + { + } + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/tsp-location.yaml b/sdk/easm/Azure.Analytics.Defender.Easm/tsp-location.yaml new file mode 100644 index 000000000000..d37397e6159a --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/tsp-location.yaml @@ -0,0 +1,5 @@ +commit: d46356e843f385805e3451091696d4bdbe8fb588 +additionalDirectories: [] +directory: specification/riskiq/Easm +repo: Azure/azure-rest-api-specs + diff --git a/sdk/easm/ci.yml b/sdk/easm/ci.yml new file mode 100644 index 000000000000..96f0f73c2b66 --- /dev/null +++ b/sdk/easm/ci.yml @@ -0,0 +1,35 @@ +# NOTE: Please refer to https://aka.ms/azsdk/engsys/ci-yaml before editing this file. + +trigger: + branches: + include: + - main + - hotfix/* + - release/* + paths: + include: + - sdk/easm + - sdk/easm/ci.yml + - sdk/easm/Azure.Analytics.Defender.Easm + +pr: + branches: + include: + - main + - feature/* + - hotfix/* + - release/* + paths: + include: + - sdk/easm + - sdk/easm/ci.yml + - sdk/easm/Azure.Analytics.Defender.Easm + +extends: + template: /eng/pipelines/templates/stages/archetype-sdk-client.yml + parameters: + ServiceDirectory: easm + ArtifactName: packages + Artifacts: + - name: Azure.Analytics.Defender.Easm + safeName: AzureAnalyticsDefenderEasm