diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ActionParameters.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ActionParameters.Serialization.cs new file mode 100644 index 000000000000..d32397a6432d --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ActionParameters.Serialization.cs @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class ActionParameters : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ActionParameters)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStringValue(Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ActionParameters IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ActionParameters)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeActionParameters(document.RootElement, options); + } + + internal static ActionParameters DeserializeActionParameters(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + value = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ActionParameters(value, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ActionParameters)} does not support writing '{options.Format}' format."); + } + } + + ActionParameters IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeActionParameters(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ActionParameters)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ActionParameters FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeActionParameters(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ActionParameters.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ActionParameters.cs new file mode 100644 index 000000000000..54e07325de47 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ActionParameters.cs @@ -0,0 +1,73 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Analytics.Defender.Easm +{ + /// This is an object that exists to provide a common schema definition for the action parameters. + public partial class ActionParameters + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ActionParameters() + { + } + + /// Initializes a new instance of . + /// + /// The value parameter that is used by the policy action. This is action specific, + /// for further information please refer to documentation here: + /// https://learn.microsoft.com/en-us/azure/external-attack-surface-management/policy-engine + /// + /// Keeps track of any properties unknown to the library. + internal ActionParameters(string value, IDictionary serializedAdditionalRawData) + { + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// + /// The value parameter that is used by the policy action. This is action specific, + /// for further information please refer to documentation here: + /// https://learn.microsoft.com/en-us/azure/external-attack-surface-management/policy-engine + /// + public string Value { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AnalyticsDefenderEasmModelFactory.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AnalyticsDefenderEasmModelFactory.cs index 6333520b7dc2..81af844b25c1 100644 --- a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AnalyticsDefenderEasmModelFactory.cs +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AnalyticsDefenderEasmModelFactory.cs @@ -54,7 +54,7 @@ public static AssetResource AssetResource(string kind = null, string id = null, } /// Initializes a new instance of . - /// The system generated unique id for the resource. + /// This is typically the same as the name but might be different for different models. /// The caller provided unique name for the resource. /// The name that can be used for display purposes. /// The kind of asset. @@ -1979,15 +1979,152 @@ public static TaskResource TaskResource(string id = null, DateTimeOffset? starte serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// The total number of elements. + /// The summary of observation counts by priority. + /// The list of observation results. + /// A new instance for mocking. + public static ObservationPageResult ObservationPageResult(long totalElements = default, IReadOnlyDictionary prioritySummary = null, IEnumerable value = null) + { + prioritySummary ??= new Dictionary(); + value ??= new List(); + + return new ObservationPageResult(totalElements, prioritySummary, value?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The name of the observation. + /// The list of applicable types. + /// The priority of the observation. + /// The CVSS v2 score. + /// The CVSS v3 score. + /// The remediation state of the observation. + /// The source of the remediation state of the observation. + /// A new instance for mocking. + public static ObservationResult ObservationResult(string name = null, IEnumerable types = null, ObservationPriority priority = default, double cvssScoreV2 = default, double cvssScoreV3 = default, ObservationRemediationState remediationState = default, ObservationRemediationSource remediationSource = default) + { + types ??= new List(); + + return new ObservationResult( + name, + types?.ToList(), + priority, + cvssScoreV2, + cvssScoreV3, + remediationState, + remediationSource, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The type of delta detail to retrieve. + /// The number of days prior to retrieve deltas for. + /// The type of asset. + /// expected format to be: yyyy-MM-dd. + /// A new instance for mocking. + public static DeltaDetailsRequest DeltaDetailsRequest(DeltaDetailType deltaDetailType = default, int? priorDays = null, GlobalAssetType kind = default, string date = null) + { + return new DeltaDetailsRequest(deltaDetailType, priorDays, kind, date, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Shows the asset kind. + /// Shows the asset name. + /// Shows the date when the asset was originally created. + /// Shows the date when the asset was last updated, usually the date the we trying to pull up the results for. + /// Shows the inventory state. + /// A new instance for mocking. + public static DeltaResult DeltaResult(GlobalAssetType kind = default, string name = null, DateTimeOffset createdAt = default, DateTimeOffset updatedAt = default, GlobalInventoryState state = default) + { + return new DeltaResult( + kind, + name, + createdAt, + updatedAt, + state, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Contains added, removed, and difference values for the whole range either 7 or 30 days. + /// Contains added, removed, count, and difference values for each day. + /// A new instance for mocking. + public static DeltaSummaryResult DeltaSummaryResult(DeltaRangeResult summary = null, IEnumerable daily = null) + { + daily ??= new List(); + + return new DeltaSummaryResult(summary, daily?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The range of dates requested. + /// The total amount of assets removed over a date range. + /// The total amount of assets added over a date range. + /// The total amount of assets changed removed over a date range. + /// A list of summary changes per asset kind. + /// A new instance for mocking. + public static DeltaRangeResult DeltaRangeResult(long range = default, long removed = default, long added = default, long difference = default, IEnumerable kindSummaries = null) + { + kindSummaries ??= new List(); + + return new DeltaRangeResult( + range, + removed, + added, + difference, + kindSummaries?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The kind of asset. + /// The amount of assets removed for one asset kind. + /// The amount of assets added for one asset kind. + /// The amount of assets changed for one asset kind. + /// A new instance for mocking. + public static DeltaTypeResponse DeltaTypeResponse(GlobalAssetType kind = default, long removed = default, long added = default, long difference = default) + { + return new DeltaTypeResponse(kind, removed, added, difference, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The date that is being requested. + /// A list of summary counts per day. + /// A new instance for mocking. + public static DeltaDateResult DeltaDateResult(DateTimeOffset date = default, IEnumerable deltas = null) + { + deltas ??= new List(); + + return new DeltaDateResult(date, deltas?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The kind of asset. + /// The amount of assets removed for one asset kind. + /// The amount of assets added for one asset kind. + /// The amount of assets changed for one asset kind. + /// The current number of assets for one asset kind. + /// A new instance for mocking. + public static DailyDeltaTypeResponse DailyDeltaTypeResponse(GlobalAssetType kind = default, long removed = default, long added = default, long difference = default, long count = default) + { + return new DailyDeltaTypeResponse( + kind, + removed, + added, + difference, + serializedAdditionalRawData: null, + count); + } + /// Initializes a new instance of . /// Discriminator property for DataConnection. - /// The system generated unique id for the resource. + /// This is typically the same as the name but might be different for different models. /// 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 day to update the data connection on. (1-7 for weekly, 1-31 for monthly). /// 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. @@ -2012,13 +2149,13 @@ public static DataConnection DataConnection(string kind = null, string id = null } /// Initializes a new instance of . - /// The system generated unique id for the resource. + /// This is typically the same as the name but might be different for different models. /// 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 day to update the data connection on. (1-7 for weekly, 1-31 for monthly). /// 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. @@ -2045,13 +2182,13 @@ public static LogAnalyticsDataConnection LogAnalyticsDataConnection(string id = } /// Initializes a new instance of . - /// The system generated unique id for the resource. + /// This is typically the same as the name but might be different for different models. /// 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 day to update the data connection on. (1-7 for weekly, 1-31 for monthly). /// 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. @@ -2153,7 +2290,7 @@ public static InnerError InnerError(string code = null, BinaryData value = null) } /// Initializes a new instance of . - /// The system generated unique id for the resource. + /// This is typically the same as the name but might be different for different models. /// The caller provided unique name for the resource. /// The name that can be used for display purposes. /// The description for a disco group. @@ -2218,6 +2355,47 @@ public static DiscoveryRunResult DiscoveryRunResult(DateTimeOffset? submittedDat serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// A list of asset chain summaries per asset kind. + /// A list of disco group summaries. + /// The list of exceptions. + /// A new instance for mocking. + public static AssetChainSummaryResult AssetChainSummaryResult(IEnumerable affectedAssetsSummary = null, IEnumerable affectedGroupsSummary = null, IEnumerable errors = null) + { + affectedAssetsSummary ??= new List(); + affectedGroupsSummary ??= new List(); + errors ??= new List(); + + return new AssetChainSummaryResult(affectedAssetsSummary?.ToList(), affectedGroupsSummary?.ToList(), errors?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The kind of asset. + /// The amount of assets affected for a given asset kind. + /// A new instance for mocking. + public static AssetChainKindSummaryResult AssetChainKindSummaryResult(AssetKind kind = default, long affectedCount = default) + { + return new AssetChainKindSummaryResult(kind, affectedCount, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// 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 DiscoGroupSummaryResult DiscoGroupSummaryResult(string id = null, string name = null, string displayName = null) + { + return new DiscoGroupSummaryResult(id, name, displayName, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The error object. + /// A new instance for mocking. + public static ErrorResponse ErrorResponse(ResponseError error = null) + { + return new ErrorResponse(error, serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// The system generated unique id for the resource. /// The caller provided unique name for the resource. @@ -2358,7 +2536,7 @@ public static AssetSummaryResult AssetSummaryResult(string displayName = null, s } /// Initializes a new instance of . - /// The system generated unique id for the resource. + /// This is typically the same as the name but might be different for different models. /// The caller provided unique name for the resource. /// The name that can be used for display purposes. /// @@ -2374,5 +2552,65 @@ public static SavedFilter SavedFilter(string id = null, string name = null, stri description, serializedAdditionalRawData: null); } + + /// Initializes a new instance of . + /// The CVE ID of the vulnerability in the format CVE-YYYY-NNNN, note that the number portion can have more than 4 digits. + /// The vendor or project name for the vulnerability. + /// The vulnerability product. + /// The name of the vulnerability. + /// A short description of the vulnerability. + /// The required action to address the vulnerability. + /// Any additional notes about the vulnerability. + /// The date the vulnerability was added to the catalog in the format YYYY-MM-DD. + /// The date the required action is due in the format YYYY-MM-DD. + /// The date the vulnerability was updated. + /// The number of assets affected by the vulnerability. + /// A new instance for mocking. + public static CisaCveResult CisaCveResult(string cveId = null, string vendorProject = null, string product = null, string vulnerabilityName = null, string shortDescription = null, string requiredAction = null, string notes = null, DateTimeOffset dateAdded = default, DateTimeOffset dueDate = default, DateTimeOffset updatedAt = default, long count = default) + { + return new CisaCveResult( + cveId, + vendorProject, + product, + vulnerabilityName, + shortDescription, + requiredAction, + notes, + dateAdded, + dueDate, + updatedAt, + count, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// This is typically the same as the name but might be different for different models. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// A human readable description of what the policy should do. + /// Name of the saved filter query to be used to select assets that are to be updated by a given policy. + /// Action specifying what the policy should do. + /// Number of assets in inventory that have been updated by this policy. + /// The unique name of the user that created the policy user@gmail.com. + /// The date this policy was created, in RFC3339 format. + /// The date this policy was last updated, in RFC3339 format. + /// Additional parameters needed to perform the policy action. + /// A new instance for mocking. + public static Policy Policy(string id = null, string name = null, string displayName = null, string description = null, string filterName = null, PolicyAction action = default, long? updatedAssetsCount = null, string user = null, DateTimeOffset? createdDate = null, DateTimeOffset? updatedDate = null, ActionParameters actionParameters = null) + { + return new Policy( + id, + name, + displayName, + description, + filterName, + action, + updatedAssetsCount, + user, + createdDate, + updatedDate, + actionParameters, + serializedAdditionalRawData: null); + } } } diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetChainKindSummaryResult.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetChainKindSummaryResult.Serialization.cs new file mode 100644 index 000000000000..26d0aef4c3ac --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetChainKindSummaryResult.Serialization.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class AssetChainKindSummaryResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AssetChainKindSummaryResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + writer.WritePropertyName("affectedCount"u8); + writer.WriteNumberValue(AffectedCount); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + AssetChainKindSummaryResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AssetChainKindSummaryResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAssetChainKindSummaryResult(document.RootElement, options); + } + + internal static AssetChainKindSummaryResult DeserializeAssetChainKindSummaryResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AssetKind kind = default; + long affectedCount = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = new AssetKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("affectedCount"u8)) + { + affectedCount = property.Value.GetInt64(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AssetChainKindSummaryResult(kind, affectedCount, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AssetChainKindSummaryResult)} does not support writing '{options.Format}' format."); + } + } + + AssetChainKindSummaryResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAssetChainKindSummaryResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AssetChainKindSummaryResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AssetChainKindSummaryResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAssetChainKindSummaryResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetChainKindSummaryResult.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetChainKindSummaryResult.cs new file mode 100644 index 000000000000..255ca689194f --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetChainKindSummaryResult.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Analytics.Defender.Easm +{ + /// A list of asset chain summaries per asset kind. + public partial class AssetChainKindSummaryResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The kind of asset. + /// The amount of assets affected for a given asset kind. + internal AssetChainKindSummaryResult(AssetKind kind, long affectedCount) + { + Kind = kind; + AffectedCount = affectedCount; + } + + /// Initializes a new instance of . + /// The kind of asset. + /// The amount of assets affected for a given asset kind. + /// Keeps track of any properties unknown to the library. + internal AssetChainKindSummaryResult(AssetKind kind, long affectedCount, IDictionary serializedAdditionalRawData) + { + Kind = kind; + AffectedCount = affectedCount; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AssetChainKindSummaryResult() + { + } + + /// The kind of asset. + public AssetKind Kind { get; } + /// The amount of assets affected for a given asset kind. + public long AffectedCount { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetChainRequest.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetChainRequest.Serialization.cs new file mode 100644 index 000000000000..41374cb8a377 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetChainRequest.Serialization.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class AssetChainRequest : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AssetChainRequest)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("assetChainSource"u8); + writer.WriteStringValue(AssetChainSource.ToString()); + writer.WritePropertyName("sourceIds"u8); + writer.WriteStartArray(); + foreach (var item in SourceIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + AssetChainRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AssetChainRequest)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAssetChainRequest(document.RootElement, options); + } + + internal static AssetChainRequest DeserializeAssetChainRequest(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + AssetChainSource assetChainSource = default; + IList sourceIds = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("assetChainSource"u8)) + { + assetChainSource = new AssetChainSource(property.Value.GetString()); + continue; + } + if (property.NameEquals("sourceIds"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + sourceIds = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AssetChainRequest(assetChainSource, sourceIds, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AssetChainRequest)} does not support writing '{options.Format}' format."); + } + } + + AssetChainRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAssetChainRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AssetChainRequest)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AssetChainRequest FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAssetChainRequest(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetChainRequest.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetChainRequest.cs new file mode 100644 index 000000000000..31ae0976c45c --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetChainRequest.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.Analytics.Defender.Easm +{ + /// AssetChainRequest containing information needed for the retrieval of the asset chain summary. + public partial class AssetChainRequest + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Asset chain source. + /// A collection of asset chain source ids. + /// is null. + public AssetChainRequest(AssetChainSource assetChainSource, IEnumerable sourceIds) + { + Argument.AssertNotNull(sourceIds, nameof(sourceIds)); + + AssetChainSource = assetChainSource; + SourceIds = sourceIds.ToList(); + } + + /// Initializes a new instance of . + /// Asset chain source. + /// A collection of asset chain source ids. + /// Keeps track of any properties unknown to the library. + internal AssetChainRequest(AssetChainSource assetChainSource, IList sourceIds, IDictionary serializedAdditionalRawData) + { + AssetChainSource = assetChainSource; + SourceIds = sourceIds; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AssetChainRequest() + { + } + + /// Asset chain source. + public AssetChainSource AssetChainSource { get; } + /// A collection of asset chain source ids. + public IList SourceIds { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetChainSource.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetChainSource.cs new file mode 100644 index 000000000000..0ef98b3e3b64 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetChainSource.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 +{ + /// A list of asset chain sources. + public readonly partial struct AssetChainSource : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AssetChainSource(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string DISCOGROUPValue = "DISCO_GROUP"; + private const string ASSETValue = "ASSET"; + + /// discovery group. + public static AssetChainSource DISCOGROUP { get; } = new AssetChainSource(DISCOGROUPValue); + /// asset. + public static AssetChainSource ASSET { get; } = new AssetChainSource(ASSETValue); + /// Determines if two values are the same. + public static bool operator ==(AssetChainSource left, AssetChainSource right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AssetChainSource left, AssetChainSource right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AssetChainSource(string value) => new AssetChainSource(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AssetChainSource other && Equals(other); + /// + public bool Equals(AssetChainSource other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetChainSummaryResult.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetChainSummaryResult.Serialization.cs new file mode 100644 index 000000000000..15cfb6fd12a4 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetChainSummaryResult.Serialization.cs @@ -0,0 +1,188 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class AssetChainSummaryResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AssetChainSummaryResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("affectedAssetsSummary"u8); + writer.WriteStartArray(); + foreach (var item in AffectedAssetsSummary) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + writer.WritePropertyName("affectedGroupsSummary"u8); + writer.WriteStartArray(); + foreach (var item in AffectedGroupsSummary) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (Optional.IsCollectionDefined(Errors)) + { + writer.WritePropertyName("errors"u8); + writer.WriteStartArray(); + foreach (var item in Errors) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + AssetChainSummaryResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AssetChainSummaryResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAssetChainSummaryResult(document.RootElement, options); + } + + internal static AssetChainSummaryResult DeserializeAssetChainSummaryResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList affectedAssetsSummary = default; + IReadOnlyList affectedGroupsSummary = default; + IReadOnlyList errors = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("affectedAssetsSummary"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(AssetChainKindSummaryResult.DeserializeAssetChainKindSummaryResult(item, options)); + } + affectedAssetsSummary = array; + continue; + } + if (property.NameEquals("affectedGroupsSummary"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DiscoGroupSummaryResult.DeserializeDiscoGroupSummaryResult(item, options)); + } + affectedGroupsSummary = 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(ErrorResponse.DeserializeErrorResponse(item, options)); + } + errors = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AssetChainSummaryResult(affectedAssetsSummary, affectedGroupsSummary, errors ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AssetChainSummaryResult)} does not support writing '{options.Format}' format."); + } + } + + AssetChainSummaryResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAssetChainSummaryResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AssetChainSummaryResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AssetChainSummaryResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAssetChainSummaryResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetChainSummaryResult.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetChainSummaryResult.cs new file mode 100644 index 000000000000..b97b8cdb4826 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetChainSummaryResult.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.Analytics.Defender.Easm +{ + /// Response for the asset chain summary. + public partial class AssetChainSummaryResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// A list of asset chain summaries per asset kind. + /// A list of disco group summaries. + /// or is null. + internal AssetChainSummaryResult(IEnumerable affectedAssetsSummary, IEnumerable affectedGroupsSummary) + { + Argument.AssertNotNull(affectedAssetsSummary, nameof(affectedAssetsSummary)); + Argument.AssertNotNull(affectedGroupsSummary, nameof(affectedGroupsSummary)); + + AffectedAssetsSummary = affectedAssetsSummary.ToList(); + AffectedGroupsSummary = affectedGroupsSummary.ToList(); + Errors = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// A list of asset chain summaries per asset kind. + /// A list of disco group summaries. + /// The list of exceptions. + /// Keeps track of any properties unknown to the library. + internal AssetChainSummaryResult(IReadOnlyList affectedAssetsSummary, IReadOnlyList affectedGroupsSummary, IReadOnlyList errors, IDictionary serializedAdditionalRawData) + { + AffectedAssetsSummary = affectedAssetsSummary; + AffectedGroupsSummary = affectedGroupsSummary; + Errors = errors; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AssetChainSummaryResult() + { + } + + /// A list of asset chain summaries per asset kind. + public IReadOnlyList AffectedAssetsSummary { get; } + /// A list of disco group summaries. + public IReadOnlyList AffectedGroupsSummary { get; } + /// The list of exceptions. + public IReadOnlyList Errors { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetKind.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetKind.cs new file mode 100644 index 000000000000..92da5b5a4e53 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetKind.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 AssetKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AssetKind(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 AssetKind As { get; } = new AssetKind(AsValue); + /// contact. + public static AssetKind Contact { get; } = new AssetKind(ContactValue); + /// domain. + public static AssetKind Domain { get; } = new AssetKind(DomainValue); + /// host. + public static AssetKind Host { get; } = new AssetKind(HostValue); + /// ipAddress. + public static AssetKind IpAddress { get; } = new AssetKind(IpAddressValue); + /// ipBlock. + public static AssetKind IpBlock { get; } = new AssetKind(IpBlockValue); + /// page. + public static AssetKind Page { get; } = new AssetKind(PageValue); + /// sslCert. + public static AssetKind SslCert { get; } = new AssetKind(SslCertValue); + /// Determines if two values are the same. + public static bool operator ==(AssetKind left, AssetKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AssetKind left, AssetKind right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AssetKind(string value) => new AssetKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AssetKind other && Equals(other); + /// + public bool Equals(AssetKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetResponseType.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetResponseType.cs new file mode 100644 index 000000000000..ff23400e2008 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetResponseType.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 +{ + /// A list of asset response type. + public readonly partial struct AssetResponseType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AssetResponseType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string IdValue = "id"; + private const string StandardValue = "standard"; + private const string FullValue = "full"; + private const string ReducedValue = "reduced"; + + /// Return only the asset id. + public static AssetResponseType Id { get; } = new AssetResponseType(IdValue); + /// Return the standard set of asset fields. + public static AssetResponseType Standard { get; } = new AssetResponseType(StandardValue); + /// Return the full set of asset fields. + public static AssetResponseType Full { get; } = new AssetResponseType(FullValue); + /// Return a reduced set of fields. + public static AssetResponseType Reduced { get; } = new AssetResponseType(ReducedValue); + /// Determines if two values are the same. + public static bool operator ==(AssetResponseType left, AssetResponseType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AssetResponseType left, AssetResponseType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator AssetResponseType(string value) => new AssetResponseType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AssetResponseType other && Equals(other); + /// + public bool Equals(AssetResponseType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetUpdatePayload.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetUpdatePayload.Serialization.cs index 786a43b84cc6..f3e1970be833 100644 --- a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetUpdatePayload.Serialization.cs +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetUpdatePayload.Serialization.cs @@ -52,6 +52,16 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrit writer.WritePropertyName("transfers"u8); writer.WriteStringValue(Transfers.Value.ToString()); } + if (Optional.IsCollectionDefined(Remediations)) + { + writer.WritePropertyName("remediations"u8); + writer.WriteStartArray(); + foreach (var item in Remediations) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } if (options.Format != "W" && _serializedAdditionalRawData != null) { foreach (var item in _serializedAdditionalRawData) @@ -94,6 +104,7 @@ internal static AssetUpdatePayload DeserializeAssetUpdatePayload(JsonElement ele string externalId = default; IDictionary labels = default; AssetUpdateTransfers? transfers = default; + IList remediations = default; IDictionary serializedAdditionalRawData = default; Dictionary rawDataDictionary = new Dictionary(); foreach (var property in element.EnumerateObject()) @@ -135,13 +146,33 @@ internal static AssetUpdatePayload DeserializeAssetUpdatePayload(JsonElement ele transfers = new AssetUpdateTransfers(property.Value.GetString()); continue; } + if (property.NameEquals("remediations"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservationRemediationItem.DeserializeObservationRemediationItem(item, options)); + } + remediations = array; + continue; + } if (options.Format != "W") { rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); } } serializedAdditionalRawData = rawDataDictionary; - return new AssetUpdatePayload(state, externalId, labels ?? new ChangeTrackingDictionary(), transfers, serializedAdditionalRawData); + return new AssetUpdatePayload( + state, + externalId, + labels ?? new ChangeTrackingDictionary(), + transfers, + remediations ?? new ChangeTrackingList(), + serializedAdditionalRawData); } BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetUpdatePayload.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetUpdatePayload.cs index fd1c4c850a68..8139a5faf306 100644 --- a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetUpdatePayload.cs +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetUpdatePayload.cs @@ -49,6 +49,7 @@ public partial class AssetUpdatePayload public AssetUpdatePayload() { Labels = new ChangeTrackingDictionary(); + Remediations = new ChangeTrackingList(); } /// Initializes a new instance of . @@ -56,13 +57,15 @@ public AssetUpdatePayload() /// A string which can be used to identify the asset in external systems. /// Any Labels to update the asset with. /// A list of asset types to cascade the updates to. + /// A list of observation remediations to apply to the asset. /// Keeps track of any properties unknown to the library. - internal AssetUpdatePayload(AssetUpdateState? state, string externalId, IDictionary labels, AssetUpdateTransfers? transfers, IDictionary serializedAdditionalRawData) + internal AssetUpdatePayload(AssetUpdateState? state, string externalId, IDictionary labels, AssetUpdateTransfers? transfers, IList remediations, IDictionary serializedAdditionalRawData) { State = state; ExternalId = externalId; Labels = labels; Transfers = transfers; + Remediations = remediations; _serializedAdditionalRawData = serializedAdditionalRawData; } @@ -74,5 +77,7 @@ internal AssetUpdatePayload(AssetUpdateState? state, string externalId, IDiction public IDictionary Labels { get; } /// A list of asset types to cascade the updates to. public AssetUpdateTransfers? Transfers { get; set; } + /// A list of observation remediations to apply to the asset. + public IList Remediations { get; } } } diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetsExportRequest.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetsExportRequest.Serialization.cs new file mode 100644 index 000000000000..df18ef2d43cd --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetsExportRequest.Serialization.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class AssetsExportRequest : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AssetsExportRequest)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("fileName"u8); + writer.WriteStringValue(FileName); + writer.WritePropertyName("columns"u8); + writer.WriteStartArray(); + foreach (var item in Columns) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + AssetsExportRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AssetsExportRequest)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAssetsExportRequest(document.RootElement, options); + } + + internal static AssetsExportRequest DeserializeAssetsExportRequest(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string fileName = default; + IList columns = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("fileName"u8)) + { + fileName = property.Value.GetString(); + continue; + } + if (property.NameEquals("columns"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + columns = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AssetsExportRequest(fileName, columns, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AssetsExportRequest)} does not support writing '{options.Format}' format."); + } + } + + AssetsExportRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeAssetsExportRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AssetsExportRequest)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AssetsExportRequest FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeAssetsExportRequest(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetsExportRequest.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetsExportRequest.cs new file mode 100644 index 000000000000..a32f3acef2e9 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AssetsExportRequest.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.Analytics.Defender.Easm +{ + /// A request body used to export an asset. + public partial class AssetsExportRequest + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The name of the file to export. + /// The columns to export. + /// or is null. + public AssetsExportRequest(string fileName, IEnumerable columns) + { + Argument.AssertNotNull(fileName, nameof(fileName)); + Argument.AssertNotNull(columns, nameof(columns)); + + FileName = fileName; + Columns = columns.ToList(); + } + + /// Initializes a new instance of . + /// The name of the file to export. + /// The columns to export. + /// Keeps track of any properties unknown to the library. + internal AssetsExportRequest(string fileName, IList columns, IDictionary serializedAdditionalRawData) + { + FileName = fileName; + Columns = columns; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AssetsExportRequest() + { + } + + /// The name of the file to export. + public string FileName { get; } + /// The columns to export. + public IList Columns { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AuditTrailItem.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AuditTrailItem.cs index b4269bc0fb74..556300c2ad74 100644 --- a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AuditTrailItem.cs +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AuditTrailItem.cs @@ -51,7 +51,7 @@ internal AuditTrailItem() } /// Initializes a new instance of . - /// The system generated unique id for the resource. + /// This is typically the same as the name but might be different for different models. /// The caller provided unique name for the resource. /// The name that can be used for display purposes. /// The kind of asset. @@ -67,7 +67,7 @@ internal AuditTrailItem(string id, string name, string displayName, AuditTrailIt _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The system generated unique id for the resource. + /// This is typically the same as the name but might be different for different models. public string Id { get; } /// The caller provided unique name for the resource. public string Name { get; } diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AzureDataExplorerDataConnection.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AzureDataExplorerDataConnection.cs index 690b1b97f475..2204e266508c 100644 --- a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AzureDataExplorerDataConnection.cs +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AzureDataExplorerDataConnection.cs @@ -26,13 +26,13 @@ internal AzureDataExplorerDataConnection(AzureDataExplorerDataConnectionProperti /// Initializes a new instance of . /// Discriminator property for DataConnection. - /// The system generated unique id for the resource. + /// This is typically the same as the name but might be different for different models. /// 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 day to update the data connection on. (1-7 for weekly, 1-31 for monthly). /// 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. diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AzureDataExplorerDataConnectionPayload.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AzureDataExplorerDataConnectionPayload.cs index b98a0f227ee5..10d82d783d74 100644 --- a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AzureDataExplorerDataConnectionPayload.cs +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/AzureDataExplorerDataConnectionPayload.cs @@ -25,7 +25,7 @@ public AzureDataExplorerDataConnectionPayload(AzureDataExplorerDataConnectionPro } /// Initializes a new instance of . - /// Discriminator property for DataConnectionPayload. + /// Discriminator property for DataConnectionData. /// The name of data connection. /// The type of data the data connection will transfer. /// The rate at which the data connection will receive updates. diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/CisaCveResult.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/CisaCveResult.Serialization.cs new file mode 100644 index 000000000000..9e20c938f789 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/CisaCveResult.Serialization.cs @@ -0,0 +1,230 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class CisaCveResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CisaCveResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W") + { + writer.WritePropertyName("cveId"u8); + writer.WriteStringValue(CveId); + } + writer.WritePropertyName("vendorProject"u8); + writer.WriteStringValue(VendorProject); + writer.WritePropertyName("product"u8); + writer.WriteStringValue(Product); + writer.WritePropertyName("vulnerabilityName"u8); + writer.WriteStringValue(VulnerabilityName); + writer.WritePropertyName("shortDescription"u8); + writer.WriteStringValue(ShortDescription); + writer.WritePropertyName("requiredAction"u8); + writer.WriteStringValue(RequiredAction); + writer.WritePropertyName("notes"u8); + writer.WriteStringValue(Notes); + writer.WritePropertyName("dateAdded"u8); + writer.WriteStringValue(DateAdded, "O"); + writer.WritePropertyName("dueDate"u8); + writer.WriteStringValue(DueDate, "O"); + writer.WritePropertyName("updatedAt"u8); + writer.WriteStringValue(UpdatedAt, "O"); + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + CisaCveResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CisaCveResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCisaCveResult(document.RootElement, options); + } + + internal static CisaCveResult DeserializeCisaCveResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string cveId = default; + string vendorProject = default; + string product = default; + string vulnerabilityName = default; + string shortDescription = default; + string requiredAction = default; + string notes = default; + DateTimeOffset dateAdded = default; + DateTimeOffset dueDate = default; + DateTimeOffset updatedAt = default; + long count = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("cveId"u8)) + { + cveId = property.Value.GetString(); + continue; + } + if (property.NameEquals("vendorProject"u8)) + { + vendorProject = property.Value.GetString(); + continue; + } + if (property.NameEquals("product"u8)) + { + product = property.Value.GetString(); + continue; + } + if (property.NameEquals("vulnerabilityName"u8)) + { + vulnerabilityName = property.Value.GetString(); + continue; + } + if (property.NameEquals("shortDescription"u8)) + { + shortDescription = property.Value.GetString(); + continue; + } + if (property.NameEquals("requiredAction"u8)) + { + requiredAction = property.Value.GetString(); + continue; + } + if (property.NameEquals("notes"u8)) + { + notes = property.Value.GetString(); + continue; + } + if (property.NameEquals("dateAdded"u8)) + { + dateAdded = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("dueDate"u8)) + { + dueDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("updatedAt"u8)) + { + updatedAt = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("count"u8)) + { + count = property.Value.GetInt64(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CisaCveResult( + cveId, + vendorProject, + product, + vulnerabilityName, + shortDescription, + requiredAction, + notes, + dateAdded, + dueDate, + updatedAt, + count, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CisaCveResult)} does not support writing '{options.Format}' format."); + } + } + + CisaCveResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeCisaCveResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CisaCveResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CisaCveResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeCisaCveResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/CisaCveResult.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/CisaCveResult.cs new file mode 100644 index 000000000000..b232b946b07f --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/CisaCveResult.cs @@ -0,0 +1,138 @@ +// 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 +{ + /// cisa cve in a given workspace. + public partial class CisaCveResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The vendor or project name for the vulnerability. + /// The vulnerability product. + /// The name of the vulnerability. + /// A short description of the vulnerability. + /// The required action to address the vulnerability. + /// Any additional notes about the vulnerability. + /// The date the vulnerability was added to the catalog in the format YYYY-MM-DD. + /// The date the required action is due in the format YYYY-MM-DD. + /// The date the vulnerability was updated. + /// The number of assets affected by the vulnerability. + /// , , , , or is null. + internal CisaCveResult(string vendorProject, string product, string vulnerabilityName, string shortDescription, string requiredAction, string notes, DateTimeOffset dateAdded, DateTimeOffset dueDate, DateTimeOffset updatedAt, long count) + { + Argument.AssertNotNull(vendorProject, nameof(vendorProject)); + Argument.AssertNotNull(product, nameof(product)); + Argument.AssertNotNull(vulnerabilityName, nameof(vulnerabilityName)); + Argument.AssertNotNull(shortDescription, nameof(shortDescription)); + Argument.AssertNotNull(requiredAction, nameof(requiredAction)); + Argument.AssertNotNull(notes, nameof(notes)); + + VendorProject = vendorProject; + Product = product; + VulnerabilityName = vulnerabilityName; + ShortDescription = shortDescription; + RequiredAction = requiredAction; + Notes = notes; + DateAdded = dateAdded; + DueDate = dueDate; + UpdatedAt = updatedAt; + Count = count; + } + + /// Initializes a new instance of . + /// The CVE ID of the vulnerability in the format CVE-YYYY-NNNN, note that the number portion can have more than 4 digits. + /// The vendor or project name for the vulnerability. + /// The vulnerability product. + /// The name of the vulnerability. + /// A short description of the vulnerability. + /// The required action to address the vulnerability. + /// Any additional notes about the vulnerability. + /// The date the vulnerability was added to the catalog in the format YYYY-MM-DD. + /// The date the required action is due in the format YYYY-MM-DD. + /// The date the vulnerability was updated. + /// The number of assets affected by the vulnerability. + /// Keeps track of any properties unknown to the library. + internal CisaCveResult(string cveId, string vendorProject, string product, string vulnerabilityName, string shortDescription, string requiredAction, string notes, DateTimeOffset dateAdded, DateTimeOffset dueDate, DateTimeOffset updatedAt, long count, IDictionary serializedAdditionalRawData) + { + CveId = cveId; + VendorProject = vendorProject; + Product = product; + VulnerabilityName = vulnerabilityName; + ShortDescription = shortDescription; + RequiredAction = requiredAction; + Notes = notes; + DateAdded = dateAdded; + DueDate = dueDate; + UpdatedAt = updatedAt; + Count = count; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CisaCveResult() + { + } + + /// The CVE ID of the vulnerability in the format CVE-YYYY-NNNN, note that the number portion can have more than 4 digits. + public string CveId { get; } + /// The vendor or project name for the vulnerability. + public string VendorProject { get; } + /// The vulnerability product. + public string Product { get; } + /// The name of the vulnerability. + public string VulnerabilityName { get; } + /// A short description of the vulnerability. + public string ShortDescription { get; } + /// The required action to address the vulnerability. + public string RequiredAction { get; } + /// Any additional notes about the vulnerability. + public string Notes { get; } + /// The date the vulnerability was added to the catalog in the format YYYY-MM-DD. + public DateTimeOffset DateAdded { get; } + /// The date the required action is due in the format YYYY-MM-DD. + public DateTimeOffset DueDate { get; } + /// The date the vulnerability was updated. + public DateTimeOffset UpdatedAt { get; } + /// The number of assets affected by the vulnerability. + public long Count { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DailyDeltaTypeResponse.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DailyDeltaTypeResponse.Serialization.cs new file mode 100644 index 000000000000..0655299fd965 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DailyDeltaTypeResponse.Serialization.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class DailyDeltaTypeResponse : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DailyDeltaTypeResponse)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("count"u8); + writer.WriteNumberValue(Count); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + writer.WritePropertyName("removed"u8); + writer.WriteNumberValue(Removed); + writer.WritePropertyName("added"u8); + writer.WriteNumberValue(Added); + writer.WritePropertyName("difference"u8); + writer.WriteNumberValue(Difference); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DailyDeltaTypeResponse IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DailyDeltaTypeResponse)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDailyDeltaTypeResponse(document.RootElement, options); + } + + internal static DailyDeltaTypeResponse DeserializeDailyDeltaTypeResponse(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + long count = default; + GlobalAssetType kind = default; + long removed = default; + long added = default; + long difference = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("count"u8)) + { + count = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new GlobalAssetType(property.Value.GetString()); + continue; + } + if (property.NameEquals("removed"u8)) + { + removed = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("added"u8)) + { + added = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("difference"u8)) + { + difference = property.Value.GetInt64(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DailyDeltaTypeResponse( + kind, + removed, + added, + difference, + serializedAdditionalRawData, + count); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DailyDeltaTypeResponse)} does not support writing '{options.Format}' format."); + } + } + + DailyDeltaTypeResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDailyDeltaTypeResponse(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DailyDeltaTypeResponse)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new DailyDeltaTypeResponse FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDailyDeltaTypeResponse(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DailyDeltaTypeResponse.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DailyDeltaTypeResponse.cs new file mode 100644 index 000000000000..bf7813c7e4e5 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DailyDeltaTypeResponse.cs @@ -0,0 +1,47 @@ +// 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 +{ + /// Delta response for each day. + public partial class DailyDeltaTypeResponse : DeltaTypeResponse + { + /// Initializes a new instance of . + /// The kind of asset. + /// The amount of assets removed for one asset kind. + /// The amount of assets added for one asset kind. + /// The amount of assets changed for one asset kind. + /// The current number of assets for one asset kind. + internal DailyDeltaTypeResponse(GlobalAssetType kind, long removed, long added, long difference, long count) : base(kind, removed, added, difference) + { + Count = count; + } + + /// Initializes a new instance of . + /// The kind of asset. + /// The amount of assets removed for one asset kind. + /// The amount of assets added for one asset kind. + /// The amount of assets changed for one asset kind. + /// Keeps track of any properties unknown to the library. + /// The current number of assets for one asset kind. + internal DailyDeltaTypeResponse(GlobalAssetType kind, long removed, long added, long difference, IDictionary serializedAdditionalRawData, long count) : base(kind, removed, added, difference, serializedAdditionalRawData) + { + Count = count; + } + + /// Initializes a new instance of for deserialization. + internal DailyDeltaTypeResponse() + { + } + + /// The current number of assets for one asset kind. + public long Count { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DataConnection.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DataConnection.cs index f5cd01907046..eea63fcd0e7c 100644 --- a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DataConnection.cs +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DataConnection.cs @@ -56,13 +56,13 @@ protected DataConnection() /// Initializes a new instance of . /// Discriminator property for DataConnection. - /// The system generated unique id for the resource. + /// This is typically the same as the name but might be different for different models. /// 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 day to update the data connection on. (1-7 for weekly, 1-31 for monthly). /// 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. @@ -87,7 +87,7 @@ internal DataConnection(string kind, string id, string name, string displayName, /// Discriminator property for DataConnection. internal string Kind { get; set; } - /// The system generated unique id for the resource. + /// This is typically the same as the name but might be different for different models. public string Id { get; } /// The caller provided unique name for the resource. public string Name { get; } @@ -99,7 +99,7 @@ internal DataConnection(string kind, string id, string name, string displayName, public DateTimeOffset? CreatedDate { get; } /// The rate at which the data connection will receive updates. public DataConnectionFrequency? Frequency { get; } - /// The day to update the data connection on. + /// The day to update the data connection on. (1-7 for weekly, 1-31 for monthly). public int? FrequencyOffset { get; } /// The date the data connection was last updated. public DateTimeOffset? UpdatedDate { get; } diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DataConnectionPayload.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DataConnectionPayload.cs index a10e83a8ee34..d059fceb8aa5 100644 --- a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DataConnectionPayload.cs +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DataConnectionPayload.cs @@ -55,7 +55,7 @@ protected DataConnectionPayload() } /// Initializes a new instance of . - /// Discriminator property for DataConnectionPayload. + /// Discriminator property for DataConnectionData. /// The name of data connection. /// The type of data the data connection will transfer. /// The rate at which the data connection will receive updates. @@ -71,7 +71,7 @@ internal DataConnectionPayload(string kind, string name, DataConnectionContent? _serializedAdditionalRawData = serializedAdditionalRawData; } - /// Discriminator property for DataConnectionPayload. + /// Discriminator property for DataConnectionData. internal string Kind { get; set; } /// The name of data connection. public string Name { get; set; } diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaDateResult.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaDateResult.Serialization.cs new file mode 100644 index 000000000000..e2df53fc4e8f --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaDateResult.Serialization.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class DeltaDateResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DeltaDateResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("date"u8); + writer.WriteStringValue(Date, "O"); + writer.WritePropertyName("deltas"u8); + writer.WriteStartArray(); + foreach (var item in Deltas) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DeltaDateResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DeltaDateResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeltaDateResult(document.RootElement, options); + } + + internal static DeltaDateResult DeserializeDeltaDateResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DateTimeOffset date = default; + IReadOnlyList deltas = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("date"u8)) + { + date = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("deltas"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DailyDeltaTypeResponse.DeserializeDailyDeltaTypeResponse(item, options)); + } + deltas = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DeltaDateResult(date, deltas, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DeltaDateResult)} does not support writing '{options.Format}' format."); + } + } + + DeltaDateResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDeltaDateResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeltaDateResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DeltaDateResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDeltaDateResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaDateResult.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaDateResult.cs new file mode 100644 index 000000000000..ee5af7f2ec93 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaDateResult.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.Analytics.Defender.Easm +{ + /// Date information for the delta response. + public partial class DeltaDateResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The date that is being requested. + /// A list of summary counts per day. + /// is null. + internal DeltaDateResult(DateTimeOffset date, IEnumerable deltas) + { + Argument.AssertNotNull(deltas, nameof(deltas)); + + Date = date; + Deltas = deltas.ToList(); + } + + /// Initializes a new instance of . + /// The date that is being requested. + /// A list of summary counts per day. + /// Keeps track of any properties unknown to the library. + internal DeltaDateResult(DateTimeOffset date, IReadOnlyList deltas, IDictionary serializedAdditionalRawData) + { + Date = date; + Deltas = deltas; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DeltaDateResult() + { + } + + /// The date that is being requested. + public DateTimeOffset Date { get; } + /// A list of summary counts per day. + public IReadOnlyList Deltas { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaDetailType.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaDetailType.cs new file mode 100644 index 000000000000..d2d8937f1c8c --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaDetailType.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 +{ + /// A list of delta detail type. + public readonly partial struct DeltaDetailType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public DeltaDetailType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AddedValue = "added"; + private const string RemovedValue = "removed"; + + /// added. + public static DeltaDetailType Added { get; } = new DeltaDetailType(AddedValue); + /// removed. + public static DeltaDetailType Removed { get; } = new DeltaDetailType(RemovedValue); + /// Determines if two values are the same. + public static bool operator ==(DeltaDetailType left, DeltaDetailType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(DeltaDetailType left, DeltaDetailType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator DeltaDetailType(string value) => new DeltaDetailType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is DeltaDetailType other && Equals(other); + /// + public bool Equals(DeltaDetailType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaDetailsRequest.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaDetailsRequest.Serialization.cs new file mode 100644 index 000000000000..5034fd50e00c --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaDetailsRequest.Serialization.cs @@ -0,0 +1,169 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class DeltaDetailsRequest : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DeltaDetailsRequest)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("deltaDetailType"u8); + writer.WriteStringValue(DeltaDetailType.ToString()); + if (Optional.IsDefined(PriorDays)) + { + writer.WritePropertyName("priorDays"u8); + writer.WriteNumberValue(PriorDays.Value); + } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + if (Optional.IsDefined(Date)) + { + writer.WritePropertyName("date"u8); + writer.WriteStringValue(Date); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DeltaDetailsRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DeltaDetailsRequest)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeltaDetailsRequest(document.RootElement, options); + } + + internal static DeltaDetailsRequest DeserializeDeltaDetailsRequest(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DeltaDetailType deltaDetailType = default; + int? priorDays = default; + GlobalAssetType kind = default; + string date = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("deltaDetailType"u8)) + { + deltaDetailType = new DeltaDetailType(property.Value.GetString()); + continue; + } + if (property.NameEquals("priorDays"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + priorDays = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new GlobalAssetType(property.Value.GetString()); + continue; + } + if (property.NameEquals("date"u8)) + { + date = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DeltaDetailsRequest(deltaDetailType, priorDays, kind, date, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DeltaDetailsRequest)} does not support writing '{options.Format}' format."); + } + } + + DeltaDetailsRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDeltaDetailsRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeltaDetailsRequest)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DeltaDetailsRequest FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDeltaDetailsRequest(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaDetailsRequest.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaDetailsRequest.cs new file mode 100644 index 000000000000..42095a187362 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaDetailsRequest.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Analytics.Defender.Easm +{ + /// A request body used to retrieve a list of deltas. + public partial class DeltaDetailsRequest + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The type of delta detail to retrieve. + /// The type of asset. + public DeltaDetailsRequest(DeltaDetailType deltaDetailType, GlobalAssetType kind) + { + DeltaDetailType = deltaDetailType; + Kind = kind; + } + + /// Initializes a new instance of . + /// The type of delta detail to retrieve. + /// The number of days prior to retrieve deltas for. + /// The type of asset. + /// expected format to be: yyyy-MM-dd. + /// Keeps track of any properties unknown to the library. + internal DeltaDetailsRequest(DeltaDetailType deltaDetailType, int? priorDays, GlobalAssetType kind, string date, IDictionary serializedAdditionalRawData) + { + DeltaDetailType = deltaDetailType; + PriorDays = priorDays; + Kind = kind; + Date = date; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DeltaDetailsRequest() + { + } + + /// The type of delta detail to retrieve. + public DeltaDetailType DeltaDetailType { get; } + /// The number of days prior to retrieve deltas for. + public int? PriorDays { get; set; } + /// The type of asset. + public GlobalAssetType Kind { get; } + /// expected format to be: yyyy-MM-dd. + public string Date { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaRangeResult.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaRangeResult.Serialization.cs new file mode 100644 index 000000000000..b20a31665806 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaRangeResult.Serialization.cs @@ -0,0 +1,183 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class DeltaRangeResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DeltaRangeResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("range"u8); + writer.WriteNumberValue(Range); + writer.WritePropertyName("removed"u8); + writer.WriteNumberValue(Removed); + writer.WritePropertyName("added"u8); + writer.WriteNumberValue(Added); + writer.WritePropertyName("difference"u8); + writer.WriteNumberValue(Difference); + writer.WritePropertyName("kindSummaries"u8); + writer.WriteStartArray(); + foreach (var item in KindSummaries) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DeltaRangeResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DeltaRangeResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeltaRangeResult(document.RootElement, options); + } + + internal static DeltaRangeResult DeserializeDeltaRangeResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + long range = default; + long removed = default; + long added = default; + long difference = default; + IReadOnlyList kindSummaries = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("range"u8)) + { + range = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("removed"u8)) + { + removed = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("added"u8)) + { + added = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("difference"u8)) + { + difference = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("kindSummaries"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeltaTypeResponse.DeserializeDeltaTypeResponse(item, options)); + } + kindSummaries = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DeltaRangeResult( + range, + removed, + added, + difference, + kindSummaries, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DeltaRangeResult)} does not support writing '{options.Format}' format."); + } + } + + DeltaRangeResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDeltaRangeResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeltaRangeResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DeltaRangeResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDeltaRangeResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaRangeResult.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaRangeResult.cs new file mode 100644 index 000000000000..2a64af73cbc1 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaRangeResult.cs @@ -0,0 +1,100 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.Analytics.Defender.Easm +{ + /// Contains added, removed, and difference values for the whole range either 7 or 30 days. + public partial class DeltaRangeResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The range of dates requested. + /// The total amount of assets removed over a date range. + /// The total amount of assets added over a date range. + /// The total amount of assets changed removed over a date range. + /// A list of summary changes per asset kind. + /// is null. + internal DeltaRangeResult(long range, long removed, long added, long difference, IEnumerable kindSummaries) + { + Argument.AssertNotNull(kindSummaries, nameof(kindSummaries)); + + Range = range; + Removed = removed; + Added = added; + Difference = difference; + KindSummaries = kindSummaries.ToList(); + } + + /// Initializes a new instance of . + /// The range of dates requested. + /// The total amount of assets removed over a date range. + /// The total amount of assets added over a date range. + /// The total amount of assets changed removed over a date range. + /// A list of summary changes per asset kind. + /// Keeps track of any properties unknown to the library. + internal DeltaRangeResult(long range, long removed, long added, long difference, IReadOnlyList kindSummaries, IDictionary serializedAdditionalRawData) + { + Range = range; + Removed = removed; + Added = added; + Difference = difference; + KindSummaries = kindSummaries; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DeltaRangeResult() + { + } + + /// The range of dates requested. + public long Range { get; } + /// The total amount of assets removed over a date range. + public long Removed { get; } + /// The total amount of assets added over a date range. + public long Added { get; } + /// The total amount of assets changed removed over a date range. + public long Difference { get; } + /// A list of summary changes per asset kind. + public IReadOnlyList KindSummaries { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaResult.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaResult.Serialization.cs new file mode 100644 index 000000000000..f4e149b5498e --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaResult.Serialization.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class DeltaResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DeltaResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("createdAt"u8); + writer.WriteStringValue(CreatedAt, "O"); + writer.WritePropertyName("updatedAt"u8); + writer.WriteStringValue(UpdatedAt, "O"); + writer.WritePropertyName("state"u8); + writer.WriteStringValue(State.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DeltaResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DeltaResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeltaResult(document.RootElement, options); + } + + internal static DeltaResult DeserializeDeltaResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + GlobalAssetType kind = default; + string name = default; + DateTimeOffset createdAt = default; + DateTimeOffset updatedAt = default; + GlobalInventoryState state = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = new GlobalAssetType(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("createdAt"u8)) + { + createdAt = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("updatedAt"u8)) + { + updatedAt = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("state"u8)) + { + state = new GlobalInventoryState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DeltaResult( + kind, + name, + createdAt, + updatedAt, + state, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DeltaResult)} does not support writing '{options.Format}' format."); + } + } + + DeltaResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDeltaResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeltaResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DeltaResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDeltaResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaResult.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaResult.cs new file mode 100644 index 000000000000..574e2526e978 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaResult.cs @@ -0,0 +1,99 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Analytics.Defender.Easm +{ + /// Result for each of the delta detail response. + public partial class DeltaResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Shows the asset kind. + /// Shows the asset name. + /// Shows the date when the asset was originally created. + /// Shows the date when the asset was last updated, usually the date the we trying to pull up the results for. + /// Shows the inventory state. + /// is null. + internal DeltaResult(GlobalAssetType kind, string name, DateTimeOffset createdAt, DateTimeOffset updatedAt, GlobalInventoryState state) + { + Argument.AssertNotNull(name, nameof(name)); + + Kind = kind; + Name = name; + CreatedAt = createdAt; + UpdatedAt = updatedAt; + State = state; + } + + /// Initializes a new instance of . + /// Shows the asset kind. + /// Shows the asset name. + /// Shows the date when the asset was originally created. + /// Shows the date when the asset was last updated, usually the date the we trying to pull up the results for. + /// Shows the inventory state. + /// Keeps track of any properties unknown to the library. + internal DeltaResult(GlobalAssetType kind, string name, DateTimeOffset createdAt, DateTimeOffset updatedAt, GlobalInventoryState state, IDictionary serializedAdditionalRawData) + { + Kind = kind; + Name = name; + CreatedAt = createdAt; + UpdatedAt = updatedAt; + State = state; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DeltaResult() + { + } + + /// Shows the asset kind. + public GlobalAssetType Kind { get; } + /// Shows the asset name. + public string Name { get; } + /// Shows the date when the asset was originally created. + public DateTimeOffset CreatedAt { get; } + /// Shows the date when the asset was last updated, usually the date the we trying to pull up the results for. + public DateTimeOffset UpdatedAt { get; } + /// Shows the inventory state. + public GlobalInventoryState State { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaSummaryRequest.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaSummaryRequest.Serialization.cs new file mode 100644 index 000000000000..5d81ed2d1590 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaSummaryRequest.Serialization.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class DeltaSummaryRequest : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DeltaSummaryRequest)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(PriorDays)) + { + writer.WritePropertyName("priorDays"u8); + writer.WriteNumberValue(PriorDays.Value); + } + if (Optional.IsDefined(Date)) + { + writer.WritePropertyName("date"u8); + writer.WriteStringValue(Date); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DeltaSummaryRequest IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DeltaSummaryRequest)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeltaSummaryRequest(document.RootElement, options); + } + + internal static DeltaSummaryRequest DeserializeDeltaSummaryRequest(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + int? priorDays = default; + string date = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("priorDays"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + priorDays = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("date"u8)) + { + date = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DeltaSummaryRequest(priorDays, date, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DeltaSummaryRequest)} does not support writing '{options.Format}' format."); + } + } + + DeltaSummaryRequest IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDeltaSummaryRequest(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeltaSummaryRequest)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DeltaSummaryRequest FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDeltaSummaryRequest(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaSummaryRequest.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaSummaryRequest.cs new file mode 100644 index 000000000000..b28a577ccb9c --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaSummaryRequest.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Analytics.Defender.Easm +{ + /// A request body used to retrieve a delta summary. + public partial class DeltaSummaryRequest + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public DeltaSummaryRequest() + { + } + + /// Initializes a new instance of . + /// The number of days prior to retrieve deltas for. + /// expected format to be: yyyy-MM-dd. + /// Keeps track of any properties unknown to the library. + internal DeltaSummaryRequest(int? priorDays, string date, IDictionary serializedAdditionalRawData) + { + PriorDays = priorDays; + Date = date; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The number of days prior to retrieve deltas for. + public int? PriorDays { get; set; } + /// expected format to be: yyyy-MM-dd. + public string Date { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaSummaryResult.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaSummaryResult.Serialization.cs new file mode 100644 index 000000000000..bb74f2943fd8 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaSummaryResult.Serialization.cs @@ -0,0 +1,153 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class DeltaSummaryResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DeltaSummaryResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("summary"u8); + writer.WriteObjectValue(Summary, options); + writer.WritePropertyName("daily"u8); + writer.WriteStartArray(); + foreach (var item in Daily) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DeltaSummaryResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DeltaSummaryResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeltaSummaryResult(document.RootElement, options); + } + + internal static DeltaSummaryResult DeserializeDeltaSummaryResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + DeltaRangeResult summary = default; + IReadOnlyList daily = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("summary"u8)) + { + summary = DeltaRangeResult.DeserializeDeltaRangeResult(property.Value, options); + continue; + } + if (property.NameEquals("daily"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(DeltaDateResult.DeserializeDeltaDateResult(item, options)); + } + daily = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DeltaSummaryResult(summary, daily, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DeltaSummaryResult)} does not support writing '{options.Format}' format."); + } + } + + DeltaSummaryResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDeltaSummaryResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeltaSummaryResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DeltaSummaryResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDeltaSummaryResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaSummaryResult.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaSummaryResult.cs new file mode 100644 index 000000000000..659416679db8 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaSummaryResult.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.Analytics.Defender.Easm +{ + /// Define response body for getting delta summary. + public partial class DeltaSummaryResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Contains added, removed, and difference values for the whole range either 7 or 30 days. + /// Contains added, removed, count, and difference values for each day. + /// or is null. + internal DeltaSummaryResult(DeltaRangeResult summary, IEnumerable daily) + { + Argument.AssertNotNull(summary, nameof(summary)); + Argument.AssertNotNull(daily, nameof(daily)); + + Summary = summary; + Daily = daily.ToList(); + } + + /// Initializes a new instance of . + /// Contains added, removed, and difference values for the whole range either 7 or 30 days. + /// Contains added, removed, count, and difference values for each day. + /// Keeps track of any properties unknown to the library. + internal DeltaSummaryResult(DeltaRangeResult summary, IReadOnlyList daily, IDictionary serializedAdditionalRawData) + { + Summary = summary; + Daily = daily; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DeltaSummaryResult() + { + } + + /// Contains added, removed, and difference values for the whole range either 7 or 30 days. + public DeltaRangeResult Summary { get; } + /// Contains added, removed, count, and difference values for each day. + public IReadOnlyList Daily { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaTypeResponse.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaTypeResponse.Serialization.cs new file mode 100644 index 000000000000..549773661b6d --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaTypeResponse.Serialization.cs @@ -0,0 +1,159 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class DeltaTypeResponse : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DeltaTypeResponse)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + writer.WritePropertyName("removed"u8); + writer.WriteNumberValue(Removed); + writer.WritePropertyName("added"u8); + writer.WriteNumberValue(Added); + writer.WritePropertyName("difference"u8); + writer.WriteNumberValue(Difference); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DeltaTypeResponse IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DeltaTypeResponse)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeltaTypeResponse(document.RootElement, options); + } + + internal static DeltaTypeResponse DeserializeDeltaTypeResponse(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + GlobalAssetType kind = default; + long removed = default; + long added = default; + long difference = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = new GlobalAssetType(property.Value.GetString()); + continue; + } + if (property.NameEquals("removed"u8)) + { + removed = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("added"u8)) + { + added = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("difference"u8)) + { + difference = property.Value.GetInt64(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DeltaTypeResponse(kind, removed, added, difference, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DeltaTypeResponse)} does not support writing '{options.Format}' format."); + } + } + + DeltaTypeResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDeltaTypeResponse(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeltaTypeResponse)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DeltaTypeResponse FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDeltaTypeResponse(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaTypeResponse.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaTypeResponse.cs new file mode 100644 index 000000000000..ad7b5a9d5f8a --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DeltaTypeResponse.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Analytics.Defender.Easm +{ + /// The type of Delta response for each asset kind. + public partial class DeltaTypeResponse + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The kind of asset. + /// The amount of assets removed for one asset kind. + /// The amount of assets added for one asset kind. + /// The amount of assets changed for one asset kind. + internal DeltaTypeResponse(GlobalAssetType kind, long removed, long added, long difference) + { + Kind = kind; + Removed = removed; + Added = added; + Difference = difference; + } + + /// Initializes a new instance of . + /// The kind of asset. + /// The amount of assets removed for one asset kind. + /// The amount of assets added for one asset kind. + /// The amount of assets changed for one asset kind. + /// Keeps track of any properties unknown to the library. + internal DeltaTypeResponse(GlobalAssetType kind, long removed, long added, long difference, IDictionary serializedAdditionalRawData) + { + Kind = kind; + Removed = removed; + Added = added; + Difference = difference; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DeltaTypeResponse() + { + } + + /// The kind of asset. + public GlobalAssetType Kind { get; } + /// The amount of assets removed for one asset kind. + public long Removed { get; } + /// The amount of assets added for one asset kind. + public long Added { get; } + /// The amount of assets changed for one asset kind. + public long Difference { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoGroupSummaryResult.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoGroupSummaryResult.Serialization.cs new file mode 100644 index 000000000000..e0b589805745 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoGroupSummaryResult.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class DiscoGroupSummaryResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DiscoGroupSummaryResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + DiscoGroupSummaryResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DiscoGroupSummaryResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDiscoGroupSummaryResult(document.RootElement, options); + } + + internal static DiscoGroupSummaryResult DeserializeDiscoGroupSummaryResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + string name = default; + string displayName = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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 (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DiscoGroupSummaryResult(id, name, displayName, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DiscoGroupSummaryResult)} does not support writing '{options.Format}' format."); + } + } + + DiscoGroupSummaryResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeDiscoGroupSummaryResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DiscoGroupSummaryResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static DiscoGroupSummaryResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeDiscoGroupSummaryResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoGroupSummaryResult.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoGroupSummaryResult.cs new file mode 100644 index 000000000000..8a3fcd7758d4 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoGroupSummaryResult.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Analytics.Defender.Easm +{ + /// A list of disco group summaries. + public partial class DiscoGroupSummaryResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The system generated unique id for the resource. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// , or is null. + internal DiscoGroupSummaryResult(string id, string name, string displayName) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(displayName, nameof(displayName)); + + Id = id; + Name = name; + DisplayName = displayName; + } + + /// Initializes a new instance of . + /// 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. + /// Keeps track of any properties unknown to the library. + internal DiscoGroupSummaryResult(string id, string name, string displayName, IDictionary serializedAdditionalRawData) + { + Id = id; + Name = name; + DisplayName = displayName; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DiscoGroupSummaryResult() + { + } + + /// 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; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoveryGroup.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoveryGroup.cs index 467ce65ae68d..a503e1391073 100644 --- a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoveryGroup.cs +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/DiscoveryGroup.cs @@ -54,7 +54,7 @@ internal DiscoveryGroup() } /// Initializes a new instance of . - /// The system generated unique id for the resource. + /// This is typically the same as the name but might be different for different models. /// The caller provided unique name for the resource. /// The name that can be used for display purposes. /// The description for a disco group. @@ -84,7 +84,7 @@ internal DiscoveryGroup(string id, string name, string displayName, string descr _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The system generated unique id for the resource. + /// This is typically the same as the name but might be different for different models. public string Id { get; } /// The caller provided unique name for the resource. public string Name { 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 index 57b7b001be07..e04e7484b5a5 100644 --- a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Docs/EasmClient.xml +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Docs/EasmClient.xml @@ -17,6 +17,7 @@ AssetUpdatePayload body = new AssetUpdatePayload { ["contosoLabel"] = true }, + Remediations = { new ObservationRemediationItem(ObservationType.Cve, "CVE-0000-00000", ObservationRemediationState.Active), new ObservationRemediationItem(ObservationType.Insight, "This is an insight", ObservationRemediationState.NonApplicable) }, }; Response response = await client.UpdateAssetsAsync("state%20%3D%20%22confirmed%22%20AND%20name%20%5E%3D%20%22contoso.com%22", body); ]]> @@ -37,6 +38,7 @@ AssetUpdatePayload body = new AssetUpdatePayload { ["contosoLabel"] = true }, + Remediations = { new ObservationRemediationItem(ObservationType.Cve, "CVE-0000-00000", ObservationRemediationState.Active), new ObservationRemediationItem(ObservationType.Insight, "This is an insight", ObservationRemediationState.NonApplicable) }, }; Response response = client.UpdateAssets("state%20%3D%20%22confirmed%22%20AND%20name%20%5E%3D%20%22contoso.com%22", body); ]]> @@ -57,6 +59,21 @@ using RequestContent content = RequestContent.Create(new { contosoLabel = true, }, + remediations = new object[] + { + new + { + name = "CVE-0000-00000", + kind = "cve", + state = "active", + }, + new + { + name = "This is an insight", + kind = "insight", + state = "nonApplicable", + } + }, }); Response response = await client.UpdateAssetsAsync("state%20%3D%20%22confirmed%22%20AND%20name%20%5E%3D%20%22contoso.com%22", content); @@ -80,6 +97,21 @@ using RequestContent content = RequestContent.Create(new { contosoLabel = true, }, + remediations = new object[] + { + new + { + name = "CVE-0000-00000", + kind = "cve", + state = "active", + }, + new + { + name = "This is an insight", + kind = "insight", + state = "nonApplicable", + } + }, }); Response response = client.UpdateAssets("state%20%3D%20%22confirmed%22%20AND%20name%20%5E%3D%20%22contoso.com%22", content); @@ -137,6 +169,238 @@ Response response = client.GetAssetResource("aG9zdCQkY29udG9zby5jb20", 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 GetAssetsExportAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +AssetsExportRequest body = new AssetsExportRequest("ThisisaFileName", new string[] { "asset", "name" }); +Response response = await client.GetAssetsExportAsync(body); +]]> + + + +This sample shows how to call GetAssetsExport. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +AssetsExportRequest body = new AssetsExportRequest("ThisisaFileName", new string[] { "asset", "name" }); +Response response = client.GetAssetsExport(body); +]]> + + + +This sample shows how to call GetAssetsExportAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + fileName = "ThisisaFileName", + columns = new object[] + { + "asset", + "name" + }, +}); +Response response = await client.GetAssetsExportAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> + + + +This sample shows how to call GetAssetsExport and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + fileName = "ThisisaFileName", + columns = new object[] + { + "asset", + "name" + }, +}); +Response response = client.GetAssetsExport(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> + + + +This sample shows how to call GetObservationsAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +Response response = await client.GetObservationsAsync("aG9zdCQkY29udG9zby5jb20"); +]]> + + + +This sample shows how to call GetObservations. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +Response response = client.GetObservations("aG9zdCQkY29udG9zby5jb20"); +]]> + + + +This sample shows how to call GetObservationsAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +Response response = await client.GetObservationsAsync("aG9zdCQkY29udG9zby5jb20", null, null, null, null, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("totalElements").ToString()); +Console.WriteLine(result.GetProperty("prioritySummary").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("types")[0].ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("priority").ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("cvssScoreV2").ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("cvssScoreV3").ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("remediationState").ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("remediationSource").ToString()); +]]> + + + +This sample shows how to call GetObservations and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +Response response = client.GetObservations("aG9zdCQkY29udG9zby5jb20", null, null, null, null, null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("totalElements").ToString()); +Console.WriteLine(result.GetProperty("prioritySummary").GetProperty("").ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("types")[0].ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("priority").ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("cvssScoreV2").ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("cvssScoreV3").ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("remediationState").ToString()); +Console.WriteLine(result.GetProperty("value")[0].GetProperty("remediationSource").ToString()); +]]> + + + +This sample shows how to call GetDeltaSummaryAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +DeltaSummaryRequest body = new DeltaSummaryRequest +{ + PriorDays = 30, + Date = "2024-03-17", +}; +Response response = await client.GetDeltaSummaryAsync(body); +]]> + + + +This sample shows how to call GetDeltaSummary. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +DeltaSummaryRequest body = new DeltaSummaryRequest +{ + PriorDays = 30, + Date = "2024-03-17", +}; +Response response = client.GetDeltaSummary(body); +]]> + + + +This sample shows how to call GetDeltaSummaryAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + priorDays = 30, + date = "2024-03-17", +}); +Response response = await client.GetDeltaSummaryAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("summary").GetProperty("range").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("removed").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("added").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("difference").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("kindSummaries")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("kindSummaries")[0].GetProperty("removed").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("kindSummaries")[0].GetProperty("added").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("kindSummaries")[0].GetProperty("difference").ToString()); +Console.WriteLine(result.GetProperty("daily")[0].GetProperty("date").ToString()); +Console.WriteLine(result.GetProperty("daily")[0].GetProperty("deltas")[0].GetProperty("count").ToString()); +Console.WriteLine(result.GetProperty("daily")[0].GetProperty("deltas")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("daily")[0].GetProperty("deltas")[0].GetProperty("removed").ToString()); +Console.WriteLine(result.GetProperty("daily")[0].GetProperty("deltas")[0].GetProperty("added").ToString()); +Console.WriteLine(result.GetProperty("daily")[0].GetProperty("deltas")[0].GetProperty("difference").ToString()); +]]> + + + +This sample shows how to call GetDeltaSummary and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + priorDays = 30, + date = "2024-03-17", +}); +Response response = client.GetDeltaSummary(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("summary").GetProperty("range").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("removed").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("added").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("difference").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("kindSummaries")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("kindSummaries")[0].GetProperty("removed").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("kindSummaries")[0].GetProperty("added").ToString()); +Console.WriteLine(result.GetProperty("summary").GetProperty("kindSummaries")[0].GetProperty("difference").ToString()); +Console.WriteLine(result.GetProperty("daily")[0].GetProperty("date").ToString()); +Console.WriteLine(result.GetProperty("daily")[0].GetProperty("deltas")[0].GetProperty("count").ToString()); +Console.WriteLine(result.GetProperty("daily")[0].GetProperty("deltas")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("daily")[0].GetProperty("deltas")[0].GetProperty("removed").ToString()); +Console.WriteLine(result.GetProperty("daily")[0].GetProperty("deltas")[0].GetProperty("added").ToString()); +Console.WriteLine(result.GetProperty("daily")[0].GetProperty("deltas")[0].GetProperty("difference").ToString()); ]]> @@ -403,9 +667,9 @@ Response response = client.DeleteDataConnection("ThisisaDataConnection"); Console.WriteLine(response.Status); ]]> - + -This sample shows how to call ValidateDiscoveryGroupAsync. +This sample shows how to call ValidateDiscoGroupAsync. "); TokenCredential credential = new DefaultAzureCredential(); @@ -413,6 +677,7 @@ EasmClient client = new EasmClient(endpoint, credential); DiscoveryGroupPayload body = new DiscoveryGroupPayload { + Name = "ThisisaDiscoGroup", Description = "This is a disco group", Tier = "advanced", FrequencyMilliseconds = 604800000L, @@ -422,12 +687,12 @@ DiscoveryGroupPayload body = new DiscoveryGroupPayload Name = "thisisatest.microsoft.com", }}, }; -Response response = await client.ValidateDiscoveryGroupAsync(body); +Response response = await client.ValidateDiscoGroupAsync(body); ]]> - + -This sample shows how to call ValidateDiscoveryGroup. +This sample shows how to call ValidateDiscoGroup. "); TokenCredential credential = new DefaultAzureCredential(); @@ -435,6 +700,7 @@ EasmClient client = new EasmClient(endpoint, credential); DiscoveryGroupPayload body = new DiscoveryGroupPayload { + Name = "ThisisaDiscoGroup", Description = "This is a disco group", Tier = "advanced", FrequencyMilliseconds = 604800000L, @@ -444,12 +710,12 @@ DiscoveryGroupPayload body = new DiscoveryGroupPayload Name = "thisisatest.microsoft.com", }}, }; -Response response = client.ValidateDiscoveryGroup(body); +Response response = client.ValidateDiscoGroup(body); ]]> - + -This sample shows how to call ValidateDiscoveryGroupAsync and parse the result. +This sample shows how to call ValidateDiscoGroupAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); @@ -457,6 +723,7 @@ EasmClient client = new EasmClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { + name = "ThisisaDiscoGroup", description = "This is a disco group", frequencyMilliseconds = 604800000L, tier = "advanced", @@ -469,15 +736,15 @@ using RequestContent content = RequestContent.Create(new } }, }); -Response response = await client.ValidateDiscoveryGroupAsync(content); +Response response = await client.ValidateDiscoGroupAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); ]]> - + -This sample shows how to call ValidateDiscoveryGroup and parse the result. +This sample shows how to call ValidateDiscoGroup and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); @@ -485,6 +752,7 @@ EasmClient client = new EasmClient(endpoint, credential); using RequestContent content = RequestContent.Create(new { + name = "ThisisaDiscoGroup", description = "This is a disco group", frequencyMilliseconds = 604800000L, tier = "advanced", @@ -497,65 +765,91 @@ using RequestContent content = RequestContent.Create(new } }, }); -Response response = client.ValidateDiscoveryGroup(content); +Response response = client.ValidateDiscoGroup(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); ]]> - + -This sample shows how to call GetDiscoveryGroupAsync. +This sample shows how to call GetDiscoGroupAsync. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -Response response = await client.GetDiscoveryGroupAsync("ThisisaDiscoGroup"); +Response response = await client.GetDiscoGroupAsync("ThisisaDiscoGroup"); ]]> - + -This sample shows how to call GetDiscoveryGroup. +This sample shows how to call GetDiscoGroup. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -Response response = client.GetDiscoveryGroup("ThisisaDiscoGroup"); +Response response = client.GetDiscoGroup("ThisisaDiscoGroup"); ]]> - + -This sample shows how to call GetDiscoveryGroupAsync and parse the result. +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.GetDiscoveryGroupAsync("ThisisaDiscoGroup", null); +Response response = await client.GetDiscoGroupAsync("ThisisaDiscoGroup", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); ]]> - + -This sample shows how to call GetDiscoveryGroup and parse the result. +This sample shows how to call GetDiscoGroup and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -Response response = client.GetDiscoveryGroup("ThisisaDiscoGroup", null); +Response response = client.GetDiscoGroup("ThisisaDiscoGroup", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); ]]> - + + +This sample shows how to call DeleteDiscoGroupAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +Response response = await client.DeleteDiscoGroupAsync("ThisisaDiscoGroup"); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call DeleteDiscoGroup. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +Response response = client.DeleteDiscoGroup("ThisisaDiscoGroup"); + +Console.WriteLine(response.Status); +]]> + + -This sample shows how to call CreateOrReplaceDiscoveryGroupAsync. +This sample shows how to call CreateOrReplaceDiscoGroupAsync. "); TokenCredential credential = new DefaultAzureCredential(); @@ -572,12 +866,12 @@ DiscoveryGroupPayload body = new DiscoveryGroupPayload Name = "thisisatest.microsoft.com", }}, }; -Response response = await client.CreateOrReplaceDiscoveryGroupAsync("ThisisaDiscoGroup", body); +Response response = await client.CreateOrReplaceDiscoGroupAsync("ThisisaDiscoGroup", body); ]]> - + -This sample shows how to call CreateOrReplaceDiscoveryGroup. +This sample shows how to call CreateOrReplaceDiscoGroup. "); TokenCredential credential = new DefaultAzureCredential(); @@ -594,12 +888,12 @@ DiscoveryGroupPayload body = new DiscoveryGroupPayload Name = "thisisatest.microsoft.com", }}, }; -Response response = client.CreateOrReplaceDiscoveryGroup("ThisisaDiscoGroup", body); +Response response = client.CreateOrReplaceDiscoGroup("ThisisaDiscoGroup", body); ]]> - + -This sample shows how to call CreateOrReplaceDiscoveryGroupAsync and parse the result. +This sample shows how to call CreateOrReplaceDiscoGroupAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); @@ -619,15 +913,15 @@ using RequestContent content = RequestContent.Create(new } }, }); -Response response = await client.CreateOrReplaceDiscoveryGroupAsync("ThisisaDiscoGroup", content); +Response response = await client.CreateOrReplaceDiscoGroupAsync("ThisisaDiscoGroup", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); ]]> - + -This sample shows how to call CreateOrReplaceDiscoveryGroup and parse the result. +This sample shows how to call CreateOrReplaceDiscoGroup and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); @@ -647,230 +941,374 @@ using RequestContent content = RequestContent.Create(new } }, }); -Response response = client.CreateOrReplaceDiscoveryGroup("ThisisaDiscoGroup", content); +Response response = client.CreateOrReplaceDiscoGroup("ThisisaDiscoGroup", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); ]]> - + -This sample shows how to call RunDiscoveryGroupAsync. +This sample shows how to call RunDiscoGroupAsync. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -Response response = await client.RunDiscoveryGroupAsync("ThisisaDiscoGroup"); +Response response = await client.RunDiscoGroupAsync("ThisisaDiscoGroup"); Console.WriteLine(response.Status); ]]> - + -This sample shows how to call RunDiscoveryGroup. +This sample shows how to call RunDiscoGroup. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -Response response = client.RunDiscoveryGroup("ThisisaDiscoGroup"); +Response response = client.RunDiscoGroup("ThisisaDiscoGroup"); Console.WriteLine(response.Status); ]]> - + -This sample shows how to call GetDiscoveryTemplateAsync. +This sample shows how to call GetAssetChainSummaryAsync. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -Response response = await client.GetDiscoveryTemplateAsync("12345"); +AssetChainRequest body = new AssetChainRequest(AssetChainSource.ASSET, new string[] { "DOMAIN$$contoso.com" }); +Response response = await client.GetAssetChainSummaryAsync(body); ]]> - + -This sample shows how to call GetDiscoveryTemplate. +This sample shows how to call GetAssetChainSummary. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -Response response = client.GetDiscoveryTemplate("12345"); +AssetChainRequest body = new AssetChainRequest(AssetChainSource.ASSET, new string[] { "DOMAIN$$contoso.com" }); +Response response = client.GetAssetChainSummary(body); ]]> - + -This sample shows how to call GetDiscoveryTemplateAsync and parse the result. +This sample shows how to call GetAssetChainSummaryAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -Response response = await client.GetDiscoveryTemplateAsync("12345", null); +using RequestContent content = RequestContent.Create(new +{ + assetChainSource = "ASSET", + sourceIds = new object[] + { + "DOMAIN$$contoso.com" + }, +}); +Response response = await client.GetAssetChainSummaryAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("affectedAssetsSummary")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("affectedAssetsSummary")[0].GetProperty("affectedCount").ToString()); +Console.WriteLine(result.GetProperty("affectedGroupsSummary")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("affectedGroupsSummary")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("affectedGroupsSummary")[0].GetProperty("displayName").ToString()); ]]> - + -This sample shows how to call GetDiscoveryTemplate and parse the result. +This sample shows how to call GetAssetChainSummary and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -Response response = client.GetDiscoveryTemplate("12345", null); +using RequestContent content = RequestContent.Create(new +{ + assetChainSource = "ASSET", + sourceIds = new object[] + { + "DOMAIN$$contoso.com" + }, +}); +Response response = client.GetAssetChainSummary(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("affectedAssetsSummary")[0].GetProperty("kind").ToString()); +Console.WriteLine(result.GetProperty("affectedAssetsSummary")[0].GetProperty("affectedCount").ToString()); +Console.WriteLine(result.GetProperty("affectedGroupsSummary")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("affectedGroupsSummary")[0].GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("affectedGroupsSummary")[0].GetProperty("displayName").ToString()); ]]> - + -This sample shows how to call GetBillableAsync. +This sample shows how to call DismissAssetChainAsync. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -Response response = await client.GetBillableAsync(); +AssetChainRequest body = new AssetChainRequest(AssetChainSource.ASSET, new string[] { "DOMAIN$$contoso.com" }); +Response response = await client.DismissAssetChainAsync(body); ]]> - + -This sample shows how to call GetBillable. +This sample shows how to call DismissAssetChain. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -Response response = client.GetBillable(); +AssetChainRequest body = new AssetChainRequest(AssetChainSource.ASSET, new string[] { "DOMAIN$$contoso.com" }); +Response response = client.DismissAssetChain(body); ]]> - + -This sample shows how to call GetBillableAsync and parse the result. +This sample shows how to call DismissAssetChainAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -Response response = await client.GetBillableAsync(null); +using RequestContent content = RequestContent.Create(new +{ + assetChainSource = "ASSET", + sourceIds = new object[] + { + "DOMAIN$$contoso.com" + }, +}); +Response response = await client.DismissAssetChainAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); ]]> - + -This sample shows how to call GetBillable and parse the result. +This sample shows how to call DismissAssetChain and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -Response response = client.GetBillable(null); +using RequestContent content = RequestContent.Create(new +{ + assetChainSource = "ASSET", + sourceIds = new object[] + { + "DOMAIN$$contoso.com" + }, +}); +Response response = client.DismissAssetChain(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); ]]> - + -This sample shows how to call GetSnapshotAsync. +This sample shows how to call GetDiscoTemplateAsync. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -ReportAssetSnapshotPayload body = new ReportAssetSnapshotPayload -{ - Metric = "site_status_active", - Size = 5, - Page = 0, -}; -Response response = await client.GetSnapshotAsync(body); +Response response = await client.GetDiscoTemplateAsync("12345"); ]]> - + -This sample shows how to call GetSnapshot. +This sample shows how to call GetDiscoTemplate. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -ReportAssetSnapshotPayload body = new ReportAssetSnapshotPayload -{ - Metric = "site_status_active", - Size = 5, - Page = 0, -}; -Response response = client.GetSnapshot(body); +Response response = client.GetDiscoTemplate("12345"); ]]> - + -This sample shows how to call GetSnapshotAsync and parse the result. +This sample shows how to call GetDiscoTemplateAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - metric = "site_status_active", - page = 0, - size = 5, -}); -Response response = await client.GetSnapshotAsync(content); +Response response = await client.GetDiscoTemplateAsync("12345", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); ]]> - + -This sample shows how to call GetSnapshot and parse the result. +This sample shows how to call GetDiscoTemplate and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - metric = "site_status_active", - page = 0, - size = 5, -}); -Response response = client.GetSnapshot(content); +Response response = client.GetDiscoTemplate("12345", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); ]]> - + -This sample shows how to call GetSummaryAsync. +This sample shows how to call GetBillableAsync. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -ReportAssetSummaryPayload body = new ReportAssetSummaryPayload -{ - Filters = { "state = \"confirmed\" AND kind = \"domain\"", "state = \"confirmed\" AND kind = \"host\"", "state = \"confirmed\" AND kind = \"page\"" }, -}; -Response response = await client.GetSummaryAsync(body); +Response response = await client.GetBillableAsync(); ]]> - + -This sample shows how to call GetSummary. +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 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 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 GetSnapshotAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +ReportAssetSnapshotPayload body = new ReportAssetSnapshotPayload +{ + Metric = "site_status_active", + Size = 5, + Page = 0, +}; +Response response = await client.GetSnapshotAsync(body); +]]> + + + +This sample shows how to call GetSnapshot. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +ReportAssetSnapshotPayload body = new ReportAssetSnapshotPayload +{ + Metric = "site_status_active", + Size = 5, + Page = 0, +}; +Response response = client.GetSnapshot(body); +]]> + + + +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 +{ + metric = "site_status_active", + page = 0, + size = 5, +}); +Response response = await client.GetSnapshotAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.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 +{ + metric = "site_status_active", + page = 0, + size = 5, +}); +Response response = client.GetSnapshot(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> + + + +This sample shows how to call GetSummaryAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +ReportAssetSummaryPayload body = new ReportAssetSummaryPayload +{ + Filters = { "state = \"confirmed\" AND kind = \"domain\"", "state = \"confirmed\" AND kind = \"host\"", "state = \"confirmed\" AND kind = \"page\"" }, +}; +Response response = await client.GetSummaryAsync(body); +]]> + + + +This sample shows how to call GetSummary. "); TokenCredential credential = new DefaultAzureCredential(); @@ -883,345 +1321,859 @@ ReportAssetSummaryPayload body = new ReportAssetSummaryPayload Response response = client.GetSummary(body); ]]> - + + +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 +{ + filters = new object[] + { + "state = \"confirmed\" AND kind = \"domain\"", + "state = \"confirmed\" AND kind = \"host\"", + "state = \"confirmed\" AND kind = \"page\"" + }, +}); +Response response = await client.GetSummaryAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.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 +{ + filters = new object[] + { + "state = \"confirmed\" AND kind = \"domain\"", + "state = \"confirmed\" AND kind = \"host\"", + "state = \"confirmed\" AND kind = \"page\"" + }, +}); +Response response = client.GetSummary(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.ToString()); +]]> + + + +This sample shows how to call GetSnapshotExportAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +ReportAssetSnapshotExportPayload body = new ReportAssetSnapshotExportPayload +{ + Metric = "ThisisaMetricName", + FileName = "exportedFileName", + Columns = { "Column1", "Column2", "Column3" }, +}; +Response response = await client.GetSnapshotExportAsync(body); +]]> + + + +This sample shows how to call GetSnapshotExport. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +ReportAssetSnapshotExportPayload body = new ReportAssetSnapshotExportPayload +{ + Metric = "ThisisaMetricName", + FileName = "exportedFileName", + Columns = { "Column1", "Column2", "Column3" }, +}; +Response response = client.GetSnapshotExport(body); +]]> + + + +This sample shows how to call GetSnapshotExportAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + metric = "ThisisaMetricName", + fileName = "exportedFileName", + columns = new object[] + { + "Column1", + "Column2", + "Column3" + }, +}); +Response response = await client.GetSnapshotExportAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> + + + +This sample shows how to call GetSnapshotExport and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + metric = "ThisisaMetricName", + fileName = "exportedFileName", + columns = new object[] + { + "Column1", + "Column2", + "Column3" + }, +}); +Response response = client.GetSnapshotExport(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> + + + +This sample shows how to call GetSavedFilterAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +Response response = await client.GetSavedFilterAsync("ThisisaSavedFilter"); +]]> + + + +This sample shows how to call GetSavedFilter. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +Response response = client.GetSavedFilter("ThisisaSavedFilter"); +]]> + + + +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("ThisisaSavedFilter", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").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("ThisisaSavedFilter", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +]]> + + + +This sample shows how to call CreateOrReplaceSavedFilterAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +SavedFilterPayload body = new SavedFilterPayload("state IN (\"confirmed\")", "This is a saved filter"); +Response response = await client.CreateOrReplaceSavedFilterAsync("ThisisaSavedFilter", body); +]]> + + + +This sample shows how to call CreateOrReplaceSavedFilter. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +SavedFilterPayload body = new SavedFilterPayload("state IN (\"confirmed\")", "This is a saved filter"); +Response response = client.CreateOrReplaceSavedFilter("ThisisaSavedFilter", body); +]]> + + + +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 +{ + filter = "state IN (\"confirmed\")", + description = "This is a saved filter", +}); +Response response = await client.CreateOrReplaceSavedFilterAsync("ThisisaSavedFilter", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").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 +{ + filter = "state IN (\"confirmed\")", + description = "This is a saved filter", +}); +Response response = client.CreateOrReplaceSavedFilter("ThisisaSavedFilter", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("name").ToString()); +]]> + + + +This sample shows how to call DeleteSavedFilterAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +Response response = await client.DeleteSavedFilterAsync("ThisisaSavedFilter"); + +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("ThisisaSavedFilter"); + +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("ThisisaTaskId"); +]]> + + + +This sample shows how to call GetTask. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +Response response = client.GetTask("ThisisaTaskId"); +]]> + + + +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("ThisisaTaskId", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").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("ThisisaTaskId", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> + + + +This sample shows how to call CancelTaskAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +Response response = await client.CancelTaskAsync("ThisisaTaskId"); +]]> + + + +This sample shows how to call CancelTask. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +Response response = client.CancelTask("ThisisaTaskId"); +]]> + + + +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("ThisisaTaskId", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").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("ThisisaTaskId", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> + + + +This sample shows how to call RunTaskAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +Response response = await client.RunTaskAsync("ThisisaTaskId"); +]]> + + + +This sample shows how to call RunTask. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +Response response = client.RunTask("ThisisaTaskId"); +]]> + + + +This sample shows how to call RunTaskAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +Response response = await client.RunTaskAsync("ThisisaTaskId", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> + + + +This sample shows how to call RunTask and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +Response response = client.RunTask("ThisisaTaskId", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> + + + +This sample shows how to call DownloadTaskAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +Response response = await client.DownloadTaskAsync("ThisisaTaskId"); +]]> + + + +This sample shows how to call DownloadTask. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +Response response = client.DownloadTask("ThisisaTaskId"); +]]> + + -This sample shows how to call GetSummaryAsync and parse the result. +This sample shows how to call DownloadTaskAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - filters = new object[] - { - "state = \"confirmed\" AND kind = \"domain\"", - "state = \"confirmed\" AND kind = \"host\"", - "state = \"confirmed\" AND kind = \"page\"" - }, -}); -Response response = await client.GetSummaryAsync(content); +Response response = await client.DownloadTaskAsync("ThisisaTaskId", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); ]]> - + -This sample shows how to call GetSummary and parse the result. +This sample shows how to call DownloadTask and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - filters = new object[] - { - "state = \"confirmed\" AND kind = \"domain\"", - "state = \"confirmed\" AND kind = \"host\"", - "state = \"confirmed\" AND kind = \"page\"" - }, -}); -Response response = client.GetSummary(content); +Response response = client.DownloadTask("ThisisaTaskId", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); ]]> - + -This sample shows how to call GetSavedFilterAsync. +This sample shows how to call GetCisaCveAsync. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -Response response = await client.GetSavedFilterAsync("ThisisaSavedFilter"); +Response response = await client.GetCisaCveAsync("CVE-2021-40438"); ]]> - + -This sample shows how to call GetSavedFilter. +This sample shows how to call GetCisaCve. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -Response response = client.GetSavedFilter("ThisisaSavedFilter"); +Response response = client.GetCisaCve("CVE-2021-40438"); ]]> - + -This sample shows how to call GetSavedFilterAsync and parse the result. +This sample shows how to call GetCisaCveAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -Response response = await client.GetSavedFilterAsync("ThisisaSavedFilter", null); +Response response = await client.GetCisaCveAsync("CVE-2021-40438", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("cveId").ToString()); +Console.WriteLine(result.GetProperty("vendorProject").ToString()); +Console.WriteLine(result.GetProperty("product").ToString()); +Console.WriteLine(result.GetProperty("vulnerabilityName").ToString()); +Console.WriteLine(result.GetProperty("shortDescription").ToString()); +Console.WriteLine(result.GetProperty("requiredAction").ToString()); +Console.WriteLine(result.GetProperty("notes").ToString()); +Console.WriteLine(result.GetProperty("dateAdded").ToString()); +Console.WriteLine(result.GetProperty("dueDate").ToString()); +Console.WriteLine(result.GetProperty("updatedAt").ToString()); +Console.WriteLine(result.GetProperty("count").ToString()); ]]> - + -This sample shows how to call GetSavedFilter and parse the result. +This sample shows how to call GetCisaCve and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -Response response = client.GetSavedFilter("ThisisaSavedFilter", null); +Response response = client.GetCisaCve("CVE-2021-40438", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("cveId").ToString()); +Console.WriteLine(result.GetProperty("vendorProject").ToString()); +Console.WriteLine(result.GetProperty("product").ToString()); +Console.WriteLine(result.GetProperty("vulnerabilityName").ToString()); +Console.WriteLine(result.GetProperty("shortDescription").ToString()); +Console.WriteLine(result.GetProperty("requiredAction").ToString()); +Console.WriteLine(result.GetProperty("notes").ToString()); +Console.WriteLine(result.GetProperty("dateAdded").ToString()); +Console.WriteLine(result.GetProperty("dueDate").ToString()); +Console.WriteLine(result.GetProperty("updatedAt").ToString()); +Console.WriteLine(result.GetProperty("count").ToString()); ]]> - + -This sample shows how to call CreateOrReplaceSavedFilterAsync. +This sample shows how to call GetPolicyAsync. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -SavedFilterPayload body = new SavedFilterPayload("state IN (\"confirmed\")", "This is a saved filter"); -Response response = await client.CreateOrReplaceSavedFilterAsync("ThisisaSavedFilter", body); +Response response = await client.GetPolicyAsync("ThisisaPolicy"); ]]> - + -This sample shows how to call CreateOrReplaceSavedFilter. +This sample shows how to call GetPolicy. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -SavedFilterPayload body = new SavedFilterPayload("state IN (\"confirmed\")", "This is a saved filter"); -Response response = client.CreateOrReplaceSavedFilter("ThisisaSavedFilter", body); +Response response = client.GetPolicy("ThisisaPolicy"); ]]> - + -This sample shows how to call CreateOrReplaceSavedFilterAsync and parse the result. +This sample shows how to call GetPolicyAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - filter = "state IN (\"confirmed\")", - description = "This is a saved filter", -}); -Response response = await client.CreateOrReplaceSavedFilterAsync("ThisisaSavedFilter", content); +Response response = await client.GetPolicyAsync("ThisisaPolicy", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("filterName").ToString()); +Console.WriteLine(result.GetProperty("action").ToString()); +Console.WriteLine(result.GetProperty("actionParameters").ToString()); ]]> - + -This sample shows how to call CreateOrReplaceSavedFilter and parse the result. +This sample shows how to call GetPolicy and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -using RequestContent content = RequestContent.Create(new -{ - filter = "state IN (\"confirmed\")", - description = "This is a saved filter", -}); -Response response = client.CreateOrReplaceSavedFilter("ThisisaSavedFilter", content); +Response response = client.GetPolicy("ThisisaPolicy", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("filterName").ToString()); +Console.WriteLine(result.GetProperty("action").ToString()); +Console.WriteLine(result.GetProperty("actionParameters").ToString()); ]]> - + -This sample shows how to call DeleteSavedFilterAsync. +This sample shows how to call DeletePolicyAsync. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -Response response = await client.DeleteSavedFilterAsync("ThisisaSavedFilter"); +Response response = await client.DeletePolicyAsync("ThisisaPolicy"); Console.WriteLine(response.Status); ]]> - + -This sample shows how to call DeleteSavedFilter. +This sample shows how to call DeletePolicy. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -Response response = client.DeleteSavedFilter("ThisisaSavedFilter"); +Response response = client.DeletePolicy("ThisisaPolicy"); Console.WriteLine(response.Status); ]]> - + -This sample shows how to call GetTaskAsync. +This sample shows how to call CreateOrReplacePolicyAsync. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -Response response = await client.GetTaskAsync("ThisisaTaskId"); +Policy body = new Policy("ThisisaFilter", PolicyAction.SetState, new ActionParameters +{ + Value = "confirmed", +}) +{ + Description = "This is a policy", +}; +Response response = await client.CreateOrReplacePolicyAsync("ThisisaPolicy", body); ]]> - + -This sample shows how to call GetTask. +This sample shows how to call CreateOrReplacePolicy. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -Response response = client.GetTask("ThisisaTaskId"); +Policy body = new Policy("ThisisaFilter", PolicyAction.SetState, new ActionParameters +{ + Value = "confirmed", +}) +{ + Description = "This is a policy", +}; +Response response = client.CreateOrReplacePolicy("ThisisaPolicy", body); ]]> - + -This sample shows how to call GetTaskAsync and parse the result. +This sample shows how to call CreateOrReplacePolicyAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -Response response = await client.GetTaskAsync("ThisisaTaskId", null); +using RequestContent content = RequestContent.Create(new +{ + filterName = "ThisisaFilter", + description = "This is a policy", + action = "setState", + actionParameters = new + { + value = "confirmed", + }, +}); +Response response = await client.CreateOrReplacePolicyAsync("ThisisaPolicy", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("filterName").ToString()); +Console.WriteLine(result.GetProperty("action").ToString()); +Console.WriteLine(result.GetProperty("actionParameters").ToString()); ]]> - + -This sample shows how to call GetTask and parse the result. +This sample shows how to call CreateOrReplacePolicy and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -Response response = client.GetTask("ThisisaTaskId", null); +using RequestContent content = RequestContent.Create(new +{ + filterName = "ThisisaFilter", + description = "This is a policy", + action = "setState", + actionParameters = new + { + value = "confirmed", + }, +}); +Response response = client.CreateOrReplacePolicy("ThisisaPolicy", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("name").ToString()); +Console.WriteLine(result.GetProperty("filterName").ToString()); +Console.WriteLine(result.GetProperty("action").ToString()); +Console.WriteLine(result.GetProperty("actionParameters").ToString()); ]]> - + -This sample shows how to call CancelTaskAsync. +This sample shows how to call GetAssetResourcesAsync. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -Response response = await client.CancelTaskAsync("ThisisaTaskId"); +await foreach (AssetResource item in client.GetAssetResourcesAsync()) +{ +} ]]> - + -This sample shows how to call CancelTask. +This sample shows how to call GetAssetResources. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -Response response = client.CancelTask("ThisisaTaskId"); +foreach (AssetResource item in client.GetAssetResources()) +{ +} ]]> - + -This sample shows how to call CancelTaskAsync and parse the result. +This sample shows how to call GetAssetResourcesAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -Response response = await client.CancelTaskAsync("ThisisaTaskId", null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("id").ToString()); +await foreach (BinaryData item in client.GetAssetResourcesAsync("state%20%3D%20%22confirmed%22", null, 0, 5, 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 CancelTask and parse the result. +This sample shows how to call GetAssetResources and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -Response response = client.CancelTask("ThisisaTaskId", null); - -JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; -Console.WriteLine(result.GetProperty("id").ToString()); +foreach (BinaryData item in client.GetAssetResources("state%20%3D%20%22confirmed%22", null, 0, 5, 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. +This sample shows how to call GetDeltaDetailsAsync. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -await foreach (AssetResource item in client.GetAssetResourcesAsync()) +DeltaDetailsRequest body = new DeltaDetailsRequest(DeltaDetailType.Added, GlobalAssetType.Domain) +{ + PriorDays = 30, + Date = "2024-03-17", +}; +await foreach (DeltaResult item in client.GetDeltaDetailsAsync(body)) { } ]]> - + -This sample shows how to call GetAssetResources. +This sample shows how to call GetDeltaDetails. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -foreach (AssetResource item in client.GetAssetResources()) +DeltaDetailsRequest body = new DeltaDetailsRequest(DeltaDetailType.Added, GlobalAssetType.Domain) +{ + PriorDays = 30, + Date = "2024-03-17", +}; +foreach (DeltaResult item in client.GetDeltaDetails(body)) { } ]]> - + -This sample shows how to call GetAssetResourcesAsync and parse the result. +This sample shows how to call GetDeltaDetailsAsync and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -await foreach (BinaryData item in client.GetAssetResourcesAsync("state%20%3D%20%22confirmed%22", null, 0, 5, null, null)) +using RequestContent content = RequestContent.Create(new +{ + deltaDetailType = "added", + priorDays = 30, + kind = "domain", + date = "2024-03-17", +}); +await foreach (BinaryData item in client.GetDeltaDetailsAsync(content)) { 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("createdAt").ToString()); + Console.WriteLine(result.GetProperty("updatedAt").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); } ]]> - + -This sample shows how to call GetAssetResources and parse the result. +This sample shows how to call GetDeltaDetails and parse the result. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -foreach (BinaryData item in client.GetAssetResources("state%20%3D%20%22confirmed%22", null, 0, 5, null, null)) +using RequestContent content = RequestContent.Create(new +{ + deltaDetailType = "added", + priorDays = 30, + kind = "domain", + date = "2024-03-17", +}); +foreach (BinaryData item in client.GetDeltaDetails(content)) { 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("createdAt").ToString()); + Console.WriteLine(result.GetProperty("updatedAt").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); } ]]> @@ -1283,168 +2235,168 @@ foreach (BinaryData item in client.GetDataConnections(null, null, null)) } ]]> - + -This sample shows how to call GetDiscoveryGroupsAsync. +This sample shows how to call GetDiscoGroupsAsync. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -await foreach (DiscoveryGroup item in client.GetDiscoveryGroupsAsync()) +await foreach (DiscoveryGroup item in client.GetDiscoGroupsAsync()) { } ]]> - + -This sample shows how to call GetDiscoveryGroups. +This sample shows how to call GetDiscoGroups. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -foreach (DiscoveryGroup item in client.GetDiscoveryGroups()) +foreach (DiscoveryGroup item in client.GetDiscoGroups()) { } ]]> - + -This sample shows how to call GetDiscoveryGroupsAsync and parse the result. +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.GetDiscoveryGroupsAsync(null, null, null, null)) +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 GetDiscoveryGroups and parse the result. +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.GetDiscoveryGroups(null, null, null, null)) +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 GetDiscoveryGroupRunsAsync. +This sample shows how to call GetRunsAsync. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -await foreach (DiscoveryRunResult item in client.GetDiscoveryGroupRunsAsync("ThisisaDiscoGroup")) +await foreach (DiscoveryRunResult item in client.GetRunsAsync("ThisisaDiscoGroup")) { } ]]> - + -This sample shows how to call GetDiscoveryGroupRuns. +This sample shows how to call GetRuns. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -foreach (DiscoveryRunResult item in client.GetDiscoveryGroupRuns("ThisisaDiscoGroup")) +foreach (DiscoveryRunResult item in client.GetRuns("ThisisaDiscoGroup")) { } ]]> - + -This sample shows how to call GetDiscoveryGroupRunsAsync and parse the result. +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.GetDiscoveryGroupRunsAsync("ThisisaDiscoGroup", null, null, null, null)) +await foreach (BinaryData item in client.GetRunsAsync("ThisisaDiscoGroup", null, null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.ToString()); } ]]> - + -This sample shows how to call GetDiscoveryGroupRuns and parse the result. +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.GetDiscoveryGroupRuns("ThisisaDiscoGroup", null, null, null, null)) +foreach (BinaryData item in client.GetRuns("ThisisaDiscoGroup", null, null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.ToString()); } ]]> - + -This sample shows how to call GetDiscoveryTemplatesAsync. +This sample shows how to call GetDiscoTemplatesAsync. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -await foreach (DiscoveryTemplate item in client.GetDiscoveryTemplatesAsync()) +await foreach (DiscoveryTemplate item in client.GetDiscoTemplatesAsync()) { } ]]> - + -This sample shows how to call GetDiscoveryTemplates. +This sample shows how to call GetDiscoTemplates. "); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); -foreach (DiscoveryTemplate item in client.GetDiscoveryTemplates()) +foreach (DiscoveryTemplate item in client.GetDiscoTemplates()) { } ]]> - + -This sample shows how to call GetDiscoveryTemplatesAsync and parse the result. +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.GetDiscoveryTemplatesAsync(null, null, null, null)) +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 GetDiscoveryTemplates and parse the result. +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.GetDiscoveryTemplates(null, null, null, null)) +foreach (BinaryData item in client.GetDiscoTemplates(null, null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -1561,6 +2513,144 @@ 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 GetCisaCvesAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +await foreach (CisaCveResult item in client.GetCisaCvesAsync()) +{ +} +]]> + + + +This sample shows how to call GetCisaCves. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +foreach (CisaCveResult item in client.GetCisaCves()) +{ +} +]]> + + + +This sample shows how to call GetCisaCvesAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +await foreach (BinaryData item in client.GetCisaCvesAsync(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("cveId").ToString()); + Console.WriteLine(result.GetProperty("vendorProject").ToString()); + Console.WriteLine(result.GetProperty("product").ToString()); + Console.WriteLine(result.GetProperty("vulnerabilityName").ToString()); + Console.WriteLine(result.GetProperty("shortDescription").ToString()); + Console.WriteLine(result.GetProperty("requiredAction").ToString()); + Console.WriteLine(result.GetProperty("notes").ToString()); + Console.WriteLine(result.GetProperty("dateAdded").ToString()); + Console.WriteLine(result.GetProperty("dueDate").ToString()); + Console.WriteLine(result.GetProperty("updatedAt").ToString()); + Console.WriteLine(result.GetProperty("count").ToString()); +} +]]> + + + +This sample shows how to call GetCisaCves and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +foreach (BinaryData item in client.GetCisaCves(null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("cveId").ToString()); + Console.WriteLine(result.GetProperty("vendorProject").ToString()); + Console.WriteLine(result.GetProperty("product").ToString()); + Console.WriteLine(result.GetProperty("vulnerabilityName").ToString()); + Console.WriteLine(result.GetProperty("shortDescription").ToString()); + Console.WriteLine(result.GetProperty("requiredAction").ToString()); + Console.WriteLine(result.GetProperty("notes").ToString()); + Console.WriteLine(result.GetProperty("dateAdded").ToString()); + Console.WriteLine(result.GetProperty("dueDate").ToString()); + Console.WriteLine(result.GetProperty("updatedAt").ToString()); + Console.WriteLine(result.GetProperty("count").ToString()); +} +]]> + + + +This sample shows how to call GetPoliciesAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +await foreach (Policy item in client.GetPoliciesAsync()) +{ +} +]]> + + + +This sample shows how to call GetPolicies. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +foreach (Policy item in client.GetPolicies()) +{ +} +]]> + + + +This sample shows how to call GetPoliciesAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +await foreach (BinaryData item in client.GetPoliciesAsync(null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("filterName").ToString()); + Console.WriteLine(result.GetProperty("action").ToString()); + Console.WriteLine(result.GetProperty("actionParameters").ToString()); +} +]]> + + + +This sample shows how to call GetPolicies and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +EasmClient client = new EasmClient(endpoint, credential); + +foreach (BinaryData item in client.GetPolicies(null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("filterName").ToString()); + Console.WriteLine(result.GetProperty("action").ToString()); + Console.WriteLine(result.GetProperty("actionParameters").ToString()); +} ]]> diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/EasmClient.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/EasmClient.cs index 3a076e236d9c..41ed58db5679 100644 --- a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/EasmClient.cs +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/EasmClient.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Autorest.CSharp.Core; @@ -287,38 +288,1280 @@ public virtual Response GetAssetResource(string assetId, RequestContext context) } } + /// Export a list of assets for the provided search parameters. + /// Body parameter. + /// Filter the result list using the given expression. + /// A list of expressions that specify the order of the returned resources. + /// The cancellation token to use. + /// is null. + /// + public virtual async Task> GetAssetsExportAsync(AssetsExportRequest body, string filter = null, string orderby = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using RequestContent content = body.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetAssetsExportAsync(content, filter, orderby, context).ConfigureAwait(false); + return Response.FromValue(TaskResource.FromResponse(response), response); + } + + /// Export a list of assets for the provided search parameters. + /// Body parameter. + /// Filter the result list using the given expression. + /// A list of expressions that specify the order of the returned resources. + /// The cancellation token to use. + /// is null. + /// + public virtual Response GetAssetsExport(AssetsExportRequest body, string filter = null, string orderby = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using RequestContent content = body.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetAssetsExport(content, filter, orderby, context); + return Response.FromValue(TaskResource.FromResponse(response), response); + } + + /// + /// [Protocol Method] Export 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. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// Filter the result list using the given expression. + /// A list of expressions that specify the order of the returned resources. + /// 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 GetAssetsExportAsync(RequestContent content, string filter = null, string orderby = null, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetAssetsExport"); + scope.Start(); + try + { + using HttpMessage message = CreateGetAssetsExportRequest(content, filter, orderby, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Export 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. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// Filter the result list using the given expression. + /// A list of expressions that specify the order of the returned resources. + /// 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 GetAssetsExport(RequestContent content, string filter = null, string orderby = null, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetAssetsExport"); + scope.Start(); + try + { + using HttpMessage message = CreateGetAssetsExportRequest(content, filter, orderby, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieve observations on an asset. + /// The system generated unique id for the resource. + /// 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. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetObservationsAsync(string assetId, string filter = null, string orderby = null, int? skip = null, int? maxpagesize = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(assetId, nameof(assetId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetObservationsAsync(assetId, filter, orderby, skip, maxpagesize, context).ConfigureAwait(false); + return Response.FromValue(ObservationPageResult.FromResponse(response), response); + } + + /// Retrieve observations on an asset. + /// The system generated unique id for the resource. + /// 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. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetObservations(string assetId, string filter = null, string orderby = null, int? skip = null, int? maxpagesize = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(assetId, nameof(assetId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetObservations(assetId, filter, orderby, skip, maxpagesize, context); + return Response.FromValue(ObservationPageResult.FromResponse(response), response); + } + + /// + /// [Protocol Method] Retrieve observations on an asset + /// + /// + /// + /// 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. + /// 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. + /// 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 GetObservationsAsync(string assetId, string filter, string orderby, int? skip, int? maxpagesize, RequestContext context) + { + Argument.AssertNotNullOrEmpty(assetId, nameof(assetId)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetObservations"); + scope.Start(); + try + { + using HttpMessage message = CreateGetObservationsRequest(assetId, filter, orderby, skip, maxpagesize, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Retrieve observations on an asset + /// + /// + /// + /// 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. + /// 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. + /// 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 GetObservations(string assetId, string filter, string orderby, int? skip, int? maxpagesize, RequestContext context) + { + Argument.AssertNotNullOrEmpty(assetId, nameof(assetId)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetObservations"); + scope.Start(); + try + { + using HttpMessage message = CreateGetObservationsRequest(assetId, filter, orderby, skip, maxpagesize, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieve a list of deltas with overall summary changes for the provided time range. + /// Body parameter. + /// The cancellation token to use. + /// is null. + /// + public virtual async Task> GetDeltaSummaryAsync(DeltaSummaryRequest body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using RequestContent content = body.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetDeltaSummaryAsync(content, context).ConfigureAwait(false); + return Response.FromValue(DeltaSummaryResult.FromResponse(response), response); + } + + /// Retrieve a list of deltas with overall summary changes for the provided time range. + /// Body parameter. + /// The cancellation token to use. + /// is null. + /// + public virtual Response GetDeltaSummary(DeltaSummaryRequest body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using RequestContent content = body.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetDeltaSummary(content, context); + return Response.FromValue(DeltaSummaryResult.FromResponse(response), response); + } + + /// + /// [Protocol Method] Retrieve a list of deltas with overall summary changes for the provided time range. + /// + /// + /// + /// 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 GetDeltaSummaryAsync(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetDeltaSummary"); + scope.Start(); + try + { + using HttpMessage message = CreateGetDeltaSummaryRequest(content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Retrieve a list of deltas with overall summary changes for the provided time range. + /// + /// + /// + /// 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 GetDeltaSummary(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetDeltaSummary"); + scope.Start(); + try + { + using HttpMessage message = CreateGetDeltaSummaryRequest(content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Validate a data connection with a given dataConnectionName. + /// Body parameter. + /// The cancellation token to use. + /// is null. + /// + public virtual async Task> ValidateDataConnectionAsync(DataConnectionPayload body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using RequestContent content = body.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await ValidateDataConnectionAsync(content, context).ConfigureAwait(false); + return Response.FromValue(ValidateResult.FromResponse(response), response); + } + /// Validate a data connection with a given dataConnectionName. /// Body parameter. /// The cancellation token to use. /// is null. - /// - public virtual async Task> ValidateDataConnectionAsync(DataConnectionPayload body, CancellationToken cancellationToken = default) + /// + public virtual Response ValidateDataConnection(DataConnectionPayload body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using RequestContent content = body.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + 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. + /// Body parameter. + /// 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, DataConnectionPayload body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataConnectionName, nameof(dataConnectionName)); + Argument.AssertNotNull(body, nameof(body)); + + using RequestContent content = body.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + 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. + /// Body parameter. + /// 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, DataConnectionPayload body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(dataConnectionName, nameof(dataConnectionName)); + Argument.AssertNotNull(body, nameof(body)); + + using RequestContent content = body.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + 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. + /// Body parameter. + /// The cancellation token to use. + /// is null. + /// + public virtual async Task> ValidateDiscoGroupAsync(DiscoveryGroupPayload body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using RequestContent content = body.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await ValidateDiscoGroupAsync(content, context).ConfigureAwait(false); + return Response.FromValue(ValidateResult.FromResponse(response), response); + } + + /// Validate a discovery group with a given groupName. + /// Body parameter. + /// The cancellation token to use. + /// is null. + /// + public virtual Response ValidateDiscoGroup(DiscoveryGroupPayload body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using RequestContent content = body.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + 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(DiscoveryGroup.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(DiscoveryGroup.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; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Delete a discovery group with a given discovery group name. + /// + /// + /// + /// 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 DeleteDiscoGroupAsync(string groupName, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.DeleteDiscoGroup"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteDiscoGroupRequest(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] Delete a discovery group with a given discovery group name. + /// + /// + /// + /// 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 DeleteDiscoGroup(string groupName, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.DeleteDiscoGroup"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteDiscoGroupRequest(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. + /// Body parameter. + /// 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, DiscoveryGroupPayload body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + Argument.AssertNotNull(body, nameof(body)); + + using RequestContent content = body.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await CreateOrReplaceDiscoGroupAsync(groupName, content, context).ConfigureAwait(false); + return Response.FromValue(DiscoveryGroup.FromResponse(response), response); + } + + /// Create a discovery group with a given groupName. + /// The caller provided unique name for the resource. + /// Body parameter. + /// 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, DiscoveryGroupPayload body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + Argument.AssertNotNull(body, nameof(body)); + + using RequestContent content = body.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = CreateOrReplaceDiscoGroup(groupName, content, context); + return Response.FromValue(DiscoveryGroup.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 an asset chain summary. + /// Body parameter. + /// The cancellation token to use. + /// is null. + /// + public virtual async Task> GetAssetChainSummaryAsync(AssetChainRequest body, CancellationToken cancellationToken = default) { Argument.AssertNotNull(body, nameof(body)); using RequestContent content = body.ToRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await ValidateDataConnectionAsync(content, context).ConfigureAwait(false); - return Response.FromValue(ValidateResult.FromResponse(response), response); + Response response = await GetAssetChainSummaryAsync(content, context).ConfigureAwait(false); + return Response.FromValue(AssetChainSummaryResult.FromResponse(response), response); } - /// Validate a data connection with a given dataConnectionName. + /// Retrieve an asset chain summary. /// Body parameter. /// The cancellation token to use. /// is null. - /// - public virtual Response ValidateDataConnection(DataConnectionPayload body, CancellationToken cancellationToken = default) + /// + public virtual Response GetAssetChainSummary(AssetChainRequest body, CancellationToken cancellationToken = default) { Argument.AssertNotNull(body, nameof(body)); using RequestContent content = body.ToRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); - Response response = ValidateDataConnection(content, context); - return Response.FromValue(ValidateResult.FromResponse(response), response); + Response response = GetAssetChainSummary(content, context); + return Response.FromValue(AssetChainSummaryResult.FromResponse(response), response); } /// - /// [Protocol Method] Validate a data connection with a given dataConnectionName. + /// [Protocol Method] Retrieve an asset chain summary. /// /// /// @@ -327,7 +1570,7 @@ public virtual Response ValidateDataConnection(DataConnectionPay /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// @@ -337,16 +1580,16 @@ public virtual Response ValidateDataConnection(DataConnectionPay /// 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) + /// + public virtual async Task GetAssetChainSummaryAsync(RequestContent content, RequestContext context = null) { Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("EasmClient.ValidateDataConnection"); + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetAssetChainSummary"); scope.Start(); try { - using HttpMessage message = CreateValidateDataConnectionRequest(content, context); + using HttpMessage message = CreateGetAssetChainSummaryRequest(content, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -357,7 +1600,7 @@ public virtual async Task ValidateDataConnectionAsync(RequestContent c } /// - /// [Protocol Method] Validate a data connection with a given dataConnectionName. + /// [Protocol Method] Retrieve an asset chain summary. /// /// /// @@ -366,7 +1609,7 @@ public virtual async Task ValidateDataConnectionAsync(RequestContent c /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// @@ -376,16 +1619,16 @@ public virtual async Task ValidateDataConnectionAsync(RequestContent c /// is null. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response ValidateDataConnection(RequestContent content, RequestContext context = null) + /// + public virtual Response GetAssetChainSummary(RequestContent content, RequestContext context = null) { Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("EasmClient.ValidateDataConnection"); + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetAssetChainSummary"); scope.Start(); try { - using HttpMessage message = CreateValidateDataConnectionRequest(content, context); + using HttpMessage message = CreateGetAssetChainSummaryRequest(content, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -395,38 +1638,38 @@ public virtual Response ValidateDataConnection(RequestContent content, RequestCo } } - /// Retrieve a data connection with a given dataConnectionName. - /// The caller provided unique name for the resource. + /// Dismiss discovery chain for a given asset chain source. + /// Body parameter. /// 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) + /// is null. + /// + public virtual async Task> DismissAssetChainAsync(AssetChainRequest body, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(dataConnectionName, nameof(dataConnectionName)); + Argument.AssertNotNull(body, nameof(body)); + using RequestContent content = body.ToRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetDataConnectionAsync(dataConnectionName, context).ConfigureAwait(false); - return Response.FromValue(DataConnection.FromResponse(response), response); + Response response = await DismissAssetChainAsync(content, context).ConfigureAwait(false); + return Response.FromValue(TaskResource.FromResponse(response), response); } - /// Retrieve a data connection with a given dataConnectionName. - /// The caller provided unique name for the resource. + /// Dismiss discovery chain for a given asset chain source. + /// Body parameter. /// 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) + /// is null. + /// + public virtual Response DismissAssetChain(AssetChainRequest body, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(dataConnectionName, nameof(dataConnectionName)); + Argument.AssertNotNull(body, nameof(body)); + using RequestContent content = body.ToRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetDataConnection(dataConnectionName, context); - return Response.FromValue(DataConnection.FromResponse(response), response); + Response response = DismissAssetChain(content, context); + return Response.FromValue(TaskResource.FromResponse(response), response); } /// - /// [Protocol Method] Retrieve a data connection with a given dataConnectionName. + /// [Protocol Method] Dismiss discovery chain for a given asset chain source /// /// /// @@ -435,27 +1678,230 @@ public virtual Response GetDataConnection(string dataConnectionN /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// 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. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task GetDataConnectionAsync(string dataConnectionName, RequestContext context) + /// + public virtual async Task DismissAssetChainAsync(RequestContent content, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(dataConnectionName, nameof(dataConnectionName)); + Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("EasmClient.GetDataConnection"); + using var scope = ClientDiagnostics.CreateScope("EasmClient.DismissAssetChain"); scope.Start(); try { - using HttpMessage message = CreateGetDataConnectionRequest(dataConnectionName, context); + using HttpMessage message = CreateDismissAssetChainRequest(content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Dismiss discovery chain for a given asset chain source + /// + /// + /// + /// 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 DismissAssetChain(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.DismissAssetChain"); + scope.Start(); + try + { + using HttpMessage message = CreateDismissAssetChainRequest(content, 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(DiscoveryTemplate.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(DiscoveryTemplate.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) @@ -466,7 +1912,7 @@ public virtual async Task GetDataConnectionAsync(string dataConnection } /// - /// [Protocol Method] Retrieve a data connection with a given dataConnectionName. + /// [Protocol Method] Get billable assets summary for the workspace. /// /// /// @@ -475,27 +1921,22 @@ public virtual async Task GetDataConnectionAsync(string dataConnection /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// 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) + /// + public virtual Response GetBillable(RequestContext context) { - Argument.AssertNotNullOrEmpty(dataConnectionName, nameof(dataConnectionName)); - - using var scope = ClientDiagnostics.CreateScope("EasmClient.GetDataConnection"); + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetBillable"); scope.Start(); try { - using HttpMessage message = CreateGetDataConnectionRequest(dataConnectionName, context); + using HttpMessage message = CreateGetBillableRequest(context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -505,44 +1946,38 @@ public virtual Response GetDataConnection(string dataConnectionName, RequestCont } } - /// Create or replace a data connection with a given dataConnectionName. - /// The caller provided unique name for the resource. + /// Get the most recent snapshot of asset summary values for the snapshot request. /// Body parameter. /// 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, DataConnectionPayload body, CancellationToken cancellationToken = default) + /// is null. + /// + public virtual async Task> GetSnapshotAsync(ReportAssetSnapshotPayload body, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(dataConnectionName, nameof(dataConnectionName)); Argument.AssertNotNull(body, nameof(body)); using RequestContent content = body.ToRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await CreateOrReplaceDataConnectionAsync(dataConnectionName, content, context).ConfigureAwait(false); - return Response.FromValue(DataConnection.FromResponse(response), response); + Response response = await GetSnapshotAsync(content, context).ConfigureAwait(false); + return Response.FromValue(ReportAssetSnapshotResult.FromResponse(response), response); } - /// Create or replace a data connection with a given dataConnectionName. - /// The caller provided unique name for the resource. + /// Get the most recent snapshot of asset summary values for the snapshot request. /// Body parameter. /// 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, DataConnectionPayload body, CancellationToken cancellationToken = default) + /// is null. + /// + public virtual Response GetSnapshot(ReportAssetSnapshotPayload body, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(dataConnectionName, nameof(dataConnectionName)); Argument.AssertNotNull(body, nameof(body)); using RequestContent content = body.ToRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); - Response response = CreateOrReplaceDataConnection(dataConnectionName, content, context); - return Response.FromValue(DataConnection.FromResponse(response), response); + Response response = GetSnapshot(content, context); + return Response.FromValue(ReportAssetSnapshotResult.FromResponse(response), response); } /// - /// [Protocol Method] Create or replace a data connection with a given dataConnectionName. + /// [Protocol Method] Get the most recent snapshot of asset summary values for the snapshot request. /// /// /// @@ -551,29 +1986,26 @@ public virtual Response CreateOrReplaceDataConnection(string dat /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// 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. + /// is null. /// 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) + /// + public virtual async Task GetSnapshotAsync(RequestContent content, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(dataConnectionName, nameof(dataConnectionName)); Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("EasmClient.CreateOrReplaceDataConnection"); + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetSnapshot"); scope.Start(); try { - using HttpMessage message = CreateCreateOrReplaceDataConnectionRequest(dataConnectionName, content, context); + using HttpMessage message = CreateGetSnapshotRequest(content, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -584,7 +2016,7 @@ public virtual async Task CreateOrReplaceDataConnectionAsync(string da } /// - /// [Protocol Method] Create or replace a data connection with a given dataConnectionName. + /// [Protocol Method] Get the most recent snapshot of asset summary values for the snapshot request. /// /// /// @@ -593,29 +2025,26 @@ public virtual async Task CreateOrReplaceDataConnectionAsync(string da /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// 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. + /// is null. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response CreateOrReplaceDataConnection(string dataConnectionName, RequestContent content, RequestContext context = null) + /// + public virtual Response GetSnapshot(RequestContent content, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(dataConnectionName, nameof(dataConnectionName)); Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("EasmClient.CreateOrReplaceDataConnection"); + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetSnapshot"); scope.Start(); try { - using HttpMessage message = CreateCreateOrReplaceDataConnectionRequest(dataConnectionName, content, context); + using HttpMessage message = CreateGetSnapshotRequest(content, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -625,33 +2054,66 @@ public virtual Response CreateOrReplaceDataConnection(string dataConnectionName, } } - // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// Get asset summary details for the summary request. + /// Body parameter. + /// The cancellation token to use. + /// is null. + /// + public virtual async Task> GetSummaryAsync(ReportAssetSummaryPayload body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using RequestContent content = body.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetSummaryAsync(content, context).ConfigureAwait(false); + return Response.FromValue(ReportAssetSummaryResult.FromResponse(response), response); + } + + /// Get asset summary details for the summary request. + /// Body parameter. + /// The cancellation token to use. + /// is null. + /// + public virtual Response GetSummary(ReportAssetSummaryPayload body, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(body, nameof(body)); + + using RequestContent content = body.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetSummary(content, context); + return Response.FromValue(ReportAssetSummaryResult.FromResponse(response), response); + } + /// - /// [Protocol Method] Delete a data connection with a given dataConnectionName. + /// [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 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. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task DeleteDataConnectionAsync(string dataConnectionName, RequestContext context = null) + /// + public virtual async Task GetSummaryAsync(RequestContent content, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(dataConnectionName, nameof(dataConnectionName)); + Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("EasmClient.DeleteDataConnection"); + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetSummary"); scope.Start(); try { - using HttpMessage message = CreateDeleteDataConnectionRequest(dataConnectionName, context); + using HttpMessage message = CreateGetSummaryRequest(content, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -661,33 +2123,36 @@ public virtual async Task DeleteDataConnectionAsync(string dataConnect } } - // 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. + /// [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 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. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// is null. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response DeleteDataConnection(string dataConnectionName, RequestContext context = null) + /// + public virtual Response GetSummary(RequestContent content, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(dataConnectionName, nameof(dataConnectionName)); + Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("EasmClient.DeleteDataConnection"); + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetSummary"); scope.Start(); try { - using HttpMessage message = CreateDeleteDataConnectionRequest(dataConnectionName, context); + using HttpMessage message = CreateGetSummaryRequest(content, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -697,38 +2162,38 @@ public virtual Response DeleteDataConnection(string dataConnectionName, RequestC } } - /// Validate a discovery group with a given groupName. + /// Get the most recent snapshot of asset summary values for the snapshot request exported to a file. /// Body parameter. /// The cancellation token to use. /// is null. - /// - public virtual async Task> ValidateDiscoveryGroupAsync(DiscoveryGroupPayload body, CancellationToken cancellationToken = default) + /// + public virtual async Task> GetSnapshotExportAsync(ReportAssetSnapshotExportPayload body, CancellationToken cancellationToken = default) { Argument.AssertNotNull(body, nameof(body)); using RequestContent content = body.ToRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await ValidateDiscoveryGroupAsync(content, context).ConfigureAwait(false); - return Response.FromValue(ValidateResult.FromResponse(response), response); + Response response = await GetSnapshotExportAsync(content, context).ConfigureAwait(false); + return Response.FromValue(TaskResource.FromResponse(response), response); } - /// Validate a discovery group with a given groupName. + /// Get the most recent snapshot of asset summary values for the snapshot request exported to a file. /// Body parameter. /// The cancellation token to use. /// is null. - /// - public virtual Response ValidateDiscoveryGroup(DiscoveryGroupPayload body, CancellationToken cancellationToken = default) + /// + public virtual Response GetSnapshotExport(ReportAssetSnapshotExportPayload body, CancellationToken cancellationToken = default) { Argument.AssertNotNull(body, nameof(body)); using RequestContent content = body.ToRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); - Response response = ValidateDiscoveryGroup(content, context); - return Response.FromValue(ValidateResult.FromResponse(response), response); + Response response = GetSnapshotExport(content, context); + return Response.FromValue(TaskResource.FromResponse(response), response); } /// - /// [Protocol Method] Validate a discovery group with a given groupName. + /// [Protocol Method] Get the most recent snapshot of asset summary values for the snapshot request exported to a file. /// /// /// @@ -737,7 +2202,7 @@ public virtual Response ValidateDiscoveryGroup(DiscoveryGroupPay /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// @@ -747,16 +2212,16 @@ public virtual Response ValidateDiscoveryGroup(DiscoveryGroupPay /// is null. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task ValidateDiscoveryGroupAsync(RequestContent content, RequestContext context = null) + /// + public virtual async Task GetSnapshotExportAsync(RequestContent content, RequestContext context = null) { Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("EasmClient.ValidateDiscoveryGroup"); + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetSnapshotExport"); scope.Start(); try { - using HttpMessage message = CreateValidateDiscoveryGroupRequest(content, context); + using HttpMessage message = CreateGetSnapshotExportRequest(content, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -767,7 +2232,7 @@ public virtual async Task ValidateDiscoveryGroupAsync(RequestContent c } /// - /// [Protocol Method] Validate a discovery group with a given groupName. + /// [Protocol Method] Get the most recent snapshot of asset summary values for the snapshot request exported to a file. /// /// /// @@ -776,7 +2241,7 @@ public virtual async Task ValidateDiscoveryGroupAsync(RequestContent c /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// @@ -786,16 +2251,16 @@ public virtual async Task ValidateDiscoveryGroupAsync(RequestContent c /// is null. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response ValidateDiscoveryGroup(RequestContent content, RequestContext context = null) + /// + public virtual Response GetSnapshotExport(RequestContent content, RequestContext context = null) { Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("EasmClient.ValidateDiscoveryGroup"); + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetSnapshotExport"); scope.Start(); try { - using HttpMessage message = CreateValidateDiscoveryGroupRequest(content, context); + using HttpMessage message = CreateGetSnapshotExportRequest(content, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -805,38 +2270,38 @@ public virtual Response ValidateDiscoveryGroup(RequestContent content, RequestCo } } - /// Retrieve a discovery group with a given groupName. - /// The caller provided unique name for the resource. + /// 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> GetDiscoveryGroupAsync(string groupName, CancellationToken cancellationToken = default) + /// 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(groupName, nameof(groupName)); + Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetDiscoveryGroupAsync(groupName, context).ConfigureAwait(false); - return Response.FromValue(DiscoveryGroup.FromResponse(response), response); + Response response = await GetSavedFilterAsync(filterName, context).ConfigureAwait(false); + return Response.FromValue(SavedFilter.FromResponse(response), response); } - /// Retrieve a discovery group with a given groupName. - /// The caller provided unique name for the resource. + /// 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 GetDiscoveryGroup(string groupName, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetSavedFilter(string filterName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetDiscoveryGroup(groupName, context); - return Response.FromValue(DiscoveryGroup.FromResponse(response), response); + Response response = GetSavedFilter(filterName, context); + return Response.FromValue(SavedFilter.FromResponse(response), response); } /// - /// [Protocol Method] Retrieve a discovery group with a given groupName. + /// [Protocol Method] Retrieve a saved filter by filterName. /// /// /// @@ -845,27 +2310,27 @@ public virtual Response GetDiscoveryGroup(string groupName, Canc /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// - /// The caller provided unique name for the resource. + /// 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. + /// 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 GetDiscoveryGroupAsync(string groupName, RequestContext context) + /// + public virtual async Task GetSavedFilterAsync(string filterName, RequestContext context) { - Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); - using var scope = ClientDiagnostics.CreateScope("EasmClient.GetDiscoveryGroup"); + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetSavedFilter"); scope.Start(); try { - using HttpMessage message = CreateGetDiscoveryGroupRequest(groupName, context); + using HttpMessage message = CreateGetSavedFilterRequest(filterName, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -876,7 +2341,7 @@ public virtual async Task GetDiscoveryGroupAsync(string groupName, Req } /// - /// [Protocol Method] Retrieve a discovery group with a given groupName. + /// [Protocol Method] Retrieve a saved filter by filterName. /// /// /// @@ -885,27 +2350,27 @@ public virtual async Task GetDiscoveryGroupAsync(string groupName, Req /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// - /// The caller provided unique name for the resource. + /// 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. + /// 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 GetDiscoveryGroup(string groupName, RequestContext context) + /// + public virtual Response GetSavedFilter(string filterName, RequestContext context) { - Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); - using var scope = ClientDiagnostics.CreateScope("EasmClient.GetDiscoveryGroup"); + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetSavedFilter"); scope.Start(); try { - using HttpMessage message = CreateGetDiscoveryGroupRequest(groupName, context); + using HttpMessage message = CreateGetSavedFilterRequest(filterName, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -915,44 +2380,44 @@ public virtual Response GetDiscoveryGroup(string groupName, RequestContext conte } } - /// Create a discovery group with a given groupName. - /// The caller provided unique name for the resource. + /// Create or replace a saved filter with a given filterName. + /// The caller provided unique name for the resource. /// Body parameter. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// - public virtual async Task> CreateOrReplaceDiscoveryGroupAsync(string groupName, DiscoveryGroupPayload body, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> CreateOrReplaceSavedFilterAsync(string filterName, SavedFilterPayload body, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); Argument.AssertNotNull(body, nameof(body)); using RequestContent content = body.ToRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await CreateOrReplaceDiscoveryGroupAsync(groupName, content, context).ConfigureAwait(false); - return Response.FromValue(DiscoveryGroup.FromResponse(response), response); + Response response = await CreateOrReplaceSavedFilterAsync(filterName, content, context).ConfigureAwait(false); + return Response.FromValue(SavedFilter.FromResponse(response), response); } - /// Create a discovery group with a given groupName. - /// The caller provided unique name for the resource. + /// Create or replace a saved filter with a given filterName. + /// The caller provided unique name for the resource. /// Body parameter. /// The cancellation token to use. - /// or is null. - /// is an empty string, and was expected to be non-empty. - /// - public virtual Response CreateOrReplaceDiscoveryGroup(string groupName, DiscoveryGroupPayload body, CancellationToken cancellationToken = default) + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response CreateOrReplaceSavedFilter(string filterName, SavedFilterPayload body, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); Argument.AssertNotNull(body, nameof(body)); using RequestContent content = body.ToRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); - Response response = CreateOrReplaceDiscoveryGroup(groupName, content, context); - return Response.FromValue(DiscoveryGroup.FromResponse(response), response); + Response response = CreateOrReplaceSavedFilter(filterName, content, context); + return Response.FromValue(SavedFilter.FromResponse(response), response); } /// - /// [Protocol Method] Create a discovery group with a given groupName. + /// [Protocol Method] Create or replace a saved filter with a given filterName. /// /// /// @@ -961,29 +2426,29 @@ public virtual Response CreateOrReplaceDiscoveryGroup(string gro /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// - /// The caller provided unique name for the resource. + /// 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. + /// 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 CreateOrReplaceDiscoveryGroupAsync(string groupName, RequestContent content, RequestContext context = null) + /// + public virtual async Task CreateOrReplaceSavedFilterAsync(string filterName, RequestContent content, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("EasmClient.CreateOrReplaceDiscoveryGroup"); + using var scope = ClientDiagnostics.CreateScope("EasmClient.CreateOrReplaceSavedFilter"); scope.Start(); try { - using HttpMessage message = CreateCreateOrReplaceDiscoveryGroupRequest(groupName, content, context); + using HttpMessage message = CreateCreateOrReplaceSavedFilterRequest(filterName, content, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -994,7 +2459,7 @@ public virtual async Task CreateOrReplaceDiscoveryGroupAsync(string gr } /// - /// [Protocol Method] Create a discovery group with a given groupName. + /// [Protocol Method] Create or replace a saved filter with a given filterName. /// /// /// @@ -1003,29 +2468,29 @@ public virtual async Task CreateOrReplaceDiscoveryGroupAsync(string gr /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// - /// The caller provided unique name for the resource. + /// 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. + /// 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 CreateOrReplaceDiscoveryGroup(string groupName, RequestContent content, RequestContext context = null) + /// + public virtual Response CreateOrReplaceSavedFilter(string filterName, RequestContent content, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("EasmClient.CreateOrReplaceDiscoveryGroup"); + using var scope = ClientDiagnostics.CreateScope("EasmClient.CreateOrReplaceSavedFilter"); scope.Start(); try { - using HttpMessage message = CreateCreateOrReplaceDiscoveryGroupRequest(groupName, content, context); + using HttpMessage message = CreateCreateOrReplaceSavedFilterRequest(filterName, content, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1037,7 +2502,7 @@ public virtual Response CreateOrReplaceDiscoveryGroup(string groupName, RequestC // 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. + /// [Protocol Method] Delete a saved filter with a given filterName. /// /// /// @@ -1046,22 +2511,22 @@ public virtual Response CreateOrReplaceDiscoveryGroup(string groupName, RequestC /// /// /// - /// The caller provided unique name for the resource. + /// 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. + /// 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 RunDiscoveryGroupAsync(string groupName, RequestContext context = null) + /// + public virtual async Task DeleteSavedFilterAsync(string filterName, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); - using var scope = ClientDiagnostics.CreateScope("EasmClient.RunDiscoveryGroup"); + using var scope = ClientDiagnostics.CreateScope("EasmClient.DeleteSavedFilter"); scope.Start(); try { - using HttpMessage message = CreateRunDiscoveryGroupRequest(groupName, context); + using HttpMessage message = CreateDeleteSavedFilterRequest(filterName, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -1073,7 +2538,7 @@ public virtual async Task RunDiscoveryGroupAsync(string groupName, Req // 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. + /// [Protocol Method] Delete a saved filter with a given filterName. /// /// /// @@ -1082,22 +2547,22 @@ public virtual async Task RunDiscoveryGroupAsync(string groupName, Req /// /// /// - /// The caller provided unique name for the resource. + /// 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. + /// 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 RunDiscoveryGroup(string groupName, RequestContext context = null) + /// + public virtual Response DeleteSavedFilter(string filterName, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); + Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); - using var scope = ClientDiagnostics.CreateScope("EasmClient.RunDiscoveryGroup"); + using var scope = ClientDiagnostics.CreateScope("EasmClient.DeleteSavedFilter"); scope.Start(); try { - using HttpMessage message = CreateRunDiscoveryGroupRequest(groupName, context); + using HttpMessage message = CreateDeleteSavedFilterRequest(filterName, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1107,38 +2572,38 @@ public virtual Response RunDiscoveryGroup(string groupName, RequestContext conte } } - /// Retrieve a disco template with a given templateId. - /// The system generated unique id for the resource. + /// 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> GetDiscoveryTemplateAsync(string templateId, CancellationToken cancellationToken = default) + /// 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(templateId, nameof(templateId)); + Argument.AssertNotNullOrEmpty(taskId, nameof(taskId)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetDiscoveryTemplateAsync(templateId, context).ConfigureAwait(false); - return Response.FromValue(DiscoveryTemplate.FromResponse(response), response); + Response response = await GetTaskAsync(taskId, context).ConfigureAwait(false); + return Response.FromValue(TaskResource.FromResponse(response), response); } - /// Retrieve a disco template with a given templateId. - /// The system generated unique id for the resource. + /// 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 GetDiscoveryTemplate(string templateId, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetTask(string taskId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(templateId, nameof(templateId)); + Argument.AssertNotNullOrEmpty(taskId, nameof(taskId)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetDiscoveryTemplate(templateId, context); - return Response.FromValue(DiscoveryTemplate.FromResponse(response), response); + Response response = GetTask(taskId, context); + return Response.FromValue(TaskResource.FromResponse(response), response); } /// - /// [Protocol Method] Retrieve a disco template with a given templateId. + /// [Protocol Method] Retrieve a task by taskId. /// /// /// @@ -1147,27 +2612,27 @@ public virtual Response GetDiscoveryTemplate(string templateI /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// - /// The system generated unique id for the resource. + /// 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. + /// 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 GetDiscoveryTemplateAsync(string templateId, RequestContext context) + /// + public virtual async Task GetTaskAsync(string taskId, RequestContext context) { - Argument.AssertNotNullOrEmpty(templateId, nameof(templateId)); + Argument.AssertNotNullOrEmpty(taskId, nameof(taskId)); - using var scope = ClientDiagnostics.CreateScope("EasmClient.GetDiscoveryTemplate"); + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetTask"); scope.Start(); try { - using HttpMessage message = CreateGetDiscoveryTemplateRequest(templateId, context); + using HttpMessage message = CreateGetTaskRequest(taskId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -1178,7 +2643,7 @@ public virtual async Task GetDiscoveryTemplateAsync(string templateId, } /// - /// [Protocol Method] Retrieve a disco template with a given templateId. + /// [Protocol Method] Retrieve a task by taskId. /// /// /// @@ -1187,27 +2652,27 @@ public virtual async Task GetDiscoveryTemplateAsync(string templateId, /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// - /// The system generated unique id for the resource. + /// 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. + /// 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 GetDiscoveryTemplate(string templateId, RequestContext context) + /// + public virtual Response GetTask(string taskId, RequestContext context) { - Argument.AssertNotNullOrEmpty(templateId, nameof(templateId)); + Argument.AssertNotNullOrEmpty(taskId, nameof(taskId)); - using var scope = ClientDiagnostics.CreateScope("EasmClient.GetDiscoveryTemplate"); + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetTask"); scope.Start(); try { - using HttpMessage message = CreateGetDiscoveryTemplateRequest(templateId, context); + using HttpMessage message = CreateGetTaskRequest(taskId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1217,28 +2682,38 @@ public virtual Response GetDiscoveryTemplate(string templateId, RequestContext c } } - /// Get billable assets summary for the workspace. + /// Cancel a task by taskId. + /// The unique identifier of the task. /// The cancellation token to use. - /// - public virtual async Task> GetBillableAsync(CancellationToken cancellationToken = default) + /// 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 GetBillableAsync(context).ConfigureAwait(false); - return Response.FromValue(ReportBillableAssetSummaryResult.FromResponse(response), response); + Response response = await CancelTaskAsync(taskId, context).ConfigureAwait(false); + return Response.FromValue(TaskResource.FromResponse(response), response); } - /// Get billable assets summary for the workspace. + /// Cancel a task by taskId. + /// The unique identifier of the task. /// The cancellation token to use. - /// - public virtual Response GetBillable(CancellationToken cancellationToken = default) + /// 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 = GetBillable(context); - return Response.FromValue(ReportBillableAssetSummaryResult.FromResponse(response), response); + Response response = CancelTask(taskId, context); + return Response.FromValue(TaskResource.FromResponse(response), response); } /// - /// [Protocol Method] Get billable assets summary for the workspace. + /// [Protocol Method] Cancel a task by taskId. /// /// /// @@ -1247,22 +2722,27 @@ public virtual Response GetBillable(Cancellati /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// 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 GetBillableAsync(RequestContext context) + /// + public virtual async Task CancelTaskAsync(string taskId, RequestContext context) { - using var scope = ClientDiagnostics.CreateScope("EasmClient.GetBillable"); + Argument.AssertNotNullOrEmpty(taskId, nameof(taskId)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.CancelTask"); scope.Start(); try { - using HttpMessage message = CreateGetBillableRequest(context); + using HttpMessage message = CreateCancelTaskRequest(taskId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -1273,7 +2753,7 @@ public virtual async Task GetBillableAsync(RequestContext context) } /// - /// [Protocol Method] Get billable assets summary for the workspace. + /// [Protocol Method] Cancel a task by taskId. /// /// /// @@ -1282,22 +2762,27 @@ public virtual async Task GetBillableAsync(RequestContext context) /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// 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 GetBillable(RequestContext context) + /// + public virtual Response CancelTask(string taskId, RequestContext context) { - using var scope = ClientDiagnostics.CreateScope("EasmClient.GetBillable"); + Argument.AssertNotNullOrEmpty(taskId, nameof(taskId)); + + using var scope = ClientDiagnostics.CreateScope("EasmClient.CancelTask"); scope.Start(); try { - using HttpMessage message = CreateGetBillableRequest(context); + using HttpMessage message = CreateCancelTaskRequest(taskId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1307,38 +2792,38 @@ public virtual Response GetBillable(RequestContext context) } } - /// Get the most recent snapshot of asset summary values for the snapshot request. - /// Body parameter. + /// Run a task by taskId. + /// The unique identifier of the task. /// The cancellation token to use. - /// is null. - /// - public virtual async Task> GetSnapshotAsync(ReportAssetSnapshotPayload body, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> RunTaskAsync(string taskId, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(body, nameof(body)); + Argument.AssertNotNullOrEmpty(taskId, nameof(taskId)); - using RequestContent content = body.ToRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetSnapshotAsync(content, context).ConfigureAwait(false); - return Response.FromValue(ReportAssetSnapshotResult.FromResponse(response), response); + Response response = await RunTaskAsync(taskId, context).ConfigureAwait(false); + return Response.FromValue(TaskResource.FromResponse(response), response); } - /// Get the most recent snapshot of asset summary values for the snapshot request. - /// Body parameter. + /// Run a task by taskId. + /// The unique identifier of the task. /// The cancellation token to use. - /// is null. - /// - public virtual Response GetSnapshot(ReportAssetSnapshotPayload body, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response RunTask(string taskId, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(body, nameof(body)); + Argument.AssertNotNullOrEmpty(taskId, nameof(taskId)); - using RequestContent content = body.ToRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetSnapshot(content, context); - return Response.FromValue(ReportAssetSnapshotResult.FromResponse(response), response); + Response response = RunTask(taskId, context); + return Response.FromValue(TaskResource.FromResponse(response), response); } /// - /// [Protocol Method] Get the most recent snapshot of asset summary values for the snapshot request. + /// [Protocol Method] Run a task by taskId. /// /// /// @@ -1347,26 +2832,27 @@ public virtual Response GetSnapshot(ReportAssetSnapsh /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// - /// The content to send as the body of the request. + /// 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 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 GetSnapshotAsync(RequestContent content, RequestContext context = null) + /// + public virtual async Task RunTaskAsync(string taskId, RequestContext context) { - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(taskId, nameof(taskId)); - using var scope = ClientDiagnostics.CreateScope("EasmClient.GetSnapshot"); + using var scope = ClientDiagnostics.CreateScope("EasmClient.RunTask"); scope.Start(); try { - using HttpMessage message = CreateGetSnapshotRequest(content, context); + using HttpMessage message = CreateRunTaskRequest(taskId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -1377,7 +2863,7 @@ public virtual async Task GetSnapshotAsync(RequestContent content, Req } /// - /// [Protocol Method] Get the most recent snapshot of asset summary values for the snapshot request. + /// [Protocol Method] Run a task by taskId. /// /// /// @@ -1386,26 +2872,27 @@ public virtual async Task GetSnapshotAsync(RequestContent content, Req /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// - /// The content to send as the body of the request. + /// 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 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 GetSnapshot(RequestContent content, RequestContext context = null) + /// + public virtual Response RunTask(string taskId, RequestContext context) { - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(taskId, nameof(taskId)); - using var scope = ClientDiagnostics.CreateScope("EasmClient.GetSnapshot"); + using var scope = ClientDiagnostics.CreateScope("EasmClient.RunTask"); scope.Start(); try { - using HttpMessage message = CreateGetSnapshotRequest(content, context); + using HttpMessage message = CreateRunTaskRequest(taskId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1415,38 +2902,38 @@ public virtual Response GetSnapshot(RequestContent content, RequestContext conte } } - /// Get asset summary details for the summary request. - /// Body parameter. + /// Download a task. + /// The unique identifier of the task. /// The cancellation token to use. - /// is null. - /// - public virtual async Task> GetSummaryAsync(ReportAssetSummaryPayload body, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> DownloadTaskAsync(string taskId, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(body, nameof(body)); + Argument.AssertNotNullOrEmpty(taskId, nameof(taskId)); - using RequestContent content = body.ToRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetSummaryAsync(content, context).ConfigureAwait(false); - return Response.FromValue(ReportAssetSummaryResult.FromResponse(response), response); + Response response = await DownloadTaskAsync(taskId, context).ConfigureAwait(false); + return Response.FromValue(TaskResource.FromResponse(response), response); } - /// Get asset summary details for the summary request. - /// Body parameter. - /// The cancellation token to use. - /// is null. - /// - public virtual Response GetSummary(ReportAssetSummaryPayload body, CancellationToken cancellationToken = default) + /// Download a task. + /// 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 DownloadTask(string taskId, CancellationToken cancellationToken = default) { - Argument.AssertNotNull(body, nameof(body)); + Argument.AssertNotNullOrEmpty(taskId, nameof(taskId)); - using RequestContent content = body.ToRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetSummary(content, context); - return Response.FromValue(ReportAssetSummaryResult.FromResponse(response), response); + Response response = DownloadTask(taskId, context); + return Response.FromValue(TaskResource.FromResponse(response), response); } /// - /// [Protocol Method] Get asset summary details for the summary request. + /// [Protocol Method] Download a task. /// /// /// @@ -1455,26 +2942,27 @@ public virtual Response GetSummary(ReportAssetSummaryP /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// - /// The content to send as the body of the request. + /// 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 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 GetSummaryAsync(RequestContent content, RequestContext context = null) + /// + public virtual async Task DownloadTaskAsync(string taskId, RequestContext context) { - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(taskId, nameof(taskId)); - using var scope = ClientDiagnostics.CreateScope("EasmClient.GetSummary"); + using var scope = ClientDiagnostics.CreateScope("EasmClient.DownloadTask"); scope.Start(); try { - using HttpMessage message = CreateGetSummaryRequest(content, context); + using HttpMessage message = CreateDownloadTaskRequest(taskId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -1485,7 +2973,7 @@ public virtual async Task GetSummaryAsync(RequestContent content, Requ } /// - /// [Protocol Method] Get asset summary details for the summary request. + /// [Protocol Method] Download a task. /// /// /// @@ -1494,26 +2982,27 @@ public virtual async Task GetSummaryAsync(RequestContent content, Requ /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// - /// The content to send as the body of the request. + /// 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 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 GetSummary(RequestContent content, RequestContext context = null) + /// + public virtual Response DownloadTask(string taskId, RequestContext context) { - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(taskId, nameof(taskId)); - using var scope = ClientDiagnostics.CreateScope("EasmClient.GetSummary"); + using var scope = ClientDiagnostics.CreateScope("EasmClient.DownloadTask"); scope.Start(); try { - using HttpMessage message = CreateGetSummaryRequest(content, context); + using HttpMessage message = CreateDownloadTaskRequest(taskId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1523,38 +3012,38 @@ public virtual Response GetSummary(RequestContent content, RequestContext contex } } - /// Retrieve a saved filter by filterName. - /// The caller provided unique name for the resource. + /// Retrieve details of CisaCve by cveId. + /// The CVE ID of the vulnerability in the format CVE-YYYY-NNNN, note that the number portion can have more than 4 digits. /// 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) + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetCisaCveAsync(string cveId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); + Argument.AssertNotNullOrEmpty(cveId, nameof(cveId)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetSavedFilterAsync(filterName, context).ConfigureAwait(false); - return Response.FromValue(SavedFilter.FromResponse(response), response); + Response response = await GetCisaCveAsync(cveId, context).ConfigureAwait(false); + return Response.FromValue(CisaCveResult.FromResponse(response), response); } - /// Retrieve a saved filter by filterName. - /// The caller provided unique name for the resource. + /// Retrieve details of CisaCve by cveId. + /// The CVE ID of the vulnerability in the format CVE-YYYY-NNNN, note that the number portion can have more than 4 digits. /// 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) + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetCisaCve(string cveId, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); + Argument.AssertNotNullOrEmpty(cveId, nameof(cveId)); RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetSavedFilter(filterName, context); - return Response.FromValue(SavedFilter.FromResponse(response), response); + Response response = GetCisaCve(cveId, context); + return Response.FromValue(CisaCveResult.FromResponse(response), response); } /// - /// [Protocol Method] Retrieve a saved filter by filterName. + /// [Protocol Method] Retrieve details of CisaCve by cveId /// /// /// @@ -1563,27 +3052,27 @@ public virtual Response GetSavedFilter(string filterName, Cancellat /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// - /// The caller provided unique name for the resource. + /// The CVE ID of the vulnerability in the format CVE-YYYY-NNNN, note that the number portion can have more than 4 digits. /// 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. + /// 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) + /// + public virtual async Task GetCisaCveAsync(string cveId, RequestContext context) { - Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); + Argument.AssertNotNullOrEmpty(cveId, nameof(cveId)); - using var scope = ClientDiagnostics.CreateScope("EasmClient.GetSavedFilter"); + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetCisaCve"); scope.Start(); try { - using HttpMessage message = CreateGetSavedFilterRequest(filterName, context); + using HttpMessage message = CreateGetCisaCveRequest(cveId, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -1594,7 +3083,7 @@ public virtual async Task GetSavedFilterAsync(string filterName, Reque } /// - /// [Protocol Method] Retrieve a saved filter by filterName. + /// [Protocol Method] Retrieve details of CisaCve by cveId /// /// /// @@ -1603,27 +3092,27 @@ public virtual async Task GetSavedFilterAsync(string filterName, Reque /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// - /// The caller provided unique name for the resource. + /// The CVE ID of the vulnerability in the format CVE-YYYY-NNNN, note that the number portion can have more than 4 digits. /// 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. + /// 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) + /// + public virtual Response GetCisaCve(string cveId, RequestContext context) { - Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); + Argument.AssertNotNullOrEmpty(cveId, nameof(cveId)); - using var scope = ClientDiagnostics.CreateScope("EasmClient.GetSavedFilter"); + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetCisaCve"); scope.Start(); try { - using HttpMessage message = CreateGetSavedFilterRequest(filterName, context); + using HttpMessage message = CreateGetCisaCveRequest(cveId, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1633,44 +3122,38 @@ public virtual Response GetSavedFilter(string filterName, RequestContext context } } - /// Create or replace a saved filter with a given filterName. - /// The caller provided unique name for the resource. - /// Body parameter. + /// Retrieve a policy with a given policyName. + /// The caller provided unique name for the resource. /// 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, SavedFilterPayload body, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetPolicyAsync(string policyName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); - Argument.AssertNotNull(body, nameof(body)); + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); - using RequestContent content = body.ToRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await CreateOrReplaceSavedFilterAsync(filterName, content, context).ConfigureAwait(false); - return Response.FromValue(SavedFilter.FromResponse(response), response); + Response response = await GetPolicyAsync(policyName, context).ConfigureAwait(false); + return Response.FromValue(Policy.FromResponse(response), response); } - /// Create or replace a saved filter with a given filterName. - /// The caller provided unique name for the resource. - /// Body parameter. + /// Retrieve a policy with a given policyName. + /// The caller provided unique name for the resource. /// 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, SavedFilterPayload body, CancellationToken cancellationToken = default) + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetPolicy(string policyName, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); - Argument.AssertNotNull(body, nameof(body)); + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); - using RequestContent content = body.ToRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); - Response response = CreateOrReplaceSavedFilter(filterName, content, context); - return Response.FromValue(SavedFilter.FromResponse(response), response); + Response response = GetPolicy(policyName, context); + return Response.FromValue(Policy.FromResponse(response), response); } /// - /// [Protocol Method] Create or replace a saved filter with a given filterName. + /// [Protocol Method] Retrieve a policy with a given policyName. /// /// /// @@ -1679,29 +3162,27 @@ public virtual Response CreateOrReplaceSavedFilter(string filterNam /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// 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 caller provided unique name for the resource. /// 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. + /// 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) + /// + public virtual async Task GetPolicyAsync(string policyName, RequestContext context) { - Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); - using var scope = ClientDiagnostics.CreateScope("EasmClient.CreateOrReplaceSavedFilter"); + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetPolicy"); scope.Start(); try { - using HttpMessage message = CreateCreateOrReplaceSavedFilterRequest(filterName, content, context); + using HttpMessage message = CreateGetPolicyRequest(policyName, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -1712,7 +3193,7 @@ public virtual async Task CreateOrReplaceSavedFilterAsync(string filte } /// - /// [Protocol Method] Create or replace a saved filter with a given filterName. + /// [Protocol Method] Retrieve a policy with a given policyName. /// /// /// @@ -1721,29 +3202,27 @@ public virtual async Task CreateOrReplaceSavedFilterAsync(string filte /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// 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 caller provided unique name for the resource. /// 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. + /// 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) + /// + public virtual Response GetPolicy(string policyName, RequestContext context) { - Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); - Argument.AssertNotNull(content, nameof(content)); + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); - using var scope = ClientDiagnostics.CreateScope("EasmClient.CreateOrReplaceSavedFilter"); + using var scope = ClientDiagnostics.CreateScope("EasmClient.GetPolicy"); scope.Start(); try { - using HttpMessage message = CreateCreateOrReplaceSavedFilterRequest(filterName, content, context); + using HttpMessage message = CreateGetPolicyRequest(policyName, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1755,7 +3234,7 @@ public virtual Response CreateOrReplaceSavedFilter(string filterName, RequestCon // 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. + /// [Protocol Method] Delete a policy with a given policyName. /// /// /// @@ -1764,22 +3243,22 @@ public virtual Response CreateOrReplaceSavedFilter(string filterName, RequestCon /// /// /// - /// The caller provided unique name for the resource. + /// 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. + /// 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) + /// + public virtual async Task DeletePolicyAsync(string policyName, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); - using var scope = ClientDiagnostics.CreateScope("EasmClient.DeleteSavedFilter"); + using var scope = ClientDiagnostics.CreateScope("EasmClient.DeletePolicy"); scope.Start(); try { - using HttpMessage message = CreateDeleteSavedFilterRequest(filterName, context); + using HttpMessage message = CreateDeletePolicyRequest(policyName, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -1791,7 +3270,7 @@ public virtual async Task DeleteSavedFilterAsync(string filterName, Re // 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. + /// [Protocol Method] Delete a policy with a given policyName. /// /// /// @@ -1800,22 +3279,22 @@ public virtual async Task DeleteSavedFilterAsync(string filterName, Re /// /// /// - /// The caller provided unique name for the resource. + /// 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. + /// 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) + /// + public virtual Response DeletePolicy(string policyName, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(filterName, nameof(filterName)); + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); - using var scope = ClientDiagnostics.CreateScope("EasmClient.DeleteSavedFilter"); + using var scope = ClientDiagnostics.CreateScope("EasmClient.DeletePolicy"); scope.Start(); try { - using HttpMessage message = CreateDeleteSavedFilterRequest(filterName, context); + using HttpMessage message = CreateDeletePolicyRequest(policyName, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1825,38 +3304,44 @@ public virtual Response DeleteSavedFilter(string filterName, RequestContext cont } } - /// Retrieve a task by taskId. - /// The unique identifier of the task. + /// Create a policy with a given policyName. + /// The caller provided unique name for the resource. + /// Body parameter. /// 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) + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> CreateOrReplacePolicyAsync(string policyName, Policy body, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(taskId, nameof(taskId)); + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); + Argument.AssertNotNull(body, nameof(body)); + using RequestContent content = body.ToRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); - Response response = await GetTaskAsync(taskId, context).ConfigureAwait(false); - return Response.FromValue(TaskResource.FromResponse(response), response); + Response response = await CreateOrReplacePolicyAsync(policyName, content, context).ConfigureAwait(false); + return Response.FromValue(Policy.FromResponse(response), response); } - /// Retrieve a task by taskId. - /// The unique identifier of the task. + /// Create a policy with a given policyName. + /// The caller provided unique name for the resource. + /// Body parameter. /// 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) + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response CreateOrReplacePolicy(string policyName, Policy body, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(taskId, nameof(taskId)); + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); + Argument.AssertNotNull(body, nameof(body)); + using RequestContent content = body.ToRequestContent(); RequestContext context = FromCancellationToken(cancellationToken); - Response response = GetTask(taskId, context); - return Response.FromValue(TaskResource.FromResponse(response), response); + Response response = CreateOrReplacePolicy(policyName, content, context); + return Response.FromValue(Policy.FromResponse(response), response); } /// - /// [Protocol Method] Retrieve a task by taskId. + /// [Protocol Method] Create a policy with a given policyName. /// /// /// @@ -1865,27 +3350,29 @@ public virtual Response GetTask(string taskId, CancellationToken c /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// - /// The unique identifier of the task. + /// 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. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual async Task GetTaskAsync(string taskId, RequestContext context) + /// + public virtual async Task CreateOrReplacePolicyAsync(string policyName, RequestContent content, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(taskId, nameof(taskId)); + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); + Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("EasmClient.GetTask"); + using var scope = ClientDiagnostics.CreateScope("EasmClient.CreateOrReplacePolicy"); scope.Start(); try { - using HttpMessage message = CreateGetTaskRequest(taskId, context); + using HttpMessage message = CreateCreateOrReplacePolicyRequest(policyName, content, context); return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); } catch (Exception e) @@ -1896,7 +3383,7 @@ public virtual async Task GetTaskAsync(string taskId, RequestContext c } /// - /// [Protocol Method] Retrieve a task by taskId. + /// [Protocol Method] Create a policy with a given policyName. /// /// /// @@ -1905,27 +3392,29 @@ public virtual async Task GetTaskAsync(string taskId, RequestContext c /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// - /// The unique identifier of the task. + /// 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. - /// is null. - /// is an empty string, and was expected to be non-empty. + /// or is null. + /// is an empty string, and was expected to be non-empty. /// Service returned a non-success status code. /// The response returned from the service. - /// - public virtual Response GetTask(string taskId, RequestContext context) + /// + public virtual Response CreateOrReplacePolicy(string policyName, RequestContent content, RequestContext context = null) { - Argument.AssertNotNullOrEmpty(taskId, nameof(taskId)); + Argument.AssertNotNullOrEmpty(policyName, nameof(policyName)); + Argument.AssertNotNull(content, nameof(content)); - using var scope = ClientDiagnostics.CreateScope("EasmClient.GetTask"); + using var scope = ClientDiagnostics.CreateScope("EasmClient.CreateOrReplacePolicy"); scope.Start(); try { - using HttpMessage message = CreateGetTaskRequest(taskId, context); + using HttpMessage message = CreateCreateOrReplacePolicyRequest(policyName, content, context); return _pipeline.ProcessMessage(message, context); } catch (Exception e) @@ -1935,38 +3424,46 @@ public virtual Response GetTask(string taskId, RequestContext context) } } - /// Cancel a task by taskId. - /// The unique identifier of the task. + /// 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. + /// Specify the response type. The possible values are: ID, STANDARD, FULL, REDUCED. + /// The properties to include in the response. + /// If it's recent only. /// 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) + /// + public virtual AsyncPageable GetAssetResourcesAsync(string filter = null, string orderby = null, int? skip = null, int? maxpagesize = null, string mark = null, AssetResponseType? responseType = null, IEnumerable responseIncludes = null, bool? recentOnly = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(taskId, nameof(taskId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = await CancelTaskAsync(taskId, context).ConfigureAwait(false); - return Response.FromValue(TaskResource.FromResponse(response), response); + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAssetResourcesRequest(filter, orderby, skip, maxpagesize, mark, responseType?.ToString(), responseIncludes, recentOnly, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAssetResourcesNextPageRequest(nextLink, filter, orderby, skip, maxpagesize, mark, responseType?.ToString(), responseIncludes, recentOnly, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => AssetResource.DeserializeAssetResource(e), ClientDiagnostics, _pipeline, "EasmClient.GetAssetResources", "value", "nextLink", context); } - /// Cancel a task by taskId. - /// The unique identifier of the task. + /// 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. + /// Specify the response type. The possible values are: ID, STANDARD, FULL, REDUCED. + /// The properties to include in the response. + /// If it's recent only. /// 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) + /// + public virtual Pageable GetAssetResources(string filter = null, string orderby = null, int? skip = null, int? maxpagesize = null, string mark = null, AssetResponseType? responseType = null, IEnumerable responseIncludes = null, bool? recentOnly = null, CancellationToken cancellationToken = default) { - Argument.AssertNotNullOrEmpty(taskId, nameof(taskId)); - - RequestContext context = FromCancellationToken(cancellationToken); - Response response = CancelTask(taskId, context); - return Response.FromValue(TaskResource.FromResponse(response), response); + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAssetResourcesRequest(filter, orderby, skip, maxpagesize, mark, responseType?.ToString(), responseIncludes, recentOnly, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAssetResourcesNextPageRequest(nextLink, filter, orderby, skip, maxpagesize, mark, responseType?.ToString(), responseIncludes, recentOnly, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => AssetResource.DeserializeAssetResource(e), ClientDiagnostics, _pipeline, "EasmClient.GetAssetResources", "value", "nextLink", context); } /// - /// [Protocol Method] Cancel a task by taskId. + /// [Protocol Method] Retrieve a list of assets for the provided search parameters. /// /// /// @@ -1975,38 +3472,32 @@ public virtual Response CancelTask(string taskId, CancellationToke /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// 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; - } + /// 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. + /// Specify the response type. The possible values are: ID, STANDARD, FULL, REDUCED. Allowed values: "id" | "standard" | "full" | "reduced". + /// The properties to include in the response. + /// If it's recent only. + /// 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, string responseType, IEnumerable responseIncludes, bool? recentOnly, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAssetResourcesRequest(filter, orderby, skip, maxpagesize, mark, responseType, responseIncludes, recentOnly, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAssetResourcesNextPageRequest(nextLink, filter, orderby, skip, maxpagesize, mark, responseType, responseIncludes, recentOnly, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EasmClient.GetAssetResources", "value", "nextLink", context); } /// - /// [Protocol Method] Cancel a task by taskId. + /// [Protocol Method] Retrieve a list of assets for the provided search parameters. /// /// /// @@ -2015,70 +3506,68 @@ public virtual async Task CancelTaskAsync(string taskId, RequestContex /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// /// - /// The unique identifier of the task. + /// 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. + /// Specify the response type. The possible values are: ID, STANDARD, FULL, REDUCED. Allowed values: "id" | "standard" | "full" | "reduced". + /// The properties to include in the response. + /// If it's recent only. /// 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) + /// 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, string responseType, IEnumerable responseIncludes, bool? recentOnly, 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; - } + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetAssetResourcesRequest(filter, orderby, skip, maxpagesize, mark, responseType, responseIncludes, recentOnly, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetAssetResourcesNextPageRequest(nextLink, filter, orderby, skip, maxpagesize, mark, responseType, responseIncludes, recentOnly, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), 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. + /// Retrieve a list of deltas for the provided time range. + /// Body parameter. /// 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) + /// is null. + /// + public virtual AsyncPageable GetDeltaDetailsAsync(DeltaDetailsRequest body, int? skip = null, int? maxpagesize = null, CancellationToken cancellationToken = default) { + Argument.AssertNotNull(body, nameof(body)); + + RequestContent content = body.ToRequestContent(); 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, e => AssetResource.DeserializeAssetResource(e), ClientDiagnostics, _pipeline, "EasmClient.GetAssetResources", "value", "nextLink", context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDeltaDetailsRequest(content, skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDeltaDetailsNextPageRequest(nextLink, content, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => DeltaResult.DeserializeDeltaResult(e), ClientDiagnostics, _pipeline, "EasmClient.GetDeltaDetails", "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. + /// Retrieve a list of deltas for the provided time range. + /// Body parameter. /// 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) + /// is null. + /// + public virtual Pageable GetDeltaDetails(DeltaDetailsRequest body, int? skip = null, int? maxpagesize = null, CancellationToken cancellationToken = default) { + Argument.AssertNotNull(body, nameof(body)); + + RequestContent content = body.ToRequestContent(); 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, e => AssetResource.DeserializeAssetResource(e), ClientDiagnostics, _pipeline, "EasmClient.GetAssetResources", "value", "nextLink", context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDeltaDetailsRequest(content, skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDeltaDetailsNextPageRequest(nextLink, content, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => DeltaResult.DeserializeDeltaResult(e), ClientDiagnostics, _pipeline, "EasmClient.GetDeltaDetails", "value", "nextLink", context); } /// - /// [Protocol Method] Retrieve a list of assets for the provided search parameters. + /// [Protocol Method] Retrieve a list of deltas for the provided time range. /// /// /// @@ -2087,29 +3576,30 @@ public virtual Pageable GetAssetResources(string filter = null, s /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// 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 content to send as the body of the request. /// 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. + /// is null. /// 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) + /// + public virtual AsyncPageable GetDeltaDetailsAsync(RequestContent content, int? skip = null, int? maxpagesize = null, RequestContext context = 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, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EasmClient.GetAssetResources", "value", "nextLink", context); + Argument.AssertNotNull(content, nameof(content)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDeltaDetailsRequest(content, skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDeltaDetailsNextPageRequest(nextLink, content, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EasmClient.GetDeltaDetails", "value", "nextLink", context); } /// - /// [Protocol Method] Retrieve a list of assets for the provided search parameters. + /// [Protocol Method] Retrieve a list of deltas for the provided time range. /// /// /// @@ -2118,25 +3608,26 @@ public virtual AsyncPageable GetAssetResourcesAsync(string filter, s /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// 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 content to send as the body of the request. /// 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. + /// is null. /// 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) + /// + public virtual Pageable GetDeltaDetails(RequestContent content, int? skip = null, int? maxpagesize = null, RequestContext context = 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, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EasmClient.GetAssetResources", "value", "nextLink", context); + Argument.AssertNotNull(content, nameof(content)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDeltaDetailsRequest(content, skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDeltaDetailsNextPageRequest(nextLink, content, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EasmClient.GetDeltaDetails", "value", "nextLink", context); } /// Retrieve a list of data connections. @@ -2226,13 +3717,13 @@ public virtual Pageable GetDataConnections(int? skip, int? maxpagesi /// The number of result items to skip. /// The maximum number of result items per page. /// The cancellation token to use. - /// - public virtual AsyncPageable GetDiscoveryGroupsAsync(string filter = null, int? skip = null, int? maxpagesize = null, CancellationToken cancellationToken = default) + /// + 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) => CreateGetDiscoveryGroupsRequest(filter, skip, maxpagesize, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDiscoveryGroupsNextPageRequest(nextLink, filter, skip, maxpagesize, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => DiscoveryGroup.DeserializeDiscoveryGroup(e), ClientDiagnostics, _pipeline, "EasmClient.GetDiscoveryGroups", "value", "nextLink", 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 => DiscoveryGroup.DeserializeDiscoveryGroup(e), ClientDiagnostics, _pipeline, "EasmClient.GetDiscoGroups", "value", "nextLink", context); } /// Retrieve a list of discovery group for the provided search parameters. @@ -2240,13 +3731,13 @@ public virtual AsyncPageable GetDiscoveryGroupsAsync(string filt /// The number of result items to skip. /// The maximum number of result items per page. /// The cancellation token to use. - /// - public virtual Pageable GetDiscoveryGroups(string filter = null, int? skip = null, int? maxpagesize = null, CancellationToken cancellationToken = default) + /// + 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) => CreateGetDiscoveryGroupsRequest(filter, skip, maxpagesize, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDiscoveryGroupsNextPageRequest(nextLink, filter, skip, maxpagesize, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => DiscoveryGroup.DeserializeDiscoveryGroup(e), ClientDiagnostics, _pipeline, "EasmClient.GetDiscoveryGroups", "value", "nextLink", 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 => DiscoveryGroup.DeserializeDiscoveryGroup(e), ClientDiagnostics, _pipeline, "EasmClient.GetDiscoGroups", "value", "nextLink", context); } /// @@ -2259,7 +3750,7 @@ public virtual Pageable GetDiscoveryGroups(string filter = null, /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// @@ -2270,12 +3761,12 @@ public virtual Pageable GetDiscoveryGroups(string filter = null, /// 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 GetDiscoveryGroupsAsync(string filter, int? skip, int? maxpagesize, RequestContext context) + /// + public virtual AsyncPageable GetDiscoGroupsAsync(string filter, int? skip, int? maxpagesize, RequestContext context) { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDiscoveryGroupsRequest(filter, skip, maxpagesize, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDiscoveryGroupsNextPageRequest(nextLink, filter, skip, maxpagesize, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EasmClient.GetDiscoveryGroups", "value", "nextLink", 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); } /// @@ -2288,7 +3779,7 @@ public virtual AsyncPageable GetDiscoveryGroupsAsync(string filter, /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// @@ -2299,12 +3790,12 @@ public virtual AsyncPageable GetDiscoveryGroupsAsync(string filter, /// 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 GetDiscoveryGroups(string filter, int? skip, int? maxpagesize, RequestContext context) + /// + public virtual Pageable GetDiscoGroups(string filter, int? skip, int? maxpagesize, RequestContext context) { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDiscoveryGroupsRequest(filter, skip, maxpagesize, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDiscoveryGroupsNextPageRequest(nextLink, filter, skip, maxpagesize, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EasmClient.GetDiscoveryGroups", "value", "nextLink", 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. @@ -2315,15 +3806,15 @@ public virtual Pageable GetDiscoveryGroups(string filter, int? skip, /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. - /// - public virtual AsyncPageable GetDiscoveryGroupRunsAsync(string groupName, string filter = null, int? skip = null, int? maxpagesize = null, CancellationToken cancellationToken = default) + /// + 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) => CreateGetDiscoveryGroupRunsRequest(groupName, filter, skip, maxpagesize, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDiscoveryGroupRunsNextPageRequest(nextLink, groupName, filter, skip, maxpagesize, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => DiscoveryRunResult.DeserializeDiscoveryRunResult(e), ClientDiagnostics, _pipeline, "EasmClient.GetDiscoveryGroupRuns", "value", "nextLink", context); + 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 => DiscoveryRunResult.DeserializeDiscoveryRunResult(e), ClientDiagnostics, _pipeline, "EasmClient.GetRuns", "value", "nextLink", context); } /// Retrieve a collection of discovery run results for a discovery group with a given groupName. @@ -2334,15 +3825,15 @@ public virtual AsyncPageable GetDiscoveryGroupRunsAsync(stri /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. - /// - public virtual Pageable GetDiscoveryGroupRuns(string groupName, string filter = null, int? skip = null, int? maxpagesize = null, CancellationToken cancellationToken = default) + /// + 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) => CreateGetDiscoveryGroupRunsRequest(groupName, filter, skip, maxpagesize, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDiscoveryGroupRunsNextPageRequest(nextLink, groupName, filter, skip, maxpagesize, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => DiscoveryRunResult.DeserializeDiscoveryRunResult(e), ClientDiagnostics, _pipeline, "EasmClient.GetDiscoveryGroupRuns", "value", "nextLink", context); + 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 => DiscoveryRunResult.DeserializeDiscoveryRunResult(e), ClientDiagnostics, _pipeline, "EasmClient.GetRuns", "value", "nextLink", context); } /// @@ -2355,7 +3846,7 @@ public virtual Pageable GetDiscoveryGroupRuns(string groupNa /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// @@ -2369,14 +3860,14 @@ public virtual Pageable GetDiscoveryGroupRuns(string groupNa /// 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 GetDiscoveryGroupRunsAsync(string groupName, string filter, int? skip, int? maxpagesize, RequestContext context) + /// + public virtual AsyncPageable GetRunsAsync(string groupName, string filter, int? skip, int? maxpagesize, RequestContext context) { Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDiscoveryGroupRunsRequest(groupName, filter, skip, maxpagesize, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDiscoveryGroupRunsNextPageRequest(nextLink, groupName, filter, skip, maxpagesize, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EasmClient.GetDiscoveryGroupRuns", "value", "nextLink", context); + 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); } /// @@ -2389,7 +3880,7 @@ public virtual AsyncPageable GetDiscoveryGroupRunsAsync(string group /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// @@ -2403,14 +3894,14 @@ public virtual AsyncPageable GetDiscoveryGroupRunsAsync(string group /// 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 GetDiscoveryGroupRuns(string groupName, string filter, int? skip, int? maxpagesize, RequestContext context) + /// + public virtual Pageable GetRuns(string groupName, string filter, int? skip, int? maxpagesize, RequestContext context) { Argument.AssertNotNullOrEmpty(groupName, nameof(groupName)); - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDiscoveryGroupRunsRequest(groupName, filter, skip, maxpagesize, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDiscoveryGroupRunsNextPageRequest(nextLink, groupName, filter, skip, maxpagesize, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EasmClient.GetDiscoveryGroupRuns", "value", "nextLink", context); + 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. @@ -2418,13 +3909,13 @@ public virtual Pageable GetDiscoveryGroupRuns(string groupName, stri /// The number of result items to skip. /// The maximum number of result items per page. /// The cancellation token to use. - /// - public virtual AsyncPageable GetDiscoveryTemplatesAsync(string filter = null, int? skip = null, int? maxpagesize = null, CancellationToken cancellationToken = default) + /// + 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) => CreateGetDiscoveryTemplatesRequest(filter, skip, maxpagesize, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDiscoveryTemplatesNextPageRequest(nextLink, filter, skip, maxpagesize, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => DiscoveryTemplate.DeserializeDiscoveryTemplate(e), ClientDiagnostics, _pipeline, "EasmClient.GetDiscoveryTemplates", "value", "nextLink", 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 => DiscoveryTemplate.DeserializeDiscoveryTemplate(e), ClientDiagnostics, _pipeline, "EasmClient.GetDiscoTemplates", "value", "nextLink", context); } /// Retrieve a list of disco templates for the provided search parameters. @@ -2432,13 +3923,13 @@ public virtual AsyncPageable GetDiscoveryTemplatesAsync(strin /// The number of result items to skip. /// The maximum number of result items per page. /// The cancellation token to use. - /// - public virtual Pageable GetDiscoveryTemplates(string filter = null, int? skip = null, int? maxpagesize = null, CancellationToken cancellationToken = default) + /// + 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) => CreateGetDiscoveryTemplatesRequest(filter, skip, maxpagesize, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDiscoveryTemplatesNextPageRequest(nextLink, filter, skip, maxpagesize, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => DiscoveryTemplate.DeserializeDiscoveryTemplate(e), ClientDiagnostics, _pipeline, "EasmClient.GetDiscoveryTemplates", "value", "nextLink", 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 => DiscoveryTemplate.DeserializeDiscoveryTemplate(e), ClientDiagnostics, _pipeline, "EasmClient.GetDiscoTemplates", "value", "nextLink", context); } /// @@ -2451,7 +3942,7 @@ public virtual Pageable GetDiscoveryTemplates(string filter = /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// @@ -2462,12 +3953,12 @@ public virtual Pageable GetDiscoveryTemplates(string filter = /// 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 GetDiscoveryTemplatesAsync(string filter, int? skip, int? maxpagesize, RequestContext context) + /// + public virtual AsyncPageable GetDiscoTemplatesAsync(string filter, int? skip, int? maxpagesize, RequestContext context) { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDiscoveryTemplatesRequest(filter, skip, maxpagesize, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDiscoveryTemplatesNextPageRequest(nextLink, filter, skip, maxpagesize, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EasmClient.GetDiscoveryTemplates", "value", "nextLink", 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); } /// @@ -2480,7 +3971,7 @@ public virtual AsyncPageable GetDiscoveryTemplatesAsync(string filte /// /// /// - /// Please try the simpler convenience overload with strongly typed models first. + /// Please try the simpler convenience overload with strongly typed models first. /// /// /// @@ -2491,12 +3982,12 @@ public virtual AsyncPageable GetDiscoveryTemplatesAsync(string filte /// 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 GetDiscoveryTemplates(string filter, int? skip, int? maxpagesize, RequestContext context) + /// + public virtual Pageable GetDiscoTemplates(string filter, int? skip, int? maxpagesize, RequestContext context) { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDiscoveryTemplatesRequest(filter, skip, maxpagesize, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDiscoveryTemplatesNextPageRequest(nextLink, filter, skip, maxpagesize, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EasmClient.GetDiscoveryTemplates", "value", "nextLink", 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. @@ -2670,19 +4161,283 @@ public virtual AsyncPageable GetTasksAsync(string filter, string ord /// 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); + 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); + } + + /// Retrieve a list of CisaCves for the provided search parameters. + /// The cancellation token to use. + /// + public virtual AsyncPageable GetCisaCvesAsync(CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetCisaCvesRequest(context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetCisaCvesNextPageRequest(nextLink, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => CisaCveResult.DeserializeCisaCveResult(e), ClientDiagnostics, _pipeline, "EasmClient.GetCisaCves", "value", "nextLink", context); + } + + /// Retrieve a list of CisaCves for the provided search parameters. + /// The cancellation token to use. + /// + public virtual Pageable GetCisaCves(CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetCisaCvesRequest(context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetCisaCvesNextPageRequest(nextLink, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => CisaCveResult.DeserializeCisaCveResult(e), ClientDiagnostics, _pipeline, "EasmClient.GetCisaCves", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieve a list of CisaCves 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. + /// + /// + /// + /// + /// 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 GetCisaCvesAsync(RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetCisaCvesRequest(context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetCisaCvesNextPageRequest(nextLink, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EasmClient.GetCisaCves", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieve a list of CisaCves 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. + /// + /// + /// + /// + /// 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 GetCisaCves(RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetCisaCvesRequest(context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetCisaCvesNextPageRequest(nextLink, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EasmClient.GetCisaCves", "value", "nextLink", context); + } + + /// Retrieve a list of policies 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 GetPoliciesAsync(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) => CreateGetPoliciesRequest(filter, skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPoliciesNextPageRequest(nextLink, filter, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => Policy.DeserializePolicy(e), ClientDiagnostics, _pipeline, "EasmClient.GetPolicies", "value", "nextLink", context); + } + + /// Retrieve a list of policies 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 GetPolicies(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) => CreateGetPoliciesRequest(filter, skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPoliciesNextPageRequest(nextLink, filter, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => Policy.DeserializePolicy(e), ClientDiagnostics, _pipeline, "EasmClient.GetPolicies", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieve a list of policies 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 GetPoliciesAsync(string filter, int? skip, int? maxpagesize, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetPoliciesRequest(filter, skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPoliciesNextPageRequest(nextLink, filter, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EasmClient.GetPolicies", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieve a list of policies 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 GetPolicies(string filter, int? skip, int? maxpagesize, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetPoliciesRequest(filter, skip, maxpagesize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetPoliciesNextPageRequest(nextLink, filter, skip, maxpagesize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "EasmClient.GetPolicies", "value", "nextLink", context); + } + + internal HttpMessage CreateGetAssetResourcesRequest(string filter, string orderby, int? skip, int? maxpagesize, string mark, string responseType, IEnumerable responseIncludes, bool? recentOnly, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + 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); + } + if (responseType != null) + { + uri.AppendQuery("responseType", responseType, true); + } + if (responseIncludes != null && !(responseIncludes is ChangeTrackingList changeTrackingList && changeTrackingList.IsUndefined)) + { + uri.AppendQueryDelimited("responseIncludes", responseIncludes, ",", true); + } + if (recentOnly != null) + { + uri.AppendQuery("recentOnly", recentOnly.Value, 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.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.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 CreateGetAssetsExportRequest(RequestContent content, string filter, string orderby, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/assets:export", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (filter != null) + { + uri.AppendQuery("filter", filter, true); + } + if (orderby != null) + { + uri.AppendQuery("orderby", orderby, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; } - internal HttpMessage CreateGetAssetResourcesRequest(string filter, string orderby, int? skip, int? maxpagesize, string mark, RequestContext context) + internal HttpMessage CreateGetObservationsRequest(string assetId, string filter, string orderby, int? skip, int? maxpagesize, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/assets", false); + uri.AppendPath("/assets/", false); + uri.AppendPath(assetId, true); + uri.AppendPath(":getObservations", false); uri.AppendQuery("api-version", _apiVersion, true); if (filter != null) { @@ -2700,25 +4455,28 @@ internal HttpMessage CreateGetAssetResourcesRequest(string filter, string orderb { 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) + internal HttpMessage CreateGetDeltaDetailsRequest(RequestContent content, int? skip, int? maxpagesize, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/assets", false); - uri.AppendQuery("filter", filter, true); + uri.AppendPath("/assets:getDeltaDetails", 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"); request.Headers.Add("Content-Type", "application/json"); @@ -2726,18 +4484,19 @@ internal HttpMessage CreateUpdateAssetsRequest(string filter, RequestContent con return message; } - internal HttpMessage CreateGetAssetResourceRequest(string assetId, RequestContext context) + internal HttpMessage CreateGetDeltaSummaryRequest(RequestContent content, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; - request.Method = RequestMethod.Get; + request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); uri.Reset(_endpoint); - uri.AppendPath("/assets/", false); - uri.AppendPath(assetId, true); + uri.AppendPath("/assets:getDeltaSummary", 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; } @@ -2826,7 +4585,7 @@ internal HttpMessage CreateDeleteDataConnectionRequest(string dataConnectionName return message; } - internal HttpMessage CreateGetDiscoveryGroupsRequest(string filter, int? skip, int? maxpagesize, RequestContext context) + internal HttpMessage CreateGetDiscoGroupsRequest(string filter, int? skip, int? maxpagesize, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -2852,7 +4611,7 @@ internal HttpMessage CreateGetDiscoveryGroupsRequest(string filter, int? skip, i return message; } - internal HttpMessage CreateValidateDiscoveryGroupRequest(RequestContent content, RequestContext context) + internal HttpMessage CreateValidateDiscoGroupRequest(RequestContent content, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -2868,7 +4627,7 @@ internal HttpMessage CreateValidateDiscoveryGroupRequest(RequestContent content, return message; } - internal HttpMessage CreateGetDiscoveryGroupRequest(string groupName, RequestContext context) + internal HttpMessage CreateGetDiscoGroupRequest(string groupName, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -2883,7 +4642,22 @@ internal HttpMessage CreateGetDiscoveryGroupRequest(string groupName, RequestCon return message; } - internal HttpMessage CreateCreateOrReplaceDiscoveryGroupRequest(string groupName, RequestContent content, RequestContext context) + internal HttpMessage CreateDeleteDiscoGroupRequest(string groupName, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + 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; @@ -2900,7 +4674,7 @@ internal HttpMessage CreateCreateOrReplaceDiscoveryGroupRequest(string groupName return message; } - internal HttpMessage CreateRunDiscoveryGroupRequest(string groupName, RequestContext context) + internal HttpMessage CreateRunDiscoGroupRequest(string groupName, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier204); var request = message.Request; @@ -2916,7 +4690,7 @@ internal HttpMessage CreateRunDiscoveryGroupRequest(string groupName, RequestCon return message; } - internal HttpMessage CreateGetDiscoveryGroupRunsRequest(string groupName, string filter, int? skip, int? maxpagesize, RequestContext context) + internal HttpMessage CreateGetRunsRequest(string groupName, string filter, int? skip, int? maxpagesize, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -2944,7 +4718,39 @@ internal HttpMessage CreateGetDiscoveryGroupRunsRequest(string groupName, string return message; } - internal HttpMessage CreateGetDiscoveryTemplatesRequest(string filter, int? skip, int? maxpagesize, RequestContext context) + internal HttpMessage CreateGetAssetChainSummaryRequest(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.AppendPath("/discoGroups:getAssetChainSummary", 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 CreateDismissAssetChainRequest(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.AppendPath("/discoGroups:dismissAssetChain", 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 CreateGetDiscoTemplatesRequest(string filter, int? skip, int? maxpagesize, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -2970,7 +4776,7 @@ internal HttpMessage CreateGetDiscoveryTemplatesRequest(string filter, int? skip return message; } - internal HttpMessage CreateGetDiscoveryTemplateRequest(string templateId, RequestContext context) + internal HttpMessage CreateGetDiscoTemplateRequest(string templateId, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -3031,6 +4837,22 @@ internal HttpMessage CreateGetSummaryRequest(RequestContent content, RequestCont return message; } + internal HttpMessage CreateGetSnapshotExportRequest(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.AppendPath("/reports/assets:getSnapshotExport", 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); @@ -3165,7 +4987,154 @@ internal HttpMessage CreateCancelTaskRequest(string taskId, RequestContext conte return message; } - internal HttpMessage CreateGetAssetResourcesNextPageRequest(string nextLink, string filter, string orderby, int? skip, int? maxpagesize, string mark, RequestContext context) + internal HttpMessage CreateRunTaskRequest(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.AppendPath("/tasks/", false); + uri.AppendPath(taskId, true); + uri.AppendPath(":run", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateDownloadTaskRequest(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.AppendPath("/tasks/", false); + uri.AppendPath(taskId, true); + uri.AppendPath(":download", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetCisaCvesRequest(RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/cisaCves", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetCisaCveRequest(string cveId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/cisaCves/", false); + uri.AppendPath(cveId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetPoliciesRequest(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.AppendPath("/policies", 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 CreateGetPolicyRequest(string policyName, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateDeletePolicyRequest(string policyName, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/policies/", false); + uri.AppendPath(policyName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateCreateOrReplacePolicyRequest(string policyName, 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.AppendPath("/policies/", false); + uri.AppendPath(policyName, 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 CreateGetAssetResourcesNextPageRequest(string nextLink, string filter, string orderby, int? skip, int? maxpagesize, string mark, string responseType, IEnumerable responseIncludes, bool? recentOnly, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetDeltaDetailsNextPageRequest(string nextLink, RequestContent content, int? skip, int? maxpagesize, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -3191,7 +5160,7 @@ internal HttpMessage CreateGetDataConnectionsNextPageRequest(string nextLink, in return message; } - internal HttpMessage CreateGetDiscoveryGroupsNextPageRequest(string nextLink, string filter, int? skip, int? maxpagesize, RequestContext context) + internal HttpMessage CreateGetDiscoGroupsNextPageRequest(string nextLink, string filter, int? skip, int? maxpagesize, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -3204,7 +5173,7 @@ internal HttpMessage CreateGetDiscoveryGroupsNextPageRequest(string nextLink, st return message; } - internal HttpMessage CreateGetDiscoveryGroupRunsNextPageRequest(string nextLink, string groupName, string filter, int? skip, int? maxpagesize, RequestContext context) + 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; @@ -3217,7 +5186,7 @@ internal HttpMessage CreateGetDiscoveryGroupRunsNextPageRequest(string nextLink, return message; } - internal HttpMessage CreateGetDiscoveryTemplatesNextPageRequest(string nextLink, string filter, int? skip, int? maxpagesize, RequestContext context) + internal HttpMessage CreateGetDiscoTemplatesNextPageRequest(string nextLink, string filter, int? skip, int? maxpagesize, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -3256,6 +5225,32 @@ internal HttpMessage CreateGetTasksNextPageRequest(string nextLink, string filte return message; } + internal HttpMessage CreateGetCisaCvesNextPageRequest(string nextLink, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetPoliciesNextPageRequest(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.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) { diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/EasmClientOptions.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/EasmClientOptions.cs index e5ea46ee7b0b..fcd44b47a299 100644 --- a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/EasmClientOptions.cs +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/EasmClientOptions.cs @@ -13,13 +13,17 @@ namespace Azure.Analytics.Defender.Easm /// Client options for EasmClient. public partial class EasmClientOptions : ClientOptions { - private const ServiceVersion LatestVersion = ServiceVersion.V2023_03_01_Preview; + private const ServiceVersion LatestVersion = ServiceVersion.V2024_10_01_Preview; /// The version of the service to use. public enum ServiceVersion { /// Service version "2023-03-01-preview". V2023_03_01_Preview = 1, + /// Service version "2024-03-01-preview". + V2024_03_01_Preview = 2, + /// Service version "2024-10-01-preview". + V2024_10_01_Preview = 3, } internal string Version { get; } @@ -30,6 +34,8 @@ public EasmClientOptions(ServiceVersion version = LatestVersion) Version = version switch { ServiceVersion.V2023_03_01_Preview => "2023-03-01-preview", + ServiceVersion.V2024_03_01_Preview => "2024-03-01-preview", + ServiceVersion.V2024_10_01_Preview => "2024-10-01-preview", _ => throw new NotSupportedException() }; } diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ErrorResponse.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ErrorResponse.Serialization.cs new file mode 100644 index 000000000000..09d57de93b30 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ErrorResponse.Serialization.cs @@ -0,0 +1,135 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class ErrorResponse : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ErrorResponse)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("error"u8); + JsonSerializer.Serialize(writer, Error); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ErrorResponse IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ErrorResponse)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeErrorResponse(document.RootElement, options); + } + + internal static ErrorResponse DeserializeErrorResponse(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResponseError error = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("error"u8)) + { + error = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ErrorResponse(error, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ErrorResponse)} does not support writing '{options.Format}' format."); + } + } + + ErrorResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeErrorResponse(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ErrorResponse)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ErrorResponse FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeErrorResponse(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ErrorResponse.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ErrorResponse.cs new file mode 100644 index 000000000000..0c6fbbace0f6 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ErrorResponse.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Analytics.Defender.Easm +{ + /// A response containing error details. + public partial class ErrorResponse + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The error object. + /// is null. + internal ErrorResponse(ResponseError error) + { + Argument.AssertNotNull(error, nameof(error)); + + Error = error; + } + + /// Initializes a new instance of . + /// The error object. + /// Keeps track of any properties unknown to the library. + internal ErrorResponse(ResponseError error, IDictionary serializedAdditionalRawData) + { + Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ErrorResponse() + { + } + + /// The error object. + public ResponseError Error { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/GlobalAssetType.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/GlobalAssetType.cs new file mode 100644 index 000000000000..abbea0eb2c06 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/GlobalAssetType.cs @@ -0,0 +1,78 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Analytics.Defender.Easm +{ + /// A list of global asset type. + public readonly partial struct GlobalAssetType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public GlobalAssetType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PageValue = "page"; + private const string ResourceValue = "resource"; + private const string MailServerValue = "mailServer"; + private const string NameServerValue = "nameServer"; + private const string HostValue = "host"; + private const string DomainValue = "domain"; + private const string IpAddressValue = "ipAddress"; + private const string IpBlockValue = "ipBlock"; + private const string AsValue = "as"; + private const string ContactValue = "contact"; + private const string SslCertValue = "sslCert"; + + /// page. + public static GlobalAssetType Page { get; } = new GlobalAssetType(PageValue); + /// resource. + public static GlobalAssetType Resource { get; } = new GlobalAssetType(ResourceValue); + /// mail server. + public static GlobalAssetType MailServer { get; } = new GlobalAssetType(MailServerValue); + /// name server. + public static GlobalAssetType NameServer { get; } = new GlobalAssetType(NameServerValue); + /// host. + public static GlobalAssetType Host { get; } = new GlobalAssetType(HostValue); + /// domain. + public static GlobalAssetType Domain { get; } = new GlobalAssetType(DomainValue); + /// ip address. + public static GlobalAssetType IpAddress { get; } = new GlobalAssetType(IpAddressValue); + /// ip block. + public static GlobalAssetType IpBlock { get; } = new GlobalAssetType(IpBlockValue); + /// autonomous system number. + public static GlobalAssetType As { get; } = new GlobalAssetType(AsValue); + /// contact. + public static GlobalAssetType Contact { get; } = new GlobalAssetType(ContactValue); + /// ssl certificate. + public static GlobalAssetType SslCert { get; } = new GlobalAssetType(SslCertValue); + /// Determines if two values are the same. + public static bool operator ==(GlobalAssetType left, GlobalAssetType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(GlobalAssetType left, GlobalAssetType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator GlobalAssetType(string value) => new GlobalAssetType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is GlobalAssetType other && Equals(other); + /// + public bool Equals(GlobalAssetType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/GlobalInventoryState.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/GlobalInventoryState.cs new file mode 100644 index 000000000000..04687d59ea84 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/GlobalInventoryState.cs @@ -0,0 +1,72 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Analytics.Defender.Easm +{ + /// A list of global inventory states. + public readonly partial struct GlobalInventoryState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public GlobalInventoryState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CandidateValue = "candidate"; + private const string CandidateInvestigateValue = "candidateInvestigate"; + private const string ConfirmedValue = "confirmed"; + private const string AssociatedValue = "associated"; + private const string AssociatedPartnerValue = "associatedPartner"; + private const string AssociatedThirdPartyValue = "associatedThirdParty"; + private const string ArchivedValue = "archived"; + private const string DismissedValue = "dismissed"; + private const string AutoconfirmedValue = "autoconfirmed"; + + /// candidate. + public static GlobalInventoryState Candidate { get; } = new GlobalInventoryState(CandidateValue); + /// candidate investigate. + public static GlobalInventoryState CandidateInvestigate { get; } = new GlobalInventoryState(CandidateInvestigateValue); + /// confirmed. + public static GlobalInventoryState Confirmed { get; } = new GlobalInventoryState(ConfirmedValue); + /// associated. + public static GlobalInventoryState Associated { get; } = new GlobalInventoryState(AssociatedValue); + /// associated partner. + public static GlobalInventoryState AssociatedPartner { get; } = new GlobalInventoryState(AssociatedPartnerValue); + /// associated third party. + public static GlobalInventoryState AssociatedThirdParty { get; } = new GlobalInventoryState(AssociatedThirdPartyValue); + /// archived. + public static GlobalInventoryState Archived { get; } = new GlobalInventoryState(ArchivedValue); + /// dismissed. + public static GlobalInventoryState Dismissed { get; } = new GlobalInventoryState(DismissedValue); + /// auto confirmed. + public static GlobalInventoryState Autoconfirmed { get; } = new GlobalInventoryState(AutoconfirmedValue); + /// Determines if two values are the same. + public static bool operator ==(GlobalInventoryState left, GlobalInventoryState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(GlobalInventoryState left, GlobalInventoryState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator GlobalInventoryState(string value) => new GlobalInventoryState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is GlobalInventoryState other && Equals(other); + /// + public bool Equals(GlobalInventoryState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/LogAnalyticsDataConnection.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/LogAnalyticsDataConnection.cs index 02d610eaa298..16cf7f223be9 100644 --- a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/LogAnalyticsDataConnection.cs +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/LogAnalyticsDataConnection.cs @@ -26,13 +26,13 @@ internal LogAnalyticsDataConnection(LogAnalyticsDataConnectionProperties propert /// Initializes a new instance of . /// Discriminator property for DataConnection. - /// The system generated unique id for the resource. + /// This is typically the same as the name but might be different for different models. /// 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 day to update the data connection on. (1-7 for weekly, 1-31 for monthly). /// 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. diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/LogAnalyticsDataConnectionPayload.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/LogAnalyticsDataConnectionPayload.cs index 8548b2b8e98f..e1613dab0c06 100644 --- a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/LogAnalyticsDataConnectionPayload.cs +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/LogAnalyticsDataConnectionPayload.cs @@ -25,7 +25,7 @@ public LogAnalyticsDataConnectionPayload(LogAnalyticsDataConnectionProperties pr } /// Initializes a new instance of . - /// Discriminator property for DataConnectionPayload. + /// Discriminator property for DataConnectionData. /// The name of data connection. /// The type of data the data connection will transfer. /// The rate at which the data connection will receive updates. diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservationPageResult.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservationPageResult.Serialization.cs new file mode 100644 index 000000000000..0b9c4d8082ff --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservationPageResult.Serialization.cs @@ -0,0 +1,172 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class ObservationPageResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ObservationPageResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("totalElements"u8); + writer.WriteNumberValue(TotalElements); + writer.WritePropertyName("prioritySummary"u8); + writer.WriteStartObject(); + foreach (var item in PrioritySummary) + { + writer.WritePropertyName(item.Key); + writer.WriteNumberValue(item.Value); + } + writer.WriteEndObject(); + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ObservationPageResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ObservationPageResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeObservationPageResult(document.RootElement, options); + } + + internal static ObservationPageResult DeserializeObservationPageResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + long totalElements = default; + IReadOnlyDictionary prioritySummary = default; + IReadOnlyList value = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("totalElements"u8)) + { + totalElements = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("prioritySummary"u8)) + { + Dictionary dictionary = new Dictionary(); + foreach (var property0 in property.Value.EnumerateObject()) + { + dictionary.Add(property0.Name, property0.Value.GetInt32()); + } + prioritySummary = dictionary; + continue; + } + if (property.NameEquals("value"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ObservationResult.DeserializeObservationResult(item, options)); + } + value = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ObservationPageResult(totalElements, prioritySummary, value, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ObservationPageResult)} does not support writing '{options.Format}' format."); + } + } + + ObservationPageResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeObservationPageResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ObservationPageResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ObservationPageResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeObservationPageResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservationPageResult.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservationPageResult.cs new file mode 100644 index 000000000000..78d316e3b890 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservationPageResult.cs @@ -0,0 +1,89 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.Analytics.Defender.Easm +{ + /// The page result response for the observation. + public partial class ObservationPageResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The total number of elements. + /// The summary of observation counts by priority. + /// The list of observation results. + /// or is null. + internal ObservationPageResult(long totalElements, IReadOnlyDictionary prioritySummary, IEnumerable value) + { + Argument.AssertNotNull(prioritySummary, nameof(prioritySummary)); + Argument.AssertNotNull(value, nameof(value)); + + TotalElements = totalElements; + PrioritySummary = prioritySummary; + Value = value.ToList(); + } + + /// Initializes a new instance of . + /// The total number of elements. + /// The summary of observation counts by priority. + /// The list of observation results. + /// Keeps track of any properties unknown to the library. + internal ObservationPageResult(long totalElements, IReadOnlyDictionary prioritySummary, IReadOnlyList value, IDictionary serializedAdditionalRawData) + { + TotalElements = totalElements; + PrioritySummary = prioritySummary; + Value = value; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ObservationPageResult() + { + } + + /// The total number of elements. + public long TotalElements { get; } + /// The summary of observation counts by priority. + public IReadOnlyDictionary PrioritySummary { get; } + /// The list of observation results. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservationPriority.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservationPriority.cs new file mode 100644 index 000000000000..340da33eedf4 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservationPriority.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 +{ + /// A list of observation priorities. + public readonly partial struct ObservationPriority : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ObservationPriority(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string HighValue = "high"; + private const string MediumValue = "medium"; + private const string LowValue = "low"; + private const string NoneValue = "none"; + + /// high. + public static ObservationPriority High { get; } = new ObservationPriority(HighValue); + /// medium. + public static ObservationPriority Medium { get; } = new ObservationPriority(MediumValue); + /// low. + public static ObservationPriority Low { get; } = new ObservationPriority(LowValue); + /// none. + public static ObservationPriority None { get; } = new ObservationPriority(NoneValue); + /// Determines if two values are the same. + public static bool operator ==(ObservationPriority left, ObservationPriority right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ObservationPriority left, ObservationPriority right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ObservationPriority(string value) => new ObservationPriority(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ObservationPriority other && Equals(other); + /// + public bool Equals(ObservationPriority other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservationRemediationItem.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservationRemediationItem.Serialization.cs new file mode 100644 index 000000000000..8772a7aa8131 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservationRemediationItem.Serialization.cs @@ -0,0 +1,151 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class ObservationRemediationItem : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ObservationRemediationItem)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind.ToString()); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("state"u8); + writer.WriteStringValue(State.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ObservationRemediationItem IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ObservationRemediationItem)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeObservationRemediationItem(document.RootElement, options); + } + + internal static ObservationRemediationItem DeserializeObservationRemediationItem(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ObservationType kind = default; + string name = default; + ObservationRemediationState state = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = new ObservationType(property.Value.GetString()); + continue; + } + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("state"u8)) + { + state = new ObservationRemediationState(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ObservationRemediationItem(kind, name, state, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ObservationRemediationItem)} does not support writing '{options.Format}' format."); + } + } + + ObservationRemediationItem IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeObservationRemediationItem(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ObservationRemediationItem)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ObservationRemediationItem FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeObservationRemediationItem(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservationRemediationItem.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservationRemediationItem.cs new file mode 100644 index 000000000000..12dc86c1aac5 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservationRemediationItem.cs @@ -0,0 +1,87 @@ +// 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 +{ + /// This is an object that contains the observation remediation information that is used as part of the asset update. + public partial class ObservationRemediationItem + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The kind of the observation to remediate. + /// The name of the observation to remediate. + /// The state to which to update the observation. + /// is null. + public ObservationRemediationItem(ObservationType kind, string name, ObservationRemediationState state) + { + Argument.AssertNotNull(name, nameof(name)); + + Kind = kind; + Name = name; + State = state; + } + + /// Initializes a new instance of . + /// The kind of the observation to remediate. + /// The name of the observation to remediate. + /// The state to which to update the observation. + /// Keeps track of any properties unknown to the library. + internal ObservationRemediationItem(ObservationType kind, string name, ObservationRemediationState state, IDictionary serializedAdditionalRawData) + { + Kind = kind; + Name = name; + State = state; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ObservationRemediationItem() + { + } + + /// The kind of the observation to remediate. + public ObservationType Kind { get; } + /// The name of the observation to remediate. + public string Name { get; } + /// The state to which to update the observation. + public ObservationRemediationState State { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservationRemediationSource.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservationRemediationSource.cs new file mode 100644 index 000000000000..0753e543249f --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservationRemediationSource.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 +{ + /// A list of observation remediation sources. + public readonly partial struct ObservationRemediationSource : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ObservationRemediationSource(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string UserValue = "user"; + private const string SystemValue = "system"; + + /// The source of the observation state is a user. + public static ObservationRemediationSource User { get; } = new ObservationRemediationSource(UserValue); + /// The source of the observation state is the system. + public static ObservationRemediationSource System { get; } = new ObservationRemediationSource(SystemValue); + /// Determines if two values are the same. + public static bool operator ==(ObservationRemediationSource left, ObservationRemediationSource right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ObservationRemediationSource left, ObservationRemediationSource right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ObservationRemediationSource(string value) => new ObservationRemediationSource(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ObservationRemediationSource other && Equals(other); + /// + public bool Equals(ObservationRemediationSource other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservationRemediationState.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservationRemediationState.cs new file mode 100644 index 000000000000..d945499b1aef --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservationRemediationState.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 +{ + /// A list of observation states. + public readonly partial struct ObservationRemediationState : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ObservationRemediationState(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ActiveValue = "active"; + private const string NonApplicableValue = "nonApplicable"; + + /// active. + public static ObservationRemediationState Active { get; } = new ObservationRemediationState(ActiveValue); + /// nonApplicable. + public static ObservationRemediationState NonApplicable { get; } = new ObservationRemediationState(NonApplicableValue); + /// Determines if two values are the same. + public static bool operator ==(ObservationRemediationState left, ObservationRemediationState right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ObservationRemediationState left, ObservationRemediationState right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ObservationRemediationState(string value) => new ObservationRemediationState(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ObservationRemediationState other && Equals(other); + /// + public bool Equals(ObservationRemediationState other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservationResult.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservationResult.Serialization.cs new file mode 100644 index 000000000000..cc77e2cfb84d --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservationResult.Serialization.cs @@ -0,0 +1,201 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class ObservationResult : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ObservationResult)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + writer.WritePropertyName("types"u8); + writer.WriteStartArray(); + foreach (var item in Types) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + writer.WritePropertyName("priority"u8); + writer.WriteStringValue(Priority.ToString()); + writer.WritePropertyName("cvssScoreV2"u8); + writer.WriteNumberValue(CvssScoreV2); + writer.WritePropertyName("cvssScoreV3"u8); + writer.WriteNumberValue(CvssScoreV3); + writer.WritePropertyName("remediationState"u8); + writer.WriteStringValue(RemediationState.ToString()); + writer.WritePropertyName("remediationSource"u8); + writer.WriteStringValue(RemediationSource.ToString()); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ObservationResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ObservationResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeObservationResult(document.RootElement, options); + } + + internal static ObservationResult DeserializeObservationResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string name = default; + IReadOnlyList types = default; + ObservationPriority priority = default; + double cvssScoreV2 = default; + double cvssScoreV3 = default; + ObservationRemediationState remediationState = default; + ObservationRemediationSource remediationSource = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("name"u8)) + { + name = property.Value.GetString(); + continue; + } + if (property.NameEquals("types"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(new ObservationType(item.GetString())); + } + types = array; + continue; + } + if (property.NameEquals("priority"u8)) + { + priority = new ObservationPriority(property.Value.GetString()); + continue; + } + if (property.NameEquals("cvssScoreV2"u8)) + { + cvssScoreV2 = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("cvssScoreV3"u8)) + { + cvssScoreV3 = property.Value.GetDouble(); + continue; + } + if (property.NameEquals("remediationState"u8)) + { + remediationState = new ObservationRemediationState(property.Value.GetString()); + continue; + } + if (property.NameEquals("remediationSource"u8)) + { + remediationSource = new ObservationRemediationSource(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ObservationResult( + name, + types, + priority, + cvssScoreV2, + cvssScoreV3, + remediationState, + remediationSource, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ObservationResult)} does not support writing '{options.Format}' format."); + } + } + + ObservationResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeObservationResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ObservationResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ObservationResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeObservationResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservationResult.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservationResult.cs new file mode 100644 index 000000000000..bd0fe6f7bba0 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservationResult.cs @@ -0,0 +1,113 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.Analytics.Defender.Easm +{ + /// The result response for the observation. + public partial class ObservationResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The name of the observation. + /// The list of applicable types. + /// The priority of the observation. + /// The CVSS v2 score. + /// The CVSS v3 score. + /// The remediation state of the observation. + /// The source of the remediation state of the observation. + /// or is null. + internal ObservationResult(string name, IEnumerable types, ObservationPriority priority, double cvssScoreV2, double cvssScoreV3, ObservationRemediationState remediationState, ObservationRemediationSource remediationSource) + { + Argument.AssertNotNull(name, nameof(name)); + Argument.AssertNotNull(types, nameof(types)); + + Name = name; + Types = types.ToList(); + Priority = priority; + CvssScoreV2 = cvssScoreV2; + CvssScoreV3 = cvssScoreV3; + RemediationState = remediationState; + RemediationSource = remediationSource; + } + + /// Initializes a new instance of . + /// The name of the observation. + /// The list of applicable types. + /// The priority of the observation. + /// The CVSS v2 score. + /// The CVSS v3 score. + /// The remediation state of the observation. + /// The source of the remediation state of the observation. + /// Keeps track of any properties unknown to the library. + internal ObservationResult(string name, IReadOnlyList types, ObservationPriority priority, double cvssScoreV2, double cvssScoreV3, ObservationRemediationState remediationState, ObservationRemediationSource remediationSource, IDictionary serializedAdditionalRawData) + { + Name = name; + Types = types; + Priority = priority; + CvssScoreV2 = cvssScoreV2; + CvssScoreV3 = cvssScoreV3; + RemediationState = remediationState; + RemediationSource = remediationSource; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ObservationResult() + { + } + + /// The name of the observation. + public string Name { get; } + /// The list of applicable types. + public IReadOnlyList Types { get; } + /// The priority of the observation. + public ObservationPriority Priority { get; } + /// The CVSS v2 score. + public double CvssScoreV2 { get; } + /// The CVSS v3 score. + public double CvssScoreV3 { get; } + /// The remediation state of the observation. + public ObservationRemediationState RemediationState { get; } + /// The source of the remediation state of the observation. + public ObservationRemediationSource RemediationSource { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservationType.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservationType.cs new file mode 100644 index 000000000000..fce69cb9055e --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ObservationType.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 +{ + /// A list of observation types. + public readonly partial struct ObservationType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ObservationType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CveValue = "cve"; + private const string InsightValue = "insight"; + + /// common vulnerabilities and exposures. + public static ObservationType Cve { get; } = new ObservationType(CveValue); + /// insight. + public static ObservationType Insight { get; } = new ObservationType(InsightValue); + /// Determines if two values are the same. + public static bool operator ==(ObservationType left, ObservationType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ObservationType left, ObservationType right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ObservationType(string value) => new ObservationType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ObservationType other && Equals(other); + /// + public bool Equals(ObservationType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Policy.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Policy.Serialization.cs new file mode 100644 index 000000000000..83c3fd00e981 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Policy.Serialization.cs @@ -0,0 +1,263 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class Policy : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Policy)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (options.Format != "W" && Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (options.Format != "W") + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (options.Format != "W" && Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + if (Optional.IsDefined(Description)) + { + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + } + writer.WritePropertyName("filterName"u8); + writer.WriteStringValue(FilterName); + writer.WritePropertyName("action"u8); + writer.WriteStringValue(Action.ToString()); + if (options.Format != "W" && Optional.IsDefined(UpdatedAssetsCount)) + { + writer.WritePropertyName("updatedAssetsCount"u8); + writer.WriteNumberValue(UpdatedAssetsCount.Value); + } + if (options.Format != "W" && Optional.IsDefined(User)) + { + writer.WritePropertyName("user"u8); + writer.WriteStringValue(User); + } + if (options.Format != "W" && Optional.IsDefined(CreatedDate)) + { + writer.WritePropertyName("createdDate"u8); + writer.WriteStringValue(CreatedDate.Value, "O"); + } + if (options.Format != "W" && Optional.IsDefined(UpdatedDate)) + { + writer.WritePropertyName("updatedDate"u8); + writer.WriteStringValue(UpdatedDate.Value, "O"); + } + writer.WritePropertyName("actionParameters"u8); + writer.WriteObjectValue(ActionParameters, options); + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + Policy IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(Policy)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializePolicy(document.RootElement, options); + } + + internal static Policy DeserializePolicy(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + string name = default; + string displayName = default; + string description = default; + string filterName = default; + PolicyAction action = default; + long? updatedAssetsCount = default; + string user = default; + DateTimeOffset? createdDate = default; + DateTimeOffset? updatedDate = default; + ActionParameters actionParameters = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + 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("filterName"u8)) + { + filterName = property.Value.GetString(); + continue; + } + if (property.NameEquals("action"u8)) + { + action = new PolicyAction(property.Value.GetString()); + continue; + } + if (property.NameEquals("updatedAssetsCount"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + updatedAssetsCount = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("user"u8)) + { + user = 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("updatedDate"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + updatedDate = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("actionParameters"u8)) + { + actionParameters = ActionParameters.DeserializeActionParameters(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new Policy( + id, + name, + displayName, + description, + filterName, + action, + updatedAssetsCount, + user, + createdDate, + updatedDate, + actionParameters, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(Policy)} does not support writing '{options.Format}' format."); + } + } + + Policy IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializePolicy(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(Policy)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static Policy FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializePolicy(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Policy.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Policy.cs new file mode 100644 index 000000000000..a33bce6beb0d --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/Policy.cs @@ -0,0 +1,120 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Analytics.Defender.Easm +{ + /// This is an object that exists to provide a common schema definition for the policy response. + public partial class Policy + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Name of the saved filter query to be used to select assets that are to be updated by a given policy. + /// Action specifying what the policy should do. + /// Additional parameters needed to perform the policy action. + /// or is null. + public Policy(string filterName, PolicyAction action, ActionParameters actionParameters) + { + Argument.AssertNotNull(filterName, nameof(filterName)); + Argument.AssertNotNull(actionParameters, nameof(actionParameters)); + + FilterName = filterName; + Action = action; + ActionParameters = actionParameters; + } + + /// Initializes a new instance of . + /// This is typically the same as the name but might be different for different models. + /// The caller provided unique name for the resource. + /// The name that can be used for display purposes. + /// A human readable description of what the policy should do. + /// Name of the saved filter query to be used to select assets that are to be updated by a given policy. + /// Action specifying what the policy should do. + /// Number of assets in inventory that have been updated by this policy. + /// The unique name of the user that created the policy user@gmail.com. + /// The date this policy was created, in RFC3339 format. + /// The date this policy was last updated, in RFC3339 format. + /// Additional parameters needed to perform the policy action. + /// Keeps track of any properties unknown to the library. + internal Policy(string id, string name, string displayName, string description, string filterName, PolicyAction action, long? updatedAssetsCount, string user, DateTimeOffset? createdDate, DateTimeOffset? updatedDate, ActionParameters actionParameters, IDictionary serializedAdditionalRawData) + { + Id = id; + Name = name; + DisplayName = displayName; + Description = description; + FilterName = filterName; + Action = action; + UpdatedAssetsCount = updatedAssetsCount; + User = user; + CreatedDate = createdDate; + UpdatedDate = updatedDate; + ActionParameters = actionParameters; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal Policy() + { + } + + /// This is typically the same as the name but might be different for different models. + 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; } + /// A human readable description of what the policy should do. + public string Description { get; set; } + /// Name of the saved filter query to be used to select assets that are to be updated by a given policy. + public string FilterName { get; set; } + /// Action specifying what the policy should do. + public PolicyAction Action { get; set; } + /// Number of assets in inventory that have been updated by this policy. + public long? UpdatedAssetsCount { get; } + /// The unique name of the user that created the policy user@gmail.com. + public string User { get; } + /// The date this policy was created, in RFC3339 format. + public DateTimeOffset? CreatedDate { get; } + /// The date this policy was last updated, in RFC3339 format. + public DateTimeOffset? UpdatedDate { get; } + /// Additional parameters needed to perform the policy action. + public ActionParameters ActionParameters { get; set; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/PolicyAction.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/PolicyAction.cs new file mode 100644 index 000000000000..cbb4dbb1d203 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/PolicyAction.cs @@ -0,0 +1,60 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Analytics.Defender.Easm +{ + /// A list of policy actions. + public readonly partial struct PolicyAction : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public PolicyAction(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string AddResourceValue = "addResource"; + private const string RemoveResourceValue = "removeResource"; + private const string SetStateValue = "setState"; + private const string SetExternalIDValue = "setExternalID"; + private const string RemoveFromInventoryValue = "removeFromInventory"; + + /// Add a resource label with a given name. + public static PolicyAction AddResource { get; } = new PolicyAction(AddResourceValue); + /// Remove a resource label with a given name. + public static PolicyAction RemoveResource { get; } = new PolicyAction(RemoveResourceValue); + /// Set inventory state to a given supported state value. + public static PolicyAction SetState { get; } = new PolicyAction(SetStateValue); + /// Set an external id. + public static PolicyAction SetExternalID { get; } = new PolicyAction(SetExternalIDValue); + /// Remove from inventory. + public static PolicyAction RemoveFromInventory { get; } = new PolicyAction(RemoveFromInventoryValue); + /// Determines if two values are the same. + public static bool operator ==(PolicyAction left, PolicyAction right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(PolicyAction left, PolicyAction right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator PolicyAction(string value) => new PolicyAction(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is PolicyAction other && Equals(other); + /// + public bool Equals(PolicyAction other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportAssetSnapshotExportPayload.Serialization.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportAssetSnapshotExportPayload.Serialization.cs new file mode 100644 index 000000000000..cc2db6d470f7 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportAssetSnapshotExportPayload.Serialization.cs @@ -0,0 +1,174 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Analytics.Defender.Easm +{ + public partial class ReportAssetSnapshotExportPayload : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ReportAssetSnapshotExportPayload)} does not support writing '{format}' format."); + } + + writer.WriteStartObject(); + if (Optional.IsDefined(Metric)) + { + writer.WritePropertyName("metric"u8); + writer.WriteStringValue(Metric); + } + if (Optional.IsDefined(FileName)) + { + writer.WritePropertyName("fileName"u8); + writer.WriteStringValue(FileName); + } + if (Optional.IsCollectionDefined(Columns)) + { + writer.WritePropertyName("columns"u8); + writer.WriteStartArray(); + foreach (var item in Columns) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + writer.WriteEndObject(); + } + + ReportAssetSnapshotExportPayload IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ReportAssetSnapshotExportPayload)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeReportAssetSnapshotExportPayload(document.RootElement, options); + } + + internal static ReportAssetSnapshotExportPayload DeserializeReportAssetSnapshotExportPayload(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string metric = default; + string fileName = default; + IList columns = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("metric"u8)) + { + metric = property.Value.GetString(); + continue; + } + if (property.NameEquals("fileName"u8)) + { + fileName = property.Value.GetString(); + continue; + } + if (property.NameEquals("columns"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + columns = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ReportAssetSnapshotExportPayload(metric, fileName, columns ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ReportAssetSnapshotExportPayload)} does not support writing '{options.Format}' format."); + } + } + + ReportAssetSnapshotExportPayload IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data); + return DeserializeReportAssetSnapshotExportPayload(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ReportAssetSnapshotExportPayload)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ReportAssetSnapshotExportPayload FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeReportAssetSnapshotExportPayload(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportAssetSnapshotExportPayload.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportAssetSnapshotExportPayload.cs new file mode 100644 index 000000000000..afe9bdf23965 --- /dev/null +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/ReportAssetSnapshotExportPayload.cs @@ -0,0 +1,74 @@ +// 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 +{ + /// A request body used for an asset report snapshot export. + public partial class ReportAssetSnapshotExportPayload + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public ReportAssetSnapshotExportPayload() + { + Columns = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The metric to retrieve a snapshot for. + /// The filename of the exported file. + /// The columns to include in the export. + /// Keeps track of any properties unknown to the library. + internal ReportAssetSnapshotExportPayload(string metric, string fileName, IList columns, IDictionary serializedAdditionalRawData) + { + Metric = metric; + FileName = fileName; + Columns = columns; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The metric to retrieve a snapshot for. + public string Metric { get; set; } + /// The filename of the exported file. + public string FileName { get; set; } + /// The columns to include in the export. + public IList Columns { get; } + } +} diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SavedFilter.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SavedFilter.cs index a5cbd4cc4be7..a40d1041a929 100644 --- a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SavedFilter.cs +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/SavedFilter.cs @@ -51,7 +51,7 @@ internal SavedFilter() } /// Initializes a new instance of . - /// The system generated unique id for the resource. + /// This is typically the same as the name but might be different for different models. /// The caller provided unique name for the resource. /// The name that can be used for display purposes. /// @@ -67,7 +67,7 @@ internal SavedFilter(string id, string name, string displayName, string filter, _serializedAdditionalRawData = serializedAdditionalRawData; } - /// The system generated unique id for the resource. + /// This is typically the same as the name but might be different for different models. public string Id { get; } /// The caller provided unique name for the resource. public string Name { get; } diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/UnknownDataConnection.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/UnknownDataConnection.cs index 58f0f96e44a4..ba74d6e2b559 100644 --- a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/UnknownDataConnection.cs +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/UnknownDataConnection.cs @@ -15,13 +15,13 @@ internal partial class UnknownDataConnection : DataConnection { /// Initializes a new instance of . /// Discriminator property for DataConnection. - /// The system generated unique id for the resource. + /// This is typically the same as the name but might be different for different models. /// 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 day to update the data connection on. (1-7 for weekly, 1-31 for monthly). /// 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. diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/UnknownDataConnectionPayload.cs b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/UnknownDataConnectionPayload.cs index e675efb20269..a0229b61062a 100644 --- a/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/UnknownDataConnectionPayload.cs +++ b/sdk/easm/Azure.Analytics.Defender.Easm/src/Generated/UnknownDataConnectionPayload.cs @@ -14,7 +14,7 @@ namespace Azure.Analytics.Defender.Easm internal partial class UnknownDataConnectionPayload : DataConnectionPayload { /// Initializes a new instance of . - /// Discriminator property for DataConnectionPayload. + /// Discriminator property for DataConnectionData. /// The name of data connection. /// The type of data the data connection will transfer. /// The rate at which the data connection will receive updates. 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 index 437666172da9..60569ec52214 100644 --- 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 @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Collections.Generic; using System.Text.Json; using System.Threading.Tasks; using Azure.Core; @@ -32,6 +33,21 @@ public void Example_AssetResource_UpdateAssets_AssetsUpdateAssets() { contosoLabel = true, }, + remediations = new object[] + { +new +{ +name = "CVE-0000-00000", +kind = "cve", +state = "active", +}, +new +{ +name = "This is an insight", +kind = "insight", +state = "nonApplicable", +} + }, }); Response response = client.UpdateAssets("state%20%3D%20%22confirmed%22%20AND%20name%20%5E%3D%20%22contoso.com%22", content); @@ -55,6 +71,21 @@ public async Task Example_AssetResource_UpdateAssets_AssetsUpdateAssets_Async() { contosoLabel = true, }, + remediations = new object[] + { +new +{ +name = "CVE-0000-00000", +kind = "cve", +state = "active", +}, +new +{ +name = "This is an insight", +kind = "insight", +state = "nonApplicable", +} + }, }); Response response = await client.UpdateAssetsAsync("state%20%3D%20%22confirmed%22%20AND%20name%20%5E%3D%20%22contoso.com%22", content); @@ -78,6 +109,7 @@ public void Example_AssetResource_UpdateAssets_AssetsUpdateAssets_Convenience() { ["contosoLabel"] = true }, + Remediations = { new ObservationRemediationItem(ObservationType.Cve, "CVE-0000-00000", ObservationRemediationState.Active), new ObservationRemediationItem(ObservationType.Insight, "This is an insight", ObservationRemediationState.NonApplicable) }, }; Response response = client.UpdateAssets("state%20%3D%20%22confirmed%22%20AND%20name%20%5E%3D%20%22contoso.com%22", body); } @@ -98,6 +130,7 @@ public async Task Example_AssetResource_UpdateAssets_AssetsUpdateAssets_Convenie { ["contosoLabel"] = true }, + Remediations = { new ObservationRemediationItem(ObservationType.Cve, "CVE-0000-00000", ObservationRemediationState.Active), new ObservationRemediationItem(ObservationType.Insight, "This is an insight", ObservationRemediationState.NonApplicable) }, }; Response response = await client.UpdateAssetsAsync("state%20%3D%20%22confirmed%22%20AND%20name%20%5E%3D%20%22contoso.com%22", body); } @@ -154,6 +187,238 @@ public async Task Example_AssetResource_GetAssetResource_AssetsGetAssetResource_ Response response = await client.GetAssetResourceAsync("aG9zdCQkY29udG9zby5jb20"); } + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EasmClient_GetAssetsExport_AssetsGetAssetsExport() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + fileName = "ThisisaFileName", + columns = new object[] + { +"asset", +"name" + }, + }); + Response response = client.GetAssetsExport(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EasmClient_GetAssetsExport_AssetsGetAssetsExport_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + fileName = "ThisisaFileName", + columns = new object[] + { +"asset", +"name" + }, + }); + Response response = await client.GetAssetsExportAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EasmClient_GetAssetsExport_AssetsGetAssetsExport_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + AssetsExportRequest body = new AssetsExportRequest("ThisisaFileName", new string[] { "asset", "name" }); + Response response = client.GetAssetsExport(body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EasmClient_GetAssetsExport_AssetsGetAssetsExport_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + AssetsExportRequest body = new AssetsExportRequest("ThisisaFileName", new string[] { "asset", "name" }); + Response response = await client.GetAssetsExportAsync(body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EasmClient_GetObservations_AssetsGetObservations() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + Response response = client.GetObservations("aG9zdCQkY29udG9zby5jb20", null, null, null, null, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("totalElements").ToString()); + Console.WriteLine(result.GetProperty("prioritySummary").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("value")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("value")[0].GetProperty("types")[0].ToString()); + Console.WriteLine(result.GetProperty("value")[0].GetProperty("priority").ToString()); + Console.WriteLine(result.GetProperty("value")[0].GetProperty("cvssScoreV2").ToString()); + Console.WriteLine(result.GetProperty("value")[0].GetProperty("cvssScoreV3").ToString()); + Console.WriteLine(result.GetProperty("value")[0].GetProperty("remediationState").ToString()); + Console.WriteLine(result.GetProperty("value")[0].GetProperty("remediationSource").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EasmClient_GetObservations_AssetsGetObservations_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + Response response = await client.GetObservationsAsync("aG9zdCQkY29udG9zby5jb20", null, null, null, null, null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("totalElements").ToString()); + Console.WriteLine(result.GetProperty("prioritySummary").GetProperty("").ToString()); + Console.WriteLine(result.GetProperty("value")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("value")[0].GetProperty("types")[0].ToString()); + Console.WriteLine(result.GetProperty("value")[0].GetProperty("priority").ToString()); + Console.WriteLine(result.GetProperty("value")[0].GetProperty("cvssScoreV2").ToString()); + Console.WriteLine(result.GetProperty("value")[0].GetProperty("cvssScoreV3").ToString()); + Console.WriteLine(result.GetProperty("value")[0].GetProperty("remediationState").ToString()); + Console.WriteLine(result.GetProperty("value")[0].GetProperty("remediationSource").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EasmClient_GetObservations_AssetsGetObservations_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + Response response = client.GetObservations("aG9zdCQkY29udG9zby5jb20"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EasmClient_GetObservations_AssetsGetObservations_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + Response response = await client.GetObservationsAsync("aG9zdCQkY29udG9zby5jb20"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EasmClient_GetDeltaSummary_AssetsGetDeltaSummary() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + priorDays = 30, + date = "2024-03-17", + }); + Response response = client.GetDeltaSummary(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("summary").GetProperty("range").ToString()); + Console.WriteLine(result.GetProperty("summary").GetProperty("removed").ToString()); + Console.WriteLine(result.GetProperty("summary").GetProperty("added").ToString()); + Console.WriteLine(result.GetProperty("summary").GetProperty("difference").ToString()); + Console.WriteLine(result.GetProperty("summary").GetProperty("kindSummaries")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("summary").GetProperty("kindSummaries")[0].GetProperty("removed").ToString()); + Console.WriteLine(result.GetProperty("summary").GetProperty("kindSummaries")[0].GetProperty("added").ToString()); + Console.WriteLine(result.GetProperty("summary").GetProperty("kindSummaries")[0].GetProperty("difference").ToString()); + Console.WriteLine(result.GetProperty("daily")[0].GetProperty("date").ToString()); + Console.WriteLine(result.GetProperty("daily")[0].GetProperty("deltas")[0].GetProperty("count").ToString()); + Console.WriteLine(result.GetProperty("daily")[0].GetProperty("deltas")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("daily")[0].GetProperty("deltas")[0].GetProperty("removed").ToString()); + Console.WriteLine(result.GetProperty("daily")[0].GetProperty("deltas")[0].GetProperty("added").ToString()); + Console.WriteLine(result.GetProperty("daily")[0].GetProperty("deltas")[0].GetProperty("difference").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EasmClient_GetDeltaSummary_AssetsGetDeltaSummary_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + priorDays = 30, + date = "2024-03-17", + }); + Response response = await client.GetDeltaSummaryAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("summary").GetProperty("range").ToString()); + Console.WriteLine(result.GetProperty("summary").GetProperty("removed").ToString()); + Console.WriteLine(result.GetProperty("summary").GetProperty("added").ToString()); + Console.WriteLine(result.GetProperty("summary").GetProperty("difference").ToString()); + Console.WriteLine(result.GetProperty("summary").GetProperty("kindSummaries")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("summary").GetProperty("kindSummaries")[0].GetProperty("removed").ToString()); + Console.WriteLine(result.GetProperty("summary").GetProperty("kindSummaries")[0].GetProperty("added").ToString()); + Console.WriteLine(result.GetProperty("summary").GetProperty("kindSummaries")[0].GetProperty("difference").ToString()); + Console.WriteLine(result.GetProperty("daily")[0].GetProperty("date").ToString()); + Console.WriteLine(result.GetProperty("daily")[0].GetProperty("deltas")[0].GetProperty("count").ToString()); + Console.WriteLine(result.GetProperty("daily")[0].GetProperty("deltas")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("daily")[0].GetProperty("deltas")[0].GetProperty("removed").ToString()); + Console.WriteLine(result.GetProperty("daily")[0].GetProperty("deltas")[0].GetProperty("added").ToString()); + Console.WriteLine(result.GetProperty("daily")[0].GetProperty("deltas")[0].GetProperty("difference").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EasmClient_GetDeltaSummary_AssetsGetDeltaSummary_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + DeltaSummaryRequest body = new DeltaSummaryRequest + { + PriorDays = 30, + Date = "2024-03-17", + }; + Response response = client.GetDeltaSummary(body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EasmClient_GetDeltaSummary_AssetsGetDeltaSummary_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + DeltaSummaryRequest body = new DeltaSummaryRequest + { + PriorDays = 30, + Date = "2024-03-17", + }; + Response response = await client.GetDeltaSummaryAsync(body); + } + [Test] [Ignore("Only validating compilation of examples")] public void Example_EasmClient_ValidateDataConnection_DataConnectionsValidateDataConnection() @@ -420,7 +685,7 @@ public async Task Example_DataConnection_DeleteDataConnection_DataConnectionsDel [Test] [Ignore("Only validating compilation of examples")] - public void Example_EasmClient_ValidateDiscoveryGroup_DiscoveryGroupsValidateDiscoGroup() + public void Example_EasmClient_ValidateDiscoGroup_DiscoveryGroupsValidateDiscoGroup() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -428,6 +693,7 @@ public void Example_EasmClient_ValidateDiscoveryGroup_DiscoveryGroupsValidateDis using RequestContent content = RequestContent.Create(new { + name = "ThisisaDiscoGroup", description = "This is a disco group", frequencyMilliseconds = 604800000L, tier = "advanced", @@ -440,7 +706,7 @@ public void Example_EasmClient_ValidateDiscoveryGroup_DiscoveryGroupsValidateDis } }, }); - Response response = client.ValidateDiscoveryGroup(content); + Response response = client.ValidateDiscoGroup(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -448,7 +714,7 @@ public void Example_EasmClient_ValidateDiscoveryGroup_DiscoveryGroupsValidateDis [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_EasmClient_ValidateDiscoveryGroup_DiscoveryGroupsValidateDiscoGroup_Async() + public async Task Example_EasmClient_ValidateDiscoGroup_DiscoveryGroupsValidateDiscoGroup_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -456,6 +722,7 @@ public async Task Example_EasmClient_ValidateDiscoveryGroup_DiscoveryGroupsValid using RequestContent content = RequestContent.Create(new { + name = "ThisisaDiscoGroup", description = "This is a disco group", frequencyMilliseconds = 604800000L, tier = "advanced", @@ -468,7 +735,7 @@ public async Task Example_EasmClient_ValidateDiscoveryGroup_DiscoveryGroupsValid } }, }); - Response response = await client.ValidateDiscoveryGroupAsync(content); + Response response = await client.ValidateDiscoGroupAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.ToString()); @@ -476,7 +743,7 @@ public async Task Example_EasmClient_ValidateDiscoveryGroup_DiscoveryGroupsValid [Test] [Ignore("Only validating compilation of examples")] - public void Example_EasmClient_ValidateDiscoveryGroup_DiscoveryGroupsValidateDiscoGroup_Convenience() + public void Example_EasmClient_ValidateDiscoGroup_DiscoveryGroupsValidateDiscoGroup_Convenience() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -484,6 +751,7 @@ public void Example_EasmClient_ValidateDiscoveryGroup_DiscoveryGroupsValidateDis DiscoveryGroupPayload body = new DiscoveryGroupPayload { + Name = "ThisisaDiscoGroup", Description = "This is a disco group", Tier = "advanced", FrequencyMilliseconds = 604800000L, @@ -493,12 +761,12 @@ public void Example_EasmClient_ValidateDiscoveryGroup_DiscoveryGroupsValidateDis Name = "thisisatest.microsoft.com", }}, }; - Response response = client.ValidateDiscoveryGroup(body); + Response response = client.ValidateDiscoGroup(body); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_EasmClient_ValidateDiscoveryGroup_DiscoveryGroupsValidateDiscoGroup_Convenience_Async() + public async Task Example_EasmClient_ValidateDiscoGroup_DiscoveryGroupsValidateDiscoGroup_Convenience_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -506,6 +774,7 @@ public async Task Example_EasmClient_ValidateDiscoveryGroup_DiscoveryGroupsValid DiscoveryGroupPayload body = new DiscoveryGroupPayload { + Name = "ThisisaDiscoGroup", Description = "This is a disco group", Tier = "advanced", FrequencyMilliseconds = 604800000L, @@ -515,18 +784,18 @@ public async Task Example_EasmClient_ValidateDiscoveryGroup_DiscoveryGroupsValid Name = "thisisatest.microsoft.com", }}, }; - Response response = await client.ValidateDiscoveryGroupAsync(body); + Response response = await client.ValidateDiscoGroupAsync(body); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_DiscoGroup_GetDiscoveryGroup_DiscoveryGroupsGetDiscoGroup() + public void Example_DiscoGroup_GetDiscoGroup_DiscoveryGroupsGetDiscoGroup() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - Response response = client.GetDiscoveryGroup("ThisisaDiscoGroup", null); + Response response = client.GetDiscoGroup("ThisisaDiscoGroup", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -534,13 +803,13 @@ public void Example_DiscoGroup_GetDiscoveryGroup_DiscoveryGroupsGetDiscoGroup() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DiscoGroup_GetDiscoveryGroup_DiscoveryGroupsGetDiscoGroup_Async() + public async Task Example_DiscoGroup_GetDiscoGroup_DiscoveryGroupsGetDiscoGroup_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - Response response = await client.GetDiscoveryGroupAsync("ThisisaDiscoGroup", null); + Response response = await client.GetDiscoGroupAsync("ThisisaDiscoGroup", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -548,29 +817,55 @@ public async Task Example_DiscoGroup_GetDiscoveryGroup_DiscoveryGroupsGetDiscoGr [Test] [Ignore("Only validating compilation of examples")] - public void Example_DiscoGroup_GetDiscoveryGroup_DiscoveryGroupsGetDiscoGroup_Convenience() + public void Example_DiscoGroup_GetDiscoGroup_DiscoveryGroupsGetDiscoGroup_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + Response response = client.GetDiscoGroup("ThisisaDiscoGroup"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DiscoGroup_GetDiscoGroup_DiscoveryGroupsGetDiscoGroup_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + Response response = await client.GetDiscoGroupAsync("ThisisaDiscoGroup"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DiscoGroup_DeleteDiscoGroup_DiscoveryGroupsDeleteDiscoGroup() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - Response response = client.GetDiscoveryGroup("ThisisaDiscoGroup"); + Response response = client.DeleteDiscoGroup("ThisisaDiscoGroup"); + + Console.WriteLine(response.Status); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DiscoGroup_GetDiscoveryGroup_DiscoveryGroupsGetDiscoGroup_Convenience_Async() + public async Task Example_DiscoGroup_DeleteDiscoGroup_DiscoveryGroupsDeleteDiscoGroup_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - Response response = await client.GetDiscoveryGroupAsync("ThisisaDiscoGroup"); + Response response = await client.DeleteDiscoGroupAsync("ThisisaDiscoGroup"); + + Console.WriteLine(response.Status); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_DiscoGroup_CreateOrReplaceDiscoveryGroup_DiscoveryGroupsCreateOrReplaceDiscoGroup() + public void Example_DiscoGroup_CreateOrReplaceDiscoGroup_DiscoveryGroupsCreateOrReplaceDiscoGroup() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -590,7 +885,7 @@ public void Example_DiscoGroup_CreateOrReplaceDiscoveryGroup_DiscoveryGroupsCrea } }, }); - Response response = client.CreateOrReplaceDiscoveryGroup("ThisisaDiscoGroup", content); + Response response = client.CreateOrReplaceDiscoGroup("ThisisaDiscoGroup", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -598,7 +893,7 @@ public void Example_DiscoGroup_CreateOrReplaceDiscoveryGroup_DiscoveryGroupsCrea [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DiscoGroup_CreateOrReplaceDiscoveryGroup_DiscoveryGroupsCreateOrReplaceDiscoGroup_Async() + public async Task Example_DiscoGroup_CreateOrReplaceDiscoGroup_DiscoveryGroupsCreateOrReplaceDiscoGroup_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -618,7 +913,7 @@ public async Task Example_DiscoGroup_CreateOrReplaceDiscoveryGroup_DiscoveryGrou } }, }); - Response response = await client.CreateOrReplaceDiscoveryGroupAsync("ThisisaDiscoGroup", content); + Response response = await client.CreateOrReplaceDiscoGroupAsync("ThisisaDiscoGroup", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -626,7 +921,7 @@ public async Task Example_DiscoGroup_CreateOrReplaceDiscoveryGroup_DiscoveryGrou [Test] [Ignore("Only validating compilation of examples")] - public void Example_DiscoGroup_CreateOrReplaceDiscoveryGroup_DiscoveryGroupsCreateOrReplaceDiscoGroup_Convenience() + public void Example_DiscoGroup_CreateOrReplaceDiscoGroup_DiscoveryGroupsCreateOrReplaceDiscoGroup_Convenience() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -643,12 +938,12 @@ public void Example_DiscoGroup_CreateOrReplaceDiscoveryGroup_DiscoveryGroupsCrea Name = "thisisatest.microsoft.com", }}, }; - Response response = client.CreateOrReplaceDiscoveryGroup("ThisisaDiscoGroup", body); + Response response = client.CreateOrReplaceDiscoGroup("ThisisaDiscoGroup", body); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DiscoGroup_CreateOrReplaceDiscoveryGroup_DiscoveryGroupsCreateOrReplaceDiscoGroup_Convenience_Async() + public async Task Example_DiscoGroup_CreateOrReplaceDiscoGroup_DiscoveryGroupsCreateOrReplaceDiscoGroup_Convenience_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); @@ -665,221 +960,365 @@ public async Task Example_DiscoGroup_CreateOrReplaceDiscoveryGroup_DiscoveryGrou Name = "thisisatest.microsoft.com", }}, }; - Response response = await client.CreateOrReplaceDiscoveryGroupAsync("ThisisaDiscoGroup", body); + Response response = await client.CreateOrReplaceDiscoGroupAsync("ThisisaDiscoGroup", body); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_EasmClient_RunDiscoveryGroup_DiscoveryGroupsRunDiscoGroup() + public void Example_EasmClient_RunDiscoGroup_DiscoveryGroupsRunDiscoGroup() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - Response response = client.RunDiscoveryGroup("ThisisaDiscoGroup"); + Response response = client.RunDiscoGroup("ThisisaDiscoGroup"); Console.WriteLine(response.Status); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_EasmClient_RunDiscoveryGroup_DiscoveryGroupsRunDiscoGroup_Async() + public async Task Example_EasmClient_RunDiscoGroup_DiscoveryGroupsRunDiscoGroup_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - Response response = await client.RunDiscoveryGroupAsync("ThisisaDiscoGroup"); + Response response = await client.RunDiscoGroupAsync("ThisisaDiscoGroup"); Console.WriteLine(response.Status); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_DiscoTemplate_GetDiscoveryTemplate_DiscoveryTemplatesGetDiscoTemplate() + public void Example_EasmClient_GetAssetChainSummary_DiscoveryGroupsGetAssetChainSummary() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - Response response = client.GetDiscoveryTemplate("12345", null); + using RequestContent content = RequestContent.Create(new + { + assetChainSource = "ASSET", + sourceIds = new object[] + { +"DOMAIN$$contoso.com" + }, + }); + Response response = client.GetAssetChainSummary(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("affectedAssetsSummary")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("affectedAssetsSummary")[0].GetProperty("affectedCount").ToString()); + Console.WriteLine(result.GetProperty("affectedGroupsSummary")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("affectedGroupsSummary")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("affectedGroupsSummary")[0].GetProperty("displayName").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DiscoTemplate_GetDiscoveryTemplate_DiscoveryTemplatesGetDiscoTemplate_Async() + public async Task Example_EasmClient_GetAssetChainSummary_DiscoveryGroupsGetAssetChainSummary_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - Response response = await client.GetDiscoveryTemplateAsync("12345", null); + using RequestContent content = RequestContent.Create(new + { + assetChainSource = "ASSET", + sourceIds = new object[] + { +"DOMAIN$$contoso.com" + }, + }); + Response response = await client.GetAssetChainSummaryAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("affectedAssetsSummary")[0].GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("affectedAssetsSummary")[0].GetProperty("affectedCount").ToString()); + Console.WriteLine(result.GetProperty("affectedGroupsSummary")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("affectedGroupsSummary")[0].GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("affectedGroupsSummary")[0].GetProperty("displayName").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_DiscoTemplate_GetDiscoveryTemplate_DiscoveryTemplatesGetDiscoTemplate_Convenience() + public void Example_EasmClient_GetAssetChainSummary_DiscoveryGroupsGetAssetChainSummary_Convenience() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - Response response = client.GetDiscoveryTemplate("12345"); + AssetChainRequest body = new AssetChainRequest(AssetChainSource.ASSET, new string[] { "DOMAIN$$contoso.com" }); + Response response = client.GetAssetChainSummary(body); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DiscoTemplate_GetDiscoveryTemplate_DiscoveryTemplatesGetDiscoTemplate_Convenience_Async() + public async Task Example_EasmClient_GetAssetChainSummary_DiscoveryGroupsGetAssetChainSummary_Convenience_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - Response response = await client.GetDiscoveryTemplateAsync("12345"); + AssetChainRequest body = new AssetChainRequest(AssetChainSource.ASSET, new string[] { "DOMAIN$$contoso.com" }); + Response response = await client.GetAssetChainSummaryAsync(body); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_EasmClient_GetBillable_ReportsGetBillable() + public void Example_EasmClient_DismissAssetChain_DiscoveryGroupsDismissAssetChain() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - Response response = client.GetBillable(null); + using RequestContent content = RequestContent.Create(new + { + assetChainSource = "ASSET", + sourceIds = new object[] + { +"DOMAIN$$contoso.com" + }, + }); + Response response = client.DismissAssetChain(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_EasmClient_GetBillable_ReportsGetBillable_Async() + public async Task Example_EasmClient_DismissAssetChain_DiscoveryGroupsDismissAssetChain_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - Response response = await client.GetBillableAsync(null); + using RequestContent content = RequestContent.Create(new + { + assetChainSource = "ASSET", + sourceIds = new object[] + { +"DOMAIN$$contoso.com" + }, + }); + Response response = await client.DismissAssetChainAsync(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_EasmClient_GetBillable_ReportsGetBillable_Convenience() + public void Example_EasmClient_DismissAssetChain_DiscoveryGroupsDismissAssetChain_Convenience() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - Response response = client.GetBillable(); + AssetChainRequest body = new AssetChainRequest(AssetChainSource.ASSET, new string[] { "DOMAIN$$contoso.com" }); + Response response = client.DismissAssetChain(body); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_EasmClient_GetBillable_ReportsGetBillable_Convenience_Async() + public async Task Example_EasmClient_DismissAssetChain_DiscoveryGroupsDismissAssetChain_Convenience_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - Response response = await client.GetBillableAsync(); + AssetChainRequest body = new AssetChainRequest(AssetChainSource.ASSET, new string[] { "DOMAIN$$contoso.com" }); + Response response = await client.DismissAssetChainAsync(body); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_EasmClient_GetSnapshot_ReportsGetSnapshot() + public void Example_DiscoTemplate_GetDiscoTemplate_DiscoveryTemplatesGetDiscoTemplate() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - metric = "site_status_active", - page = 0, - size = 5, - }); - Response response = client.GetSnapshot(content); + Response response = client.GetDiscoTemplate("12345", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_EasmClient_GetSnapshot_ReportsGetSnapshot_Async() + public async Task Example_DiscoTemplate_GetDiscoTemplate_DiscoveryTemplatesGetDiscoTemplate_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - metric = "site_status_active", - page = 0, - size = 5, - }); - Response response = await client.GetSnapshotAsync(content); + Response response = await client.GetDiscoTemplateAsync("12345", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_EasmClient_GetSnapshot_ReportsGetSnapshot_Convenience() + public void Example_DiscoTemplate_GetDiscoTemplate_DiscoveryTemplatesGetDiscoTemplate_Convenience() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - ReportAssetSnapshotPayload body = new ReportAssetSnapshotPayload - { - Metric = "site_status_active", - Size = 5, - Page = 0, - }; - Response response = client.GetSnapshot(body); + Response response = client.GetDiscoTemplate("12345"); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_EasmClient_GetSnapshot_ReportsGetSnapshot_Convenience_Async() + public async Task Example_DiscoTemplate_GetDiscoTemplate_DiscoveryTemplatesGetDiscoTemplate_Convenience_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - ReportAssetSnapshotPayload body = new ReportAssetSnapshotPayload - { - Metric = "site_status_active", - Size = 5, - Page = 0, - }; - Response response = await client.GetSnapshotAsync(body); + Response response = await client.GetDiscoTemplateAsync("12345"); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_EasmClient_GetSummary_ReportsGetSummary() + public void Example_EasmClient_GetBillable_ReportsGetBillable() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - filters = new object[] - { + 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 Task Example_EasmClient_GetBillable_ReportsGetBillable_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_EasmClient_GetBillable_ReportsGetBillable_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 Task Example_EasmClient_GetBillable_ReportsGetBillable_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_EasmClient_GetSnapshot_ReportsGetSnapshot() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + metric = "site_status_active", + page = 0, + size = 5, + }); + 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 Task Example_EasmClient_GetSnapshot_ReportsGetSnapshot_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + metric = "site_status_active", + page = 0, + size = 5, + }); + 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_EasmClient_GetSnapshot_ReportsGetSnapshot_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + ReportAssetSnapshotPayload body = new ReportAssetSnapshotPayload + { + Metric = "site_status_active", + Size = 5, + Page = 0, + }; + Response response = client.GetSnapshot(body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EasmClient_GetSnapshot_ReportsGetSnapshot_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + ReportAssetSnapshotPayload body = new ReportAssetSnapshotPayload + { + Metric = "site_status_active", + Size = 5, + Page = 0, + }; + Response response = await client.GetSnapshotAsync(body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EasmClient_GetSummary_ReportsGetSummary() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + filters = new object[] + { "state = \"confirmed\" AND kind = \"domain\"", "state = \"confirmed\" AND kind = \"host\"", "state = \"confirmed\" AND kind = \"page\"" @@ -888,354 +1327,868 @@ public void Example_EasmClient_GetSummary_ReportsGetSummary() Response response = client.GetSummary(content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result.ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EasmClient_GetSummary_ReportsGetSummary_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + filters = new object[] + { +"state = \"confirmed\" AND kind = \"domain\"", +"state = \"confirmed\" AND kind = \"host\"", +"state = \"confirmed\" AND kind = \"page\"" + }, + }); + 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_EasmClient_GetSummary_ReportsGetSummary_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + ReportAssetSummaryPayload body = new ReportAssetSummaryPayload + { + Filters = { "state = \"confirmed\" AND kind = \"domain\"", "state = \"confirmed\" AND kind = \"host\"", "state = \"confirmed\" AND kind = \"page\"" }, + }; + Response response = client.GetSummary(body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EasmClient_GetSummary_ReportsGetSummary_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + ReportAssetSummaryPayload body = new ReportAssetSummaryPayload + { + Filters = { "state = \"confirmed\" AND kind = \"domain\"", "state = \"confirmed\" AND kind = \"host\"", "state = \"confirmed\" AND kind = \"page\"" }, + }; + Response response = await client.GetSummaryAsync(body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EasmClient_GetSnapshotExport_ReportsGetSnapshotExport() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + metric = "ThisisaMetricName", + fileName = "exportedFileName", + columns = new object[] + { +"Column1", +"Column2", +"Column3" + }, + }); + Response response = client.GetSnapshotExport(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EasmClient_GetSnapshotExport_ReportsGetSnapshotExport_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + metric = "ThisisaMetricName", + fileName = "exportedFileName", + columns = new object[] + { +"Column1", +"Column2", +"Column3" + }, + }); + Response response = await client.GetSnapshotExportAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EasmClient_GetSnapshotExport_ReportsGetSnapshotExport_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + ReportAssetSnapshotExportPayload body = new ReportAssetSnapshotExportPayload + { + Metric = "ThisisaMetricName", + FileName = "exportedFileName", + Columns = { "Column1", "Column2", "Column3" }, + }; + Response response = client.GetSnapshotExport(body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EasmClient_GetSnapshotExport_ReportsGetSnapshotExport_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + ReportAssetSnapshotExportPayload body = new ReportAssetSnapshotExportPayload + { + Metric = "ThisisaMetricName", + FileName = "exportedFileName", + Columns = { "Column1", "Column2", "Column3" }, + }; + Response response = await client.GetSnapshotExportAsync(body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_SavedFilter_GetSavedFilter_SavedFiltersGetSavedFilter() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + Response response = client.GetSavedFilter("ThisisaSavedFilter", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_SavedFilter_GetSavedFilter_SavedFiltersGetSavedFilter_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + Response response = await client.GetSavedFilterAsync("ThisisaSavedFilter", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_SavedFilter_GetSavedFilter_SavedFiltersGetSavedFilter_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + Response response = client.GetSavedFilter("ThisisaSavedFilter"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_SavedFilter_GetSavedFilter_SavedFiltersGetSavedFilter_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + Response response = await client.GetSavedFilterAsync("ThisisaSavedFilter"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_SavedFilter_CreateOrReplaceSavedFilter_SavedFiltersCreateOrReplaceSavedFilter() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + filter = "state IN (\"confirmed\")", + description = "This is a saved filter", + }); + Response response = client.CreateOrReplaceSavedFilter("ThisisaSavedFilter", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_SavedFilter_CreateOrReplaceSavedFilter_SavedFiltersCreateOrReplaceSavedFilter_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + filter = "state IN (\"confirmed\")", + description = "This is a saved filter", + }); + Response response = await client.CreateOrReplaceSavedFilterAsync("ThisisaSavedFilter", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_SavedFilter_CreateOrReplaceSavedFilter_SavedFiltersCreateOrReplaceSavedFilter_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + SavedFilterPayload body = new SavedFilterPayload("state IN (\"confirmed\")", "This is a saved filter"); + Response response = client.CreateOrReplaceSavedFilter("ThisisaSavedFilter", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_SavedFilter_CreateOrReplaceSavedFilter_SavedFiltersCreateOrReplaceSavedFilter_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + SavedFilterPayload body = new SavedFilterPayload("state IN (\"confirmed\")", "This is a saved filter"); + Response response = await client.CreateOrReplaceSavedFilterAsync("ThisisaSavedFilter", body); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_SavedFilter_DeleteSavedFilter_SavedFiltersDeleteSavedFilter() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + Response response = client.DeleteSavedFilter("ThisisaSavedFilter"); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_SavedFilter_DeleteSavedFilter_SavedFiltersDeleteSavedFilter_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + Response response = await client.DeleteSavedFilterAsync("ThisisaSavedFilter"); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Task_GetTask_TasksGetTask() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + Response response = client.GetTask("ThisisaTaskId", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Task_GetTask_TasksGetTask_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + Response response = await client.GetTaskAsync("ThisisaTaskId", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Task_GetTask_TasksGetTask_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + Response response = client.GetTask("ThisisaTaskId"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Task_GetTask_TasksGetTask_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + Response response = await client.GetTaskAsync("ThisisaTaskId"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EasmClient_CancelTask_TasksCancelTask() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + Response response = client.CancelTask("ThisisaTaskId", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EasmClient_CancelTask_TasksCancelTask_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + Response response = await client.CancelTaskAsync("ThisisaTaskId", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EasmClient_CancelTask_TasksCancelTask_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + Response response = client.CancelTask("ThisisaTaskId"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EasmClient_CancelTask_TasksCancelTask_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + Response response = await client.CancelTaskAsync("ThisisaTaskId"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EasmClient_RunTask_TasksRunTask() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + Response response = client.RunTask("ThisisaTaskId", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EasmClient_RunTask_TasksRunTask_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + Response response = await client.RunTaskAsync("ThisisaTaskId", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EasmClient_RunTask_TasksRunTask_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + Response response = client.RunTask("ThisisaTaskId"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_EasmClient_RunTask_TasksRunTask_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + Response response = await client.RunTaskAsync("ThisisaTaskId"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_EasmClient_DownloadTask_TasksDownloadTask() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + Response response = client.DownloadTask("ThisisaTaskId", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_EasmClient_GetSummary_ReportsGetSummary_Async() + public async Task Example_EasmClient_DownloadTask_TasksDownloadTask_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - filters = new object[] - { -"state = \"confirmed\" AND kind = \"domain\"", -"state = \"confirmed\" AND kind = \"host\"", -"state = \"confirmed\" AND kind = \"page\"" - }, - }); - Response response = await client.GetSummaryAsync(content); + Response response = await client.DownloadTaskAsync("ThisisaTaskId", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_EasmClient_GetSummary_ReportsGetSummary_Convenience() + public void Example_EasmClient_DownloadTask_TasksDownloadTask_Convenience() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - ReportAssetSummaryPayload body = new ReportAssetSummaryPayload - { - Filters = { "state = \"confirmed\" AND kind = \"domain\"", "state = \"confirmed\" AND kind = \"host\"", "state = \"confirmed\" AND kind = \"page\"" }, - }; - Response response = client.GetSummary(body); + Response response = client.DownloadTask("ThisisaTaskId"); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_EasmClient_GetSummary_ReportsGetSummary_Convenience_Async() + public async Task Example_EasmClient_DownloadTask_TasksDownloadTask_Convenience_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - ReportAssetSummaryPayload body = new ReportAssetSummaryPayload - { - Filters = { "state = \"confirmed\" AND kind = \"domain\"", "state = \"confirmed\" AND kind = \"host\"", "state = \"confirmed\" AND kind = \"page\"" }, - }; - Response response = await client.GetSummaryAsync(body); + Response response = await client.DownloadTaskAsync("ThisisaTaskId"); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_SavedFilter_GetSavedFilter_SavedFiltersGetSavedFilter() + public void Example_CisaCveResult_GetCisaCve_CisaCvesGetCisaCve() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - Response response = client.GetSavedFilter("ThisisaSavedFilter", null); + Response response = client.GetCisaCve("CVE-2021-40438", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("cveId").ToString()); + Console.WriteLine(result.GetProperty("vendorProject").ToString()); + Console.WriteLine(result.GetProperty("product").ToString()); + Console.WriteLine(result.GetProperty("vulnerabilityName").ToString()); + Console.WriteLine(result.GetProperty("shortDescription").ToString()); + Console.WriteLine(result.GetProperty("requiredAction").ToString()); + Console.WriteLine(result.GetProperty("notes").ToString()); + Console.WriteLine(result.GetProperty("dateAdded").ToString()); + Console.WriteLine(result.GetProperty("dueDate").ToString()); + Console.WriteLine(result.GetProperty("updatedAt").ToString()); + Console.WriteLine(result.GetProperty("count").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_SavedFilter_GetSavedFilter_SavedFiltersGetSavedFilter_Async() + public async Task Example_CisaCveResult_GetCisaCve_CisaCvesGetCisaCve_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - Response response = await client.GetSavedFilterAsync("ThisisaSavedFilter", null); + Response response = await client.GetCisaCveAsync("CVE-2021-40438", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("cveId").ToString()); + Console.WriteLine(result.GetProperty("vendorProject").ToString()); + Console.WriteLine(result.GetProperty("product").ToString()); + Console.WriteLine(result.GetProperty("vulnerabilityName").ToString()); + Console.WriteLine(result.GetProperty("shortDescription").ToString()); + Console.WriteLine(result.GetProperty("requiredAction").ToString()); + Console.WriteLine(result.GetProperty("notes").ToString()); + Console.WriteLine(result.GetProperty("dateAdded").ToString()); + Console.WriteLine(result.GetProperty("dueDate").ToString()); + Console.WriteLine(result.GetProperty("updatedAt").ToString()); + Console.WriteLine(result.GetProperty("count").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_SavedFilter_GetSavedFilter_SavedFiltersGetSavedFilter_Convenience() + public void Example_CisaCveResult_GetCisaCve_CisaCvesGetCisaCve_Convenience() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - Response response = client.GetSavedFilter("ThisisaSavedFilter"); + Response response = client.GetCisaCve("CVE-2021-40438"); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_SavedFilter_GetSavedFilter_SavedFiltersGetSavedFilter_Convenience_Async() + public async Task Example_CisaCveResult_GetCisaCve_CisaCvesGetCisaCve_Convenience_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - Response response = await client.GetSavedFilterAsync("ThisisaSavedFilter"); + Response response = await client.GetCisaCveAsync("CVE-2021-40438"); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_SavedFilter_CreateOrReplaceSavedFilter_SavedFiltersCreateOrReplaceSavedFilter() + public void Example_Policy_GetPolicy_PoliciesGetPolicy() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - filter = "state IN (\"confirmed\")", - description = "This is a saved filter", - }); - Response response = client.CreateOrReplaceSavedFilter("ThisisaSavedFilter", content); + Response response = client.GetPolicy("ThisisaPolicy", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("filterName").ToString()); + Console.WriteLine(result.GetProperty("action").ToString()); + Console.WriteLine(result.GetProperty("actionParameters").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_SavedFilter_CreateOrReplaceSavedFilter_SavedFiltersCreateOrReplaceSavedFilter_Async() + public async Task Example_Policy_GetPolicy_PoliciesGetPolicy_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - using RequestContent content = RequestContent.Create(new - { - filter = "state IN (\"confirmed\")", - description = "This is a saved filter", - }); - Response response = await client.CreateOrReplaceSavedFilterAsync("ThisisaSavedFilter", content); + Response response = await client.GetPolicyAsync("ThisisaPolicy", null); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("filterName").ToString()); + Console.WriteLine(result.GetProperty("action").ToString()); + Console.WriteLine(result.GetProperty("actionParameters").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_SavedFilter_CreateOrReplaceSavedFilter_SavedFiltersCreateOrReplaceSavedFilter_Convenience() + public void Example_Policy_GetPolicy_PoliciesGetPolicy_Convenience() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - SavedFilterPayload body = new SavedFilterPayload("state IN (\"confirmed\")", "This is a saved filter"); - Response response = client.CreateOrReplaceSavedFilter("ThisisaSavedFilter", body); + Response response = client.GetPolicy("ThisisaPolicy"); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_SavedFilter_CreateOrReplaceSavedFilter_SavedFiltersCreateOrReplaceSavedFilter_Convenience_Async() + public async Task Example_Policy_GetPolicy_PoliciesGetPolicy_Convenience_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - SavedFilterPayload body = new SavedFilterPayload("state IN (\"confirmed\")", "This is a saved filter"); - Response response = await client.CreateOrReplaceSavedFilterAsync("ThisisaSavedFilter", body); + Response response = await client.GetPolicyAsync("ThisisaPolicy"); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_SavedFilter_DeleteSavedFilter_SavedFiltersDeleteSavedFilter() + public void Example_Policy_DeletePolicy_PoliciesDeletePolicy() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - Response response = client.DeleteSavedFilter("ThisisaSavedFilter"); + Response response = client.DeletePolicy("ThisisaPolicy"); Console.WriteLine(response.Status); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_SavedFilter_DeleteSavedFilter_SavedFiltersDeleteSavedFilter_Async() + public async Task Example_Policy_DeletePolicy_PoliciesDeletePolicy_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - Response response = await client.DeleteSavedFilterAsync("ThisisaSavedFilter"); + Response response = await client.DeletePolicyAsync("ThisisaPolicy"); Console.WriteLine(response.Status); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_Task_GetTask_TasksGetTask() + public void Example_Policy_CreateOrReplacePolicy_PoliciesCreateOrReplacePolicy() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - Response response = client.GetTask("ThisisaTaskId", null); + using RequestContent content = RequestContent.Create(new + { + filterName = "ThisisaFilter", + description = "This is a policy", + action = "setState", + actionParameters = new + { + value = "confirmed", + }, + }); + Response response = client.CreateOrReplacePolicy("ThisisaPolicy", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("filterName").ToString()); + Console.WriteLine(result.GetProperty("action").ToString()); + Console.WriteLine(result.GetProperty("actionParameters").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_Task_GetTask_TasksGetTask_Async() + public async Task Example_Policy_CreateOrReplacePolicy_PoliciesCreateOrReplacePolicy_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - Response response = await client.GetTaskAsync("ThisisaTaskId", null); + using RequestContent content = RequestContent.Create(new + { + filterName = "ThisisaFilter", + description = "This is a policy", + action = "setState", + actionParameters = new + { + value = "confirmed", + }, + }); + Response response = await client.CreateOrReplacePolicyAsync("ThisisaPolicy", content); JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("filterName").ToString()); + Console.WriteLine(result.GetProperty("action").ToString()); + Console.WriteLine(result.GetProperty("actionParameters").ToString()); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_Task_GetTask_TasksGetTask_Convenience() + public void Example_Policy_CreateOrReplacePolicy_PoliciesCreateOrReplacePolicy_Convenience() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - Response response = client.GetTask("ThisisaTaskId"); + Policy body = new Policy("ThisisaFilter", PolicyAction.SetState, new ActionParameters + { + Value = "confirmed", + }) + { + Description = "This is a policy", + }; + Response response = client.CreateOrReplacePolicy("ThisisaPolicy", body); } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_Task_GetTask_TasksGetTask_Convenience_Async() + public async Task Example_Policy_CreateOrReplacePolicy_PoliciesCreateOrReplacePolicy_Convenience_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - Response response = await client.GetTaskAsync("ThisisaTaskId"); + Policy body = new Policy("ThisisaFilter", PolicyAction.SetState, new ActionParameters + { + Value = "confirmed", + }) + { + Description = "This is a policy", + }; + Response response = await client.CreateOrReplacePolicyAsync("ThisisaPolicy", body); } [Test] [Ignore("Only validating compilation of examples")] - public void Example_EasmClient_CancelTask_TasksCancelTask() + public void Example_AssetResource_GetAssetResources_AssetsListAssetResource() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - Response response = client.CancelTask("ThisisaTaskId", null); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); + foreach (BinaryData item in client.GetAssetResources("state%20%3D%20%22confirmed%22", null, 0, 5, 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 Task Example_EasmClient_CancelTask_TasksCancelTask_Async() + public async Task Example_AssetResource_GetAssetResources_AssetsListAssetResource_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - Response response = await client.CancelTaskAsync("ThisisaTaskId", null); - - JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); + await foreach (BinaryData item in client.GetAssetResourcesAsync("state%20%3D%20%22confirmed%22", null, 0, 5, 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_EasmClient_CancelTask_TasksCancelTask_Convenience() + public void Example_AssetResource_GetAssetResources_AssetsListAssetResource_Convenience() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - Response response = client.CancelTask("ThisisaTaskId"); + foreach (AssetResource item in client.GetAssetResources()) + { + } } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_EasmClient_CancelTask_TasksCancelTask_Convenience_Async() + public async Task Example_AssetResource_GetAssetResources_AssetsListAssetResource_Convenience_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - Response response = await client.CancelTaskAsync("ThisisaTaskId"); + await foreach (AssetResource item in client.GetAssetResourcesAsync()) + { + } } [Test] [Ignore("Only validating compilation of examples")] - public void Example_AssetResource_GetAssetResources_AssetsListAssetResource() + public void Example_EasmClient_GetDeltaDetails_AssetsGetDeltaDetails() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - foreach (BinaryData item in client.GetAssetResources("state%20%3D%20%22confirmed%22", null, 0, 5, null, null)) + using RequestContent content = RequestContent.Create(new + { + deltaDetailType = "added", + priorDays = 30, + kind = "domain", + date = "2024-03-17", + }); + foreach (BinaryData item in client.GetDeltaDetails(content)) { 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("createdAt").ToString()); + Console.WriteLine(result.GetProperty("updatedAt").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); } } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_AssetResource_GetAssetResources_AssetsListAssetResource_Async() + public async Task Example_EasmClient_GetDeltaDetails_AssetsGetDeltaDetails_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - await foreach (BinaryData item in client.GetAssetResourcesAsync("state%20%3D%20%22confirmed%22", null, 0, 5, null, null)) + using RequestContent content = RequestContent.Create(new + { + deltaDetailType = "added", + priorDays = 30, + kind = "domain", + date = "2024-03-17", + }); + await foreach (BinaryData item in client.GetDeltaDetailsAsync(content)) { 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("createdAt").ToString()); + Console.WriteLine(result.GetProperty("updatedAt").ToString()); + Console.WriteLine(result.GetProperty("state").ToString()); } } [Test] [Ignore("Only validating compilation of examples")] - public void Example_AssetResource_GetAssetResources_AssetsListAssetResource_Convenience() + public void Example_EasmClient_GetDeltaDetails_AssetsGetDeltaDetails_Convenience() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - foreach (AssetResource item in client.GetAssetResources()) + DeltaDetailsRequest body = new DeltaDetailsRequest(DeltaDetailType.Added, GlobalAssetType.Domain) + { + PriorDays = 30, + Date = "2024-03-17", + }; + foreach (DeltaResult item in client.GetDeltaDetails(body)) { } } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_AssetResource_GetAssetResources_AssetsListAssetResource_Convenience_Async() + public async Task Example_EasmClient_GetDeltaDetails_AssetsGetDeltaDetails_Convenience_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - await foreach (AssetResource item in client.GetAssetResourcesAsync()) + DeltaDetailsRequest body = new DeltaDetailsRequest(DeltaDetailType.Added, GlobalAssetType.Domain) + { + PriorDays = 30, + Date = "2024-03-17", + }; + await foreach (DeltaResult item in client.GetDeltaDetailsAsync(body)) { } } @@ -1300,13 +2253,13 @@ public async Task Example_DataConnection_GetDataConnections_DataConnectionsListD [Test] [Ignore("Only validating compilation of examples")] - public void Example_DiscoGroup_GetDiscoveryGroups_DiscoveryGroupsListDiscoGroup() + public void Example_DiscoGroup_GetDiscoGroups_DiscoveryGroupsListDiscoGroup() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - foreach (BinaryData item in client.GetDiscoveryGroups(null, null, null, null)) + foreach (BinaryData item in client.GetDiscoGroups(null, null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -1315,13 +2268,13 @@ public void Example_DiscoGroup_GetDiscoveryGroups_DiscoveryGroupsListDiscoGroup( [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DiscoGroup_GetDiscoveryGroups_DiscoveryGroupsListDiscoGroup_Async() + public async Task Example_DiscoGroup_GetDiscoGroups_DiscoveryGroupsListDiscoGroup_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - await foreach (BinaryData item in client.GetDiscoveryGroupsAsync(null, null, null, null)) + await foreach (BinaryData item in client.GetDiscoGroupsAsync(null, null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("name").ToString()); @@ -1330,39 +2283,39 @@ public async Task Example_DiscoGroup_GetDiscoveryGroups_DiscoveryGroupsListDisco [Test] [Ignore("Only validating compilation of examples")] - public void Example_DiscoGroup_GetDiscoveryGroups_DiscoveryGroupsListDiscoGroup_Convenience() + public void Example_DiscoGroup_GetDiscoGroups_DiscoveryGroupsListDiscoGroup_Convenience() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - foreach (DiscoveryGroup item in client.GetDiscoveryGroups()) + foreach (DiscoveryGroup item in client.GetDiscoGroups()) { } } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DiscoGroup_GetDiscoveryGroups_DiscoveryGroupsListDiscoGroup_Convenience_Async() + public async Task Example_DiscoGroup_GetDiscoGroups_DiscoveryGroupsListDiscoGroup_Convenience_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - await foreach (DiscoveryGroup item in client.GetDiscoveryGroupsAsync()) + await foreach (DiscoveryGroup item in client.GetDiscoGroupsAsync()) { } } [Test] [Ignore("Only validating compilation of examples")] - public void Example_EasmClient_GetDiscoveryGroupRuns_DiscoveryGroupsListRuns() + public void Example_EasmClient_GetRuns_DiscoveryGroupsListRuns() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - foreach (BinaryData item in client.GetDiscoveryGroupRuns("ThisisaDiscoGroup", null, null, null, null)) + foreach (BinaryData item in client.GetRuns("ThisisaDiscoGroup", null, null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.ToString()); @@ -1371,13 +2324,13 @@ public void Example_EasmClient_GetDiscoveryGroupRuns_DiscoveryGroupsListRuns() [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_EasmClient_GetDiscoveryGroupRuns_DiscoveryGroupsListRuns_Async() + public async Task Example_EasmClient_GetRuns_DiscoveryGroupsListRuns_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - await foreach (BinaryData item in client.GetDiscoveryGroupRunsAsync("ThisisaDiscoGroup", null, null, null, null)) + await foreach (BinaryData item in client.GetRunsAsync("ThisisaDiscoGroup", null, null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.ToString()); @@ -1386,39 +2339,39 @@ public async Task Example_EasmClient_GetDiscoveryGroupRuns_DiscoveryGroupsListRu [Test] [Ignore("Only validating compilation of examples")] - public void Example_EasmClient_GetDiscoveryGroupRuns_DiscoveryGroupsListRuns_Convenience() + public void Example_EasmClient_GetRuns_DiscoveryGroupsListRuns_Convenience() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - foreach (DiscoveryRunResult item in client.GetDiscoveryGroupRuns("ThisisaDiscoGroup")) + foreach (DiscoveryRunResult item in client.GetRuns("ThisisaDiscoGroup")) { } } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_EasmClient_GetDiscoveryGroupRuns_DiscoveryGroupsListRuns_Convenience_Async() + public async Task Example_EasmClient_GetRuns_DiscoveryGroupsListRuns_Convenience_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - await foreach (DiscoveryRunResult item in client.GetDiscoveryGroupRunsAsync("ThisisaDiscoGroup")) + await foreach (DiscoveryRunResult item in client.GetRunsAsync("ThisisaDiscoGroup")) { } } [Test] [Ignore("Only validating compilation of examples")] - public void Example_DiscoTemplate_GetDiscoveryTemplates_DiscoveryTemplatesListDiscoTemplate() + public void Example_DiscoTemplate_GetDiscoTemplates_DiscoveryTemplatesListDiscoTemplate() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - foreach (BinaryData item in client.GetDiscoveryTemplates(null, null, null, null)) + foreach (BinaryData item in client.GetDiscoTemplates(null, null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -1427,13 +2380,13 @@ public void Example_DiscoTemplate_GetDiscoveryTemplates_DiscoveryTemplatesListDi [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DiscoTemplate_GetDiscoveryTemplates_DiscoveryTemplatesListDiscoTemplate_Async() + public async Task Example_DiscoTemplate_GetDiscoTemplates_DiscoveryTemplatesListDiscoTemplate_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - await foreach (BinaryData item in client.GetDiscoveryTemplatesAsync(null, null, null, null)) + await foreach (BinaryData item in client.GetDiscoTemplatesAsync(null, null, null, null)) { JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; Console.WriteLine(result.GetProperty("id").ToString()); @@ -1442,26 +2395,26 @@ public async Task Example_DiscoTemplate_GetDiscoveryTemplates_DiscoveryTemplates [Test] [Ignore("Only validating compilation of examples")] - public void Example_DiscoTemplate_GetDiscoveryTemplates_DiscoveryTemplatesListDiscoTemplate_Convenience() + public void Example_DiscoTemplate_GetDiscoTemplates_DiscoveryTemplatesListDiscoTemplate_Convenience() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - foreach (DiscoveryTemplate item in client.GetDiscoveryTemplates()) + foreach (DiscoveryTemplate item in client.GetDiscoTemplates()) { } } [Test] [Ignore("Only validating compilation of examples")] - public async Task Example_DiscoTemplate_GetDiscoveryTemplates_DiscoveryTemplatesListDiscoTemplate_Convenience_Async() + public async Task Example_DiscoTemplate_GetDiscoTemplates_DiscoveryTemplatesListDiscoTemplate_Convenience_Async() { Uri endpoint = new Uri(""); TokenCredential credential = new DefaultAzureCredential(); EasmClient client = new EasmClient(endpoint, credential); - await foreach (DiscoveryTemplate item in client.GetDiscoveryTemplatesAsync()) + await foreach (DiscoveryTemplate item in client.GetDiscoTemplatesAsync()) { } } @@ -1577,5 +2530,143 @@ public async Task Example_Task_GetTasks_TasksListTask_Convenience_Async() { } } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CisaCveResult_GetCisaCves_CisaCvesGetCisaCves() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + foreach (BinaryData item in client.GetCisaCves(null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("cveId").ToString()); + Console.WriteLine(result.GetProperty("vendorProject").ToString()); + Console.WriteLine(result.GetProperty("product").ToString()); + Console.WriteLine(result.GetProperty("vulnerabilityName").ToString()); + Console.WriteLine(result.GetProperty("shortDescription").ToString()); + Console.WriteLine(result.GetProperty("requiredAction").ToString()); + Console.WriteLine(result.GetProperty("notes").ToString()); + Console.WriteLine(result.GetProperty("dateAdded").ToString()); + Console.WriteLine(result.GetProperty("dueDate").ToString()); + Console.WriteLine(result.GetProperty("updatedAt").ToString()); + Console.WriteLine(result.GetProperty("count").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CisaCveResult_GetCisaCves_CisaCvesGetCisaCves_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + await foreach (BinaryData item in client.GetCisaCvesAsync(null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("cveId").ToString()); + Console.WriteLine(result.GetProperty("vendorProject").ToString()); + Console.WriteLine(result.GetProperty("product").ToString()); + Console.WriteLine(result.GetProperty("vulnerabilityName").ToString()); + Console.WriteLine(result.GetProperty("shortDescription").ToString()); + Console.WriteLine(result.GetProperty("requiredAction").ToString()); + Console.WriteLine(result.GetProperty("notes").ToString()); + Console.WriteLine(result.GetProperty("dateAdded").ToString()); + Console.WriteLine(result.GetProperty("dueDate").ToString()); + Console.WriteLine(result.GetProperty("updatedAt").ToString()); + Console.WriteLine(result.GetProperty("count").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CisaCveResult_GetCisaCves_CisaCvesGetCisaCves_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + foreach (CisaCveResult item in client.GetCisaCves()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CisaCveResult_GetCisaCves_CisaCvesGetCisaCves_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + await foreach (CisaCveResult item in client.GetCisaCvesAsync()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Policy_GetPolicies_PoliciesListPolicy() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + foreach (BinaryData item in client.GetPolicies(null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("filterName").ToString()); + Console.WriteLine(result.GetProperty("action").ToString()); + Console.WriteLine(result.GetProperty("actionParameters").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Policy_GetPolicies_PoliciesListPolicy_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + await foreach (BinaryData item in client.GetPoliciesAsync(null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("name").ToString()); + Console.WriteLine(result.GetProperty("filterName").ToString()); + Console.WriteLine(result.GetProperty("action").ToString()); + Console.WriteLine(result.GetProperty("actionParameters").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Policy_GetPolicies_PoliciesListPolicy_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + foreach (Policy item in client.GetPolicies()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Policy_GetPolicies_PoliciesListPolicy_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + EasmClient client = new EasmClient(endpoint, credential); + + await foreach (Policy item in client.GetPoliciesAsync()) + { + } + } } } diff --git a/sdk/easm/Azure.Analytics.Defender.Easm/tsp-location.yaml b/sdk/easm/Azure.Analytics.Defender.Easm/tsp-location.yaml index 506ec154280a..98eff94a6c67 100644 --- a/sdk/easm/Azure.Analytics.Defender.Easm/tsp-location.yaml +++ b/sdk/easm/Azure.Analytics.Defender.Easm/tsp-location.yaml @@ -1,4 +1,4 @@ directory: specification/riskiq/Easm -commit: 823fa0c70ae5dc9d4693f65dde6b5e943e8183b4 +commit: 39e6b5636e12f9c8170f3fea3bfe5edaed72d4c6 repo: Azure/azure-rest-api-specs - +additionalDirectories: