diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/api/Azure.ResourceManager.Marketplace.netstandard2.0.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/api/Azure.ResourceManager.Marketplace.netstandard2.0.cs index 01285831256e..29daf0509a7e 100644 --- a/sdk/marketplace/Azure.ResourceManager.Marketplace/api/Azure.ResourceManager.Marketplace.netstandard2.0.cs +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/api/Azure.ResourceManager.Marketplace.netstandard2.0.cs @@ -126,6 +126,7 @@ protected PrivateStoreCollectionInfoCollection() { } public partial class PrivateStoreCollectionInfoData : Azure.ResourceManager.Models.ResourceData { public PrivateStoreCollectionInfoData() { } + public System.Collections.Generic.IReadOnlyList AppliedRules { get { throw null; } } public System.DateTimeOffset? ApproveAllItemsModifiedOn { get { throw null; } } public bool? AreAllItemsApproved { get { throw null; } } public bool? AreAllSubscriptionsSelected { get { throw null; } set { } } @@ -153,9 +154,15 @@ protected PrivateStoreCollectionInfoResource() { } public virtual System.Threading.Tasks.Task> DisableApproveAllItemsAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response Get(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetPrivateStoreCollectionOffersByContexts(Azure.ResourceManager.Marketplace.Models.CollectionOffersByAllContextsPayload payload = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetPrivateStoreCollectionOffersByContextsAsync(Azure.ResourceManager.Marketplace.Models.CollectionOffersByAllContextsPayload payload = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response GetPrivateStoreOffer(string offerId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetPrivateStoreOfferAsync(string offerId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.Marketplace.PrivateStoreOfferCollection GetPrivateStoreOffers() { throw null; } + public virtual Azure.Pageable QueryRules(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable QueryRulesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response SetCollectionRules(Azure.ResourceManager.Marketplace.Models.SetRulesContent content = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task SetCollectionRulesAsync(Azure.ResourceManager.Marketplace.Models.SetRulesContent content = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response TransferOffers(Azure.ResourceManager.Marketplace.Models.TransferOffersContent content = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> TransferOffersAsync(Azure.ResourceManager.Marketplace.Models.TransferOffersContent content = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.Marketplace.PrivateStoreCollectionInfoData info, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } @@ -269,6 +276,8 @@ protected PrivateStoreResource() { } public virtual Azure.AsyncPageable QueryOffersAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Pageable QueryUserOffers(Azure.ResourceManager.Marketplace.Models.QueryUserOffersContent content = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.AsyncPageable QueryUserOffersAsync(Azure.ResourceManager.Marketplace.Models.QueryUserOffersContent content = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable QueryUserRules(Azure.ResourceManager.Marketplace.Models.QueryUserRulesProperties payload = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable QueryUserRulesAsync(Azure.ResourceManager.Marketplace.Models.QueryUserRulesProperties payload = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.ResourceManager.ArmOperation Update(Azure.WaitUntil waitUntil, Azure.ResourceManager.Marketplace.PrivateStoreData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task UpdateAsync(Azure.WaitUntil waitUntil, Azure.ResourceManager.Marketplace.PrivateStoreData data, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } @@ -301,6 +310,17 @@ internal BulkCollectionsActionResult() { } public System.Collections.Generic.IReadOnlyList Failed { get { throw null; } } public System.Collections.Generic.IReadOnlyList Succeeded { get { throw null; } } } + public partial class CollectionOffersByAllContextsPayload + { + public CollectionOffersByAllContextsPayload() { } + public System.Collections.Generic.IList SubscriptionIds { get { throw null; } } + } + public partial class CollectionOffersByContext + { + internal CollectionOffersByContext() { } + public string Context { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Value { get { throw null; } } + } public partial class CollectionsSubscriptionsMappingDetails { internal CollectionsSubscriptionsMappingDetails() { } @@ -592,6 +612,11 @@ public QueryUserOffersContent() { } public System.Collections.Generic.IList OfferIds { get { throw null; } } public System.Collections.Generic.IList SubscriptionIds { get { throw null; } } } + public partial class QueryUserRulesProperties + { + public QueryUserRulesProperties() { } + public System.Collections.Generic.IList SubscriptionIds { get { throw null; } } + } public partial class RequestApprovalsDetails { internal RequestApprovalsDetails() { } @@ -602,6 +627,36 @@ internal RequestApprovalsDetails() { } public System.Collections.Generic.IReadOnlyList Plans { get { throw null; } } public string PublisherId { get { throw null; } } } + public partial class Rule + { + public Rule() { } + public Azure.ResourceManager.Marketplace.Models.RuleType? RuleType { get { throw null; } set { } } + public System.Collections.Generic.IList Value { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RuleType : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public RuleType(string value) { throw null; } + public static Azure.ResourceManager.Marketplace.Models.RuleType PrivateProducts { get { throw null; } } + public static Azure.ResourceManager.Marketplace.Models.RuleType TermsAndCondition { get { throw null; } } + public bool Equals(Azure.ResourceManager.Marketplace.Models.RuleType other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.ResourceManager.Marketplace.Models.RuleType left, Azure.ResourceManager.Marketplace.Models.RuleType right) { throw null; } + public static implicit operator Azure.ResourceManager.Marketplace.Models.RuleType (string value) { throw null; } + public static bool operator !=(Azure.ResourceManager.Marketplace.Models.RuleType left, Azure.ResourceManager.Marketplace.Models.RuleType right) { throw null; } + public override string ToString() { throw null; } + } + public partial class SetRulesContent + { + public SetRulesContent() { } + public string NextLink { get { throw null; } set { } } + public System.Collections.Generic.IList Value { get { throw null; } } + } public partial class StopSellNotifications { internal StopSellNotifications() { } diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/CollectionOffersByAllContextsPayload.Serialization.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/CollectionOffersByAllContextsPayload.Serialization.cs new file mode 100644 index 000000000000..5dea3ea5be5b --- /dev/null +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/CollectionOffersByAllContextsPayload.Serialization.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Marketplace.Models +{ + public partial class CollectionOffersByAllContextsPayload : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(SubscriptionIds)) + { + writer.WritePropertyName("subscriptionIds"u8); + writer.WriteStartArray(); + foreach (var item in SubscriptionIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/CollectionOffersByAllContextsPayload.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/CollectionOffersByAllContextsPayload.cs new file mode 100644 index 000000000000..104c69d4c985 --- /dev/null +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/CollectionOffersByAllContextsPayload.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Marketplace.Models +{ + /// Suggested subscription list. + public partial class CollectionOffersByAllContextsPayload + { + /// Initializes a new instance of CollectionOffersByAllContextsPayload. + public CollectionOffersByAllContextsPayload() + { + SubscriptionIds = new ChangeTrackingList(); + } + + /// Subscription ids list. + public IList SubscriptionIds { get; } + } +} diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/CollectionOffersByContext.Serialization.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/CollectionOffersByContext.Serialization.cs new file mode 100644 index 000000000000..acf12eade240 --- /dev/null +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/CollectionOffersByContext.Serialization.cs @@ -0,0 +1,62 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Marketplace.Models +{ + public partial class CollectionOffersByContext + { + internal static CollectionOffersByContext DeserializeCollectionOffersByContext(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional context = default; + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("context"u8)) + { + context = property.Value.GetString(); + continue; + } + if (property.NameEquals("offers"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + foreach (var property0 in property.Value.EnumerateObject()) + { + if (property0.NameEquals("value"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(PrivateStoreOfferResult.DeserializePrivateStoreOfferResult(item)); + } + value = array; + continue; + } + } + continue; + } + } + return new CollectionOffersByContext(context.Value, Optional.ToList(value)); + } + } +} diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/CollectionOffersByContext.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/CollectionOffersByContext.cs new file mode 100644 index 000000000000..43f33e465bd9 --- /dev/null +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/CollectionOffersByContext.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Marketplace.Models +{ + /// List of offers and plans that restricted to the context. + public partial class CollectionOffersByContext + { + /// Initializes a new instance of CollectionOffersByContext. + internal CollectionOffersByContext() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of CollectionOffersByContext. + /// Offer's context, e.g. subscription ID, tenant ID. + /// + internal CollectionOffersByContext(string context, IReadOnlyList value) + { + Context = context; + Value = value; + } + + /// Offer's context, e.g. subscription ID, tenant ID. + public string Context { get; } + /// Gets the value. + public IReadOnlyList Value { get; } + } +} diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/CollectionOffersByContextList.Serialization.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/CollectionOffersByContextList.Serialization.cs new file mode 100644 index 000000000000..0721355572ce --- /dev/null +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/CollectionOffersByContextList.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Marketplace.Models +{ + internal partial class CollectionOffersByContextList + { + internal static CollectionOffersByContextList DeserializeCollectionOffersByContextList(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(CollectionOffersByContext.DeserializeCollectionOffersByContext(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new CollectionOffersByContextList(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/CollectionOffersByContextList.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/CollectionOffersByContextList.cs new file mode 100644 index 000000000000..3bc234065e97 --- /dev/null +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/CollectionOffersByContextList.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Marketplace.Models +{ + /// List of objects which describes offers per context. An empty GUID is a public context. + internal partial class CollectionOffersByContextList + { + /// Initializes a new instance of CollectionOffersByContextList. + internal CollectionOffersByContextList() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of CollectionOffersByContextList. + /// + /// URL to get the next set of offer list per context results if there are any. + internal CollectionOffersByContextList(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Gets the value. + public IReadOnlyList Value { get; } + /// URL to get the next set of offer list per context results if there are any. + public string NextLink { get; } + } +} diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/PrivateStoreCollectionInfoData.Serialization.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/PrivateStoreCollectionInfoData.Serialization.cs index 22ae938c0146..105fafbb8577 100644 --- a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/PrivateStoreCollectionInfoData.Serialization.cs +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/PrivateStoreCollectionInfoData.Serialization.cs @@ -9,6 +9,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Marketplace.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Marketplace @@ -73,6 +74,7 @@ internal static PrivateStoreCollectionInfoData DeserializePrivateStoreCollection Optional> subscriptionsList = default; Optional enabled = default; Optional numberOfOffers = default; + Optional> appliedRules = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("id"u8)) @@ -194,11 +196,26 @@ internal static PrivateStoreCollectionInfoData DeserializePrivateStoreCollection numberOfOffers = property0.Value.GetInt64(); continue; } + if (property0.NameEquals("appliedRules"u8)) + { + if (property0.Value.ValueKind == JsonValueKind.Null) + { + property0.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property0.Value.EnumerateArray()) + { + array.Add(Rule.DeserializeRule(item)); + } + appliedRules = array; + continue; + } } continue; } } - return new PrivateStoreCollectionInfoData(id, name, type, systemData.Value, Optional.ToNullable(collectionId), collectionName.Value, claim.Value, Optional.ToNullable(allSubscriptions), Optional.ToNullable(approveAllItems), Optional.ToNullable(approveAllItemsModifiedAt), Optional.ToList(subscriptionsList), Optional.ToNullable(enabled), Optional.ToNullable(numberOfOffers)); + return new PrivateStoreCollectionInfoData(id, name, type, systemData.Value, Optional.ToNullable(collectionId), collectionName.Value, claim.Value, Optional.ToNullable(allSubscriptions), Optional.ToNullable(approveAllItems), Optional.ToNullable(approveAllItemsModifiedAt), Optional.ToList(subscriptionsList), Optional.ToNullable(enabled), Optional.ToNullable(numberOfOffers), Optional.ToList(appliedRules)); } } } diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/QueryUserRulesProperties.Serialization.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/QueryUserRulesProperties.Serialization.cs new file mode 100644 index 000000000000..80247f98376f --- /dev/null +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/QueryUserRulesProperties.Serialization.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Marketplace.Models +{ + public partial class QueryUserRulesProperties : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("properties"u8); + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(SubscriptionIds)) + { + writer.WritePropertyName("subscriptionIds"u8); + writer.WriteStartArray(); + foreach (var item in SubscriptionIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/QueryUserRulesProperties.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/QueryUserRulesProperties.cs new file mode 100644 index 000000000000..5c94ecee0dcd --- /dev/null +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/QueryUserRulesProperties.cs @@ -0,0 +1,25 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Marketplace.Models +{ + /// Query user's rules properties. + public partial class QueryUserRulesProperties + { + /// Initializes a new instance of QueryUserRulesProperties. + public QueryUserRulesProperties() + { + SubscriptionIds = new ChangeTrackingList(); + } + + /// List of subscription IDs. + public IList SubscriptionIds { get; } + } +} diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/Rule.Serialization.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/Rule.Serialization.cs new file mode 100644 index 000000000000..3063edffbd1e --- /dev/null +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/Rule.Serialization.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Marketplace.Models +{ + public partial class Rule : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(RuleType)) + { + writer.WritePropertyName("type"u8); + writer.WriteStringValue(RuleType.Value.ToString()); + } + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + writer.WriteEndObject(); + } + + internal static Rule DeserializeRule(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional type = default; + Optional> value = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("type"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + type = new RuleType(property.Value.GetString()); + continue; + } + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + value = array; + continue; + } + } + return new Rule(Optional.ToNullable(type), Optional.ToList(value)); + } + } +} diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/Rule.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/Rule.cs new file mode 100644 index 000000000000..a75c8e9c5c98 --- /dev/null +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/Rule.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Marketplace.Models +{ + /// The Rule. + public partial class Rule + { + /// Initializes a new instance of Rule. + public Rule() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of Rule. + /// Rule type. + /// + internal Rule(RuleType? ruleType, IList value) + { + RuleType = ruleType; + Value = value; + } + + /// Rule type. + public RuleType? RuleType { get; set; } + /// Gets the value. + public IList Value { get; } + } +} diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/RuleListResponse.Serialization.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/RuleListResponse.Serialization.cs new file mode 100644 index 000000000000..10c5b8340645 --- /dev/null +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/RuleListResponse.Serialization.cs @@ -0,0 +1,50 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Marketplace.Models +{ + internal partial class RuleListResponse + { + internal static RuleListResponse DeserializeRuleListResponse(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional> value = default; + Optional nextLink = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("value"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(Rule.DeserializeRule(item)); + } + value = array; + continue; + } + if (property.NameEquals("nextLink"u8)) + { + nextLink = property.Value.GetString(); + continue; + } + } + return new RuleListResponse(Optional.ToList(value), nextLink.Value); + } + } +} diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/RuleListResponse.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/RuleListResponse.cs new file mode 100644 index 000000000000..1ec4373383f4 --- /dev/null +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/RuleListResponse.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Marketplace.Models +{ + /// The RuleListResponse. + internal partial class RuleListResponse + { + /// Initializes a new instance of RuleListResponse. + internal RuleListResponse() + { + Value = new ChangeTrackingList(); + } + + /// Initializes a new instance of RuleListResponse. + /// + /// URL to get the next set of rules list results if there are any. + internal RuleListResponse(IReadOnlyList value, string nextLink) + { + Value = value; + NextLink = nextLink; + } + + /// Gets the value. + public IReadOnlyList Value { get; } + /// URL to get the next set of rules list results if there are any. + public string NextLink { get; } + } +} diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/RuleType.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/RuleType.cs new file mode 100644 index 000000000000..bd68084937de --- /dev/null +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/RuleType.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.ResourceManager.Marketplace.Models +{ + /// Rule type. + public readonly partial struct RuleType : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public RuleType(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string PrivateProductsValue = "PrivateProducts"; + private const string TermsAndConditionValue = "TermsAndCondition"; + + /// PrivateProducts. + public static RuleType PrivateProducts { get; } = new RuleType(PrivateProductsValue); + /// TermsAndCondition. + public static RuleType TermsAndCondition { get; } = new RuleType(TermsAndConditionValue); + /// Determines if two values are the same. + public static bool operator ==(RuleType left, RuleType right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(RuleType left, RuleType right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator RuleType(string value) => new RuleType(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is RuleType other && Equals(other); + /// + public bool Equals(RuleType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/SetRulesContent.Serialization.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/SetRulesContent.Serialization.cs new file mode 100644 index 000000000000..6ce82889863b --- /dev/null +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/SetRulesContent.Serialization.cs @@ -0,0 +1,36 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.Marketplace.Models +{ + public partial class SetRulesContent : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(Value)) + { + writer.WritePropertyName("value"u8); + writer.WriteStartArray(); + foreach (var item in Value) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(NextLink)) + { + writer.WritePropertyName("nextLink"u8); + writer.WriteStringValue(NextLink); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/SetRulesContent.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/SetRulesContent.cs new file mode 100644 index 000000000000..977e05d247d2 --- /dev/null +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/Models/SetRulesContent.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.Marketplace.Models +{ + /// The SetRulesContent. + public partial class SetRulesContent + { + /// Initializes a new instance of SetRulesContent. + public SetRulesContent() + { + Value = new ChangeTrackingList(); + } + + /// Gets the value. + public IList Value { get; } + /// URL to get the next set of rules list results if there are any. + public string NextLink { get; set; } + } +} diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreCollectionInfoData.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreCollectionInfoData.cs index 2c6cd6ad5391..9a9a4e9b20de 100644 --- a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreCollectionInfoData.cs +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreCollectionInfoData.cs @@ -8,6 +8,7 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Marketplace.Models; using Azure.ResourceManager.Models; namespace Azure.ResourceManager.Marketplace @@ -22,6 +23,7 @@ public partial class PrivateStoreCollectionInfoData : ResourceData public PrivateStoreCollectionInfoData() { SubscriptionsList = new ChangeTrackingList(); + AppliedRules = new ChangeTrackingList(); } /// Initializes a new instance of PrivateStoreCollectionInfoData. @@ -38,7 +40,8 @@ public PrivateStoreCollectionInfoData() /// Gets or sets subscription ids list. Empty list indicates all subscriptions are selected, null indicates no update is done, explicit list indicates the explicit selected subscriptions. On insert, null is considered as bad request. /// Indicating whether the collection is enabled or disabled. /// Gets the number of offers associated with the collection. - internal PrivateStoreCollectionInfoData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, Guid? collectionId, string collectionName, string claim, bool? areAllSubscriptionsSelected, bool? areAllItemsApproved, DateTimeOffset? approveAllItemsModifiedOn, IList subscriptionsList, bool? isEnabled, long? numberOfOffers) : base(id, name, resourceType, systemData) + /// Gets list of collection rules. + internal PrivateStoreCollectionInfoData(ResourceIdentifier id, string name, ResourceType resourceType, SystemData systemData, Guid? collectionId, string collectionName, string claim, bool? areAllSubscriptionsSelected, bool? areAllItemsApproved, DateTimeOffset? approveAllItemsModifiedOn, IList subscriptionsList, bool? isEnabled, long? numberOfOffers, IReadOnlyList appliedRules) : base(id, name, resourceType, systemData) { CollectionId = collectionId; CollectionName = collectionName; @@ -49,6 +52,7 @@ internal PrivateStoreCollectionInfoData(ResourceIdentifier id, string name, Reso SubscriptionsList = subscriptionsList; IsEnabled = isEnabled; NumberOfOffers = numberOfOffers; + AppliedRules = appliedRules; } /// Gets collection Id. @@ -69,5 +73,7 @@ internal PrivateStoreCollectionInfoData(ResourceIdentifier id, string name, Reso public bool? IsEnabled { get; set; } /// Gets the number of offers associated with the collection. public long? NumberOfOffers { get; } + /// Gets list of collection rules. + public IReadOnlyList AppliedRules { get; } } } diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreCollectionInfoResource.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreCollectionInfoResource.cs index d176cb83dfb6..0ac858bd61f9 100644 --- a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreCollectionInfoResource.cs +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreCollectionInfoResource.cs @@ -34,6 +34,10 @@ public static ResourceIdentifier CreateResourceIdentifier(Guid privateStoreId, G private readonly ClientDiagnostics _privateStoreCollectionInfoPrivateStoreCollectionClientDiagnostics; private readonly PrivateStoreCollectionRestOperations _privateStoreCollectionInfoPrivateStoreCollectionRestClient; + private readonly ClientDiagnostics _defaultClientDiagnostics; + private readonly MarketplaceRPServiceRestOperations _defaultRestClient; + private readonly ClientDiagnostics _privateStoreOfferPrivateStoreCollectionOfferClientDiagnostics; + private readonly PrivateStoreCollectionOfferRestOperations _privateStoreOfferPrivateStoreCollectionOfferRestClient; private readonly PrivateStoreCollectionInfoData _data; /// Initializes a new instance of the class for mocking. @@ -58,6 +62,11 @@ internal PrivateStoreCollectionInfoResource(ArmClient client, ResourceIdentifier _privateStoreCollectionInfoPrivateStoreCollectionClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Marketplace", ResourceType.Namespace, Diagnostics); TryGetApiVersion(ResourceType, out string privateStoreCollectionInfoPrivateStoreCollectionApiVersion); _privateStoreCollectionInfoPrivateStoreCollectionRestClient = new PrivateStoreCollectionRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, privateStoreCollectionInfoPrivateStoreCollectionApiVersion); + _defaultClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Marketplace", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _defaultRestClient = new MarketplaceRPServiceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); + _privateStoreOfferPrivateStoreCollectionOfferClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Marketplace", PrivateStoreOfferResource.ResourceType.Namespace, Diagnostics); + TryGetApiVersion(PrivateStoreOfferResource.ResourceType, out string privateStoreOfferPrivateStoreCollectionOfferApiVersion); + _privateStoreOfferPrivateStoreCollectionOfferRestClient = new PrivateStoreCollectionOfferRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, privateStoreOfferPrivateStoreCollectionOfferApiVersion); #if DEBUG ValidateResourceId(Id); #endif @@ -348,6 +357,110 @@ public virtual ArmOperation Update(WaitUntil } } + /// + /// Set rule for specific private store and collection + /// + /// + /// Request Path + /// /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/setRules + /// + /// + /// Operation Id + /// SetCollectionRules + /// + /// + /// + /// The SetRulesContent to use. + /// The cancellation token to use. + public virtual async Task SetCollectionRulesAsync(SetRulesContent content = null, CancellationToken cancellationToken = default) + { + using var scope = _defaultClientDiagnostics.CreateScope("PrivateStoreCollectionInfoResource.SetCollectionRules"); + scope.Start(); + try + { + var response = await _defaultRestClient.SetCollectionRulesAsync(Guid.Parse(Id.Parent.Name), Guid.Parse(Id.Name), content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Set rule for specific private store and collection + /// + /// + /// Request Path + /// /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/setRules + /// + /// + /// Operation Id + /// SetCollectionRules + /// + /// + /// + /// The SetRulesContent to use. + /// The cancellation token to use. + public virtual Response SetCollectionRules(SetRulesContent content = null, CancellationToken cancellationToken = default) + { + using var scope = _defaultClientDiagnostics.CreateScope("PrivateStoreCollectionInfoResource.SetCollectionRules"); + scope.Start(); + try + { + var response = _defaultRestClient.SetCollectionRules(Guid.Parse(Id.Parent.Name), Guid.Parse(Id.Name), content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Get a list of all private store rules in the given private store and collection + /// + /// + /// Request Path + /// /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/queryRules + /// + /// + /// Operation Id + /// QueryRules + /// + /// + /// + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable QueryRulesAsync(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _defaultRestClient.CreateQueryRulesRequest(Guid.Parse(Id.Parent.Name), Guid.Parse(Id.Name)); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, Rule.DeserializeRule, _defaultClientDiagnostics, Pipeline, "PrivateStoreCollectionInfoResource.QueryRules", "value", null, cancellationToken); + } + + /// + /// Get a list of all private store rules in the given private store and collection + /// + /// + /// Request Path + /// /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/queryRules + /// + /// + /// Operation Id + /// QueryRules + /// + /// + /// + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable QueryRules(CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _defaultRestClient.CreateQueryRulesRequest(Guid.Parse(Id.Parent.Name), Guid.Parse(Id.Name)); + return PageableHelpers.CreatePageable(FirstPageRequest, null, Rule.DeserializeRule, _defaultClientDiagnostics, Pipeline, "PrivateStoreCollectionInfoResource.QueryRules", "value", null, cancellationToken); + } + /// /// transferring offers (copy or move) from source collection to target collection(s) /// @@ -530,6 +643,52 @@ public virtual Response DisableApproveAllIte } } + /// + /// Get a list of all offers in the given collection according to the required contexts. + /// + /// + /// Request Path + /// /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/mapOffersToContexts + /// + /// + /// Operation Id + /// PrivateStoreCollectionOffer_ListByContexts + /// + /// + /// + /// The CollectionOffersByAllContextsPayload to use. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable GetPrivateStoreCollectionOffersByContextsAsync(CollectionOffersByAllContextsPayload payload = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _privateStoreOfferPrivateStoreCollectionOfferRestClient.CreateListByContextsRequest(Guid.Parse(Id.Parent.Name), Guid.Parse(Id.Name), payload); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _privateStoreOfferPrivateStoreCollectionOfferRestClient.CreateListByContextsNextPageRequest(nextLink, Guid.Parse(Id.Parent.Name), Guid.Parse(Id.Name), payload); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, CollectionOffersByContext.DeserializeCollectionOffersByContext, _privateStoreOfferPrivateStoreCollectionOfferClientDiagnostics, Pipeline, "PrivateStoreCollectionInfoResource.GetPrivateStoreCollectionOffersByContexts", "value", "nextLink", cancellationToken); + } + + /// + /// Get a list of all offers in the given collection according to the required contexts. + /// + /// + /// Request Path + /// /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/collections/{collectionId}/mapOffersToContexts + /// + /// + /// Operation Id + /// PrivateStoreCollectionOffer_ListByContexts + /// + /// + /// + /// The CollectionOffersByAllContextsPayload to use. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable GetPrivateStoreCollectionOffersByContexts(CollectionOffersByAllContextsPayload payload = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _privateStoreOfferPrivateStoreCollectionOfferRestClient.CreateListByContextsRequest(Guid.Parse(Id.Parent.Name), Guid.Parse(Id.Name), payload); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => _privateStoreOfferPrivateStoreCollectionOfferRestClient.CreateListByContextsNextPageRequest(nextLink, Guid.Parse(Id.Parent.Name), Guid.Parse(Id.Name), payload); + return PageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, CollectionOffersByContext.DeserializeCollectionOffersByContext, _privateStoreOfferPrivateStoreCollectionOfferClientDiagnostics, Pipeline, "PrivateStoreCollectionInfoResource.GetPrivateStoreCollectionOffersByContexts", "value", "nextLink", cancellationToken); + } + /// /// Delete Private store collection. This is a workaround. /// diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreResource.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreResource.cs index 888bd918a303..9e0e2a68c1ed 100644 --- a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreResource.cs +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/PrivateStoreResource.cs @@ -35,6 +35,8 @@ public static ResourceIdentifier CreateResourceIdentifier(Guid privateStoreId) private readonly ClientDiagnostics _privateStoreClientDiagnostics; private readonly PrivateStoreRestOperations _privateStoreRestClient; + private readonly ClientDiagnostics _defaultClientDiagnostics; + private readonly MarketplaceRPServiceRestOperations _defaultRestClient; private readonly PrivateStoreData _data; /// Initializes a new instance of the class for mocking. @@ -59,6 +61,8 @@ internal PrivateStoreResource(ArmClient client, ResourceIdentifier id) : base(cl _privateStoreClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Marketplace", ResourceType.Namespace, Diagnostics); TryGetApiVersion(ResourceType, out string privateStoreApiVersion); _privateStoreRestClient = new PrivateStoreRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint, privateStoreApiVersion); + _defaultClientDiagnostics = new ClientDiagnostics("Azure.ResourceManager.Marketplace", ProviderConstants.DefaultProviderNamespace, Diagnostics); + _defaultRestClient = new MarketplaceRPServiceRestOperations(Pipeline, Diagnostics.ApplicationId, Endpoint); #if DEBUG ValidateResourceId(Id); #endif @@ -1202,5 +1206,49 @@ public virtual Response GetSubscriptionsContext(Cancel throw; } } + + /// + /// All rules approved in the private store that are relevant for user subscriptions + /// + /// + /// Request Path + /// /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/queryUserRules + /// + /// + /// Operation Id + /// QueryUserRules + /// + /// + /// + /// The QueryUserRulesProperties to use. + /// The cancellation token to use. + /// An async collection of that may take multiple service requests to iterate over. + public virtual AsyncPageable QueryUserRulesAsync(QueryUserRulesProperties payload = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _defaultRestClient.CreateQueryUserRulesRequest(Guid.Parse(Id.Name), payload); + return PageableHelpers.CreateAsyncPageable(FirstPageRequest, null, Rule.DeserializeRule, _defaultClientDiagnostics, Pipeline, "PrivateStoreResource.QueryUserRules", "value", null, cancellationToken); + } + + /// + /// All rules approved in the private store that are relevant for user subscriptions + /// + /// + /// Request Path + /// /providers/Microsoft.Marketplace/privateStores/{privateStoreId}/queryUserRules + /// + /// + /// Operation Id + /// QueryUserRules + /// + /// + /// + /// The QueryUserRulesProperties to use. + /// The cancellation token to use. + /// A collection of that may take multiple service requests to iterate over. + public virtual Pageable QueryUserRules(QueryUserRulesProperties payload = null, CancellationToken cancellationToken = default) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => _defaultRestClient.CreateQueryUserRulesRequest(Guid.Parse(Id.Name), payload); + return PageableHelpers.CreatePageable(FirstPageRequest, null, Rule.DeserializeRule, _defaultClientDiagnostics, Pipeline, "PrivateStoreResource.QueryUserRules", "value", null, cancellationToken); + } } } diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/RestOperations/MarketplaceRPServiceRestOperations.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/RestOperations/MarketplaceRPServiceRestOperations.cs new file mode 100644 index 000000000000..ce6303ca81fa --- /dev/null +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/RestOperations/MarketplaceRPServiceRestOperations.cs @@ -0,0 +1,233 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading; +using System.Threading.Tasks; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; +using Azure.ResourceManager.Marketplace.Models; + +namespace Azure.ResourceManager.Marketplace +{ + internal partial class MarketplaceRPServiceRestOperations + { + private readonly TelemetryDetails _userAgent; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// Initializes a new instance of MarketplaceRPServiceRestOperations. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// The application id to use for user agent. + /// server parameter. + /// Api Version. + /// or is null. + public MarketplaceRPServiceRestOperations(HttpPipeline pipeline, string applicationId, Uri endpoint = null, string apiVersion = default) + { + _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); + _endpoint = endpoint ?? new Uri("https://management.azure.com"); + _apiVersion = apiVersion ?? "2023-01-01"; + _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); + } + + internal HttpMessage CreateQueryUserRulesRequest(Guid privateStoreId, QueryUserRulesProperties payload) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Marketplace/privateStores/", false); + uri.AppendPath(privateStoreId, true); + uri.AppendPath("/queryUserRules", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + if (payload != null) + { + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(payload); + request.Content = content; + } + _userAgent.Apply(message); + return message; + } + + /// All rules approved in the private store that are relevant for user subscriptions. + /// The store ID - must use the tenant ID. + /// The QueryUserRulesProperties to use. + /// The cancellation token to use. + public async Task> QueryUserRulesAsync(Guid privateStoreId, QueryUserRulesProperties payload = null, CancellationToken cancellationToken = default) + { + using var message = CreateQueryUserRulesRequest(privateStoreId, payload); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RuleListResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RuleListResponse.DeserializeRuleListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// All rules approved in the private store that are relevant for user subscriptions. + /// The store ID - must use the tenant ID. + /// The QueryUserRulesProperties to use. + /// The cancellation token to use. + public Response QueryUserRules(Guid privateStoreId, QueryUserRulesProperties payload = null, CancellationToken cancellationToken = default) + { + using var message = CreateQueryUserRulesRequest(privateStoreId, payload); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RuleListResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RuleListResponse.DeserializeRuleListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateSetCollectionRulesRequest(Guid privateStoreId, Guid collectionId, SetRulesContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Marketplace/privateStores/", false); + uri.AppendPath(privateStoreId, true); + uri.AppendPath("/collections/", false); + uri.AppendPath(collectionId, true); + uri.AppendPath("/setRules", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + if (content != null) + { + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content); + request.Content = content0; + } + _userAgent.Apply(message); + return message; + } + + /// Set rule for specific private store and collection. + /// The store ID - must use the tenant ID. + /// The collection ID. + /// The SetRulesContent to use. + /// The cancellation token to use. + public async Task SetCollectionRulesAsync(Guid privateStoreId, Guid collectionId, SetRulesContent content = null, CancellationToken cancellationToken = default) + { + using var message = CreateSetCollectionRulesRequest(privateStoreId, collectionId, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + /// Set rule for specific private store and collection. + /// The store ID - must use the tenant ID. + /// The collection ID. + /// The SetRulesContent to use. + /// The cancellation token to use. + public Response SetCollectionRules(Guid privateStoreId, Guid collectionId, SetRulesContent content = null, CancellationToken cancellationToken = default) + { + using var message = CreateSetCollectionRulesRequest(privateStoreId, collectionId, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + return message.Response; + default: + throw new RequestFailedException(message.Response); + } + } + + internal HttpMessage CreateQueryRulesRequest(Guid privateStoreId, Guid collectionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Marketplace/privateStores/", false); + uri.AppendPath(privateStoreId, true); + uri.AppendPath("/collections/", false); + uri.AppendPath(collectionId, true); + uri.AppendPath("/queryRules", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a list of all private store rules in the given private store and collection. + /// The store ID - must use the tenant ID. + /// The collection ID. + /// The cancellation token to use. + public async Task> QueryRulesAsync(Guid privateStoreId, Guid collectionId, CancellationToken cancellationToken = default) + { + using var message = CreateQueryRulesRequest(privateStoreId, collectionId); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + RuleListResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = RuleListResponse.DeserializeRuleListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a list of all private store rules in the given private store and collection. + /// The store ID - must use the tenant ID. + /// The collection ID. + /// The cancellation token to use. + public Response QueryRules(Guid privateStoreId, Guid collectionId, CancellationToken cancellationToken = default) + { + using var message = CreateQueryRulesRequest(privateStoreId, collectionId); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + RuleListResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = RuleListResponse.DeserializeRuleListResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + } +} diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/RestOperations/PrivateStoreCollectionOfferRestOperations.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/RestOperations/PrivateStoreCollectionOfferRestOperations.cs index 6230abad7b95..6531f1556ecd 100644 --- a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/RestOperations/PrivateStoreCollectionOfferRestOperations.cs +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/RestOperations/PrivateStoreCollectionOfferRestOperations.cs @@ -33,7 +33,7 @@ public PrivateStoreCollectionOfferRestOperations(HttpPipeline pipeline, string a { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-03-01"; + _apiVersion = apiVersion ?? "2023-01-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -100,6 +100,78 @@ public Response List(Guid privateStoreId, Guid collectionId, } } + internal HttpMessage CreateListByContextsRequest(Guid privateStoreId, Guid collectionId, CollectionOffersByAllContextsPayload payload) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/providers/Microsoft.Marketplace/privateStores/", false); + uri.AppendPath(privateStoreId, true); + uri.AppendPath("/collections/", false); + uri.AppendPath(collectionId, true); + uri.AppendPath("/mapOffersToContexts", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + if (payload != null) + { + request.Headers.Add("Content-Type", "application/json"); + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(payload); + request.Content = content; + } + _userAgent.Apply(message); + return message; + } + + /// Get a list of all offers in the given collection according to the required contexts. + /// The store ID - must use the tenant ID. + /// The collection ID. + /// The CollectionOffersByAllContextsPayload to use. + /// The cancellation token to use. + public async Task> ListByContextsAsync(Guid privateStoreId, Guid collectionId, CollectionOffersByAllContextsPayload payload = null, CancellationToken cancellationToken = default) + { + using var message = CreateListByContextsRequest(privateStoreId, collectionId, payload); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + CollectionOffersByContextList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = CollectionOffersByContextList.DeserializeCollectionOffersByContextList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a list of all offers in the given collection according to the required contexts. + /// The store ID - must use the tenant ID. + /// The collection ID. + /// The CollectionOffersByAllContextsPayload to use. + /// The cancellation token to use. + public Response ListByContexts(Guid privateStoreId, Guid collectionId, CollectionOffersByAllContextsPayload payload = null, CancellationToken cancellationToken = default) + { + using var message = CreateListByContextsRequest(privateStoreId, collectionId, payload); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + CollectionOffersByContextList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = CollectionOffersByContextList.DeserializeCollectionOffersByContextList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + internal HttpMessage CreateGetRequest(Guid privateStoreId, Guid collectionId, string offerId) { var message = _pipeline.CreateMessage(); @@ -548,5 +620,73 @@ public Response ListNextPage(string nextLink, Guid privateSto throw new RequestFailedException(message.Response); } } + + internal HttpMessage CreateListByContextsNextPageRequest(string nextLink, Guid privateStoreId, Guid collectionId, CollectionOffersByAllContextsPayload payload) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + _userAgent.Apply(message); + return message; + } + + /// Get a list of all offers in the given collection according to the required contexts. + /// The URL to the next page of results. + /// The store ID - must use the tenant ID. + /// The collection ID. + /// The CollectionOffersByAllContextsPayload to use. + /// The cancellation token to use. + /// is null. + public async Task> ListByContextsNextPageAsync(string nextLink, Guid privateStoreId, Guid collectionId, CollectionOffersByAllContextsPayload payload = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + + using var message = CreateListByContextsNextPageRequest(nextLink, privateStoreId, collectionId, payload); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + CollectionOffersByContextList value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); + value = CollectionOffersByContextList.DeserializeCollectionOffersByContextList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// Get a list of all offers in the given collection according to the required contexts. + /// The URL to the next page of results. + /// The store ID - must use the tenant ID. + /// The collection ID. + /// The CollectionOffersByAllContextsPayload to use. + /// The cancellation token to use. + /// is null. + public Response ListByContextsNextPage(string nextLink, Guid privateStoreId, Guid collectionId, CollectionOffersByAllContextsPayload payload = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(nextLink, nameof(nextLink)); + + using var message = CreateListByContextsNextPageRequest(nextLink, privateStoreId, collectionId, payload); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + CollectionOffersByContextList value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream); + value = CollectionOffersByContextList.DeserializeCollectionOffersByContextList(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } } } diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/RestOperations/PrivateStoreCollectionRestOperations.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/RestOperations/PrivateStoreCollectionRestOperations.cs index 4385210ec4c5..d8ba8a93fffa 100644 --- a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/RestOperations/PrivateStoreCollectionRestOperations.cs +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/RestOperations/PrivateStoreCollectionRestOperations.cs @@ -33,7 +33,7 @@ public PrivateStoreCollectionRestOperations(HttpPipeline pipeline, string applic { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-03-01"; + _apiVersion = apiVersion ?? "2023-01-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/RestOperations/PrivateStoreRestOperations.cs b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/RestOperations/PrivateStoreRestOperations.cs index 8bdb694e4135..f331f908df1c 100644 --- a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/RestOperations/PrivateStoreRestOperations.cs +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/Generated/RestOperations/PrivateStoreRestOperations.cs @@ -33,7 +33,7 @@ public PrivateStoreRestOperations(HttpPipeline pipeline, string applicationId, U { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2022-03-01"; + _apiVersion = apiVersion ?? "2023-01-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } diff --git a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/autorest.md b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/autorest.md index 78d290932ce9..5324db8d4707 100644 --- a/sdk/marketplace/Azure.ResourceManager.Marketplace/src/autorest.md +++ b/sdk/marketplace/Azure.ResourceManager.Marketplace/src/autorest.md @@ -9,7 +9,7 @@ generate-model-factory: false csharp: true library-name: Marketplace namespace: Azure.ResourceManager.Marketplace -require: https://github.com/Azure/azure-rest-api-specs/blob/aa8a23b8f92477d0fdce7af6ccffee1c604b3c56/specification/marketplace/resource-manager/readme.md +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/marketplace/resource-manager/readme.md output-folder: $(this-folder)/Generated clear-output-folder: true skip-csproj: true