diff --git a/eng/Packages.Data.props b/eng/Packages.Data.props index 10b7ef0f74c37..c69ee03595921 100644 --- a/eng/Packages.Data.props +++ b/eng/Packages.Data.props @@ -139,7 +139,7 @@ All should have PrivateAssets="All" set so they don't become package dependencies --> - + diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/api/Azure.Verticals.AgriFood.Farming.netstandard2.0.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/api/Azure.Verticals.AgriFood.Farming.netstandard2.0.cs index 0016a33bc0f33..f5ebcd9319b8c 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/api/Azure.Verticals.AgriFood.Farming.netstandard2.0.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/api/Azure.Verticals.AgriFood.Farming.netstandard2.0.cs @@ -9,12 +9,12 @@ public ApplicationDataClient(System.Uri endpoint, Azure.Core.TokenCredential cre public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string farmerId, string applicationDataId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual Azure.Response Delete(string farmerId, string applicationDataId, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task DeleteAsync(string farmerId, string applicationDataId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response Get(string farmerId, string applicationDataId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetAsync(string farmerId, string applicationDataId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response List(double? minAvgMaterial = default(double?), double? maxAvgMaterial = default(double?), double? minTotalMaterial = default(double?), double? maxTotalMaterial = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task ListAsync(double? minAvgMaterial = default(double?), double? maxAvgMaterial = default(double?), double? minTotalMaterial = default(double?), double? maxTotalMaterial = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response ListByFarmerId(string farmerId, double? minAvgMaterial = default(double?), double? maxAvgMaterial = default(double?), double? minTotalMaterial = default(double?), double? maxTotalMaterial = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task ListByFarmerIdAsync(string farmerId, double? minAvgMaterial = default(double?), double? maxAvgMaterial = default(double?), double? minTotalMaterial = default(double?), double? maxTotalMaterial = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response Get(string farmerId, string applicationDataId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetAsync(string farmerId, string applicationDataId, Azure.RequestOptions options) { throw null; } + public virtual Azure.Pageable List(Azure.RequestOptions options, double? minAvgMaterial = default(double?), double? maxAvgMaterial = default(double?), double? minTotalMaterial = default(double?), double? maxTotalMaterial = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.AsyncPageable ListAsync(Azure.RequestOptions options, double? minAvgMaterial = default(double?), double? maxAvgMaterial = default(double?), double? minTotalMaterial = default(double?), double? maxTotalMaterial = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.Pageable ListByFarmerId(string farmerId, Azure.RequestOptions options, double? minAvgMaterial = default(double?), double? maxAvgMaterial = default(double?), double? minTotalMaterial = default(double?), double? maxTotalMaterial = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.AsyncPageable ListByFarmerIdAsync(string farmerId, Azure.RequestOptions options, double? minAvgMaterial = default(double?), double? maxAvgMaterial = default(double?), double? minTotalMaterial = default(double?), double? maxTotalMaterial = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } } public partial class AttachmentsClient { @@ -25,12 +25,12 @@ public AttachmentsClient(System.Uri endpoint, Azure.Core.TokenCredential credent public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string farmerId, string attachmentId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual Azure.Response Delete(string farmerId, string attachmentId, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task DeleteAsync(string farmerId, string attachmentId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response Download(string farmerId, string attachmentId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task DownloadAsync(string farmerId, string attachmentId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response Get(string farmerId, string attachmentId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetAsync(string farmerId, string attachmentId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response ListByFarmerId(string farmerId, System.Collections.Generic.IEnumerable resourceIds = null, System.Collections.Generic.IEnumerable resourceTypes = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task ListByFarmerIdAsync(string farmerId, System.Collections.Generic.IEnumerable resourceIds = null, System.Collections.Generic.IEnumerable resourceTypes = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response Download(string farmerId, string attachmentId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task DownloadAsync(string farmerId, string attachmentId, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response Get(string farmerId, string attachmentId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetAsync(string farmerId, string attachmentId, Azure.RequestOptions options) { throw null; } + public virtual Azure.Pageable ListByFarmerId(string farmerId, Azure.RequestOptions options, System.Collections.Generic.IEnumerable resourceIds = null, System.Collections.Generic.IEnumerable resourceTypes = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.AsyncPageable ListByFarmerIdAsync(string farmerId, Azure.RequestOptions options, System.Collections.Generic.IEnumerable resourceIds = null, System.Collections.Generic.IEnumerable resourceTypes = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } } public partial class BoundariesClient { @@ -43,20 +43,20 @@ public BoundariesClient(System.Uri endpoint, Azure.Core.TokenCredential credenti public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string farmerId, string boundaryId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual Azure.Response Delete(string farmerId, string boundaryId, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task DeleteAsync(string farmerId, string boundaryId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response Get(string farmerId, string boundaryId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetAsync(string farmerId, string boundaryId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetCascadeDeleteJobDetails(string jobId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetCascadeDeleteJobDetailsAsync(string jobId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetOverlap(string farmerId, string boundaryId, string otherFarmerId, string otherBoundaryId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetOverlapAsync(string farmerId, string boundaryId, string otherFarmerId, string otherBoundaryId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response List(bool? isPrimary = default(bool?), string parentType = null, System.Collections.Generic.IEnumerable parentIds = null, double? minAcreage = default(double?), double? maxAcreage = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task ListAsync(bool? isPrimary = default(bool?), string parentType = null, System.Collections.Generic.IEnumerable parentIds = null, double? minAcreage = default(double?), double? maxAcreage = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response ListByFarmerId(string farmerId, bool? isPrimary = default(bool?), string parentType = null, System.Collections.Generic.IEnumerable parentIds = null, double? minAcreage = default(double?), double? maxAcreage = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task ListByFarmerIdAsync(string farmerId, bool? isPrimary = default(bool?), string parentType = null, System.Collections.Generic.IEnumerable parentIds = null, double? minAcreage = default(double?), double? maxAcreage = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response Search(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task SearchAsync(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response SearchByFarmerId(string farmerId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task SearchByFarmerIdAsync(string farmerId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response Get(string farmerId, string boundaryId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetAsync(string farmerId, string boundaryId, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetCascadeDeleteJobDetails(string jobId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetCascadeDeleteJobDetailsAsync(string jobId, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetOverlap(string farmerId, string boundaryId, string otherFarmerId, string otherBoundaryId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetOverlapAsync(string farmerId, string boundaryId, string otherFarmerId, string otherBoundaryId, Azure.RequestOptions options) { throw null; } + public virtual Azure.Pageable List(Azure.RequestOptions options, bool? isPrimary = default(bool?), string parentType = null, System.Collections.Generic.IEnumerable parentIds = null, double? minAcreage = default(double?), double? maxAcreage = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.AsyncPageable ListAsync(Azure.RequestOptions options, bool? isPrimary = default(bool?), string parentType = null, System.Collections.Generic.IEnumerable parentIds = null, double? minAcreage = default(double?), double? maxAcreage = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.Pageable ListByFarmerId(string farmerId, Azure.RequestOptions options, bool? isPrimary = default(bool?), string parentType = null, System.Collections.Generic.IEnumerable parentIds = null, double? minAcreage = default(double?), double? maxAcreage = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.AsyncPageable ListByFarmerIdAsync(string farmerId, Azure.RequestOptions options, bool? isPrimary = default(bool?), string parentType = null, System.Collections.Generic.IEnumerable parentIds = null, double? minAcreage = default(double?), double? maxAcreage = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.Pageable Search(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.AsyncPageable SearchAsync(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Pageable SearchByFarmerId(string farmerId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.AsyncPageable SearchByFarmerIdAsync(string farmerId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } } public partial class CropsClient { @@ -67,10 +67,10 @@ public CropsClient(System.Uri endpoint, Azure.Core.TokenCredential credential, A public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string cropId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual Azure.Response Delete(string cropId, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task DeleteAsync(string cropId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response Get(string cropId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetAsync(string cropId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response List(System.Collections.Generic.IEnumerable phenotypes = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task ListAsync(System.Collections.Generic.IEnumerable phenotypes = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response Get(string cropId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetAsync(string cropId, Azure.RequestOptions options) { throw null; } + public virtual Azure.Pageable List(Azure.RequestOptions options, System.Collections.Generic.IEnumerable phenotypes = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.AsyncPageable ListAsync(Azure.RequestOptions options, System.Collections.Generic.IEnumerable phenotypes = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } } public partial class CropVarietiesClient { @@ -81,12 +81,12 @@ public CropVarietiesClient(System.Uri endpoint, Azure.Core.TokenCredential crede public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string cropId, string cropVarietyId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual Azure.Response Delete(string cropId, string cropVarietyId, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task DeleteAsync(string cropId, string cropVarietyId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response Get(string cropId, string cropVarietyId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetAsync(string cropId, string cropVarietyId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response List(System.Collections.Generic.IEnumerable cropIds = null, System.Collections.Generic.IEnumerable brands = null, System.Collections.Generic.IEnumerable products = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task ListAsync(System.Collections.Generic.IEnumerable cropIds = null, System.Collections.Generic.IEnumerable brands = null, System.Collections.Generic.IEnumerable products = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response ListByCropId(string cropId, System.Collections.Generic.IEnumerable cropIds = null, System.Collections.Generic.IEnumerable brands = null, System.Collections.Generic.IEnumerable products = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task ListByCropIdAsync(string cropId, System.Collections.Generic.IEnumerable cropIds = null, System.Collections.Generic.IEnumerable brands = null, System.Collections.Generic.IEnumerable products = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response Get(string cropId, string cropVarietyId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetAsync(string cropId, string cropVarietyId, Azure.RequestOptions options) { throw null; } + public virtual Azure.Pageable List(Azure.RequestOptions options, System.Collections.Generic.IEnumerable cropIds = null, System.Collections.Generic.IEnumerable brands = null, System.Collections.Generic.IEnumerable products = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.AsyncPageable ListAsync(Azure.RequestOptions options, System.Collections.Generic.IEnumerable cropIds = null, System.Collections.Generic.IEnumerable brands = null, System.Collections.Generic.IEnumerable products = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.Pageable ListByCropId(string cropId, Azure.RequestOptions options, System.Collections.Generic.IEnumerable cropIds = null, System.Collections.Generic.IEnumerable brands = null, System.Collections.Generic.IEnumerable products = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.AsyncPageable ListByCropIdAsync(string cropId, Azure.RequestOptions options, System.Collections.Generic.IEnumerable cropIds = null, System.Collections.Generic.IEnumerable brands = null, System.Collections.Generic.IEnumerable products = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } } public partial class FarmBeatsClientOptions : Azure.Core.ClientOptions { @@ -103,8 +103,8 @@ public FarmClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Az public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } public virtual Azure.Operation CreateDataIngestionJob(string jobId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task> CreateDataIngestionJobAsync(string jobId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetDataIngestionJobDetails(string jobId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetDataIngestionJobDetailsAsync(string jobId, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response GetDataIngestionJobDetails(string jobId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetDataIngestionJobDetailsAsync(string jobId, Azure.RequestOptions options) { throw null; } } public partial class FarmersClient { @@ -117,12 +117,12 @@ public FarmersClient(System.Uri endpoint, Azure.Core.TokenCredential credential, public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string farmerId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual Azure.Response Delete(string farmerId, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task DeleteAsync(string farmerId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response Get(string farmerId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetAsync(string farmerId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetCascadeDeleteJobDetails(string jobId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetCascadeDeleteJobDetailsAsync(string jobId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response List(System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task ListAsync(System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response Get(string farmerId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetAsync(string farmerId, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetCascadeDeleteJobDetails(string jobId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetCascadeDeleteJobDetailsAsync(string jobId, Azure.RequestOptions options) { throw null; } + public virtual Azure.Pageable List(Azure.RequestOptions options, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.AsyncPageable ListAsync(Azure.RequestOptions options, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } } public partial class FarmsClient { @@ -135,14 +135,14 @@ public FarmsClient(System.Uri endpoint, Azure.Core.TokenCredential credential, A public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string farmerId, string farmId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual Azure.Response Delete(string farmerId, string farmId, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task DeleteAsync(string farmerId, string farmId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response Get(string farmerId, string farmId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetAsync(string farmerId, string farmId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetCascadeDeleteJobDetails(string jobId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetCascadeDeleteJobDetailsAsync(string jobId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response List(System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task ListAsync(System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response ListByFarmerId(string farmerId, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task ListByFarmerIdAsync(string farmerId, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response Get(string farmerId, string farmId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetAsync(string farmerId, string farmId, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetCascadeDeleteJobDetails(string jobId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetCascadeDeleteJobDetailsAsync(string jobId, Azure.RequestOptions options) { throw null; } + public virtual Azure.Pageable List(Azure.RequestOptions options, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.AsyncPageable ListAsync(Azure.RequestOptions options, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.Pageable ListByFarmerId(string farmerId, Azure.RequestOptions options, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.AsyncPageable ListByFarmerIdAsync(string farmerId, Azure.RequestOptions options, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } } public partial class FieldsClient { @@ -155,14 +155,14 @@ public FieldsClient(System.Uri endpoint, Azure.Core.TokenCredential credential, public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string farmerId, string fieldId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual Azure.Response Delete(string farmerId, string fieldId, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task DeleteAsync(string farmerId, string fieldId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response Get(string farmerId, string fieldId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetAsync(string farmerId, string fieldId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetCascadeDeleteJobDetails(string jobId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetCascadeDeleteJobDetailsAsync(string jobId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response List(System.Collections.Generic.IEnumerable farmIds = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task ListAsync(System.Collections.Generic.IEnumerable farmIds = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response ListByFarmerId(string farmerId, System.Collections.Generic.IEnumerable farmIds = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task ListByFarmerIdAsync(string farmerId, System.Collections.Generic.IEnumerable farmIds = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response Get(string farmerId, string fieldId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetAsync(string farmerId, string fieldId, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetCascadeDeleteJobDetails(string jobId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetCascadeDeleteJobDetailsAsync(string jobId, Azure.RequestOptions options) { throw null; } + public virtual Azure.Pageable List(Azure.RequestOptions options, System.Collections.Generic.IEnumerable farmIds = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.AsyncPageable ListAsync(Azure.RequestOptions options, System.Collections.Generic.IEnumerable farmIds = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.Pageable ListByFarmerId(string farmerId, Azure.RequestOptions options, System.Collections.Generic.IEnumerable farmIds = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.AsyncPageable ListByFarmerIdAsync(string farmerId, Azure.RequestOptions options, System.Collections.Generic.IEnumerable farmIds = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } } public partial class HarvestDataClient { @@ -173,12 +173,12 @@ public HarvestDataClient(System.Uri endpoint, Azure.Core.TokenCredential credent public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string farmerId, string harvestDataId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual Azure.Response Delete(string farmerId, string harvestDataId, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task DeleteAsync(string farmerId, string harvestDataId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response Get(string farmerId, string harvestDataId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetAsync(string farmerId, string harvestDataId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response List(double? minTotalYield = default(double?), double? maxTotalYield = default(double?), double? minAvgYield = default(double?), double? maxAvgYield = default(double?), double? minTotalWetMass = default(double?), double? maxTotalWetMass = default(double?), double? minAvgWetMass = default(double?), double? maxAvgWetMass = default(double?), double? minAvgMoisture = default(double?), double? maxAvgMoisture = default(double?), double? minAvgSpeed = default(double?), double? maxAvgSpeed = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task ListAsync(double? minTotalYield = default(double?), double? maxTotalYield = default(double?), double? minAvgYield = default(double?), double? maxAvgYield = default(double?), double? minTotalWetMass = default(double?), double? maxTotalWetMass = default(double?), double? minAvgWetMass = default(double?), double? maxAvgWetMass = default(double?), double? minAvgMoisture = default(double?), double? maxAvgMoisture = default(double?), double? minAvgSpeed = default(double?), double? maxAvgSpeed = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response ListByFarmerId(string farmerId, double? minTotalYield = default(double?), double? maxTotalYield = default(double?), double? minAvgYield = default(double?), double? maxAvgYield = default(double?), double? minTotalWetMass = default(double?), double? maxTotalWetMass = default(double?), double? minAvgWetMass = default(double?), double? maxAvgWetMass = default(double?), double? minAvgMoisture = default(double?), double? maxAvgMoisture = default(double?), double? minAvgSpeed = default(double?), double? maxAvgSpeed = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task ListByFarmerIdAsync(string farmerId, double? minTotalYield = default(double?), double? maxTotalYield = default(double?), double? minAvgYield = default(double?), double? maxAvgYield = default(double?), double? minTotalWetMass = default(double?), double? maxTotalWetMass = default(double?), double? minAvgWetMass = default(double?), double? maxAvgWetMass = default(double?), double? minAvgMoisture = default(double?), double? maxAvgMoisture = default(double?), double? minAvgSpeed = default(double?), double? maxAvgSpeed = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response Get(string farmerId, string harvestDataId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetAsync(string farmerId, string harvestDataId, Azure.RequestOptions options) { throw null; } + public virtual Azure.Pageable List(Azure.RequestOptions options, double? minTotalYield = default(double?), double? maxTotalYield = default(double?), double? minAvgYield = default(double?), double? maxAvgYield = default(double?), double? minTotalWetMass = default(double?), double? maxTotalWetMass = default(double?), double? minAvgWetMass = default(double?), double? maxAvgWetMass = default(double?), double? minAvgMoisture = default(double?), double? maxAvgMoisture = default(double?), double? minAvgSpeed = default(double?), double? maxAvgSpeed = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.AsyncPageable ListAsync(Azure.RequestOptions options, double? minTotalYield = default(double?), double? maxTotalYield = default(double?), double? minAvgYield = default(double?), double? maxAvgYield = default(double?), double? minTotalWetMass = default(double?), double? maxTotalWetMass = default(double?), double? minAvgWetMass = default(double?), double? maxAvgWetMass = default(double?), double? minAvgMoisture = default(double?), double? maxAvgMoisture = default(double?), double? minAvgSpeed = default(double?), double? maxAvgSpeed = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.Pageable ListByFarmerId(string farmerId, Azure.RequestOptions options, double? minTotalYield = default(double?), double? maxTotalYield = default(double?), double? minAvgYield = default(double?), double? maxAvgYield = default(double?), double? minTotalWetMass = default(double?), double? maxTotalWetMass = default(double?), double? minAvgWetMass = default(double?), double? maxAvgWetMass = default(double?), double? minAvgMoisture = default(double?), double? maxAvgMoisture = default(double?), double? minAvgSpeed = default(double?), double? maxAvgSpeed = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.AsyncPageable ListByFarmerIdAsync(string farmerId, Azure.RequestOptions options, double? minTotalYield = default(double?), double? maxTotalYield = default(double?), double? minAvgYield = default(double?), double? maxAvgYield = default(double?), double? minTotalWetMass = default(double?), double? maxTotalWetMass = default(double?), double? minAvgWetMass = default(double?), double? maxAvgWetMass = default(double?), double? minAvgMoisture = default(double?), double? maxAvgMoisture = default(double?), double? minAvgSpeed = default(double?), double? maxAvgSpeed = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } } public partial class ImageProcessingClient { @@ -187,8 +187,8 @@ public ImageProcessingClient(System.Uri endpoint, Azure.Core.TokenCredential cre public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } public virtual Azure.Operation CreateRasterizeJob(string jobId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task> CreateRasterizeJobAsync(string jobId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetRasterizeJob(string jobId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetRasterizeJobAsync(string jobId, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response GetRasterizeJob(string jobId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetRasterizeJobAsync(string jobId, Azure.RequestOptions options) { throw null; } } public partial class OAuthProvidersClient { @@ -199,10 +199,10 @@ public OAuthProvidersClient(System.Uri endpoint, Azure.Core.TokenCredential cred public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string oauthProviderId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual Azure.Response Delete(string oauthProviderId, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task DeleteAsync(string oauthProviderId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response Get(string oauthProviderId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetAsync(string oauthProviderId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response List(System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task ListAsync(System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response Get(string oauthProviderId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetAsync(string oauthProviderId, Azure.RequestOptions options) { throw null; } + public virtual Azure.Pageable List(Azure.RequestOptions options, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.AsyncPageable ListAsync(Azure.RequestOptions options, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } } public partial class OAuthTokensClient { @@ -211,12 +211,12 @@ public OAuthTokensClient(System.Uri endpoint, Azure.Core.TokenCredential credent public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } public virtual Azure.Operation CreateCascadeDeleteJob(string jobId, string farmerId, string oauthProviderId, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task> CreateCascadeDeleteJobAsync(string jobId, string farmerId, string oauthProviderId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetCascadeDeleteJobDetails(string jobId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetCascadeDeleteJobDetailsAsync(string jobId, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response GetCascadeDeleteJobDetails(string jobId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetCascadeDeleteJobDetailsAsync(string jobId, Azure.RequestOptions options) { throw null; } public virtual Azure.Response GetOAuthConnectionLink(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task GetOAuthConnectionLinkAsync(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response List(System.Collections.Generic.IEnumerable authProviderIds = null, System.Collections.Generic.IEnumerable farmerIds = null, bool? isValid = default(bool?), System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task ListAsync(System.Collections.Generic.IEnumerable authProviderIds = null, System.Collections.Generic.IEnumerable farmerIds = null, bool? isValid = default(bool?), System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Pageable List(Azure.RequestOptions options, System.Collections.Generic.IEnumerable authProviderIds = null, System.Collections.Generic.IEnumerable farmerIds = null, bool? isValid = default(bool?), System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.AsyncPageable ListAsync(Azure.RequestOptions options, System.Collections.Generic.IEnumerable authProviderIds = null, System.Collections.Generic.IEnumerable farmerIds = null, bool? isValid = default(bool?), System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } } public partial class PlantingDataClient { @@ -227,12 +227,12 @@ public PlantingDataClient(System.Uri endpoint, Azure.Core.TokenCredential creden public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string farmerId, string plantingDataId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual Azure.Response Delete(string farmerId, string plantingDataId, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task DeleteAsync(string farmerId, string plantingDataId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response Get(string farmerId, string plantingDataId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetAsync(string farmerId, string plantingDataId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response List(double? minAvgPlantingRate = default(double?), double? maxAvgPlantingRate = default(double?), double? minTotalMaterial = default(double?), double? maxTotalMaterial = default(double?), double? minAvgMaterial = default(double?), double? maxAvgMaterial = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task ListAsync(double? minAvgPlantingRate = default(double?), double? maxAvgPlantingRate = default(double?), double? minTotalMaterial = default(double?), double? maxTotalMaterial = default(double?), double? minAvgMaterial = default(double?), double? maxAvgMaterial = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response ListByFarmerId(string farmerId, double? minAvgPlantingRate = default(double?), double? maxAvgPlantingRate = default(double?), double? minTotalMaterial = default(double?), double? maxTotalMaterial = default(double?), double? minAvgMaterial = default(double?), double? maxAvgMaterial = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task ListByFarmerIdAsync(string farmerId, double? minAvgPlantingRate = default(double?), double? maxAvgPlantingRate = default(double?), double? minTotalMaterial = default(double?), double? maxTotalMaterial = default(double?), double? minAvgMaterial = default(double?), double? maxAvgMaterial = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response Get(string farmerId, string plantingDataId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetAsync(string farmerId, string plantingDataId, Azure.RequestOptions options) { throw null; } + public virtual Azure.Pageable List(Azure.RequestOptions options, double? minAvgPlantingRate = default(double?), double? maxAvgPlantingRate = default(double?), double? minTotalMaterial = default(double?), double? maxTotalMaterial = default(double?), double? minAvgMaterial = default(double?), double? maxAvgMaterial = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.AsyncPageable ListAsync(Azure.RequestOptions options, double? minAvgPlantingRate = default(double?), double? maxAvgPlantingRate = default(double?), double? minTotalMaterial = default(double?), double? maxTotalMaterial = default(double?), double? minAvgMaterial = default(double?), double? maxAvgMaterial = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.Pageable ListByFarmerId(string farmerId, Azure.RequestOptions options, double? minAvgPlantingRate = default(double?), double? maxAvgPlantingRate = default(double?), double? minTotalMaterial = default(double?), double? maxTotalMaterial = default(double?), double? minAvgMaterial = default(double?), double? maxAvgMaterial = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.AsyncPageable ListByFarmerIdAsync(string farmerId, Azure.RequestOptions options, double? minAvgPlantingRate = default(double?), double? maxAvgPlantingRate = default(double?), double? minTotalMaterial = default(double?), double? maxTotalMaterial = default(double?), double? minAvgMaterial = default(double?), double? maxAvgMaterial = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } } public partial class ScenesClient { @@ -241,12 +241,12 @@ public ScenesClient(System.Uri endpoint, Azure.Core.TokenCredential credential, public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } public virtual Azure.Operation CreateSatelliteDataIngestionJob(string jobId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task> CreateSatelliteDataIngestionJobAsync(string jobId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response Download(string filePath, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task DownloadAsync(string filePath, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetSatelliteDataIngestionJobDetails(string jobId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetSatelliteDataIngestionJobDetailsAsync(string jobId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response List(string provider, string farmerId, string boundaryId, string source = null, System.DateTimeOffset? startDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? endDateTime = default(System.DateTimeOffset?), double? maxCloudCoveragePercentage = default(double?), double? maxDarkPixelCoveragePercentage = default(double?), System.Collections.Generic.IEnumerable imageNames = null, System.Collections.Generic.IEnumerable imageResolutions = null, System.Collections.Generic.IEnumerable imageFormats = null, int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task ListAsync(string provider, string farmerId, string boundaryId, string source = null, System.DateTimeOffset? startDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? endDateTime = default(System.DateTimeOffset?), double? maxCloudCoveragePercentage = default(double?), double? maxDarkPixelCoveragePercentage = default(double?), System.Collections.Generic.IEnumerable imageNames = null, System.Collections.Generic.IEnumerable imageResolutions = null, System.Collections.Generic.IEnumerable imageFormats = null, int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response Download(string filePath, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task DownloadAsync(string filePath, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetSatelliteDataIngestionJobDetails(string jobId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetSatelliteDataIngestionJobDetailsAsync(string jobId, Azure.RequestOptions options) { throw null; } + public virtual Azure.Pageable List(string provider, string farmerId, string boundaryId, Azure.RequestOptions options, string source = null, System.DateTimeOffset? startDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? endDateTime = default(System.DateTimeOffset?), double? maxCloudCoveragePercentage = default(double?), double? maxDarkPixelCoveragePercentage = default(double?), System.Collections.Generic.IEnumerable imageNames = null, System.Collections.Generic.IEnumerable imageResolutions = null, System.Collections.Generic.IEnumerable imageFormats = null, int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.AsyncPageable ListAsync(string provider, string farmerId, string boundaryId, Azure.RequestOptions options, string source = null, System.DateTimeOffset? startDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? endDateTime = default(System.DateTimeOffset?), double? maxCloudCoveragePercentage = default(double?), double? maxDarkPixelCoveragePercentage = default(double?), System.Collections.Generic.IEnumerable imageNames = null, System.Collections.Generic.IEnumerable imageResolutions = null, System.Collections.Generic.IEnumerable imageFormats = null, int? maxPageSize = default(int?), string skipToken = null) { throw null; } } public partial class SeasonalFieldsClient { @@ -259,14 +259,14 @@ public SeasonalFieldsClient(System.Uri endpoint, Azure.Core.TokenCredential cred public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string farmerId, string seasonalFieldId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual Azure.Response Delete(string farmerId, string seasonalFieldId, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task DeleteAsync(string farmerId, string seasonalFieldId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response Get(string farmerId, string seasonalFieldId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetAsync(string farmerId, string seasonalFieldId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetCascadeDeleteJobDetails(string jobId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetCascadeDeleteJobDetailsAsync(string jobId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response List(System.Collections.Generic.IEnumerable farmIds = null, System.Collections.Generic.IEnumerable fieldIds = null, System.Collections.Generic.IEnumerable seasonIds = null, System.Collections.Generic.IEnumerable cropVarietyIds = null, System.Collections.Generic.IEnumerable cropIds = null, double? minAvgYieldValue = default(double?), double? maxAvgYieldValue = default(double?), string avgYieldUnit = null, double? minAvgSeedPopulationValue = default(double?), double? maxAvgSeedPopulationValue = default(double?), string avgSeedPopulationUnit = null, System.DateTimeOffset? minPlantingDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxPlantingDateTime = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task ListAsync(System.Collections.Generic.IEnumerable farmIds = null, System.Collections.Generic.IEnumerable fieldIds = null, System.Collections.Generic.IEnumerable seasonIds = null, System.Collections.Generic.IEnumerable cropVarietyIds = null, System.Collections.Generic.IEnumerable cropIds = null, double? minAvgYieldValue = default(double?), double? maxAvgYieldValue = default(double?), string avgYieldUnit = null, double? minAvgSeedPopulationValue = default(double?), double? maxAvgSeedPopulationValue = default(double?), string avgSeedPopulationUnit = null, System.DateTimeOffset? minPlantingDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxPlantingDateTime = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response ListByFarmerId(string farmerId, System.Collections.Generic.IEnumerable farmIds = null, System.Collections.Generic.IEnumerable fieldIds = null, System.Collections.Generic.IEnumerable seasonIds = null, System.Collections.Generic.IEnumerable cropVarietyIds = null, System.Collections.Generic.IEnumerable cropIds = null, double? minAvgYieldValue = default(double?), double? maxAvgYieldValue = default(double?), string avgYieldUnit = null, double? minAvgSeedPopulationValue = default(double?), double? maxAvgSeedPopulationValue = default(double?), string avgSeedPopulationUnit = null, System.DateTimeOffset? minPlantingDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxPlantingDateTime = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task ListByFarmerIdAsync(string farmerId, System.Collections.Generic.IEnumerable farmIds = null, System.Collections.Generic.IEnumerable fieldIds = null, System.Collections.Generic.IEnumerable seasonIds = null, System.Collections.Generic.IEnumerable cropVarietyIds = null, System.Collections.Generic.IEnumerable cropIds = null, double? minAvgYieldValue = default(double?), double? maxAvgYieldValue = default(double?), string avgYieldUnit = null, double? minAvgSeedPopulationValue = default(double?), double? maxAvgSeedPopulationValue = default(double?), string avgSeedPopulationUnit = null, System.DateTimeOffset? minPlantingDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxPlantingDateTime = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response Get(string farmerId, string seasonalFieldId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetAsync(string farmerId, string seasonalFieldId, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetCascadeDeleteJobDetails(string jobId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetCascadeDeleteJobDetailsAsync(string jobId, Azure.RequestOptions options) { throw null; } + public virtual Azure.Pageable List(Azure.RequestOptions options, System.Collections.Generic.IEnumerable farmIds = null, System.Collections.Generic.IEnumerable fieldIds = null, System.Collections.Generic.IEnumerable seasonIds = null, System.Collections.Generic.IEnumerable cropVarietyIds = null, System.Collections.Generic.IEnumerable cropIds = null, double? minAvgYieldValue = default(double?), double? maxAvgYieldValue = default(double?), string avgYieldUnit = null, double? minAvgSeedPopulationValue = default(double?), double? maxAvgSeedPopulationValue = default(double?), string avgSeedPopulationUnit = null, System.DateTimeOffset? minPlantingDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxPlantingDateTime = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.AsyncPageable ListAsync(Azure.RequestOptions options, System.Collections.Generic.IEnumerable farmIds = null, System.Collections.Generic.IEnumerable fieldIds = null, System.Collections.Generic.IEnumerable seasonIds = null, System.Collections.Generic.IEnumerable cropVarietyIds = null, System.Collections.Generic.IEnumerable cropIds = null, double? minAvgYieldValue = default(double?), double? maxAvgYieldValue = default(double?), string avgYieldUnit = null, double? minAvgSeedPopulationValue = default(double?), double? maxAvgSeedPopulationValue = default(double?), string avgSeedPopulationUnit = null, System.DateTimeOffset? minPlantingDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxPlantingDateTime = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.Pageable ListByFarmerId(string farmerId, Azure.RequestOptions options, System.Collections.Generic.IEnumerable farmIds = null, System.Collections.Generic.IEnumerable fieldIds = null, System.Collections.Generic.IEnumerable seasonIds = null, System.Collections.Generic.IEnumerable cropVarietyIds = null, System.Collections.Generic.IEnumerable cropIds = null, double? minAvgYieldValue = default(double?), double? maxAvgYieldValue = default(double?), string avgYieldUnit = null, double? minAvgSeedPopulationValue = default(double?), double? maxAvgSeedPopulationValue = default(double?), string avgSeedPopulationUnit = null, System.DateTimeOffset? minPlantingDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxPlantingDateTime = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.AsyncPageable ListByFarmerIdAsync(string farmerId, Azure.RequestOptions options, System.Collections.Generic.IEnumerable farmIds = null, System.Collections.Generic.IEnumerable fieldIds = null, System.Collections.Generic.IEnumerable seasonIds = null, System.Collections.Generic.IEnumerable cropVarietyIds = null, System.Collections.Generic.IEnumerable cropIds = null, double? minAvgYieldValue = default(double?), double? maxAvgYieldValue = default(double?), string avgYieldUnit = null, double? minAvgSeedPopulationValue = default(double?), double? maxAvgSeedPopulationValue = default(double?), string avgSeedPopulationUnit = null, System.DateTimeOffset? minPlantingDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxPlantingDateTime = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } } public partial class SeasonsClient { @@ -277,10 +277,10 @@ public SeasonsClient(System.Uri endpoint, Azure.Core.TokenCredential credential, public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string seasonId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual Azure.Response Delete(string seasonId, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task DeleteAsync(string seasonId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response Get(string seasonId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetAsync(string seasonId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response List(System.DateTimeOffset? minStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxEndDateTime = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable years = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task ListAsync(System.DateTimeOffset? minStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxEndDateTime = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable years = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response Get(string seasonId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetAsync(string seasonId, Azure.RequestOptions options) { throw null; } + public virtual Azure.Pageable List(Azure.RequestOptions options, System.DateTimeOffset? minStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxEndDateTime = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable years = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.AsyncPageable ListAsync(Azure.RequestOptions options, System.DateTimeOffset? minStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxEndDateTime = default(System.DateTimeOffset?), System.Collections.Generic.IEnumerable years = null, System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } } public partial class TillageDataClient { @@ -291,12 +291,12 @@ public TillageDataClient(System.Uri endpoint, Azure.Core.TokenCredential credent public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(string farmerId, string tillageDataId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual Azure.Response Delete(string farmerId, string tillageDataId, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task DeleteAsync(string farmerId, string tillageDataId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response Get(string farmerId, string tillageDataId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetAsync(string farmerId, string tillageDataId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response List(double? minTillageDepth = default(double?), double? maxTillageDepth = default(double?), double? minTillagePressure = default(double?), double? maxTillagePressure = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task ListAsync(double? minTillageDepth = default(double?), double? maxTillageDepth = default(double?), double? minTillagePressure = default(double?), double? maxTillagePressure = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response ListByFarmerId(string farmerId, double? minTillageDepth = default(double?), double? maxTillageDepth = default(double?), double? minTillagePressure = default(double?), double? maxTillagePressure = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task ListByFarmerIdAsync(string farmerId, double? minTillageDepth = default(double?), double? maxTillageDepth = default(double?), double? minTillagePressure = default(double?), double? maxTillagePressure = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response Get(string farmerId, string tillageDataId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetAsync(string farmerId, string tillageDataId, Azure.RequestOptions options) { throw null; } + public virtual Azure.Pageable List(Azure.RequestOptions options, double? minTillageDepth = default(double?), double? maxTillageDepth = default(double?), double? minTillagePressure = default(double?), double? maxTillagePressure = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.AsyncPageable ListAsync(Azure.RequestOptions options, double? minTillageDepth = default(double?), double? maxTillageDepth = default(double?), double? minTillagePressure = default(double?), double? maxTillagePressure = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.Pageable ListByFarmerId(string farmerId, Azure.RequestOptions options, double? minTillageDepth = default(double?), double? maxTillageDepth = default(double?), double? minTillagePressure = default(double?), double? maxTillagePressure = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.AsyncPageable ListByFarmerIdAsync(string farmerId, Azure.RequestOptions options, double? minTillageDepth = default(double?), double? maxTillageDepth = default(double?), double? minTillagePressure = default(double?), double? maxTillagePressure = default(double?), System.Collections.Generic.IEnumerable sources = null, System.Collections.Generic.IEnumerable associatedBoundaryIds = null, System.Collections.Generic.IEnumerable operationBoundaryIds = null, System.DateTimeOffset? minOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationStartDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationEndDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minOperationModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxOperationModifiedDateTime = default(System.DateTimeOffset?), double? minArea = default(double?), double? maxArea = default(double?), System.Collections.Generic.IEnumerable ids = null, System.Collections.Generic.IEnumerable names = null, System.Collections.Generic.IEnumerable propertyFilters = null, System.Collections.Generic.IEnumerable statuses = null, System.DateTimeOffset? minCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxCreatedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? minLastModifiedDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? maxLastModifiedDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } } public partial class WeatherClient { @@ -307,11 +307,11 @@ public WeatherClient(System.Uri endpoint, Azure.Core.TokenCredential credential, public virtual System.Threading.Tasks.Task> CreateDataDeleteJobAsync(string jobId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual Azure.Operation CreateDataIngestionJob(string jobId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task> CreateDataIngestionJobAsync(string jobId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetDataDeleteJobDetails(string jobId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetDataDeleteJobDetailsAsync(string jobId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetDataIngestionJobDetails(string jobId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetDataIngestionJobDetailsAsync(string jobId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response List(string farmerId, string boundaryId, string extensionId, string weatherDataType, string granularity, System.DateTimeOffset? startDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? endDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task ListAsync(string farmerId, string boundaryId, string extensionId, string weatherDataType, string granularity, System.DateTimeOffset? startDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? endDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response GetDataDeleteJobDetails(string jobId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetDataDeleteJobDetailsAsync(string jobId, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetDataIngestionJobDetails(string jobId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetDataIngestionJobDetailsAsync(string jobId, Azure.RequestOptions options) { throw null; } + public virtual Azure.Pageable List(string farmerId, string boundaryId, string extensionId, string weatherDataType, string granularity, Azure.RequestOptions options, System.DateTimeOffset? startDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? endDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } + public virtual Azure.AsyncPageable ListAsync(string farmerId, string boundaryId, string extensionId, string weatherDataType, string granularity, Azure.RequestOptions options, System.DateTimeOffset? startDateTime = default(System.DateTimeOffset?), System.DateTimeOffset? endDateTime = default(System.DateTimeOffset?), int? maxPageSize = default(int?), string skipToken = null) { throw null; } } } diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Azure.Verticals.AgriFood.Farming.csproj b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Azure.Verticals.AgriFood.Farming.csproj index 07b04aad7c63f..567afabca648d 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Azure.Verticals.AgriFood.Farming.csproj +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Azure.Verticals.AgriFood.Farming.csproj @@ -6,6 +6,7 @@ Azure FarmBeats $(RequiredTargetFrameworks) $(NoWarn);AZC0001 + $(DefineConstants);EXPERIMENTAL diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/ApplicationDataClient.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/ApplicationDataClient.cs index 0bcd5a51f592a..00f1b31799c29 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/ApplicationDataClient.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/ApplicationDataClient.cs @@ -7,6 +7,8 @@ using System; using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; @@ -17,14 +19,16 @@ namespace Azure.Verticals.AgriFood.Farming /// The ApplicationData service client. public partial class ApplicationDataClient { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of ApplicationDataClient for mocking. protected ApplicationDataClient() @@ -35,6 +39,7 @@ protected ApplicationDataClient() /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. + /// or is null. public ApplicationDataClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) { if (endpoint == null) @@ -47,57 +52,54 @@ public ApplicationDataClient(Uri endpoint, TokenCredential credential, FarmBeats } options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); _tokenCredential = credential; - var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); - _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { authPolicy }, new ResponseClassifier()); - this.endpoint = endpoint; - apiVersion = options.Version; + _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; } - /// Returns a paginated list of application data resources under a particular farm. + /// Get a specified application data resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the application data resource. + /// The request options. + /// or is null. /// /// Schema for Response Body: /// { - /// value: [ + /// applicationProductDetails: [ /// { - /// applicationProductDetails: [ - /// { - /// productName: string, - /// isCarrier: boolean, - /// avgMaterial: { - /// unit: string, - /// value: number - /// }, - /// totalMaterial: Measure - /// } - /// ], - /// avgMaterial: Measure, - /// totalMaterial: Measure, - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// productName: string, + /// isCarrier: boolean, + /// avgMaterial: { + /// unit: string, + /// value: number + /// }, + /// totalMaterial: Measure /// } /// ], - /// $skipToken: string, - /// nextLink: string + /// avgMaterial: Measure, + /// totalMaterial: Measure, + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -115,65 +117,16 @@ public ApplicationDataClient(Uri endpoint, TokenCredential credential, FarmBeats /// /// /// - /// ID of the associated farmer. - /// Minimum average amount of material applied during the application (inclusive). - /// Maximum average amount of material applied during the application (inclusive). - /// Minimum total amount of material applied during the application (inclusive). - /// Maximum total amount of material applied during the application (inclusive). - /// Sources of the operation data. - /// Boundary IDs associated with operation data. - /// Operation boundary IDs associated with operation data. - /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum area for which operation was applied (inclusive). - /// Maximum area for which operation was applied (inclusive). - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task ListByFarmerIdAsync(string farmerId, double? minAvgMaterial = null, double? maxAvgMaterial = null, double? minTotalMaterial = null, double? maxTotalMaterial = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual async Task GetAsync(string farmerId, string applicationDataId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListByFarmerIdRequest(farmerId, minAvgMaterial, maxAvgMaterial, minTotalMaterial, maxTotalMaterial, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("ApplicationDataClient.ListByFarmerId"); + using var scope = _clientDiagnostics.CreateScope("ApplicationDataClient.Get"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRequest(farmerId, applicationDataId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -182,49 +135,46 @@ public virtual async Task ListByFarmerIdAsync(string farmerId, double? } } - /// Returns a paginated list of application data resources under a particular farm. + /// Get a specified application data resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the application data resource. + /// The request options. + /// or is null. /// /// Schema for Response Body: /// { - /// value: [ + /// applicationProductDetails: [ /// { - /// applicationProductDetails: [ - /// { - /// productName: string, - /// isCarrier: boolean, - /// avgMaterial: { - /// unit: string, - /// value: number - /// }, - /// totalMaterial: Measure - /// } - /// ], - /// avgMaterial: Measure, - /// totalMaterial: Measure, - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// productName: string, + /// isCarrier: boolean, + /// avgMaterial: { + /// unit: string, + /// value: number + /// }, + /// totalMaterial: Measure /// } /// ], - /// $skipToken: string, - /// nextLink: string + /// avgMaterial: Measure, + /// totalMaterial: Measure, + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -242,65 +192,16 @@ public virtual async Task ListByFarmerIdAsync(string farmerId, double? /// /// /// - /// ID of the associated farmer. - /// Minimum average amount of material applied during the application (inclusive). - /// Maximum average amount of material applied during the application (inclusive). - /// Minimum total amount of material applied during the application (inclusive). - /// Maximum total amount of material applied during the application (inclusive). - /// Sources of the operation data. - /// Boundary IDs associated with operation data. - /// Operation boundary IDs associated with operation data. - /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum area for which operation was applied (inclusive). - /// Maximum area for which operation was applied (inclusive). - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual Response ListByFarmerId(string farmerId, double? minAvgMaterial = null, double? maxAvgMaterial = null, double? minTotalMaterial = null, double? maxTotalMaterial = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual Response Get(string farmerId, string applicationDataId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListByFarmerIdRequest(farmerId, minAvgMaterial, maxAvgMaterial, minTotalMaterial, maxTotalMaterial, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("ApplicationDataClient.ListByFarmerId"); + using var scope = _clientDiagnostics.CreateScope("ApplicationDataClient.Get"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRequest(farmerId, applicationDataId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -309,165 +210,81 @@ public virtual Response ListByFarmerId(string farmerId, double? minAvgMaterial = } } - private HttpMessage CreateListByFarmerIdRequest(string farmerId, double? minAvgMaterial, double? maxAvgMaterial, double? minTotalMaterial, double? maxTotalMaterial, IEnumerable sources, IEnumerable associatedBoundaryIds, IEnumerable operationBoundaryIds, DateTimeOffset? minOperationStartDateTime, DateTimeOffset? maxOperationStartDateTime, DateTimeOffset? minOperationEndDateTime, DateTimeOffset? maxOperationEndDateTime, DateTimeOffset? minOperationModifiedDateTime, DateTimeOffset? maxOperationModifiedDateTime, double? minArea, double? maxArea, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/application-data", false); - if (minAvgMaterial != null) - { - uri.AppendQuery("minAvgMaterial", minAvgMaterial.Value, true); - } - if (maxAvgMaterial != null) - { - uri.AppendQuery("maxAvgMaterial", maxAvgMaterial.Value, true); - } - if (minTotalMaterial != null) - { - uri.AppendQuery("minTotalMaterial", minTotalMaterial.Value, true); - } - if (maxTotalMaterial != null) - { - uri.AppendQuery("maxTotalMaterial", maxTotalMaterial.Value, true); - } - if (sources != null) - { - uri.AppendQueryDelimited("sources", sources, ",", true); - } - if (associatedBoundaryIds != null) - { - uri.AppendQueryDelimited("associatedBoundaryIds", associatedBoundaryIds, ",", true); - } - if (operationBoundaryIds != null) - { - uri.AppendQueryDelimited("operationBoundaryIds", operationBoundaryIds, ",", true); - } - if (minOperationStartDateTime != null) - { - uri.AppendQuery("minOperationStartDateTime", minOperationStartDateTime.Value, "O", true); - } - if (maxOperationStartDateTime != null) - { - uri.AppendQuery("maxOperationStartDateTime", maxOperationStartDateTime.Value, "O", true); - } - if (minOperationEndDateTime != null) - { - uri.AppendQuery("minOperationEndDateTime", minOperationEndDateTime.Value, "O", true); - } - if (maxOperationEndDateTime != null) - { - uri.AppendQuery("maxOperationEndDateTime", maxOperationEndDateTime.Value, "O", true); - } - if (minOperationModifiedDateTime != null) - { - uri.AppendQuery("minOperationModifiedDateTime", minOperationModifiedDateTime.Value, "O", true); - } - if (maxOperationModifiedDateTime != null) - { - uri.AppendQuery("maxOperationModifiedDateTime", maxOperationModifiedDateTime.Value, "O", true); - } - if (minArea != null) - { - uri.AppendQuery("minArea", minArea.Value, true); - } - if (maxArea != null) - { - uri.AppendQuery("maxArea", maxArea.Value, true); - } - if (ids != null) - { - uri.AppendQueryDelimited("ids", ids, ",", true); - } - if (names != null) - { - uri.AppendQueryDelimited("names", names, ",", true); - } - if (propertyFilters != null) - { - uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); - } - if (statuses != null) - { - uri.AppendQueryDelimited("statuses", statuses, ",", true); - } - if (minCreatedDateTime != null) - { - uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); - } - if (maxCreatedDateTime != null) - { - uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); - } - if (minLastModifiedDateTime != null) - { - uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); - } - if (maxLastModifiedDateTime != null) - { - uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); - } - if (maxPageSize != null) - { - uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Returns a paginated list of application data resources across all farmers. + /// Creates or updates an application data resource under a particular farmer. + /// ID of the associated farmer. + /// ID of the application data resource. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// + /// Schema for Request Body: + /// { + /// applicationProductDetails: [ + /// { + /// productName: string, + /// isCarrier: boolean, + /// avgMaterial: { + /// unit: string, + /// value: number + /// }, + /// totalMaterial: Measure + /// } + /// ], + /// avgMaterial: Measure, + /// totalMaterial: Measure, + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// /// Schema for Response Body: /// { - /// value: [ + /// applicationProductDetails: [ /// { - /// applicationProductDetails: [ - /// { - /// productName: string, - /// isCarrier: boolean, - /// avgMaterial: { - /// unit: string, - /// value: number - /// }, - /// totalMaterial: Measure - /// } - /// ], - /// avgMaterial: Measure, - /// totalMaterial: Measure, - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// productName: string, + /// isCarrier: boolean, + /// avgMaterial: { + /// unit: string, + /// value: number + /// }, + /// totalMaterial: Measure /// } /// ], - /// $skipToken: string, - /// nextLink: string + /// avgMaterial: Measure, + /// totalMaterial: Measure, + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -485,64 +302,16 @@ private HttpMessage CreateListByFarmerIdRequest(string farmerId, double? minAvgM /// /// /// - /// Minimum average amount of material applied during the application (inclusive). - /// Maximum average amount of material applied during the application (inclusive). - /// Minimum total amount of material applied during the application (inclusive). - /// Maximum total amount of material applied during the application (inclusive). - /// Sources of the operation data. - /// Boundary IDs associated with operation data. - /// Operation boundary IDs associated with operation data. - /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum area for which operation was applied (inclusive). - /// Maximum area for which operation was applied (inclusive). - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task ListAsync(double? minAvgMaterial = null, double? maxAvgMaterial = null, double? minTotalMaterial = null, double? maxTotalMaterial = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual async Task CreateOrUpdateAsync(string farmerId, string applicationDataId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRequest(minAvgMaterial, maxAvgMaterial, minTotalMaterial, maxTotalMaterial, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("ApplicationDataClient.List"); + using var scope = _clientDiagnostics.CreateScope("ApplicationDataClient.CreateOrUpdate"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, applicationDataId, content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -551,248 +320,47 @@ public virtual async Task ListAsync(double? minAvgMaterial = null, dou } } - /// Returns a paginated list of application data resources across all farmers. + /// Creates or updates an application data resource under a particular farmer. + /// ID of the associated farmer. + /// ID of the application data resource. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// - /// Schema for Response Body: + /// Schema for Request Body: /// { - /// value: [ + /// applicationProductDetails: [ /// { - /// applicationProductDetails: [ - /// { - /// productName: string, - /// isCarrier: boolean, - /// avgMaterial: { - /// unit: string, - /// value: number - /// }, - /// totalMaterial: Measure - /// } - /// ], - /// avgMaterial: Measure, - /// totalMaterial: Measure, - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// productName: string, + /// isCarrier: boolean, + /// avgMaterial: { + /// unit: string, + /// value: number + /// }, + /// totalMaterial: Measure /// } /// ], - /// $skipToken: string, - /// nextLink: string - /// } - /// - /// - /// Schema for Response Error: - /// { - /// error: { - /// code: string, - /// message: string, - /// target: string, - /// details: [Error], - /// innererror: { - /// code: string, - /// innererror: InnerError - /// } - /// }, - /// traceId: string + /// avgMaterial: Measure, + /// totalMaterial: Measure, + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// - /// - /// Minimum average amount of material applied during the application (inclusive). - /// Maximum average amount of material applied during the application (inclusive). - /// Minimum total amount of material applied during the application (inclusive). - /// Maximum total amount of material applied during the application (inclusive). - /// Sources of the operation data. - /// Boundary IDs associated with operation data. - /// Operation boundary IDs associated with operation data. - /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum area for which operation was applied (inclusive). - /// Maximum area for which operation was applied (inclusive). - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. -#pragma warning disable AZC0002 - public virtual Response List(double? minAvgMaterial = null, double? maxAvgMaterial = null, double? minTotalMaterial = null, double? maxTotalMaterial = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) -#pragma warning restore AZC0002 - { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRequest(minAvgMaterial, maxAvgMaterial, minTotalMaterial, maxTotalMaterial, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("ApplicationDataClient.List"); - scope.Start(); - try - { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - private HttpMessage CreateListRequest(double? minAvgMaterial, double? maxAvgMaterial, double? minTotalMaterial, double? maxTotalMaterial, IEnumerable sources, IEnumerable associatedBoundaryIds, IEnumerable operationBoundaryIds, DateTimeOffset? minOperationStartDateTime, DateTimeOffset? maxOperationStartDateTime, DateTimeOffset? minOperationEndDateTime, DateTimeOffset? maxOperationEndDateTime, DateTimeOffset? minOperationModifiedDateTime, DateTimeOffset? maxOperationModifiedDateTime, double? minArea, double? maxArea, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/application-data", false); - if (minAvgMaterial != null) - { - uri.AppendQuery("minAvgMaterial", minAvgMaterial.Value, true); - } - if (maxAvgMaterial != null) - { - uri.AppendQuery("maxAvgMaterial", maxAvgMaterial.Value, true); - } - if (minTotalMaterial != null) - { - uri.AppendQuery("minTotalMaterial", minTotalMaterial.Value, true); - } - if (maxTotalMaterial != null) - { - uri.AppendQuery("maxTotalMaterial", maxTotalMaterial.Value, true); - } - if (sources != null) - { - uri.AppendQueryDelimited("sources", sources, ",", true); - } - if (associatedBoundaryIds != null) - { - uri.AppendQueryDelimited("associatedBoundaryIds", associatedBoundaryIds, ",", true); - } - if (operationBoundaryIds != null) - { - uri.AppendQueryDelimited("operationBoundaryIds", operationBoundaryIds, ",", true); - } - if (minOperationStartDateTime != null) - { - uri.AppendQuery("minOperationStartDateTime", minOperationStartDateTime.Value, "O", true); - } - if (maxOperationStartDateTime != null) - { - uri.AppendQuery("maxOperationStartDateTime", maxOperationStartDateTime.Value, "O", true); - } - if (minOperationEndDateTime != null) - { - uri.AppendQuery("minOperationEndDateTime", minOperationEndDateTime.Value, "O", true); - } - if (maxOperationEndDateTime != null) - { - uri.AppendQuery("maxOperationEndDateTime", maxOperationEndDateTime.Value, "O", true); - } - if (minOperationModifiedDateTime != null) - { - uri.AppendQuery("minOperationModifiedDateTime", minOperationModifiedDateTime.Value, "O", true); - } - if (maxOperationModifiedDateTime != null) - { - uri.AppendQuery("maxOperationModifiedDateTime", maxOperationModifiedDateTime.Value, "O", true); - } - if (minArea != null) - { - uri.AppendQuery("minArea", minArea.Value, true); - } - if (maxArea != null) - { - uri.AppendQuery("maxArea", maxArea.Value, true); - } - if (ids != null) - { - uri.AppendQueryDelimited("ids", ids, ",", true); - } - if (names != null) - { - uri.AppendQueryDelimited("names", names, ",", true); - } - if (propertyFilters != null) - { - uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); - } - if (statuses != null) - { - uri.AppendQueryDelimited("statuses", statuses, ",", true); - } - if (minCreatedDateTime != null) - { - uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); - } - if (maxCreatedDateTime != null) - { - uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); - } - if (minLastModifiedDateTime != null) - { - uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); - } - if (maxLastModifiedDateTime != null) - { - uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); - } - if (maxPageSize != null) - { - uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Get a specified application data resource under a particular farmer. - /// /// Schema for Response Body: /// { /// applicationProductDetails: [ @@ -827,7 +395,6 @@ private HttpMessage CreateListRequest(double? minAvgMaterial, double? maxAvgMate /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -845,35 +412,16 @@ private HttpMessage CreateListRequest(double? minAvgMaterial, double? maxAvgMate /// /// /// - /// ID of the associated farmer resource. - /// ID of the application data resource. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetAsync(string farmerId, string applicationDataId, RequestOptions options = null) + public virtual Response CreateOrUpdate(string farmerId, string applicationDataId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRequest(farmerId, applicationDataId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("ApplicationDataClient.Get"); + using var scope = _clientDiagnostics.CreateScope("ApplicationDataClient.CreateOrUpdate"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, applicationDataId, content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -882,43 +430,12 @@ public virtual async Task GetAsync(string farmerId, string application } } - /// Get a specified application data resource under a particular farmer. + /// Deletes a specified application data resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the application data. + /// The request options. + /// or is null. /// - /// Schema for Response Body: - /// { - /// applicationProductDetails: [ - /// { - /// productName: string, - /// isCarrier: boolean, - /// avgMaterial: { - /// unit: string, - /// value: number - /// }, - /// totalMaterial: Measure - /// } - /// ], - /// avgMaterial: Measure, - /// totalMaterial: Measure, - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// /// Schema for Response Error: /// { /// error: { @@ -936,35 +453,16 @@ public virtual async Task GetAsync(string farmerId, string application /// /// /// - /// ID of the associated farmer resource. - /// ID of the application data resource. - /// The request options. #pragma warning disable AZC0002 - public virtual Response Get(string farmerId, string applicationDataId, RequestOptions options = null) + public virtual async Task DeleteAsync(string farmerId, string applicationDataId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRequest(farmerId, applicationDataId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("ApplicationDataClient.Get"); + using var scope = _clientDiagnostics.CreateScope("ApplicationDataClient.Delete"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(farmerId, applicationDataId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -973,95 +471,12 @@ public virtual Response Get(string farmerId, string applicationDataId, RequestOp } } - private HttpMessage CreateGetRequest(string farmerId, string applicationDataId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/application-data/", false); - uri.AppendPath(applicationDataId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Creates or updates an application data resource under a particular farmer. + /// Deletes a specified application data resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the application data. + /// The request options. + /// or is null. /// - /// Schema for Request Body: - /// { - /// applicationProductDetails: [ - /// { - /// productName: string, - /// isCarrier: boolean, - /// avgMaterial: { - /// unit: string, - /// value: number - /// }, - /// totalMaterial: Measure - /// } - /// ], - /// avgMaterial: Measure, - /// totalMaterial: Measure, - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// - /// Schema for Response Body: - /// { - /// applicationProductDetails: [ - /// { - /// productName: string, - /// isCarrier: boolean, - /// avgMaterial: { - /// unit: string, - /// value: number - /// }, - /// totalMaterial: Measure - /// } - /// ], - /// avgMaterial: Measure, - /// totalMaterial: Measure, - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// /// Schema for Response Error: /// { /// error: { @@ -1079,37 +494,16 @@ private HttpMessage CreateGetRequest(string farmerId, string applicationDataId) /// /// /// - /// ID of the associated farmer. - /// ID of the application data resource. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task CreateOrUpdateAsync(string farmerId, string applicationDataId, RequestContent content, RequestOptions options = null) + public virtual Response Delete(string farmerId, string applicationDataId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, applicationDataId, content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("ApplicationDataClient.CreateOrUpdate"); + using var scope = _clientDiagnostics.CreateScope("ApplicationDataClient.Delete"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(farmerId, applicationDataId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1118,78 +512,82 @@ public virtual async Task CreateOrUpdateAsync(string farmerId, string } } - /// Creates or updates an application data resource under a particular farmer. + /// Returns a paginated list of application data resources under a particular farm. + /// ID of the associated farmer. + /// The request options. + /// Minimum average amount of material applied during the application (inclusive). + /// Maximum average amount of material applied during the application (inclusive). + /// Minimum total amount of material applied during the application (inclusive). + /// Maximum total amount of material applied during the application (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// is null. /// - /// Schema for Request Body: - /// { - /// applicationProductDetails: [ - /// { - /// productName: string, - /// isCarrier: boolean, - /// avgMaterial: { - /// unit: string, - /// value: number - /// }, - /// totalMaterial: Measure - /// } - /// ], - /// avgMaterial: Measure, - /// totalMaterial: Measure, - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// /// Schema for Response Body: /// { - /// applicationProductDetails: [ + /// value: [ /// { - /// productName: string, - /// isCarrier: boolean, - /// avgMaterial: { - /// unit: string, - /// value: number - /// }, - /// totalMaterial: Measure + /// applicationProductDetails: [ + /// { + /// productName: string, + /// isCarrier: boolean, + /// avgMaterial: { + /// unit: string, + /// value: number + /// }, + /// totalMaterial: Measure + /// } + /// ], + /// avgMaterial: Measure, + /// totalMaterial: Measure, + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// ], - /// avgMaterial: Measure, - /// totalMaterial: Measure, - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// $skipToken: string, + /// nextLink: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1207,66 +605,106 @@ public virtual async Task CreateOrUpdateAsync(string farmerId, string /// /// /// - /// ID of the associated farmer. - /// ID of the application data resource. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual Response CreateOrUpdate(string farmerId, string applicationDataId, RequestContent content, RequestOptions options = null) + public virtual AsyncPageable ListByFarmerIdAsync(string farmerId, RequestOptions options, double? minAvgMaterial = null, double? maxAvgMaterial = null, double? minTotalMaterial = null, double? maxTotalMaterial = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, applicationDataId, content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("ApplicationDataClient.CreateOrUpdate"); - scope.Start(); - try + if (farmerId == null) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + throw new ArgumentNullException(nameof(farmerId)); } - catch (Exception e) + + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "ApplicationDataClient.ListByFarmerId"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) { - scope.Failed(e); - throw; + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListByFarmerIdRequest(farmerId, minAvgMaterial, maxAvgMaterial, minTotalMaterial, maxTotalMaterial, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListByFarmerIdNextPageRequest(nextLink, farmerId, minAvgMaterial, maxAvgMaterial, minTotalMaterial, maxTotalMaterial, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - private HttpMessage CreateCreateOrUpdateRequest(string farmerId, string applicationDataId, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/application-data/", false); - uri.AppendPath(applicationDataId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/merge-patch+json"); - request.Content = content; - return message; - } - - /// Deletes a specified application data resource under a particular farmer. + /// Returns a paginated list of application data resources under a particular farm. + /// ID of the associated farmer. + /// The request options. + /// Minimum average amount of material applied during the application (inclusive). + /// Maximum average amount of material applied during the application (inclusive). + /// Minimum total amount of material applied during the application (inclusive). + /// Maximum total amount of material applied during the application (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// is null. /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// applicationProductDetails: [ + /// { + /// productName: string, + /// isCarrier: boolean, + /// avgMaterial: { + /// unit: string, + /// value: number + /// }, + /// totalMaterial: Measure + /// } + /// ], + /// avgMaterial: Measure, + /// totalMaterial: Measure, + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string + /// } + /// /// Schema for Response Error: /// { /// error: { @@ -1284,45 +722,104 @@ private HttpMessage CreateCreateOrUpdateRequest(string farmerId, string applicat /// /// /// - /// ID of the associated farmer resource. - /// ID of the application data. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task DeleteAsync(string farmerId, string applicationDataId, RequestOptions options = null) + public virtual Pageable ListByFarmerId(string farmerId, RequestOptions options, double? minAvgMaterial = null, double? maxAvgMaterial = null, double? minTotalMaterial = null, double? maxTotalMaterial = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(farmerId, applicationDataId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("ApplicationDataClient.Delete"); - scope.Start(); - try + if (farmerId == null) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + throw new ArgumentNullException(nameof(farmerId)); } - catch (Exception e) + + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "ApplicationDataClient.ListByFarmerId"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) { - scope.Failed(e); - throw; + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListByFarmerIdRequest(farmerId, minAvgMaterial, maxAvgMaterial, minTotalMaterial, maxTotalMaterial, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListByFarmerIdNextPageRequest(nextLink, farmerId, minAvgMaterial, maxAvgMaterial, minTotalMaterial, maxTotalMaterial, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - /// Deletes a specified application data resource under a particular farmer. + /// Returns a paginated list of application data resources across all farmers. + /// The request options. + /// Minimum average amount of material applied during the application (inclusive). + /// Maximum average amount of material applied during the application (inclusive). + /// Minimum total amount of material applied during the application (inclusive). + /// Maximum total amount of material applied during the application (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// applicationProductDetails: [ + /// { + /// productName: string, + /// isCarrier: boolean, + /// avgMaterial: { + /// unit: string, + /// value: number + /// }, + /// totalMaterial: Measure + /// } + /// ], + /// avgMaterial: Measure, + /// totalMaterial: Measure, + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string + /// } + /// /// Schema for Response Error: /// { /// error: { @@ -1340,58 +837,532 @@ public virtual async Task DeleteAsync(string farmerId, string applicat /// /// /// - /// ID of the associated farmer resource. - /// ID of the application data. - /// The request options. #pragma warning disable AZC0002 - public virtual Response Delete(string farmerId, string applicationDataId, RequestOptions options = null) + public virtual AsyncPageable ListAsync(RequestOptions options, double? minAvgMaterial = null, double? maxAvgMaterial = null, double? minTotalMaterial = null, double? maxTotalMaterial = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(farmerId, applicationDataId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("ApplicationDataClient.Delete"); - scope.Start(); - try + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "ApplicationDataClient.List"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) + do { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; + var message = string.IsNullOrEmpty(nextLink) + ? CreateListRequest(minAvgMaterial, maxAvgMaterial, minTotalMaterial, maxTotalMaterial, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListNextPageRequest(nextLink, minAvgMaterial, maxAvgMaterial, minTotalMaterial, maxTotalMaterial, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - private HttpMessage CreateDeleteRequest(string farmerId, string applicationDataId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/application-data/", false); - uri.AppendPath(applicationDataId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; + /// Returns a paginated list of application data resources across all farmers. + /// The request options. + /// Minimum average amount of material applied during the application (inclusive). + /// Maximum average amount of material applied during the application (inclusive). + /// Minimum total amount of material applied during the application (inclusive). + /// Maximum total amount of material applied during the application (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// applicationProductDetails: [ + /// { + /// productName: string, + /// isCarrier: boolean, + /// avgMaterial: { + /// unit: string, + /// value: number + /// }, + /// totalMaterial: Measure + /// } + /// ], + /// avgMaterial: Measure, + /// totalMaterial: Measure, + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [Error], + /// innererror: { + /// code: string, + /// innererror: InnerError + /// } + /// }, + /// traceId: string + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual Pageable List(RequestOptions options, double? minAvgMaterial = null, double? maxAvgMaterial = null, double? minTotalMaterial = null, double? maxTotalMaterial = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) +#pragma warning restore AZC0002 + { + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "ApplicationDataClient.List"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListRequest(minAvgMaterial, maxAvgMaterial, minTotalMaterial, maxTotalMaterial, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListNextPageRequest(nextLink, minAvgMaterial, maxAvgMaterial, minTotalMaterial, maxTotalMaterial, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + internal HttpMessage CreateListByFarmerIdRequest(string farmerId, double? minAvgMaterial, double? maxAvgMaterial, double? minTotalMaterial, double? maxTotalMaterial, IEnumerable sources, IEnumerable associatedBoundaryIds, IEnumerable operationBoundaryIds, DateTimeOffset? minOperationStartDateTime, DateTimeOffset? maxOperationStartDateTime, DateTimeOffset? minOperationEndDateTime, DateTimeOffset? maxOperationEndDateTime, DateTimeOffset? minOperationModifiedDateTime, DateTimeOffset? maxOperationModifiedDateTime, double? minArea, double? maxArea, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/application-data", false); + if (minAvgMaterial != null) + { + uri.AppendQuery("minAvgMaterial", minAvgMaterial.Value, true); + } + if (maxAvgMaterial != null) + { + uri.AppendQuery("maxAvgMaterial", maxAvgMaterial.Value, true); + } + if (minTotalMaterial != null) + { + uri.AppendQuery("minTotalMaterial", minTotalMaterial.Value, true); + } + if (maxTotalMaterial != null) + { + uri.AppendQuery("maxTotalMaterial", maxTotalMaterial.Value, true); + } + if (sources != null) + { + foreach (var param in sources) + { + uri.AppendQuery("sources", param, true); + } + } + if (associatedBoundaryIds != null) + { + foreach (var param in associatedBoundaryIds) + { + uri.AppendQuery("associatedBoundaryIds", param, true); + } + } + if (operationBoundaryIds != null) + { + foreach (var param in operationBoundaryIds) + { + uri.AppendQuery("operationBoundaryIds", param, true); + } + } + if (minOperationStartDateTime != null) + { + uri.AppendQuery("minOperationStartDateTime", minOperationStartDateTime.Value, "O", true); + } + if (maxOperationStartDateTime != null) + { + uri.AppendQuery("maxOperationStartDateTime", maxOperationStartDateTime.Value, "O", true); + } + if (minOperationEndDateTime != null) + { + uri.AppendQuery("minOperationEndDateTime", minOperationEndDateTime.Value, "O", true); + } + if (maxOperationEndDateTime != null) + { + uri.AppendQuery("maxOperationEndDateTime", maxOperationEndDateTime.Value, "O", true); + } + if (minOperationModifiedDateTime != null) + { + uri.AppendQuery("minOperationModifiedDateTime", minOperationModifiedDateTime.Value, "O", true); + } + if (maxOperationModifiedDateTime != null) + { + uri.AppendQuery("maxOperationModifiedDateTime", maxOperationModifiedDateTime.Value, "O", true); + } + if (minArea != null) + { + uri.AppendQuery("minArea", minArea.Value, true); + } + if (maxArea != null) + { + uri.AppendQuery("maxArea", maxArea.Value, true); + } + if (ids != null) + { + foreach (var param in ids) + { + uri.AppendQuery("ids", param, true); + } + } + if (names != null) + { + foreach (var param in names) + { + uri.AppendQuery("names", param, true); + } + } + if (propertyFilters != null) + { + foreach (var param in propertyFilters) + { + uri.AppendQuery("propertyFilters", param, true); + } + } + if (statuses != null) + { + foreach (var param in statuses) + { + uri.AppendQuery("statuses", param, true); + } + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateListRequest(double? minAvgMaterial, double? maxAvgMaterial, double? minTotalMaterial, double? maxTotalMaterial, IEnumerable sources, IEnumerable associatedBoundaryIds, IEnumerable operationBoundaryIds, DateTimeOffset? minOperationStartDateTime, DateTimeOffset? maxOperationStartDateTime, DateTimeOffset? minOperationEndDateTime, DateTimeOffset? maxOperationEndDateTime, DateTimeOffset? minOperationModifiedDateTime, DateTimeOffset? maxOperationModifiedDateTime, double? minArea, double? maxArea, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/application-data", false); + if (minAvgMaterial != null) + { + uri.AppendQuery("minAvgMaterial", minAvgMaterial.Value, true); + } + if (maxAvgMaterial != null) + { + uri.AppendQuery("maxAvgMaterial", maxAvgMaterial.Value, true); + } + if (minTotalMaterial != null) + { + uri.AppendQuery("minTotalMaterial", minTotalMaterial.Value, true); + } + if (maxTotalMaterial != null) + { + uri.AppendQuery("maxTotalMaterial", maxTotalMaterial.Value, true); + } + if (sources != null) + { + foreach (var param in sources) + { + uri.AppendQuery("sources", param, true); + } + } + if (associatedBoundaryIds != null) + { + foreach (var param in associatedBoundaryIds) + { + uri.AppendQuery("associatedBoundaryIds", param, true); + } + } + if (operationBoundaryIds != null) + { + foreach (var param in operationBoundaryIds) + { + uri.AppendQuery("operationBoundaryIds", param, true); + } + } + if (minOperationStartDateTime != null) + { + uri.AppendQuery("minOperationStartDateTime", minOperationStartDateTime.Value, "O", true); + } + if (maxOperationStartDateTime != null) + { + uri.AppendQuery("maxOperationStartDateTime", maxOperationStartDateTime.Value, "O", true); + } + if (minOperationEndDateTime != null) + { + uri.AppendQuery("minOperationEndDateTime", minOperationEndDateTime.Value, "O", true); + } + if (maxOperationEndDateTime != null) + { + uri.AppendQuery("maxOperationEndDateTime", maxOperationEndDateTime.Value, "O", true); + } + if (minOperationModifiedDateTime != null) + { + uri.AppendQuery("minOperationModifiedDateTime", minOperationModifiedDateTime.Value, "O", true); + } + if (maxOperationModifiedDateTime != null) + { + uri.AppendQuery("maxOperationModifiedDateTime", maxOperationModifiedDateTime.Value, "O", true); + } + if (minArea != null) + { + uri.AppendQuery("minArea", minArea.Value, true); + } + if (maxArea != null) + { + uri.AppendQuery("maxArea", maxArea.Value, true); + } + if (ids != null) + { + foreach (var param in ids) + { + uri.AppendQuery("ids", param, true); + } + } + if (names != null) + { + foreach (var param in names) + { + uri.AppendQuery("names", param, true); + } + } + if (propertyFilters != null) + { + foreach (var param in propertyFilters) + { + uri.AppendQuery("propertyFilters", param, true); + } + } + if (statuses != null) + { + foreach (var param in statuses) + { + uri.AppendQuery("statuses", param, true); + } + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetRequest(string farmerId, string applicationDataId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/application-data/", false); + uri.AppendPath(applicationDataId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string farmerId, string applicationDataId, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/application-data/", false); + uri.AppendPath(applicationDataId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/merge-patch+json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200201.Instance; + return message; + } + + internal HttpMessage CreateDeleteRequest(string farmerId, string applicationDataId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/application-data/", false); + uri.AppendPath(applicationDataId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier204.Instance; + return message; + } + + internal HttpMessage CreateListByFarmerIdNextPageRequest(string nextLink, string farmerId, double? minAvgMaterial, double? maxAvgMaterial, double? minTotalMaterial, double? maxTotalMaterial, IEnumerable sources, IEnumerable associatedBoundaryIds, IEnumerable operationBoundaryIds, DateTimeOffset? minOperationStartDateTime, DateTimeOffset? maxOperationStartDateTime, DateTimeOffset? minOperationEndDateTime, DateTimeOffset? maxOperationEndDateTime, DateTimeOffset? minOperationModifiedDateTime, DateTimeOffset? maxOperationModifiedDateTime, double? minArea, double? maxArea, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, double? minAvgMaterial, double? maxAvgMaterial, double? minTotalMaterial, double? maxTotalMaterial, IEnumerable sources, IEnumerable associatedBoundaryIds, IEnumerable operationBoundaryIds, DateTimeOffset? minOperationStartDateTime, DateTimeOffset? maxOperationStartDateTime, DateTimeOffset? minOperationEndDateTime, DateTimeOffset? maxOperationEndDateTime, DateTimeOffset? minOperationModifiedDateTime, DateTimeOffset? maxOperationModifiedDateTime, double? minArea, double? maxArea, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier200201 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200201(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + 201 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier204 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier204(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 204 => false, + _ => true + }; + } } } } diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/AttachmentsClient.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/AttachmentsClient.cs index 70e941e168739..dbef3f610101f 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/AttachmentsClient.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/AttachmentsClient.cs @@ -7,6 +7,8 @@ using System; using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; @@ -17,14 +19,16 @@ namespace Azure.Verticals.AgriFood.Farming /// The Attachments service client. public partial class AttachmentsClient { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of AttachmentsClient for mocking. protected AttachmentsClient() @@ -35,6 +39,7 @@ protected AttachmentsClient() /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. + /// or is null. public AttachmentsClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) { if (endpoint == null) @@ -47,38 +52,35 @@ public AttachmentsClient(Uri endpoint, TokenCredential credential, FarmBeatsClie } options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); _tokenCredential = credential; - var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); - _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { authPolicy }, new ResponseClassifier()); - this.endpoint = endpoint; - apiVersion = options.Version; + _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; } - /// Returns a paginated list of attachment resources under a particular farmer. + /// Gets a specified attachment resource under a particular farmer. + /// ID of the associated farmer. + /// ID of the attachment. + /// The request options. + /// or is null. /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// farmerId: string, - /// resourceId: string, - /// resourceType: string, - /// originalFileName: string, - /// id: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// eTag: string - /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// farmerId: string, + /// resourceId: string, + /// resourceType: string, + /// originalFileName: string, + /// id: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// eTag: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -96,52 +98,16 @@ public AttachmentsClient(Uri endpoint, TokenCredential credential, FarmBeatsClie /// /// /// - /// ID of the associated farmer. - /// Resource Ids of the resource. - /// Resource Types of the resource. - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task ListByFarmerIdAsync(string farmerId, IEnumerable resourceIds = null, IEnumerable resourceTypes = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual async Task GetAsync(string farmerId, string attachmentId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListByFarmerIdRequest(farmerId, resourceIds, resourceTypes, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("AttachmentsClient.ListByFarmerId"); + using var scope = _clientDiagnostics.CreateScope("AttachmentsClient.Get"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRequest(farmerId, attachmentId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -150,30 +116,27 @@ public virtual async Task ListByFarmerIdAsync(string farmerId, IEnumer } } - /// Returns a paginated list of attachment resources under a particular farmer. + /// Gets a specified attachment resource under a particular farmer. + /// ID of the associated farmer. + /// ID of the attachment. + /// The request options. + /// or is null. /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// farmerId: string, - /// resourceId: string, - /// resourceType: string, - /// originalFileName: string, - /// id: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// eTag: string - /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// farmerId: string, + /// resourceId: string, + /// resourceType: string, + /// originalFileName: string, + /// id: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// eTag: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -191,52 +154,16 @@ public virtual async Task ListByFarmerIdAsync(string farmerId, IEnumer /// /// /// - /// ID of the associated farmer. - /// Resource Ids of the resource. - /// Resource Types of the resource. - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual Response ListByFarmerId(string farmerId, IEnumerable resourceIds = null, IEnumerable resourceTypes = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual Response Get(string farmerId, string attachmentId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListByFarmerIdRequest(farmerId, resourceIds, resourceTypes, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("AttachmentsClient.ListByFarmerId"); + using var scope = _clientDiagnostics.CreateScope("AttachmentsClient.Get"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRequest(farmerId, attachmentId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -245,71 +172,12 @@ public virtual Response ListByFarmerId(string farmerId, IEnumerable reso } } - private HttpMessage CreateListByFarmerIdRequest(string farmerId, IEnumerable resourceIds, IEnumerable resourceTypes, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/attachments", false); - if (resourceIds != null) - { - uri.AppendQueryDelimited("resourceIds", resourceIds, ",", true); - } - if (resourceTypes != null) - { - uri.AppendQueryDelimited("resourceTypes", resourceTypes, ",", true); - } - if (ids != null) - { - uri.AppendQueryDelimited("ids", ids, ",", true); - } - if (names != null) - { - uri.AppendQueryDelimited("names", names, ",", true); - } - if (propertyFilters != null) - { - uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); - } - if (statuses != null) - { - uri.AppendQueryDelimited("statuses", statuses, ",", true); - } - if (minCreatedDateTime != null) - { - uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); - } - if (maxCreatedDateTime != null) - { - uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); - } - if (minLastModifiedDateTime != null) - { - uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); - } - if (maxLastModifiedDateTime != null) - { - uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); - } - if (maxPageSize != null) - { - uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets a specified attachment resource under a particular farmer. + /// Creates or updates an attachment resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the attachment resource. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// /// Schema for Response Body: /// { @@ -326,7 +194,6 @@ private HttpMessage CreateListByFarmerIdRequest(string farmerId, IEnumerable - /// /// Schema for Response Error: /// { /// error: { @@ -344,35 +211,16 @@ private HttpMessage CreateListByFarmerIdRequest(string farmerId, IEnumerable /// /// - /// ID of the associated farmer. - /// ID of the attachment. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetAsync(string farmerId, string attachmentId, RequestOptions options = null) + public virtual async Task CreateOrUpdateAsync(string farmerId, string attachmentId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRequest(farmerId, attachmentId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("AttachmentsClient.Get"); + using var scope = _clientDiagnostics.CreateScope("AttachmentsClient.CreateOrUpdate"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, attachmentId, content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -381,7 +229,12 @@ public virtual async Task GetAsync(string farmerId, string attachmentI } } - /// Gets a specified attachment resource under a particular farmer. + /// Creates or updates an attachment resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the attachment resource. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// /// Schema for Response Body: /// { @@ -398,7 +251,6 @@ public virtual async Task GetAsync(string farmerId, string attachmentI /// eTag: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -416,35 +268,16 @@ public virtual async Task GetAsync(string farmerId, string attachmentI /// /// /// - /// ID of the associated farmer. - /// ID of the attachment. - /// The request options. #pragma warning disable AZC0002 - public virtual Response Get(string farmerId, string attachmentId, RequestOptions options = null) + public virtual Response CreateOrUpdate(string farmerId, string attachmentId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRequest(farmerId, attachmentId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("AttachmentsClient.Get"); + using var scope = _clientDiagnostics.CreateScope("AttachmentsClient.CreateOrUpdate"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, attachmentId, content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -453,41 +286,12 @@ public virtual Response Get(string farmerId, string attachmentId, RequestOptions } } - private HttpMessage CreateGetRequest(string farmerId, string attachmentId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/attachments/", false); - uri.AppendPath(attachmentId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Creates or updates an attachment resource under a particular farmer. + /// Deletes a specified attachment resource under a particular farmer. + /// ID of the farmer. + /// ID of the attachment. + /// The request options. + /// or is null. /// - /// Schema for Response Body: - /// { - /// farmerId: string, - /// resourceId: string, - /// resourceType: string, - /// originalFileName: string, - /// id: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// eTag: string - /// } - /// - /// /// Schema for Response Error: /// { /// error: { @@ -505,37 +309,16 @@ private HttpMessage CreateGetRequest(string farmerId, string attachmentId) /// /// /// - /// ID of the associated farmer resource. - /// ID of the attachment resource. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task CreateOrUpdateAsync(string farmerId, string attachmentId, RequestContent content, RequestOptions options = null) + public virtual async Task DeleteAsync(string farmerId, string attachmentId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, attachmentId, content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("AttachmentsClient.CreateOrUpdate"); + using var scope = _clientDiagnostics.CreateScope("AttachmentsClient.Delete"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(farmerId, attachmentId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -544,24 +327,12 @@ public virtual async Task CreateOrUpdateAsync(string farmerId, string } } - /// Creates or updates an attachment resource under a particular farmer. + /// Deletes a specified attachment resource under a particular farmer. + /// ID of the farmer. + /// ID of the attachment. + /// The request options. + /// or is null. /// - /// Schema for Response Body: - /// { - /// farmerId: string, - /// resourceId: string, - /// resourceType: string, - /// originalFileName: string, - /// id: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// eTag: string - /// } - /// - /// /// Schema for Response Error: /// { /// error: { @@ -579,37 +350,16 @@ public virtual async Task CreateOrUpdateAsync(string farmerId, string /// /// /// - /// ID of the associated farmer resource. - /// ID of the attachment resource. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual Response CreateOrUpdate(string farmerId, string attachmentId, RequestContent content, RequestOptions options = null) + public virtual Response Delete(string farmerId, string attachmentId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, attachmentId, content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("AttachmentsClient.CreateOrUpdate"); + using var scope = _clientDiagnostics.CreateScope("AttachmentsClient.Delete"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(farmerId, attachmentId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -618,26 +368,11 @@ public virtual Response CreateOrUpdate(string farmerId, string attachmentId, Req } } - private HttpMessage CreateCreateOrUpdateRequest(string farmerId, string attachmentId, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/attachments/", false); - uri.AppendPath(attachmentId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "multipart/form-data"); - request.Content = content; - return message; - } - - /// Deletes a specified attachment resource under a particular farmer. + /// Downloads and returns attachment as response for the given input filePath. + /// ID of the associated farmer. + /// ID of attachment to be downloaded. + /// The request options. + /// or is null. /// /// Schema for Response Error: /// { @@ -656,35 +391,16 @@ private HttpMessage CreateCreateOrUpdateRequest(string farmerId, string attachme /// /// /// - /// ID of the farmer. - /// ID of the attachment. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task DeleteAsync(string farmerId, string attachmentId, RequestOptions options = null) + public virtual async Task DownloadAsync(string farmerId, string attachmentId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(farmerId, attachmentId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("AttachmentsClient.Delete"); + using var scope = _clientDiagnostics.CreateScope("AttachmentsClient.Download"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDownloadRequest(farmerId, attachmentId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -693,7 +409,11 @@ public virtual async Task DeleteAsync(string farmerId, string attachme } } - /// Deletes a specified attachment resource under a particular farmer. + /// Downloads and returns attachment as response for the given input filePath. + /// ID of the associated farmer. + /// ID of attachment to be downloaded. + /// The request options. + /// or is null. /// /// Schema for Response Error: /// { @@ -712,35 +432,16 @@ public virtual async Task DeleteAsync(string farmerId, string attachme /// /// /// - /// ID of the farmer. - /// ID of the attachment. - /// The request options. #pragma warning disable AZC0002 - public virtual Response Delete(string farmerId, string attachmentId, RequestOptions options = null) + public virtual Response Download(string farmerId, string attachmentId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(farmerId, attachmentId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("AttachmentsClient.Delete"); + using var scope = _clientDiagnostics.CreateScope("AttachmentsClient.Download"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDownloadRequest(farmerId, attachmentId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -749,25 +450,50 @@ public virtual Response Delete(string farmerId, string attachmentId, RequestOpti } } - private HttpMessage CreateDeleteRequest(string farmerId, string attachmentId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/attachments/", false); - uri.AppendPath(attachmentId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Downloads and returns attachment as response for the given input filePath. + /// Returns a paginated list of attachment resources under a particular farmer. + /// ID of the associated farmer. + /// The request options. + /// Resource Ids of the resource. + /// Resource Types of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// is null. /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// farmerId: string, + /// resourceId: string, + /// resourceType: string, + /// originalFileName: string, + /// id: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// eTag: string + /// } + /// ], + /// $skipToken: string, + /// nextLink: string + /// } + /// /// Schema for Response Error: /// { /// error: { @@ -785,45 +511,74 @@ private HttpMessage CreateDeleteRequest(string farmerId, string attachmentId) /// /// /// - /// ID of the associated farmer. - /// ID of attachment to be downloaded. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task DownloadAsync(string farmerId, string attachmentId, RequestOptions options = null) + public virtual AsyncPageable ListByFarmerIdAsync(string farmerId, RequestOptions options, IEnumerable resourceIds = null, IEnumerable resourceTypes = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDownloadRequest(farmerId, attachmentId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("AttachmentsClient.Download"); - scope.Start(); - try + if (farmerId == null) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + throw new ArgumentNullException(nameof(farmerId)); } - catch (Exception e) + + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "AttachmentsClient.ListByFarmerId"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) { - scope.Failed(e); - throw; + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListByFarmerIdRequest(farmerId, resourceIds, resourceTypes, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListByFarmerIdNextPageRequest(nextLink, farmerId, resourceIds, resourceTypes, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - /// Downloads and returns attachment as response for the given input filePath. + /// Returns a paginated list of attachment resources under a particular farmer. + /// ID of the associated farmer. + /// The request options. + /// Resource Ids of the resource. + /// Resource Types of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// is null. /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// farmerId: string, + /// resourceId: string, + /// resourceType: string, + /// originalFileName: string, + /// id: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// eTag: string + /// } + /// ], + /// $skipToken: string, + /// nextLink: string + /// } + /// /// Schema for Response Error: /// { /// error: { @@ -841,59 +596,241 @@ public virtual async Task DownloadAsync(string farmerId, string attach /// /// /// - /// ID of the associated farmer. - /// ID of attachment to be downloaded. - /// The request options. #pragma warning disable AZC0002 - public virtual Response Download(string farmerId, string attachmentId, RequestOptions options = null) + public virtual Pageable ListByFarmerId(string farmerId, RequestOptions options, IEnumerable resourceIds = null, IEnumerable resourceTypes = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDownloadRequest(farmerId, attachmentId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("AttachmentsClient.Download"); - scope.Start(); - try + if (farmerId == null) + { + throw new ArgumentNullException(nameof(farmerId)); + } + + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "AttachmentsClient.ListByFarmerId"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListByFarmerIdRequest(farmerId, resourceIds, resourceTypes, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListByFarmerIdNextPageRequest(nextLink, farmerId, resourceIds, resourceTypes, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + internal HttpMessage CreateListByFarmerIdRequest(string farmerId, IEnumerable resourceIds, IEnumerable resourceTypes, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/attachments", false); + if (resourceIds != null) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) + foreach (var param in resourceIds) { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } + uri.AppendQuery("resourceIds", param, true); } - else + } + if (resourceTypes != null) + { + foreach (var param in resourceTypes) { - return message.Response; + uri.AppendQuery("resourceTypes", param, true); } } - catch (Exception e) + if (ids != null) { - scope.Failed(e); - throw; + foreach (var param in ids) + { + uri.AppendQuery("ids", param, true); + } + } + if (names != null) + { + foreach (var param in names) + { + uri.AppendQuery("names", param, true); + } + } + if (propertyFilters != null) + { + foreach (var param in propertyFilters) + { + uri.AppendQuery("propertyFilters", param, true); + } + } + if (statuses != null) + { + foreach (var param in statuses) + { + uri.AppendQuery("statuses", param, true); + } + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; } - private HttpMessage CreateDownloadRequest(string farmerId, string attachmentId) + internal HttpMessage CreateGetRequest(string farmerId, string attachmentId) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/attachments/", false); + uri.AppendPath(attachmentId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string farmerId, string attachmentId, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/attachments/", false); + uri.AppendPath(attachmentId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "multipart/form-data"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200201.Instance; + return message; + } + + internal HttpMessage CreateDeleteRequest(string farmerId, string attachmentId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/attachments/", false); + uri.AppendPath(attachmentId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier204.Instance; + return message; + } + + internal HttpMessage CreateDownloadRequest(string farmerId, string attachmentId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); uri.AppendPath("/farmers/", false); uri.AppendPath(farmerId, true); uri.AppendPath("/attachments/", false); uri.AppendPath(attachmentId, true); uri.AppendPath("/file", false); - uri.AppendQuery("api-version", apiVersion, true); + uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/octet-stream, application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateListByFarmerIdNextPageRequest(string nextLink, string farmerId, IEnumerable resourceIds, IEnumerable resourceTypes, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; return message; } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier200201 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200201(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + 201 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier204 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier204(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 204 => false, + _ => true + }; + } + } } } diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/BoundariesClient.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/BoundariesClient.cs index d102c9af94db3..faf0c6a71cc9f 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/BoundariesClient.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/BoundariesClient.cs @@ -7,6 +7,8 @@ using System; using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; @@ -17,14 +19,16 @@ namespace Azure.Verticals.AgriFood.Farming /// The Boundaries service client. public partial class BoundariesClient { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of BoundariesClient for mocking. protected BoundariesClient() @@ -35,6 +39,7 @@ protected BoundariesClient() /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. + /// or is null. public BoundariesClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) { if (endpoint == null) @@ -47,43 +52,37 @@ public BoundariesClient(Uri endpoint, TokenCredential credential, FarmBeatsClien } options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); _tokenCredential = credential; - var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); - _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { authPolicy }, new ResponseClassifier()); - this.endpoint = endpoint; - apiVersion = options.Version; + _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; } - /// Returns a paginated list of boundary resources under a particular farmer. + /// Get cascade delete job for specified boundary. + /// ID of the job. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// farmerId: string, - /// parentId: string, - /// geometry: { - /// type: "Point" | "Polygon" | "MultiPolygon" - /// }, - /// isPrimary: boolean, - /// acreage: number, - /// parentType: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// farmerId: string, + /// resourceId: string, + /// resourceType: string, + /// id: string, + /// status: string, + /// durationInSeconds: number, + /// message: string, + /// createdDateTime: string (ISO 8601 Format), + /// lastActionDateTime: string (ISO 8601 Format), + /// startTime: string (ISO 8601 Format), + /// endTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -101,55 +100,16 @@ public BoundariesClient(Uri endpoint, TokenCredential credential, FarmBeatsClien /// /// /// - /// ID of the associated farmer. - /// Is the boundary primary. - /// Type of the parent it belongs to. - /// Parent Ids of the resource. - /// Minimum acreage of the boundary (inclusive). - /// Maximum acreage of the boundary (inclusive). - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task ListByFarmerIdAsync(string farmerId, bool? isPrimary = null, string parentType = null, IEnumerable parentIds = null, double? minAcreage = null, double? maxAcreage = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual async Task GetCascadeDeleteJobDetailsAsync(string jobId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListByFarmerIdRequest(farmerId, isPrimary, parentType, parentIds, minAcreage, maxAcreage, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("BoundariesClient.ListByFarmerId"); + using var scope = _clientDiagnostics.CreateScope("BoundariesClient.GetCascadeDeleteJobDetails"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -158,35 +118,29 @@ public virtual async Task ListByFarmerIdAsync(string farmerId, bool? i } } - /// Returns a paginated list of boundary resources under a particular farmer. + /// Get cascade delete job for specified boundary. + /// ID of the job. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// farmerId: string, - /// parentId: string, - /// geometry: { - /// type: "Point" | "Polygon" | "MultiPolygon" - /// }, - /// isPrimary: boolean, - /// acreage: number, - /// parentType: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// farmerId: string, + /// resourceId: string, + /// resourceType: string, + /// id: string, + /// status: string, + /// durationInSeconds: number, + /// message: string, + /// createdDateTime: string (ISO 8601 Format), + /// lastActionDateTime: string (ISO 8601 Format), + /// startTime: string (ISO 8601 Format), + /// endTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -204,55 +158,16 @@ public virtual async Task ListByFarmerIdAsync(string farmerId, bool? i /// /// /// - /// ID of the associated farmer. - /// Is the boundary primary. - /// Type of the parent it belongs to. - /// Parent Ids of the resource. - /// Minimum acreage of the boundary (inclusive). - /// Maximum acreage of the boundary (inclusive). - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual Response ListByFarmerId(string farmerId, bool? isPrimary = null, string parentType = null, IEnumerable parentIds = null, double? minAcreage = null, double? maxAcreage = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual Response GetCascadeDeleteJobDetails(string jobId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListByFarmerIdRequest(farmerId, isPrimary, parentType, parentIds, minAcreage, maxAcreage, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("BoundariesClient.ListByFarmerId"); + using var scope = _clientDiagnostics.CreateScope("BoundariesClient.GetCascadeDeleteJobDetails"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -261,135 +176,33 @@ public virtual Response ListByFarmerId(string farmerId, bool? isPrimary = null, } } - private HttpMessage CreateListByFarmerIdRequest(string farmerId, bool? isPrimary, string parentType, IEnumerable parentIds, double? minAcreage, double? maxAcreage, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/boundaries", false); - if (isPrimary != null) - { - uri.AppendQuery("isPrimary", isPrimary.Value, true); - } - if (parentType != null) - { - uri.AppendQuery("parentType", parentType, true); - } - if (parentIds != null) - { - uri.AppendQueryDelimited("parentIds", parentIds, ",", true); - } - if (minAcreage != null) - { - uri.AppendQuery("minAcreage", minAcreage.Value, true); - } - if (maxAcreage != null) - { - uri.AppendQuery("maxAcreage", maxAcreage.Value, true); - } - if (ids != null) - { - uri.AppendQueryDelimited("ids", ids, ",", true); - } - if (names != null) - { - uri.AppendQueryDelimited("names", names, ",", true); - } - if (propertyFilters != null) - { - uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); - } - if (statuses != null) - { - uri.AppendQueryDelimited("statuses", statuses, ",", true); - } - if (minCreatedDateTime != null) - { - uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); - } - if (maxCreatedDateTime != null) - { - uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); - } - if (minLastModifiedDateTime != null) - { - uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); - } - if (maxLastModifiedDateTime != null) - { - uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); - } - if (maxPageSize != null) - { - uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Search for boundaries by fields and intersecting geometry. + /// Gets a specified boundary resource under a particular farmer. + /// ID of the associated farmer. + /// ID of the boundary. + /// The request options. + /// or is null. /// - /// Schema for Request Body: + /// Schema for Response Body: /// { - /// ids: [string], - /// names: [string], - /// propertyFilters: [string], - /// statuses: [string], - /// minCreatedDateTime: string (ISO 8601 Format), - /// maxCreatedDateTime: string (ISO 8601 Format), - /// minLastModifiedDateTime: string (ISO 8601 Format), - /// maxLastModifiedDateTime: string (ISO 8601 Format), - /// $maxPageSize: number, - /// $skipToken: string, + /// farmerId: string, + /// parentId: string, + /// geometry: { + /// type: "Point" | "Polygon" | "MultiPolygon" + /// }, /// isPrimary: boolean, + /// acreage: number, /// parentType: string, - /// parentIds: [string], - /// minAcreage: number, - /// maxAcreage: number, - /// intersectsWithGeometry: { - /// type: "Point" | "Polygon" | "MultiPolygon" (required) - /// } + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// - /// Schema for Response Body: - /// { - /// value: [ - /// { - /// farmerId: string, - /// parentId: string, - /// geometry: { - /// type: "Point" | "Polygon" | "MultiPolygon" - /// }, - /// isPrimary: boolean, - /// acreage: number, - /// parentType: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string - /// } - /// - /// - /// Schema for Response Error: + /// Schema for Response Error: /// { /// error: { /// code: string, @@ -406,35 +219,16 @@ private HttpMessage CreateListByFarmerIdRequest(string farmerId, bool? isPrimary /// /// /// - /// ID of the farmer. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task SearchByFarmerIdAsync(string farmerId, RequestContent content, RequestOptions options = null) + public virtual async Task GetAsync(string farmerId, string boundaryId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateSearchByFarmerIdRequest(farmerId, content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("BoundariesClient.SearchByFarmerId"); + using var scope = _clientDiagnostics.CreateScope("BoundariesClient.Get"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRequest(farmerId, boundaryId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -443,58 +237,32 @@ public virtual async Task SearchByFarmerIdAsync(string farmerId, Reque } } - /// Search for boundaries by fields and intersecting geometry. + /// Gets a specified boundary resource under a particular farmer. + /// ID of the associated farmer. + /// ID of the boundary. + /// The request options. + /// or is null. /// - /// Schema for Request Body: + /// Schema for Response Body: /// { - /// ids: [string], - /// names: [string], - /// propertyFilters: [string], - /// statuses: [string], - /// minCreatedDateTime: string (ISO 8601 Format), - /// maxCreatedDateTime: string (ISO 8601 Format), - /// minLastModifiedDateTime: string (ISO 8601 Format), - /// maxLastModifiedDateTime: string (ISO 8601 Format), - /// $maxPageSize: number, - /// $skipToken: string, + /// farmerId: string, + /// parentId: string, + /// geometry: { + /// type: "Point" | "Polygon" | "MultiPolygon" + /// }, /// isPrimary: boolean, + /// acreage: number, /// parentType: string, - /// parentIds: [string], - /// minAcreage: number, - /// maxAcreage: number, - /// intersectsWithGeometry: { - /// type: "Point" | "Polygon" | "MultiPolygon" (required) - /// } - /// } - /// - /// - /// Schema for Response Body: - /// { - /// value: [ - /// { - /// farmerId: string, - /// parentId: string, - /// geometry: { - /// type: "Point" | "Polygon" | "MultiPolygon" - /// }, - /// isPrimary: boolean, - /// acreage: number, - /// parentType: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -512,35 +280,16 @@ public virtual async Task SearchByFarmerIdAsync(string farmerId, Reque /// /// /// - /// ID of the farmer. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual Response SearchByFarmerId(string farmerId, RequestContent content, RequestOptions options = null) + public virtual Response Get(string farmerId, string boundaryId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateSearchByFarmerIdRequest(farmerId, content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("BoundariesClient.SearchByFarmerId"); + using var scope = _clientDiagnostics.CreateScope("BoundariesClient.Get"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRequest(farmerId, boundaryId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -549,53 +298,53 @@ public virtual Response SearchByFarmerId(string farmerId, RequestContent content } } - private HttpMessage CreateSearchByFarmerIdRequest(string farmerId, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/boundaries", 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; - } - - /// Returns a paginated list of boundary resources across all farmers. + /// Creates or updates a boundary resource. + /// ID of the farmer resource. + /// ID of the boundary resource. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// + /// Schema for Request Body: + /// { + /// farmerId: string, + /// parentId: string, + /// geometry: { + /// type: "Point" | "Polygon" | "MultiPolygon" (required) + /// }, + /// isPrimary: boolean, + /// acreage: number, + /// parentType: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// farmerId: string, - /// parentId: string, - /// geometry: { - /// type: "Point" | "Polygon" | "MultiPolygon" - /// }, - /// isPrimary: boolean, - /// acreage: number, - /// parentType: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// farmerId: string, + /// parentId: string, + /// geometry: { + /// type: "Point" | "Polygon" | "MultiPolygon" + /// }, + /// isPrimary: boolean, + /// acreage: number, + /// parentType: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -613,54 +362,16 @@ private HttpMessage CreateSearchByFarmerIdRequest(string farmerId, RequestConten /// /// /// - /// Is the boundary primary. - /// Type of the parent it belongs to. - /// Parent Ids of the resource. - /// Minimum acreage of the boundary (inclusive). - /// Maximum acreage of the boundary (inclusive). - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task ListAsync(bool? isPrimary = null, string parentType = null, IEnumerable parentIds = null, double? minAcreage = null, double? maxAcreage = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual async Task CreateOrUpdateAsync(string farmerId, string boundaryId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRequest(isPrimary, parentType, parentIds, minAcreage, maxAcreage, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("BoundariesClient.List"); + using var scope = _clientDiagnostics.CreateScope("BoundariesClient.CreateOrUpdate"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, boundaryId, content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -669,35 +380,53 @@ public virtual async Task ListAsync(bool? isPrimary = null, string par } } - /// Returns a paginated list of boundary resources across all farmers. + /// Creates or updates a boundary resource. + /// ID of the farmer resource. + /// ID of the boundary resource. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// + /// Schema for Request Body: + /// { + /// farmerId: string, + /// parentId: string, + /// geometry: { + /// type: "Point" | "Polygon" | "MultiPolygon" (required) + /// }, + /// isPrimary: boolean, + /// acreage: number, + /// parentType: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// farmerId: string, - /// parentId: string, - /// geometry: { - /// type: "Point" | "Polygon" | "MultiPolygon" - /// }, - /// isPrimary: boolean, - /// acreage: number, - /// parentType: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// farmerId: string, + /// parentId: string, + /// geometry: { + /// type: "Point" | "Polygon" | "MultiPolygon" + /// }, + /// isPrimary: boolean, + /// acreage: number, + /// parentType: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -715,54 +444,16 @@ public virtual async Task ListAsync(bool? isPrimary = null, string par /// /// /// - /// Is the boundary primary. - /// Type of the parent it belongs to. - /// Parent Ids of the resource. - /// Minimum acreage of the boundary (inclusive). - /// Maximum acreage of the boundary (inclusive). - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual Response List(bool? isPrimary = null, string parentType = null, IEnumerable parentIds = null, double? minAcreage = null, double? maxAcreage = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual Response CreateOrUpdate(string farmerId, string boundaryId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRequest(isPrimary, parentType, parentIds, minAcreage, maxAcreage, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("BoundariesClient.List"); + using var scope = _clientDiagnostics.CreateScope("BoundariesClient.CreateOrUpdate"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, boundaryId, content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -771,132 +462,12 @@ public virtual Response List(bool? isPrimary = null, string parentType = null, I } } - private HttpMessage CreateListRequest(bool? isPrimary, string parentType, IEnumerable parentIds, double? minAcreage, double? maxAcreage, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/boundaries", false); - if (isPrimary != null) - { - uri.AppendQuery("isPrimary", isPrimary.Value, true); - } - if (parentType != null) - { - uri.AppendQuery("parentType", parentType, true); - } - if (parentIds != null) - { - uri.AppendQueryDelimited("parentIds", parentIds, ",", true); - } - if (minAcreage != null) - { - uri.AppendQuery("minAcreage", minAcreage.Value, true); - } - if (maxAcreage != null) - { - uri.AppendQuery("maxAcreage", maxAcreage.Value, true); - } - if (ids != null) - { - uri.AppendQueryDelimited("ids", ids, ",", true); - } - if (names != null) - { - uri.AppendQueryDelimited("names", names, ",", true); - } - if (propertyFilters != null) - { - uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); - } - if (statuses != null) - { - uri.AppendQueryDelimited("statuses", statuses, ",", true); - } - if (minCreatedDateTime != null) - { - uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); - } - if (maxCreatedDateTime != null) - { - uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); - } - if (minLastModifiedDateTime != null) - { - uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); - } - if (maxLastModifiedDateTime != null) - { - uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); - } - if (maxPageSize != null) - { - uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Search for boundaries across all farmers by fields and intersecting geometry. + /// Deletes a specified boundary resource under a particular farmer. + /// ID of the farmer. + /// ID of the boundary. + /// The request options. + /// or is null. /// - /// Schema for Request Body: - /// { - /// ids: [string], - /// names: [string], - /// propertyFilters: [string], - /// statuses: [string], - /// minCreatedDateTime: string (ISO 8601 Format), - /// maxCreatedDateTime: string (ISO 8601 Format), - /// minLastModifiedDateTime: string (ISO 8601 Format), - /// maxLastModifiedDateTime: string (ISO 8601 Format), - /// $maxPageSize: number, - /// $skipToken: string, - /// isPrimary: boolean, - /// parentType: string, - /// parentIds: [string], - /// minAcreage: number, - /// maxAcreage: number, - /// intersectsWithGeometry: { - /// type: "Point" | "Polygon" | "MultiPolygon" (required) - /// } - /// } - /// - /// - /// Schema for Response Body: - /// { - /// value: [ - /// { - /// farmerId: string, - /// parentId: string, - /// geometry: { - /// type: "Point" | "Polygon" | "MultiPolygon" - /// }, - /// isPrimary: boolean, - /// acreage: number, - /// parentType: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string - /// } - /// - /// /// Schema for Response Error: /// { /// error: { @@ -914,34 +485,16 @@ private HttpMessage CreateListRequest(bool? isPrimary, string parentType, IEnume /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task SearchAsync(RequestContent content, RequestOptions options = null) + public virtual async Task DeleteAsync(string farmerId, string boundaryId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateSearchRequest(content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("BoundariesClient.Search"); + using var scope = _clientDiagnostics.CreateScope("BoundariesClient.Delete"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(farmerId, boundaryId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -950,58 +503,12 @@ public virtual async Task SearchAsync(RequestContent content, RequestO } } - /// Search for boundaries across all farmers by fields and intersecting geometry. + /// Deletes a specified boundary resource under a particular farmer. + /// ID of the farmer. + /// ID of the boundary. + /// The request options. + /// or is null. /// - /// Schema for Request Body: - /// { - /// ids: [string], - /// names: [string], - /// propertyFilters: [string], - /// statuses: [string], - /// minCreatedDateTime: string (ISO 8601 Format), - /// maxCreatedDateTime: string (ISO 8601 Format), - /// minLastModifiedDateTime: string (ISO 8601 Format), - /// maxLastModifiedDateTime: string (ISO 8601 Format), - /// $maxPageSize: number, - /// $skipToken: string, - /// isPrimary: boolean, - /// parentType: string, - /// parentIds: [string], - /// minAcreage: number, - /// maxAcreage: number, - /// intersectsWithGeometry: { - /// type: "Point" | "Polygon" | "MultiPolygon" (required) - /// } - /// } - /// - /// - /// Schema for Response Body: - /// { - /// value: [ - /// { - /// farmerId: string, - /// parentId: string, - /// geometry: { - /// type: "Point" | "Polygon" | "MultiPolygon" - /// }, - /// isPrimary: boolean, - /// acreage: number, - /// parentType: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string - /// } - /// - /// /// Schema for Response Error: /// { /// error: { @@ -1019,34 +526,16 @@ public virtual async Task SearchAsync(RequestContent content, RequestO /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual Response Search(RequestContent content, RequestOptions options = null) + public virtual Response Delete(string farmerId, string boundaryId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateSearchRequest(content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("BoundariesClient.Search"); + using var scope = _clientDiagnostics.CreateScope("BoundariesClient.Delete"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(farmerId, boundaryId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1055,43 +544,21 @@ public virtual Response Search(RequestContent content, RequestOptions options = } } - private HttpMessage CreateSearchRequest(RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/boundaries", 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; - } - - /// Get cascade delete job for specified boundary. + /// Returns overlapping acreage between two boundary Ids. + /// ID of the farmer. + /// ID of the boundary. + /// FarmerId of the other field. + /// ID of the other boundary. + /// The request options. + /// , , , or is null. /// /// Schema for Response Body: /// { - /// farmerId: string, - /// resourceId: string, - /// resourceType: string, - /// id: string, - /// status: string, - /// durationInSeconds: number, - /// message: string, - /// createdDateTime: string (ISO 8601 Format), - /// lastActionDateTime: string (ISO 8601 Format), - /// startTime: string (ISO 8601 Format), - /// endTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// boundaryAcreage: number, + /// otherBoundaryAcreage: number, + /// intersectingAcreage: number /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1109,34 +576,16 @@ private HttpMessage CreateSearchRequest(RequestContent content) /// /// /// - /// ID of the job. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetCascadeDeleteJobDetailsAsync(string jobId, RequestOptions options = null) + public virtual async Task GetOverlapAsync(string farmerId, string boundaryId, string otherFarmerId, string otherBoundaryId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("BoundariesClient.GetCascadeDeleteJobDetails"); + using var scope = _clientDiagnostics.CreateScope("BoundariesClient.GetOverlap"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetOverlapRequest(farmerId, boundaryId, otherFarmerId, otherBoundaryId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1145,27 +594,21 @@ public virtual async Task GetCascadeDeleteJobDetailsAsync(string jobId } } - /// Get cascade delete job for specified boundary. + /// Returns overlapping acreage between two boundary Ids. + /// ID of the farmer. + /// ID of the boundary. + /// FarmerId of the other field. + /// ID of the other boundary. + /// The request options. + /// , , , or is null. /// /// Schema for Response Body: /// { - /// farmerId: string, - /// resourceId: string, - /// resourceType: string, - /// id: string, - /// status: string, - /// durationInSeconds: number, - /// message: string, - /// createdDateTime: string (ISO 8601 Format), - /// lastActionDateTime: string (ISO 8601 Format), - /// startTime: string (ISO 8601 Format), - /// endTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// boundaryAcreage: number, + /// otherBoundaryAcreage: number, + /// intersectingAcreage: number /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1183,34 +626,16 @@ public virtual async Task GetCascadeDeleteJobDetailsAsync(string jobId /// /// /// - /// ID of the job. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetCascadeDeleteJobDetails(string jobId, RequestOptions options = null) + public virtual Response GetOverlap(string farmerId, string boundaryId, string otherFarmerId, string otherBoundaryId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("BoundariesClient.GetCascadeDeleteJobDetails"); + using var scope = _clientDiagnostics.CreateScope("BoundariesClient.GetOverlap"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetOverlapRequest(farmerId, boundaryId, otherFarmerId, otherBoundaryId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1219,42 +644,58 @@ public virtual Response GetCascadeDeleteJobDetails(string jobId, RequestOptions } } - private HttpMessage CreateGetCascadeDeleteJobDetailsRequest(string jobId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/boundaries/cascade-delete/", false); - uri.AppendPath(jobId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Create a cascade delete job for specified boundary. + /// Returns a paginated list of boundary resources under a particular farmer. + /// ID of the associated farmer. + /// The request options. + /// Is the boundary primary. + /// Type of the parent it belongs to. + /// Parent Ids of the resource. + /// Minimum acreage of the boundary (inclusive). + /// Maximum acreage of the boundary (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// is null. /// /// Schema for Response Body: /// { - /// farmerId: string, - /// resourceId: string, - /// resourceType: string, - /// id: string, - /// status: string, - /// durationInSeconds: number, - /// message: string, - /// createdDateTime: string (ISO 8601 Format), - /// lastActionDateTime: string (ISO 8601 Format), - /// startTime: string (ISO 8601 Format), - /// endTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// value: [ + /// { + /// farmerId: string, + /// parentId: string, + /// geometry: { + /// type: "Point" | "Polygon" | "MultiPolygon" + /// }, + /// isPrimary: boolean, + /// acreage: number, + /// parentType: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1272,65 +713,82 @@ private HttpMessage CreateGetCascadeDeleteJobDetailsRequest(string jobId) /// /// /// - /// Job ID supplied by end user. - /// ID of the associated farmer. - /// ID of the boundary to be deleted. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task> CreateCascadeDeleteJobAsync(string jobId, string farmerId, string boundaryId, RequestOptions options = null) + public virtual AsyncPageable ListByFarmerIdAsync(string farmerId, RequestOptions options, bool? isPrimary = null, string parentType = null, IEnumerable parentIds = null, double? minAcreage = null, double? maxAcreage = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId, boundaryId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("BoundariesClient.CreateCascadeDeleteJob"); - scope.Start(); - try + if (farmerId == null) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "BoundariesClient.CreateCascadeDeleteJob"); - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "BoundariesClient.CreateCascadeDeleteJob"); - } + throw new ArgumentNullException(nameof(farmerId)); } - catch (Exception e) + + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "BoundariesClient.ListByFarmerId"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) { - scope.Failed(e); - throw; + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListByFarmerIdRequest(farmerId, isPrimary, parentType, parentIds, minAcreage, maxAcreage, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListByFarmerIdNextPageRequest(nextLink, farmerId, isPrimary, parentType, parentIds, minAcreage, maxAcreage, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - /// Create a cascade delete job for specified boundary. + /// Returns a paginated list of boundary resources under a particular farmer. + /// ID of the associated farmer. + /// The request options. + /// Is the boundary primary. + /// Type of the parent it belongs to. + /// Parent Ids of the resource. + /// Minimum acreage of the boundary (inclusive). + /// Maximum acreage of the boundary (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// is null. /// /// Schema for Response Body: /// { - /// farmerId: string, - /// resourceId: string, - /// resourceType: string, - /// id: string, - /// status: string, - /// durationInSeconds: number, - /// message: string, - /// createdDateTime: string (ISO 8601 Format), - /// lastActionDateTime: string (ISO 8601 Format), - /// startTime: string (ISO 8601 Format), - /// endTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// value: [ + /// { + /// farmerId: string, + /// parentId: string, + /// geometry: { + /// type: "Point" | "Polygon" | "MultiPolygon" + /// }, + /// isPrimary: boolean, + /// acreage: number, + /// parentType: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1348,84 +806,84 @@ public virtual async Task> CreateCascadeDeleteJobAsync(str /// /// /// - /// Job ID supplied by end user. - /// ID of the associated farmer. - /// ID of the boundary to be deleted. - /// The request options. #pragma warning disable AZC0002 - public virtual Operation CreateCascadeDeleteJob(string jobId, string farmerId, string boundaryId, RequestOptions options = null) + public virtual Pageable ListByFarmerId(string farmerId, RequestOptions options, bool? isPrimary = null, string parentType = null, IEnumerable parentIds = null, double? minAcreage = null, double? maxAcreage = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId, boundaryId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("BoundariesClient.CreateCascadeDeleteJob"); - scope.Start(); - try + if (farmerId == null) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "BoundariesClient.CreateCascadeDeleteJob"); - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "BoundariesClient.CreateCascadeDeleteJob"); - } + throw new ArgumentNullException(nameof(farmerId)); } - catch (Exception e) + + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "BoundariesClient.ListByFarmerId"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) { - scope.Failed(e); - throw; + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListByFarmerIdRequest(farmerId, isPrimary, parentType, parentIds, minAcreage, maxAcreage, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListByFarmerIdNextPageRequest(nextLink, farmerId, isPrimary, parentType, parentIds, minAcreage, maxAcreage, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - private HttpMessage CreateCreateCascadeDeleteJobRequest(string jobId, string farmerId, string boundaryId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/boundaries/cascade-delete/", false); - uri.AppendPath(jobId, true); - uri.AppendQuery("farmerId", farmerId, true); - uri.AppendQuery("boundaryId", boundaryId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets a specified boundary resource under a particular farmer. + /// Search for boundaries by fields and intersecting geometry. + /// ID of the farmer. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// - /// Schema for Response Body: + /// Schema for Request Body: /// { - /// farmerId: string, - /// parentId: string, - /// geometry: { - /// type: "Point" | "Polygon" | "MultiPolygon" - /// }, + /// ids: [string], + /// names: [string], + /// propertyFilters: [string], + /// statuses: [string], + /// minCreatedDateTime: string (ISO 8601 Format), + /// maxCreatedDateTime: string (ISO 8601 Format), + /// minLastModifiedDateTime: string (ISO 8601 Format), + /// maxLastModifiedDateTime: string (ISO 8601 Format), + /// $maxPageSize: number, + /// $skipToken: string, /// isPrimary: boolean, - /// acreage: number, /// parentType: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// parentIds: [string], + /// minAcreage: number, + /// maxAcreage: number, + /// intersectsWithGeometry: { + /// type: "Point" | "Polygon" | "MultiPolygon" (required) + /// } + /// } + /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// farmerId: string, + /// parentId: string, + /// geometry: { + /// type: "Point" | "Polygon" | "MultiPolygon" + /// }, + /// isPrimary: boolean, + /// acreage: number, + /// parentType: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1443,66 +901,84 @@ private HttpMessage CreateCreateCascadeDeleteJobRequest(string jobId, string far /// /// /// - /// ID of the associated farmer. - /// ID of the boundary. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetAsync(string farmerId, string boundaryId, RequestOptions options = null) + public virtual AsyncPageable SearchByFarmerIdAsync(string farmerId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRequest(farmerId, boundaryId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("BoundariesClient.Get"); - scope.Start(); - try + if (farmerId == null) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + throw new ArgumentNullException(nameof(farmerId)); } - catch (Exception e) + + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "BoundariesClient.SearchByFarmerId"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) { - scope.Failed(e); - throw; + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateSearchByFarmerIdRequest(farmerId, content) + : CreateSearchByFarmerIdNextPageRequest(nextLink, farmerId, content); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - /// Gets a specified boundary resource under a particular farmer. + /// Search for boundaries by fields and intersecting geometry. + /// ID of the farmer. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// - /// Schema for Response Body: + /// Schema for Request Body: /// { - /// farmerId: string, - /// parentId: string, - /// geometry: { - /// type: "Point" | "Polygon" | "MultiPolygon" - /// }, + /// ids: [string], + /// names: [string], + /// propertyFilters: [string], + /// statuses: [string], + /// minCreatedDateTime: string (ISO 8601 Format), + /// maxCreatedDateTime: string (ISO 8601 Format), + /// minLastModifiedDateTime: string (ISO 8601 Format), + /// maxLastModifiedDateTime: string (ISO 8601 Format), + /// $maxPageSize: number, + /// $skipToken: string, /// isPrimary: boolean, - /// acreage: number, /// parentType: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// parentIds: [string], + /// minAcreage: number, + /// maxAcreage: number, + /// intersectsWithGeometry: { + /// type: "Point" | "Polygon" | "MultiPolygon" (required) + /// } + /// } + /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// farmerId: string, + /// parentId: string, + /// geometry: { + /// type: "Point" | "Polygon" | "MultiPolygon" + /// }, + /// isPrimary: boolean, + /// acreage: number, + /// parentType: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1520,104 +996,80 @@ public virtual async Task GetAsync(string farmerId, string boundaryId, /// /// /// - /// ID of the associated farmer. - /// ID of the boundary. - /// The request options. #pragma warning disable AZC0002 - public virtual Response Get(string farmerId, string boundaryId, RequestOptions options = null) + public virtual Pageable SearchByFarmerId(string farmerId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRequest(farmerId, boundaryId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("BoundariesClient.Get"); - scope.Start(); - try + if (farmerId == null) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + throw new ArgumentNullException(nameof(farmerId)); } - catch (Exception e) + + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "BoundariesClient.SearchByFarmerId"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) { - scope.Failed(e); - throw; + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateSearchByFarmerIdRequest(farmerId, content) + : CreateSearchByFarmerIdNextPageRequest(nextLink, farmerId, content); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - private HttpMessage CreateGetRequest(string farmerId, string boundaryId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/boundaries/", false); - uri.AppendPath(boundaryId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Creates or updates a boundary resource. + /// Returns a paginated list of boundary resources across all farmers. + /// The request options. + /// Is the boundary primary. + /// Type of the parent it belongs to. + /// Parent Ids of the resource. + /// Minimum acreage of the boundary (inclusive). + /// Maximum acreage of the boundary (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. /// - /// Schema for Request Body: - /// { - /// farmerId: string, - /// parentId: string, - /// geometry: { - /// type: "Point" | "Polygon" | "MultiPolygon" (required) - /// }, - /// isPrimary: boolean, - /// acreage: number, - /// parentType: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// /// Schema for Response Body: /// { - /// farmerId: string, - /// parentId: string, - /// geometry: { - /// type: "Point" | "Polygon" | "MultiPolygon" - /// }, - /// isPrimary: boolean, - /// acreage: number, - /// parentType: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// value: [ + /// { + /// farmerId: string, + /// parentId: string, + /// geometry: { + /// type: "Point" | "Polygon" | "MultiPolygon" + /// }, + /// isPrimary: boolean, + /// acreage: number, + /// parentType: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1635,89 +1087,75 @@ private HttpMessage CreateGetRequest(string farmerId, string boundaryId) /// /// /// - /// ID of the farmer resource. - /// ID of the boundary resource. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task CreateOrUpdateAsync(string farmerId, string boundaryId, RequestContent content, RequestOptions options = null) + public virtual AsyncPageable ListAsync(RequestOptions options, bool? isPrimary = null, string parentType = null, IEnumerable parentIds = null, double? minAcreage = null, double? maxAcreage = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, boundaryId, content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("BoundariesClient.CreateOrUpdate"); - scope.Start(); - try + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "BoundariesClient.List"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else + do { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; + var message = string.IsNullOrEmpty(nextLink) + ? CreateListRequest(isPrimary, parentType, parentIds, minAcreage, maxAcreage, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListNextPageRequest(nextLink, isPrimary, parentType, parentIds, minAcreage, maxAcreage, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - /// Creates or updates a boundary resource. + /// Returns a paginated list of boundary resources across all farmers. + /// The request options. + /// Is the boundary primary. + /// Type of the parent it belongs to. + /// Parent Ids of the resource. + /// Minimum acreage of the boundary (inclusive). + /// Maximum acreage of the boundary (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. /// - /// Schema for Request Body: - /// { - /// farmerId: string, - /// parentId: string, - /// geometry: { - /// type: "Point" | "Polygon" | "MultiPolygon" (required) - /// }, - /// isPrimary: boolean, - /// acreage: number, - /// parentType: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// /// Schema for Response Body: /// { - /// farmerId: string, - /// parentId: string, - /// geometry: { - /// type: "Point" | "Polygon" | "MultiPolygon" - /// }, - /// isPrimary: boolean, - /// acreage: number, - /// parentType: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// value: [ + /// { + /// farmerId: string, + /// parentId: string, + /// geometry: { + /// type: "Point" | "Polygon" | "MultiPolygon" + /// }, + /// isPrimary: boolean, + /// acreage: number, + /// parentType: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1735,66 +1173,77 @@ public virtual async Task CreateOrUpdateAsync(string farmerId, string /// /// /// - /// ID of the farmer resource. - /// ID of the boundary resource. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual Response CreateOrUpdate(string farmerId, string boundaryId, RequestContent content, RequestOptions options = null) + public virtual Pageable List(RequestOptions options, bool? isPrimary = null, string parentType = null, IEnumerable parentIds = null, double? minAcreage = null, double? maxAcreage = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, boundaryId, content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("BoundariesClient.CreateOrUpdate"); - scope.Start(); - try + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "BoundariesClient.List"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else + do { - return message.Response; - } + var message = string.IsNullOrEmpty(nextLink) + ? CreateListRequest(isPrimary, parentType, parentIds, minAcreage, maxAcreage, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListNextPageRequest(nextLink, isPrimary, parentType, parentIds, minAcreage, maxAcreage, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - private HttpMessage CreateCreateOrUpdateRequest(string farmerId, string boundaryId, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/boundaries/", false); - uri.AppendPath(boundaryId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/merge-patch+json"); - request.Content = content; - return message; } - /// Deletes a specified boundary resource under a particular farmer. + /// Search for boundaries across all farmers by fields and intersecting geometry. + /// The content to send as the body of the request. + /// The request options. /// + /// Schema for Request Body: + /// { + /// ids: [string], + /// names: [string], + /// propertyFilters: [string], + /// statuses: [string], + /// minCreatedDateTime: string (ISO 8601 Format), + /// maxCreatedDateTime: string (ISO 8601 Format), + /// minLastModifiedDateTime: string (ISO 8601 Format), + /// maxLastModifiedDateTime: string (ISO 8601 Format), + /// $maxPageSize: number, + /// $skipToken: string, + /// isPrimary: boolean, + /// parentType: string, + /// parentIds: [string], + /// minAcreage: number, + /// maxAcreage: number, + /// intersectsWithGeometry: { + /// type: "Point" | "Polygon" | "MultiPolygon" (required) + /// } + /// } + /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// farmerId: string, + /// parentId: string, + /// geometry: { + /// type: "Point" | "Polygon" | "MultiPolygon" + /// }, + /// isPrimary: boolean, + /// acreage: number, + /// parentType: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string + /// } + /// /// Schema for Response Error: /// { /// error: { @@ -1812,45 +1261,77 @@ private HttpMessage CreateCreateOrUpdateRequest(string farmerId, string boundary /// /// /// - /// ID of the farmer. - /// ID of the boundary. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task DeleteAsync(string farmerId, string boundaryId, RequestOptions options = null) + public virtual AsyncPageable SearchAsync(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(farmerId, boundaryId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("BoundariesClient.Delete"); - scope.Start(); - try + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "BoundariesClient.Search"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) + do { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; + var message = string.IsNullOrEmpty(nextLink) + ? CreateSearchRequest(content) + : CreateSearchNextPageRequest(nextLink, content); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - /// Deletes a specified boundary resource under a particular farmer. + /// Search for boundaries across all farmers by fields and intersecting geometry. + /// The content to send as the body of the request. + /// The request options. /// + /// Schema for Request Body: + /// { + /// ids: [string], + /// names: [string], + /// propertyFilters: [string], + /// statuses: [string], + /// minCreatedDateTime: string (ISO 8601 Format), + /// maxCreatedDateTime: string (ISO 8601 Format), + /// minLastModifiedDateTime: string (ISO 8601 Format), + /// maxLastModifiedDateTime: string (ISO 8601 Format), + /// $maxPageSize: number, + /// $skipToken: string, + /// isPrimary: boolean, + /// parentType: string, + /// parentIds: [string], + /// minAcreage: number, + /// maxAcreage: number, + /// intersectsWithGeometry: { + /// type: "Point" | "Polygon" | "MultiPolygon" (required) + /// } + /// } + /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// farmerId: string, + /// parentId: string, + /// geometry: { + /// type: "Point" | "Polygon" | "MultiPolygon" + /// }, + /// isPrimary: boolean, + /// acreage: number, + /// parentType: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string + /// } + /// /// Schema for Response Error: /// { /// error: { @@ -1868,70 +1349,50 @@ public virtual async Task DeleteAsync(string farmerId, string boundary /// /// /// - /// ID of the farmer. - /// ID of the boundary. - /// The request options. #pragma warning disable AZC0002 - public virtual Response Delete(string farmerId, string boundaryId, RequestOptions options = null) + public virtual Pageable Search(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(farmerId, boundaryId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("BoundariesClient.Delete"); - scope.Start(); - try + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "BoundariesClient.Search"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else + do { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; + var message = string.IsNullOrEmpty(nextLink) + ? CreateSearchRequest(content) + : CreateSearchNextPageRequest(nextLink, content); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - private HttpMessage CreateDeleteRequest(string farmerId, string boundaryId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/boundaries/", false); - uri.AppendPath(boundaryId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Returns overlapping acreage between two boundary Ids. + /// Create a cascade delete job for specified boundary. + /// Job ID supplied by end user. + /// ID of the associated farmer. + /// ID of the boundary to be deleted. + /// The request options. + /// , , or is null. /// /// Schema for Response Body: /// { - /// boundaryAcreage: number, - /// otherBoundaryAcreage: number, - /// intersectingAcreage: number + /// farmerId: string, + /// resourceId: string, + /// resourceType: string, + /// id: string, + /// status: string, + /// durationInSeconds: number, + /// message: string, + /// createdDateTime: string (ISO 8601 Format), + /// lastActionDateTime: string (ISO 8601 Format), + /// startTime: string (ISO 8601 Format), + /// endTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1949,37 +1410,16 @@ private HttpMessage CreateDeleteRequest(string farmerId, string boundaryId) /// /// /// - /// ID of the farmer. - /// ID of the boundary. - /// FarmerId of the other field. - /// ID of the other boundary. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetOverlapAsync(string farmerId, string boundaryId, string otherFarmerId, string otherBoundaryId, RequestOptions options = null) + public virtual async Task> CreateCascadeDeleteJobAsync(string jobId, string farmerId, string boundaryId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetOverlapRequest(farmerId, boundaryId, otherFarmerId, otherBoundaryId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("BoundariesClient.GetOverlap"); + using var scope = _clientDiagnostics.CreateScope("BoundariesClient.CreateCascadeDeleteJob"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId, boundaryId); + return await LowLevelOperationHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, "BoundariesClient.CreateCascadeDeleteJob", OperationFinalStateVia.Location, options).ConfigureAwait(false); } catch (Exception e) { @@ -1988,16 +1428,31 @@ public virtual async Task GetOverlapAsync(string farmerId, string boun } } - /// Returns overlapping acreage between two boundary Ids. + /// Create a cascade delete job for specified boundary. + /// Job ID supplied by end user. + /// ID of the associated farmer. + /// ID of the boundary to be deleted. + /// The request options. + /// , , or is null. /// /// Schema for Response Body: /// { - /// boundaryAcreage: number, - /// otherBoundaryAcreage: number, - /// intersectingAcreage: number + /// farmerId: string, + /// resourceId: string, + /// resourceType: string, + /// id: string, + /// status: string, + /// durationInSeconds: number, + /// message: string, + /// createdDateTime: string (ISO 8601 Format), + /// lastActionDateTime: string (ISO 8601 Format), + /// startTime: string (ISO 8601 Format), + /// endTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -2015,52 +1470,339 @@ public virtual async Task GetOverlapAsync(string farmerId, string boun /// /// /// - /// ID of the farmer. - /// ID of the boundary. - /// FarmerId of the other field. - /// ID of the other boundary. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetOverlap(string farmerId, string boundaryId, string otherFarmerId, string otherBoundaryId, RequestOptions options = null) + public virtual Operation CreateCascadeDeleteJob(string jobId, string farmerId, string boundaryId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetOverlapRequest(farmerId, boundaryId, otherFarmerId, otherBoundaryId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("BoundariesClient.GetOverlap"); + using var scope = _clientDiagnostics.CreateScope("BoundariesClient.CreateCascadeDeleteJob"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) + using HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId, boundaryId); + return LowLevelOperationHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, "BoundariesClient.CreateCascadeDeleteJob", OperationFinalStateVia.Location, options); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + internal HttpMessage CreateListByFarmerIdRequest(string farmerId, bool? isPrimary, string parentType, IEnumerable parentIds, double? minAcreage, double? maxAcreage, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/boundaries", false); + if (isPrimary != null) + { + uri.AppendQuery("isPrimary", isPrimary.Value, true); + } + if (parentType != null) + { + uri.AppendQuery("parentType", parentType, true); + } + if (parentIds != null) + { + foreach (var param in parentIds) { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } + uri.AppendQuery("parentIds", param, true); } - else + } + if (minAcreage != null) + { + uri.AppendQuery("minAcreage", minAcreage.Value, true); + } + if (maxAcreage != null) + { + uri.AppendQuery("maxAcreage", maxAcreage.Value, true); + } + if (ids != null) + { + foreach (var param in ids) { - return message.Response; + uri.AppendQuery("ids", param, true); } } - catch (Exception e) + if (names != null) { - scope.Failed(e); - throw; + foreach (var param in names) + { + uri.AppendQuery("names", param, true); + } + } + if (propertyFilters != null) + { + foreach (var param in propertyFilters) + { + uri.AppendQuery("propertyFilters", param, true); + } + } + if (statuses != null) + { + foreach (var param in statuses) + { + uri.AppendQuery("statuses", param, true); + } + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateSearchByFarmerIdRequest(string farmerId, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/boundaries", 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; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateListRequest(bool? isPrimary, string parentType, IEnumerable parentIds, double? minAcreage, double? maxAcreage, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/boundaries", false); + if (isPrimary != null) + { + uri.AppendQuery("isPrimary", isPrimary.Value, true); + } + if (parentType != null) + { + uri.AppendQuery("parentType", parentType, true); + } + if (parentIds != null) + { + foreach (var param in parentIds) + { + uri.AppendQuery("parentIds", param, true); + } + } + if (minAcreage != null) + { + uri.AppendQuery("minAcreage", minAcreage.Value, true); + } + if (maxAcreage != null) + { + uri.AppendQuery("maxAcreage", maxAcreage.Value, true); + } + if (ids != null) + { + foreach (var param in ids) + { + uri.AppendQuery("ids", param, true); + } + } + if (names != null) + { + foreach (var param in names) + { + uri.AppendQuery("names", param, true); + } + } + if (propertyFilters != null) + { + foreach (var param in propertyFilters) + { + uri.AppendQuery("propertyFilters", param, true); + } + } + if (statuses != null) + { + foreach (var param in statuses) + { + uri.AppendQuery("statuses", param, true); + } + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateSearchRequest(RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/boundaries", 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; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetCascadeDeleteJobDetailsRequest(string jobId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/boundaries/cascade-delete/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateCascadeDeleteJobRequest(string jobId, string farmerId, string boundaryId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/boundaries/cascade-delete/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("farmerId", farmerId, true); + uri.AppendQuery("boundaryId", boundaryId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier202.Instance; + return message; + } + + internal HttpMessage CreateGetRequest(string farmerId, string boundaryId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/boundaries/", false); + uri.AppendPath(boundaryId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string farmerId, string boundaryId, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/boundaries/", false); + uri.AppendPath(boundaryId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/merge-patch+json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200201.Instance; + return message; } - private HttpMessage CreateGetOverlapRequest(string farmerId, string boundaryId, string otherFarmerId, string otherBoundaryId) + internal HttpMessage CreateDeleteRequest(string farmerId, string boundaryId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/boundaries/", false); + uri.AppendPath(boundaryId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier204.Instance; + return message; + } + + internal HttpMessage CreateGetOverlapRequest(string farmerId, string boundaryId, string otherFarmerId, string otherBoundaryId) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); + uri.Reset(_endpoint); uri.AppendPath("/farmers/", false); uri.AppendPath(farmerId, true); uri.AppendPath("/boundaries/", false); @@ -2068,10 +1810,121 @@ private HttpMessage CreateGetOverlapRequest(string farmerId, string boundaryId, uri.AppendPath("/overlap", false); uri.AppendQuery("otherFarmerId", otherFarmerId, true); uri.AppendQuery("otherBoundaryId", otherBoundaryId, true); - uri.AppendQuery("api-version", apiVersion, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateListByFarmerIdNextPageRequest(string nextLink, string farmerId, bool? isPrimary, string parentType, IEnumerable parentIds, double? minAcreage, double? maxAcreage, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateSearchByFarmerIdNextPageRequest(string nextLink, string farmerId, RequestContent content) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, bool? isPrimary, string parentType, IEnumerable parentIds, double? minAcreage, double? maxAcreage, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateSearchNextPageRequest(string nextLink, RequestContent content) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; return message; } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier202 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier202(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 202 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier200201 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200201(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + 201 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier204 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier204(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 204 => false, + _ => true + }; + } + } } } diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/CropVarietiesClient.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/CropVarietiesClient.cs index 675f6643181da..5d0a70a5f7d18 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/CropVarietiesClient.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/CropVarietiesClient.cs @@ -7,6 +7,8 @@ using System; using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; @@ -17,14 +19,16 @@ namespace Azure.Verticals.AgriFood.Farming /// The CropVarieties service client. public partial class CropVarietiesClient { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of CropVarietiesClient for mocking. protected CropVarietiesClient() @@ -35,6 +39,7 @@ protected CropVarietiesClient() /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. + /// or is null. public CropVarietiesClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) { if (endpoint == null) @@ -47,38 +52,35 @@ public CropVarietiesClient(Uri endpoint, TokenCredential credential, FarmBeatsCl } options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); _tokenCredential = credential; - var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); - _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { authPolicy }, new ResponseClassifier()); - this.endpoint = endpoint; - apiVersion = options.Version; + _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; } - /// Returns a paginated list of crop variety resources under a particular crop. + /// Gets a specified crop variety resource under a particular crop. + /// ID of the associated crop. + /// ID of the crop variety. + /// The request options. + /// or is null. /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// cropId: string, - /// brand: string, - /// product: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// cropId: string, + /// brand: string, + /// product: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -96,53 +98,16 @@ public CropVarietiesClient(Uri endpoint, TokenCredential credential, FarmBeatsCl /// /// /// - /// ID of the associated crop. - /// CropIds of the resource. - /// Brands of the resource. - /// Products of the resource. - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task ListByCropIdAsync(string cropId, IEnumerable cropIds = null, IEnumerable brands = null, IEnumerable products = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual async Task GetAsync(string cropId, string cropVarietyId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListByCropIdRequest(cropId, cropIds, brands, products, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("CropVarietiesClient.ListByCropId"); + using var scope = _clientDiagnostics.CreateScope("CropVarietiesClient.Get"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRequest(cropId, cropVarietyId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -151,30 +116,27 @@ public virtual async Task ListByCropIdAsync(string cropId, IEnumerable } } - /// Returns a paginated list of crop variety resources under a particular crop. + /// Gets a specified crop variety resource under a particular crop. + /// ID of the associated crop. + /// ID of the crop variety. + /// The request options. + /// or is null. /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// cropId: string, - /// brand: string, - /// product: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// cropId: string, + /// brand: string, + /// product: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -192,53 +154,16 @@ public virtual async Task ListByCropIdAsync(string cropId, IEnumerable /// /// /// - /// ID of the associated crop. - /// CropIds of the resource. - /// Brands of the resource. - /// Products of the resource. - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual Response ListByCropId(string cropId, IEnumerable cropIds = null, IEnumerable brands = null, IEnumerable products = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual Response Get(string cropId, string cropVarietyId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListByCropIdRequest(cropId, cropIds, brands, products, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("CropVarietiesClient.ListByCropId"); + using var scope = _clientDiagnostics.CreateScope("CropVarietiesClient.Get"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRequest(cropId, cropVarietyId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -247,98 +172,43 @@ public virtual Response ListByCropId(string cropId, IEnumerable cropIds } } - private HttpMessage CreateListByCropIdRequest(string cropId, IEnumerable cropIds, IEnumerable brands, IEnumerable products, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/crops/", false); - uri.AppendPath(cropId, true); - uri.AppendPath("/crop-varieties", false); - if (cropIds != null) - { - uri.AppendQueryDelimited("cropIds", cropIds, ",", true); - } - if (brands != null) - { - uri.AppendQueryDelimited("brands", brands, ",", true); - } - if (products != null) - { - uri.AppendQueryDelimited("products", products, ",", true); - } - if (ids != null) - { - uri.AppendQueryDelimited("ids", ids, ",", true); - } - if (names != null) - { - uri.AppendQueryDelimited("names", names, ",", true); - } - if (propertyFilters != null) - { - uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); - } - if (statuses != null) - { - uri.AppendQueryDelimited("statuses", statuses, ",", true); - } - if (minCreatedDateTime != null) - { - uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); - } - if (maxCreatedDateTime != null) - { - uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); - } - if (minLastModifiedDateTime != null) - { - uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); - } - if (maxLastModifiedDateTime != null) - { - uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); - } - if (maxPageSize != null) - { - uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Returns a paginated list of crop variety resources across all crops. + /// Creates or updates a crop variety resource. + /// ID of the crop resource. + /// ID of the crop variety resource. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// + /// Schema for Request Body: + /// { + /// cropId: string, + /// brand: string, + /// product: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// cropId: string, - /// brand: string, - /// product: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// cropId: string, + /// brand: string, + /// product: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -356,52 +226,16 @@ private HttpMessage CreateListByCropIdRequest(string cropId, IEnumerable /// /// /// - /// CropIds of the resource. - /// Brands of the resource. - /// Products of the resource. - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task ListAsync(IEnumerable cropIds = null, IEnumerable brands = null, IEnumerable products = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual async Task CreateOrUpdateAsync(string cropId, string cropVarietyId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRequest(cropIds, brands, products, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("CropVarietiesClient.List"); + using var scope = _clientDiagnostics.CreateScope("CropVarietiesClient.CreateOrUpdate"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(cropId, cropVarietyId, content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -410,169 +244,28 @@ public virtual async Task ListAsync(IEnumerable cropIds = null } } - /// Returns a paginated list of crop variety resources across all crops. + /// Creates or updates a crop variety resource. + /// ID of the crop resource. + /// ID of the crop variety resource. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// - /// Schema for Response Body: - /// { - /// value: [ - /// { - /// cropId: string, - /// brand: string, - /// product: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string - /// } - /// - /// - /// Schema for Response Error: + /// Schema for Request Body: /// { - /// error: { - /// code: string, - /// message: string, - /// target: string, - /// details: [Error], - /// innererror: { - /// code: string, - /// innererror: InnerError - /// } - /// }, - /// traceId: string + /// cropId: string, + /// brand: string, + /// product: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// - /// - /// CropIds of the resource. - /// Brands of the resource. - /// Products of the resource. - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. -#pragma warning disable AZC0002 - public virtual Response List(IEnumerable cropIds = null, IEnumerable brands = null, IEnumerable products = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) -#pragma warning restore AZC0002 - { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRequest(cropIds, brands, products, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("CropVarietiesClient.List"); - scope.Start(); - try - { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - private HttpMessage CreateListRequest(IEnumerable cropIds, IEnumerable brands, IEnumerable products, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/crop-varieties", false); - if (cropIds != null) - { - uri.AppendQueryDelimited("cropIds", cropIds, ",", true); - } - if (brands != null) - { - uri.AppendQueryDelimited("brands", brands, ",", true); - } - if (products != null) - { - uri.AppendQueryDelimited("products", products, ",", true); - } - if (ids != null) - { - uri.AppendQueryDelimited("ids", ids, ",", true); - } - if (names != null) - { - uri.AppendQueryDelimited("names", names, ",", true); - } - if (propertyFilters != null) - { - uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); - } - if (statuses != null) - { - uri.AppendQueryDelimited("statuses", statuses, ",", true); - } - if (minCreatedDateTime != null) - { - uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); - } - if (maxCreatedDateTime != null) - { - uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); - } - if (minLastModifiedDateTime != null) - { - uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); - } - if (maxLastModifiedDateTime != null) - { - uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); - } - if (maxPageSize != null) - { - uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets a specified crop variety resource under a particular crop. - /// /// Schema for Response Body: /// { /// cropId: string, @@ -588,7 +281,6 @@ private HttpMessage CreateListRequest(IEnumerable cropIds, IEnumerable - /// /// Schema for Response Error: /// { /// error: { @@ -606,35 +298,16 @@ private HttpMessage CreateListRequest(IEnumerable cropIds, IEnumerable /// /// - /// ID of the associated crop. - /// ID of the crop variety. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetAsync(string cropId, string cropVarietyId, RequestOptions options = null) + public virtual Response CreateOrUpdate(string cropId, string cropVarietyId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRequest(cropId, cropVarietyId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("CropVarietiesClient.Get"); + using var scope = _clientDiagnostics.CreateScope("CropVarietiesClient.CreateOrUpdate"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(cropId, cropVarietyId, content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -643,24 +316,12 @@ public virtual async Task GetAsync(string cropId, string cropVarietyId } } - /// Gets a specified crop variety resource under a particular crop. + /// Deletes a specified crop variety resource under a particular crop. + /// ID of the crop. + /// ID of the crop variety. + /// The request options. + /// or is null. /// - /// Schema for Response Body: - /// { - /// cropId: string, - /// brand: string, - /// product: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// /// Schema for Response Error: /// { /// error: { @@ -678,35 +339,16 @@ public virtual async Task GetAsync(string cropId, string cropVarietyId /// /// /// - /// ID of the associated crop. - /// ID of the crop variety. - /// The request options. #pragma warning disable AZC0002 - public virtual Response Get(string cropId, string cropVarietyId, RequestOptions options = null) + public virtual async Task DeleteAsync(string cropId, string cropVarietyId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRequest(cropId, cropVarietyId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("CropVarietiesClient.Get"); + using var scope = _clientDiagnostics.CreateScope("CropVarietiesClient.Delete"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(cropId, cropVarietyId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -715,57 +357,12 @@ public virtual Response Get(string cropId, string cropVarietyId, RequestOptions } } - private HttpMessage CreateGetRequest(string cropId, string cropVarietyId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/crops/", false); - uri.AppendPath(cropId, true); - uri.AppendPath("/crop-varieties/", false); - uri.AppendPath(cropVarietyId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Creates or updates a crop variety resource. + /// Deletes a specified crop variety resource under a particular crop. + /// ID of the crop. + /// ID of the crop variety. + /// The request options. + /// or is null. /// - /// Schema for Request Body: - /// { - /// cropId: string, - /// brand: string, - /// product: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// - /// Schema for Response Body: - /// { - /// cropId: string, - /// brand: string, - /// product: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// /// Schema for Response Error: /// { /// error: { @@ -783,37 +380,16 @@ private HttpMessage CreateGetRequest(string cropId, string cropVarietyId) /// /// /// - /// ID of the crop resource. - /// ID of the crop variety resource. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task CreateOrUpdateAsync(string cropId, string cropVarietyId, RequestContent content, RequestOptions options = null) + public virtual Response Delete(string cropId, string cropVarietyId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(cropId, cropVarietyId, content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("CropVarietiesClient.CreateOrUpdate"); + using var scope = _clientDiagnostics.CreateScope("CropVarietiesClient.Delete"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(cropId, cropVarietyId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -822,40 +398,137 @@ public virtual async Task CreateOrUpdateAsync(string cropId, string cr } } - /// Creates or updates a crop variety resource. + /// Returns a paginated list of crop variety resources under a particular crop. + /// ID of the associated crop. + /// The request options. + /// CropIds of the resource. + /// Brands of the resource. + /// Products of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// is null. /// - /// Schema for Request Body: + /// Schema for Response Body: /// { - /// cropId: string, - /// brand: string, - /// product: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// value: [ + /// { + /// cropId: string, + /// brand: string, + /// product: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [Error], + /// innererror: { + /// code: string, + /// innererror: InnerError + /// } + /// }, + /// traceId: string /// } /// /// + /// +#pragma warning disable AZC0002 + public virtual AsyncPageable ListByCropIdAsync(string cropId, RequestOptions options, IEnumerable cropIds = null, IEnumerable brands = null, IEnumerable products = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) +#pragma warning restore AZC0002 + { + if (cropId == null) + { + throw new ArgumentNullException(nameof(cropId)); + } + + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "CropVarietiesClient.ListByCropId"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListByCropIdRequest(cropId, cropIds, brands, products, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListByCropIdNextPageRequest(nextLink, cropId, cropIds, brands, products, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + /// Returns a paginated list of crop variety resources under a particular crop. + /// ID of the associated crop. + /// The request options. + /// CropIds of the resource. + /// Brands of the resource. + /// Products of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// is null. + /// /// Schema for Response Body: /// { - /// cropId: string, - /// brand: string, - /// product: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// value: [ + /// { + /// cropId: string, + /// brand: string, + /// product: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -873,66 +546,73 @@ public virtual async Task CreateOrUpdateAsync(string cropId, string cr /// /// /// - /// ID of the crop resource. - /// ID of the crop variety resource. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual Response CreateOrUpdate(string cropId, string cropVarietyId, RequestContent content, RequestOptions options = null) + public virtual Pageable ListByCropId(string cropId, RequestOptions options, IEnumerable cropIds = null, IEnumerable brands = null, IEnumerable products = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(cropId, cropVarietyId, content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("CropVarietiesClient.CreateOrUpdate"); - scope.Start(); - try + if (cropId == null) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + throw new ArgumentNullException(nameof(cropId)); } - catch (Exception e) + + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "CropVarietiesClient.ListByCropId"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) { - scope.Failed(e); - throw; + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListByCropIdRequest(cropId, cropIds, brands, products, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListByCropIdNextPageRequest(nextLink, cropId, cropIds, brands, products, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - private HttpMessage CreateCreateOrUpdateRequest(string cropId, string cropVarietyId, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/crops/", false); - uri.AppendPath(cropId, true); - uri.AppendPath("/crop-varieties/", false); - uri.AppendPath(cropVarietyId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/merge-patch+json"); - request.Content = content; - return message; - } - - /// Deletes a specified crop variety resource under a particular crop. + /// Returns a paginated list of crop variety resources across all crops. + /// The request options. + /// CropIds of the resource. + /// Brands of the resource. + /// Products of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// cropId: string, + /// brand: string, + /// product: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string + /// } + /// /// Schema for Response Error: /// { /// error: { @@ -950,45 +630,68 @@ private HttpMessage CreateCreateOrUpdateRequest(string cropId, string cropVariet /// /// /// - /// ID of the crop. - /// ID of the crop variety. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task DeleteAsync(string cropId, string cropVarietyId, RequestOptions options = null) + public virtual AsyncPageable ListAsync(RequestOptions options, IEnumerable cropIds = null, IEnumerable brands = null, IEnumerable products = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(cropId, cropVarietyId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("CropVarietiesClient.Delete"); - scope.Start(); - try + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "CropVarietiesClient.List"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) + do { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; + var message = string.IsNullOrEmpty(nextLink) + ? CreateListRequest(cropIds, brands, products, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListNextPageRequest(nextLink, cropIds, brands, products, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - /// Deletes a specified crop variety resource under a particular crop. + /// Returns a paginated list of crop variety resources across all crops. + /// The request options. + /// CropIds of the resource. + /// Brands of the resource. + /// Products of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// cropId: string, + /// brand: string, + /// product: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string + /// } + /// /// Schema for Response Error: /// { /// error: { @@ -1006,58 +709,326 @@ public virtual async Task DeleteAsync(string cropId, string cropVariet /// /// /// - /// ID of the crop. - /// ID of the crop variety. - /// The request options. #pragma warning disable AZC0002 - public virtual Response Delete(string cropId, string cropVarietyId, RequestOptions options = null) + public virtual Pageable List(RequestOptions options, IEnumerable cropIds = null, IEnumerable brands = null, IEnumerable products = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(cropId, cropVarietyId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("CropVarietiesClient.Delete"); - scope.Start(); - try + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "CropVarietiesClient.List"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListRequest(cropIds, brands, products, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListNextPageRequest(nextLink, cropIds, brands, products, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + internal HttpMessage CreateListByCropIdRequest(string cropId, IEnumerable cropIds, IEnumerable brands, IEnumerable products, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/crops/", false); + uri.AppendPath(cropId, true); + uri.AppendPath("/crop-varieties", false); + if (cropIds != null) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) + foreach (var param in cropIds) { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } + uri.AppendQuery("cropIds", param, true); } - else + } + if (brands != null) + { + foreach (var param in brands) { - return message.Response; + uri.AppendQuery("brands", param, true); } } - catch (Exception e) + if (products != null) { - scope.Failed(e); - throw; + foreach (var param in products) + { + uri.AppendQuery("products", param, true); + } } + if (ids != null) + { + foreach (var param in ids) + { + uri.AppendQuery("ids", param, true); + } + } + if (names != null) + { + foreach (var param in names) + { + uri.AppendQuery("names", param, true); + } + } + if (propertyFilters != null) + { + foreach (var param in propertyFilters) + { + uri.AppendQuery("propertyFilters", param, true); + } + } + if (statuses != null) + { + foreach (var param in statuses) + { + uri.AppendQuery("statuses", param, true); + } + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; } - private HttpMessage CreateDeleteRequest(string cropId, string cropVarietyId) + internal HttpMessage CreateListRequest(IEnumerable cropIds, IEnumerable brands, IEnumerable products, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/crop-varieties", false); + if (cropIds != null) + { + foreach (var param in cropIds) + { + uri.AppendQuery("cropIds", param, true); + } + } + if (brands != null) + { + foreach (var param in brands) + { + uri.AppendQuery("brands", param, true); + } + } + if (products != null) + { + foreach (var param in products) + { + uri.AppendQuery("products", param, true); + } + } + if (ids != null) + { + foreach (var param in ids) + { + uri.AppendQuery("ids", param, true); + } + } + if (names != null) + { + foreach (var param in names) + { + uri.AppendQuery("names", param, true); + } + } + if (propertyFilters != null) + { + foreach (var param in propertyFilters) + { + uri.AppendQuery("propertyFilters", param, true); + } + } + if (statuses != null) + { + foreach (var param in statuses) + { + uri.AppendQuery("statuses", param, true); + } + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetRequest(string cropId, string cropVarietyId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/crops/", false); + uri.AppendPath(cropId, true); + uri.AppendPath("/crop-varieties/", false); + uri.AppendPath(cropVarietyId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string cropId, string cropVarietyId, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/crops/", false); + uri.AppendPath(cropId, true); + uri.AppendPath("/crop-varieties/", false); + uri.AppendPath(cropVarietyId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/merge-patch+json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200201.Instance; + return message; + } + + internal HttpMessage CreateDeleteRequest(string cropId, string cropVarietyId) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); + uri.Reset(_endpoint); uri.AppendPath("/crops/", false); uri.AppendPath(cropId, true); uri.AppendPath("/crop-varieties/", false); uri.AppendPath(cropVarietyId, true); - uri.AppendQuery("api-version", apiVersion, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier204.Instance; + return message; + } + + internal HttpMessage CreateListByCropIdNextPageRequest(string nextLink, string cropId, IEnumerable cropIds, IEnumerable brands, IEnumerable products, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; return message; } + + internal HttpMessage CreateListNextPageRequest(string nextLink, IEnumerable cropIds, IEnumerable brands, IEnumerable products, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier200201 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200201(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + 201 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier204 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier204(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 204 => false, + _ => true + }; + } + } } } diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/CropsClient.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/CropsClient.cs index 4b2b2e5009af4..3aad73ee265ca 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/CropsClient.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/CropsClient.cs @@ -7,6 +7,8 @@ using System; using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; @@ -17,14 +19,16 @@ namespace Azure.Verticals.AgriFood.Farming /// The Crops service client. public partial class CropsClient { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of CropsClient for mocking. protected CropsClient() @@ -35,6 +39,7 @@ protected CropsClient() /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. + /// or is null. public CropsClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) { if (endpoint == null) @@ -47,255 +52,18 @@ public CropsClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOpti } options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); _tokenCredential = credential; - var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); - _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { authPolicy }, new ResponseClassifier()); - this.endpoint = endpoint; - apiVersion = options.Version; - } - - /// Returns a paginated list of crop resources. - /// - /// Schema for Response Body: - /// { - /// value: [ - /// { - /// phenotype: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string - /// } - /// - /// - /// Schema for Response Error: - /// { - /// error: { - /// code: string, - /// message: string, - /// target: string, - /// details: [Error], - /// innererror: { - /// code: string, - /// innererror: InnerError - /// } - /// }, - /// traceId: string - /// } - /// - /// - /// - /// Crop phenotypes of the resource. - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. -#pragma warning disable AZC0002 - public virtual async Task ListAsync(IEnumerable phenotypes = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) -#pragma warning restore AZC0002 - { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRequest(phenotypes, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("CropsClient.List"); - scope.Start(); - try - { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Returns a paginated list of crop resources. - /// - /// Schema for Response Body: - /// { - /// value: [ - /// { - /// phenotype: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string - /// } - /// - /// - /// Schema for Response Error: - /// { - /// error: { - /// code: string, - /// message: string, - /// target: string, - /// details: [Error], - /// innererror: { - /// code: string, - /// innererror: InnerError - /// } - /// }, - /// traceId: string - /// } - /// - /// - /// - /// Crop phenotypes of the resource. - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. -#pragma warning disable AZC0002 - public virtual Response List(IEnumerable phenotypes = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) -#pragma warning restore AZC0002 - { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRequest(phenotypes, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("CropsClient.List"); - scope.Start(); - try - { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - private HttpMessage CreateListRequest(IEnumerable phenotypes, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/crops", false); - if (phenotypes != null) - { - uri.AppendQueryDelimited("phenotypes", phenotypes, ",", true); - } - if (ids != null) - { - uri.AppendQueryDelimited("ids", ids, ",", true); - } - if (names != null) - { - uri.AppendQueryDelimited("names", names, ",", true); - } - if (propertyFilters != null) - { - uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); - } - if (statuses != null) - { - uri.AppendQueryDelimited("statuses", statuses, ",", true); - } - if (minCreatedDateTime != null) - { - uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); - } - if (maxCreatedDateTime != null) - { - uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); - } - if (minLastModifiedDateTime != null) - { - uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); - } - if (maxLastModifiedDateTime != null) - { - uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); - } - if (maxPageSize != null) - { - uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; + _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; } /// Gets a specified crop resource. + /// ID of the crop. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -310,7 +78,6 @@ private HttpMessage CreateListRequest(IEnumerable phenotypes, IEnumerabl /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -328,34 +95,16 @@ private HttpMessage CreateListRequest(IEnumerable phenotypes, IEnumerabl /// /// /// - /// ID of the crop. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetAsync(string cropId, RequestOptions options = null) + public virtual async Task GetAsync(string cropId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRequest(cropId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("CropsClient.Get"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRequest(cropId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -365,6 +114,9 @@ public virtual async Task GetAsync(string cropId, RequestOptions optio } /// Gets a specified crop resource. + /// ID of the crop. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -379,7 +131,6 @@ public virtual async Task GetAsync(string cropId, RequestOptions optio /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -397,34 +148,16 @@ public virtual async Task GetAsync(string cropId, RequestOptions optio /// /// /// - /// ID of the crop. - /// The request options. #pragma warning disable AZC0002 - public virtual Response Get(string cropId, RequestOptions options = null) + public virtual Response Get(string cropId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRequest(cropId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("CropsClient.Get"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRequest(cropId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -433,22 +166,11 @@ public virtual Response Get(string cropId, RequestOptions options = null) } } - private HttpMessage CreateGetRequest(string cropId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/crops/", false); - uri.AppendPath(cropId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Creates or updates a crop resource. + /// ID of the crop resource. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -463,7 +185,6 @@ private HttpMessage CreateGetRequest(string cropId) /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Body: /// { /// phenotype: string, @@ -477,7 +198,6 @@ private HttpMessage CreateGetRequest(string cropId) /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -495,36 +215,16 @@ private HttpMessage CreateGetRequest(string cropId) /// /// /// - /// ID of the crop resource. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task CreateOrUpdateAsync(string cropId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(cropId, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("CropsClient.CreateOrUpdate"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(cropId, content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -534,6 +234,10 @@ public virtual async Task CreateOrUpdateAsync(string cropId, RequestCo } /// Creates or updates a crop resource. + /// ID of the crop resource. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -548,7 +252,6 @@ public virtual async Task CreateOrUpdateAsync(string cropId, RequestCo /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Body: /// { /// phenotype: string, @@ -562,7 +265,6 @@ public virtual async Task CreateOrUpdateAsync(string cropId, RequestCo /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -580,36 +282,16 @@ public virtual async Task CreateOrUpdateAsync(string cropId, RequestCo /// /// /// - /// ID of the crop resource. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response CreateOrUpdate(string cropId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(cropId, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("CropsClient.CreateOrUpdate"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(cropId, content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -618,24 +300,10 @@ public virtual Response CreateOrUpdate(string cropId, RequestContent content, Re } } - private HttpMessage CreateCreateOrUpdateRequest(string cropId, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/crops/", false); - uri.AppendPath(cropId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/merge-patch+json"); - request.Content = content; - return message; - } - /// Deletes Crop for given crop id. + /// ID of crop to be deleted. + /// The request options. + /// is null. /// /// Schema for Response Error: /// { @@ -654,34 +322,16 @@ private HttpMessage CreateCreateOrUpdateRequest(string cropId, RequestContent co /// /// /// - /// ID of crop to be deleted. - /// The request options. #pragma warning disable AZC0002 public virtual async Task DeleteAsync(string cropId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(cropId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("CropsClient.Delete"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(cropId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -691,6 +341,9 @@ public virtual async Task DeleteAsync(string cropId, RequestOptions op } /// Deletes Crop for given crop id. + /// ID of crop to be deleted. + /// The request options. + /// is null. /// /// Schema for Response Error: /// { @@ -709,55 +362,351 @@ public virtual async Task DeleteAsync(string cropId, RequestOptions op /// /// /// - /// ID of crop to be deleted. - /// The request options. #pragma warning disable AZC0002 public virtual Response Delete(string cropId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(cropId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("CropsClient.Delete"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) + using HttpMessage message = CreateDeleteRequest(cropId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a paginated list of crop resources. + /// The request options. + /// Crop phenotypes of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// phenotype: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [Error], + /// innererror: { + /// code: string, + /// innererror: InnerError + /// } + /// }, + /// traceId: string + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual AsyncPageable ListAsync(RequestOptions options, IEnumerable phenotypes = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) +#pragma warning restore AZC0002 + { + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "CropsClient.List"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) + { + do { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } + var message = string.IsNullOrEmpty(nextLink) + ? CreateListRequest(phenotypes, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListNextPageRequest(nextLink, phenotypes, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + /// Returns a paginated list of crop resources. + /// The request options. + /// Crop phenotypes of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// phenotype: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [Error], + /// innererror: { + /// code: string, + /// innererror: InnerError + /// } + /// }, + /// traceId: string + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual Pageable List(RequestOptions options, IEnumerable phenotypes = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) +#pragma warning restore AZC0002 + { + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "CropsClient.List"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListRequest(phenotypes, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListNextPageRequest(nextLink, phenotypes, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + internal HttpMessage CreateListRequest(IEnumerable phenotypes, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/crops", false); + if (phenotypes != null) + { + foreach (var param in phenotypes) + { + uri.AppendQuery("phenotypes", param, true); } - else + } + if (ids != null) + { + foreach (var param in ids) { - return message.Response; + uri.AppendQuery("ids", param, true); } } - catch (Exception e) + if (names != null) { - scope.Failed(e); - throw; + foreach (var param in names) + { + uri.AppendQuery("names", param, true); + } + } + if (propertyFilters != null) + { + foreach (var param in propertyFilters) + { + uri.AppendQuery("propertyFilters", param, true); + } + } + if (statuses != null) + { + foreach (var param in statuses) + { + uri.AppendQuery("statuses", param, true); + } + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetRequest(string cropId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/crops/", false); + uri.AppendPath(cropId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string cropId, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/crops/", false); + uri.AppendPath(cropId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/merge-patch+json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200201.Instance; + return message; } - private HttpMessage CreateDeleteRequest(string cropId) + internal HttpMessage CreateDeleteRequest(string cropId) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); + uri.Reset(_endpoint); uri.AppendPath("/crops/", false); uri.AppendPath(cropId, true); - uri.AppendQuery("api-version", apiVersion, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier204.Instance; + return message; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, IEnumerable phenotypes, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; return message; } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier200201 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200201(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + 201 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier204 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier204(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 204 => false, + _ => true + }; + } + } } } diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/FarmClient.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/FarmClient.cs index 80ea3f52c7ee1..be19adde4f972 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/FarmClient.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/FarmClient.cs @@ -16,14 +16,16 @@ namespace Azure.Verticals.AgriFood.Farming /// The Farm service client. public partial class FarmClient { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of FarmClient for mocking. protected FarmClient() @@ -34,6 +36,7 @@ protected FarmClient() /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. + /// or is null. public FarmClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) { if (endpoint == null) @@ -46,22 +49,25 @@ public FarmClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptio } options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); _tokenCredential = credential; - var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); - _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { authPolicy }, new ResponseClassifier()); - this.endpoint = endpoint; - apiVersion = options.Version; + _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; } - /// Create a farm operation data ingestion job. + /// Get a farm operation data ingestion job. + /// ID of the job. + /// The request options. + /// is null. /// - /// Schema for Request Body: + /// Schema for Response Body: /// { - /// farmerId: string (required), - /// authProviderId: string (required), + /// farmerId: string, + /// authProviderId: string, /// operations: [string], - /// startYear: number (required), + /// startYear: number, /// id: string, /// status: string, /// durationInSeconds: number, @@ -75,7 +81,46 @@ public FarmClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptio /// properties: Dictionary<string, AnyObject> /// } /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [Error], + /// innererror: { + /// code: string, + /// innererror: InnerError + /// } + /// }, + /// traceId: string + /// } + /// /// + /// +#pragma warning disable AZC0002 + public virtual async Task GetDataIngestionJobDetailsAsync(string jobId, RequestOptions options) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("FarmClient.GetDataIngestionJobDetails"); + scope.Start(); + try + { + using HttpMessage message = CreateGetDataIngestionJobDetailsRequest(jobId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a farm operation data ingestion job. + /// ID of the job. + /// The request options. + /// is null. + /// /// Schema for Response Body: /// { /// farmerId: string, @@ -95,7 +140,6 @@ public FarmClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptio /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -113,35 +157,16 @@ public FarmClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptio /// /// /// - /// Job ID supplied by user. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task> CreateDataIngestionJobAsync(string jobId, RequestContent content, RequestOptions options = null) + public virtual Response GetDataIngestionJobDetails(string jobId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateDataIngestionJobRequest(jobId, content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("FarmClient.CreateDataIngestionJob"); + using var scope = _clientDiagnostics.CreateScope("FarmClient.GetDataIngestionJobDetails"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "FarmClient.CreateDataIngestionJob"); - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "FarmClient.CreateDataIngestionJob"); - } + using HttpMessage message = CreateGetDataIngestionJobDetailsRequest(jobId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -151,6 +176,10 @@ public virtual async Task> CreateDataIngestionJobAsync(str } /// Create a farm operation data ingestion job. + /// Job ID supplied by user. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -171,7 +200,6 @@ public virtual async Task> CreateDataIngestionJobAsync(str /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Body: /// { /// farmerId: string, @@ -191,7 +219,6 @@ public virtual async Task> CreateDataIngestionJobAsync(str /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -209,35 +236,16 @@ public virtual async Task> CreateDataIngestionJobAsync(str /// /// /// - /// Job ID supplied by user. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual Operation CreateDataIngestionJob(string jobId, RequestContent content, RequestOptions options = null) + public virtual async Task> CreateDataIngestionJobAsync(string jobId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateDataIngestionJobRequest(jobId, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("FarmClient.CreateDataIngestionJob"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "FarmClient.CreateDataIngestionJob"); - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "FarmClient.CreateDataIngestionJob"); - } + using HttpMessage message = CreateCreateDataIngestionJobRequest(jobId, content); + return await LowLevelOperationHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, "FarmClient.CreateDataIngestionJob", OperationFinalStateVia.Location, options).ConfigureAwait(false); } catch (Exception e) { @@ -246,31 +254,18 @@ public virtual Operation CreateDataIngestionJob(string jobId, Reques } } - private HttpMessage CreateCreateDataIngestionJobRequest(string jobId, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farm-operations/ingest-data/", false); - uri.AppendPath(jobId, 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; - } - - /// Get a farm operation data ingestion job. + /// Create a farm operation data ingestion job. + /// Job ID supplied by user. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// - /// Schema for Response Body: + /// Schema for Request Body: /// { - /// farmerId: string, - /// authProviderId: string, + /// farmerId: string (required), + /// authProviderId: string (required), /// operations: [string], - /// startYear: number, + /// startYear: number (required), /// id: string, /// status: string, /// durationInSeconds: number, @@ -284,62 +279,6 @@ private HttpMessage CreateCreateDataIngestionJobRequest(string jobId, RequestCon /// properties: Dictionary<string, AnyObject> /// } /// - /// - /// Schema for Response Error: - /// { - /// error: { - /// code: string, - /// message: string, - /// target: string, - /// details: [Error], - /// innererror: { - /// code: string, - /// innererror: InnerError - /// } - /// }, - /// traceId: string - /// } - /// - /// - /// - /// ID of the job. - /// The request options. -#pragma warning disable AZC0002 - public virtual async Task GetDataIngestionJobDetailsAsync(string jobId, RequestOptions options = null) -#pragma warning restore AZC0002 - { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetDataIngestionJobDetailsRequest(jobId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("FarmClient.GetDataIngestionJobDetails"); - scope.Start(); - try - { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get a farm operation data ingestion job. - /// /// Schema for Response Body: /// { /// farmerId: string, @@ -359,7 +298,6 @@ public virtual async Task GetDataIngestionJobDetailsAsync(string jobId /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -377,34 +315,16 @@ public virtual async Task GetDataIngestionJobDetailsAsync(string jobId /// /// /// - /// ID of the job. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetDataIngestionJobDetails(string jobId, RequestOptions options = null) + public virtual Operation CreateDataIngestionJob(string jobId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetDataIngestionJobDetailsRequest(jobId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("FarmClient.GetDataIngestionJobDetails"); + using var scope = _clientDiagnostics.CreateScope("FarmClient.CreateDataIngestionJob"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateDataIngestionJobRequest(jobId, content); + return LowLevelOperationHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, "FarmClient.CreateDataIngestionJob", OperationFinalStateVia.Location, options); } catch (Exception e) { @@ -413,19 +333,65 @@ public virtual Response GetDataIngestionJobDetails(string jobId, RequestOptions } } - private HttpMessage CreateGetDataIngestionJobDetailsRequest(string jobId) + internal HttpMessage CreateCreateDataIngestionJobRequest(string jobId, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farm-operations/ingest-data/", false); + uri.AppendPath(jobId, 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; + message.ResponseClassifier = ResponseClassifier202.Instance; + return message; + } + + internal HttpMessage CreateGetDataIngestionJobDetailsRequest(string jobId) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); + uri.Reset(_endpoint); uri.AppendPath("/farm-operations/ingest-data/", false); uri.AppendPath(jobId, true); - uri.AppendQuery("api-version", apiVersion, true); + uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; return message; } + + private sealed class ResponseClassifier202 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier202(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 202 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } } } diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/FarmersClient.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/FarmersClient.cs index 18135c58712e4..a670362c75e44 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/FarmersClient.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/FarmersClient.cs @@ -7,6 +7,8 @@ using System; using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; @@ -17,14 +19,16 @@ namespace Azure.Verticals.AgriFood.Farming /// The Farmers service client. public partial class FarmersClient { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of FarmersClient for mocking. protected FarmersClient() @@ -35,6 +39,7 @@ protected FarmersClient() /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. + /// or is null. public FarmersClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) { if (endpoint == null) @@ -47,247 +52,18 @@ public FarmersClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOp } options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); _tokenCredential = credential; - var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); - _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { authPolicy }, new ResponseClassifier()); - this.endpoint = endpoint; - apiVersion = options.Version; - } - - /// Returns a paginated list of farmer resources. - /// - /// Schema for Response Body: - /// { - /// value: [ - /// { - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string - /// } - /// - /// - /// Schema for Response Error: - /// { - /// error: { - /// code: string, - /// message: string, - /// target: string, - /// details: [Error], - /// innererror: { - /// code: string, - /// innererror: InnerError - /// } - /// }, - /// traceId: string - /// } - /// - /// - /// - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. -#pragma warning disable AZC0002 - public virtual async Task ListAsync(IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) -#pragma warning restore AZC0002 - { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRequest(ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("FarmersClient.List"); - scope.Start(); - try - { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Returns a paginated list of farmer resources. - /// - /// Schema for Response Body: - /// { - /// value: [ - /// { - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string - /// } - /// - /// - /// Schema for Response Error: - /// { - /// error: { - /// code: string, - /// message: string, - /// target: string, - /// details: [Error], - /// innererror: { - /// code: string, - /// innererror: InnerError - /// } - /// }, - /// traceId: string - /// } - /// - /// - /// - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. -#pragma warning disable AZC0002 - public virtual Response List(IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) -#pragma warning restore AZC0002 - { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRequest(ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("FarmersClient.List"); - scope.Start(); - try - { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - private HttpMessage CreateListRequest(IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers", false); - if (ids != null) - { - uri.AppendQueryDelimited("ids", ids, ",", true); - } - if (names != null) - { - uri.AppendQueryDelimited("names", names, ",", true); - } - if (propertyFilters != null) - { - uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); - } - if (statuses != null) - { - uri.AppendQueryDelimited("statuses", statuses, ",", true); - } - if (minCreatedDateTime != null) - { - uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); - } - if (maxCreatedDateTime != null) - { - uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); - } - if (minLastModifiedDateTime != null) - { - uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); - } - if (maxLastModifiedDateTime != null) - { - uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); - } - if (maxPageSize != null) - { - uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; + _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; } /// Gets a specified farmer resource. + /// ID of the associated farmer. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -301,7 +77,6 @@ private HttpMessage CreateListRequest(IEnumerable ids, IEnumerable - /// /// Schema for Response Error: /// { /// error: { @@ -319,34 +94,16 @@ private HttpMessage CreateListRequest(IEnumerable ids, IEnumerable /// /// - /// ID of the associated farmer. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetAsync(string farmerId, RequestOptions options = null) + public virtual async Task GetAsync(string farmerId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRequest(farmerId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("FarmersClient.Get"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRequest(farmerId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -356,6 +113,9 @@ public virtual async Task GetAsync(string farmerId, RequestOptions opt } /// Gets a specified farmer resource. + /// ID of the associated farmer. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -369,7 +129,6 @@ public virtual async Task GetAsync(string farmerId, RequestOptions opt /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -387,34 +146,16 @@ public virtual async Task GetAsync(string farmerId, RequestOptions opt /// /// /// - /// ID of the associated farmer. - /// The request options. #pragma warning disable AZC0002 - public virtual Response Get(string farmerId, RequestOptions options = null) + public virtual Response Get(string farmerId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRequest(farmerId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("FarmersClient.Get"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRequest(farmerId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -423,22 +164,11 @@ public virtual Response Get(string farmerId, RequestOptions options = null) } } - private HttpMessage CreateGetRequest(string farmerId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Creates or updates a farmer resource. + /// ID of the farmer resource. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -452,7 +182,6 @@ private HttpMessage CreateGetRequest(string farmerId) /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Body: /// { /// id: string, @@ -465,7 +194,6 @@ private HttpMessage CreateGetRequest(string farmerId) /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -483,36 +211,16 @@ private HttpMessage CreateGetRequest(string farmerId) /// /// /// - /// ID of the farmer resource. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task CreateOrUpdateAsync(string farmerId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("FarmersClient.CreateOrUpdate"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -522,6 +230,10 @@ public virtual async Task CreateOrUpdateAsync(string farmerId, Request } /// Creates or updates a farmer resource. + /// ID of the farmer resource. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -535,7 +247,6 @@ public virtual async Task CreateOrUpdateAsync(string farmerId, Request /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Body: /// { /// id: string, @@ -548,7 +259,6 @@ public virtual async Task CreateOrUpdateAsync(string farmerId, Request /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -566,36 +276,16 @@ public virtual async Task CreateOrUpdateAsync(string farmerId, Request /// /// /// - /// ID of the farmer resource. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response CreateOrUpdate(string farmerId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("FarmersClient.CreateOrUpdate"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -604,24 +294,10 @@ public virtual Response CreateOrUpdate(string farmerId, RequestContent content, } } - private HttpMessage CreateCreateOrUpdateRequest(string farmerId, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/merge-patch+json"); - request.Content = content; - return message; - } - /// Deletes a specified farmer resource. + /// ID of farmer to be deleted. + /// The request options. + /// is null. /// /// Schema for Response Error: /// { @@ -640,34 +316,16 @@ private HttpMessage CreateCreateOrUpdateRequest(string farmerId, RequestContent /// /// /// - /// ID of farmer to be deleted. - /// The request options. #pragma warning disable AZC0002 public virtual async Task DeleteAsync(string farmerId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(farmerId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("FarmersClient.Delete"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(farmerId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -677,6 +335,9 @@ public virtual async Task DeleteAsync(string farmerId, RequestOptions } /// Deletes a specified farmer resource. + /// ID of farmer to be deleted. + /// The request options. + /// is null. /// /// Schema for Response Error: /// { @@ -695,34 +356,16 @@ public virtual async Task DeleteAsync(string farmerId, RequestOptions /// /// /// - /// ID of farmer to be deleted. - /// The request options. #pragma warning disable AZC0002 public virtual Response Delete(string farmerId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(farmerId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("FarmersClient.Delete"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(farmerId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -731,22 +374,10 @@ public virtual Response Delete(string farmerId, RequestOptions options = null) } } - private HttpMessage CreateDeleteRequest(string farmerId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Get a cascade delete job for specified farmer. + /// ID of the job. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -766,7 +397,6 @@ private HttpMessage CreateDeleteRequest(string farmerId) /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -784,34 +414,16 @@ private HttpMessage CreateDeleteRequest(string farmerId) /// /// /// - /// ID of the job. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetCascadeDeleteJobDetailsAsync(string jobId, RequestOptions options = null) + public virtual async Task GetCascadeDeleteJobDetailsAsync(string jobId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("FarmersClient.GetCascadeDeleteJobDetails"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -821,6 +433,9 @@ public virtual async Task GetCascadeDeleteJobDetailsAsync(string jobId } /// Get a cascade delete job for specified farmer. + /// ID of the job. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -840,7 +455,6 @@ public virtual async Task GetCascadeDeleteJobDetailsAsync(string jobId /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -858,34 +472,16 @@ public virtual async Task GetCascadeDeleteJobDetailsAsync(string jobId /// /// /// - /// ID of the job. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetCascadeDeleteJobDetails(string jobId, RequestOptions options = null) + public virtual Response GetCascadeDeleteJobDetails(string jobId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("FarmersClient.GetCascadeDeleteJobDetails"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -894,22 +490,157 @@ public virtual Response GetCascadeDeleteJobDetails(string jobId, RequestOptions } } - private HttpMessage CreateGetCascadeDeleteJobDetailsRequest(string jobId) + /// Returns a paginated list of farmer resources. + /// The request options. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [Error], + /// innererror: { + /// code: string, + /// innererror: InnerError + /// } + /// }, + /// traceId: string + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual AsyncPageable ListAsync(RequestOptions options, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) +#pragma warning restore AZC0002 { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/cascade-delete/", false); - uri.AppendPath(jobId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "FarmersClient.List"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListRequest(ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListNextPageRequest(nextLink, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + /// Returns a paginated list of farmer resources. + /// The request options. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [Error], + /// innererror: { + /// code: string, + /// innererror: InnerError + /// } + /// }, + /// traceId: string + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual Pageable List(RequestOptions options, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) +#pragma warning restore AZC0002 + { + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "FarmersClient.List"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListRequest(ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListNextPageRequest(nextLink, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } } /// Create a cascade delete job for specified farmer. + /// Job ID supplied by end user. + /// ID of the farmer to be deleted. + /// The request options. + /// or is null. /// /// Schema for Response Body: /// { @@ -929,7 +660,6 @@ private HttpMessage CreateGetCascadeDeleteJobDetailsRequest(string jobId) /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -947,35 +677,16 @@ private HttpMessage CreateGetCascadeDeleteJobDetailsRequest(string jobId) /// /// /// - /// Job ID supplied by end user. - /// ID of the farmer to be deleted. - /// The request options. #pragma warning disable AZC0002 public virtual async Task> CreateCascadeDeleteJobAsync(string jobId, string farmerId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("FarmersClient.CreateCascadeDeleteJob"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "FarmersClient.CreateCascadeDeleteJob"); - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "FarmersClient.CreateCascadeDeleteJob"); - } + using HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId); + return await LowLevelOperationHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, "FarmersClient.CreateCascadeDeleteJob", OperationFinalStateVia.Location, options).ConfigureAwait(false); } catch (Exception e) { @@ -985,6 +696,10 @@ public virtual async Task> CreateCascadeDeleteJobAsync(str } /// Create a cascade delete job for specified farmer. + /// Job ID supplied by end user. + /// ID of the farmer to be deleted. + /// The request options. + /// or is null. /// /// Schema for Response Body: /// { @@ -1004,7 +719,6 @@ public virtual async Task> CreateCascadeDeleteJobAsync(str /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1022,57 +736,240 @@ public virtual async Task> CreateCascadeDeleteJobAsync(str /// /// /// - /// Job ID supplied by end user. - /// ID of the farmer to be deleted. - /// The request options. #pragma warning disable AZC0002 public virtual Operation CreateCascadeDeleteJob(string jobId, string farmerId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("FarmersClient.CreateCascadeDeleteJob"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) + using HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId); + return LowLevelOperationHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, "FarmersClient.CreateCascadeDeleteJob", OperationFinalStateVia.Location, options); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + internal HttpMessage CreateListRequest(IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers", false); + if (ids != null) + { + foreach (var param in ids) { - switch (message.Response.Status) - { - case 202: - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "FarmersClient.CreateCascadeDeleteJob"); - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } + uri.AppendQuery("ids", param, true); } - else + } + if (names != null) + { + foreach (var param in names) { - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "FarmersClient.CreateCascadeDeleteJob"); + uri.AppendQuery("names", param, true); } } - catch (Exception e) + if (propertyFilters != null) { - scope.Failed(e); - throw; + foreach (var param in propertyFilters) + { + uri.AppendQuery("propertyFilters", param, true); + } + } + if (statuses != null) + { + foreach (var param in statuses) + { + uri.AppendQuery("statuses", param, true); + } + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetRequest(string farmerId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string farmerId, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/merge-patch+json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200201.Instance; + return message; + } + + internal HttpMessage CreateDeleteRequest(string farmerId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier204.Instance; + return message; } - private HttpMessage CreateCreateCascadeDeleteJobRequest(string jobId, string farmerId) + internal HttpMessage CreateGetCascadeDeleteJobDetailsRequest(string jobId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/cascade-delete/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateCascadeDeleteJobRequest(string jobId, string farmerId) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); + uri.Reset(_endpoint); uri.AppendPath("/farmers/cascade-delete/", false); uri.AppendPath(jobId, true); uri.AppendQuery("farmerId", farmerId, true); - uri.AppendQuery("api-version", apiVersion, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier202.Instance; + return message; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; return message; } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier200201 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200201(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + 201 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier204 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier204(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 204 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier202 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier202(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 202 => false, + _ => true + }; + } + } } } diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/FarmsClient.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/FarmsClient.cs index 851887d762ec0..59e9e217dc5f5 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/FarmsClient.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/FarmsClient.cs @@ -7,6 +7,8 @@ using System; using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; @@ -17,14 +19,16 @@ namespace Azure.Verticals.AgriFood.Farming /// The Farms service client. public partial class FarmsClient { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of FarmsClient for mocking. protected FarmsClient() @@ -35,6 +39,7 @@ protected FarmsClient() /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. + /// or is null. public FarmsClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) { if (endpoint == null) @@ -47,36 +52,33 @@ public FarmsClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOpti } options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); _tokenCredential = credential; - var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); - _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { authPolicy }, new ResponseClassifier()); - this.endpoint = endpoint; - apiVersion = options.Version; + _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; } - /// Returns a paginated list of farm resources under a particular farmer. + /// Gets a specified farm resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the farm resource. + /// The request options. + /// or is null. /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -94,50 +96,16 @@ public FarmsClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOpti /// /// /// - /// ID of the associated farmer. - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task ListByFarmerIdAsync(string farmerId, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual async Task GetAsync(string farmerId, string farmId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListByFarmerIdRequest(farmerId, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("FarmsClient.ListByFarmerId"); + using var scope = _clientDiagnostics.CreateScope("FarmsClient.Get"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRequest(farmerId, farmId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -146,28 +114,25 @@ public virtual async Task ListByFarmerIdAsync(string farmerId, IEnumer } } - /// Returns a paginated list of farm resources under a particular farmer. + /// Gets a specified farm resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the farm resource. + /// The request options. + /// or is null. /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -185,50 +150,16 @@ public virtual async Task ListByFarmerIdAsync(string farmerId, IEnumer /// /// /// - /// ID of the associated farmer. - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual Response ListByFarmerId(string farmerId, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual Response Get(string farmerId, string farmId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListByFarmerIdRequest(farmerId, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("FarmsClient.ListByFarmerId"); + using var scope = _clientDiagnostics.CreateScope("FarmsClient.Get"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRequest(farmerId, farmId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -237,84 +168,39 @@ public virtual Response ListByFarmerId(string farmerId, IEnumerable ids } } - private HttpMessage CreateListByFarmerIdRequest(string farmerId, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/farms", false); - if (ids != null) - { - uri.AppendQueryDelimited("ids", ids, ",", true); - } - if (names != null) - { - uri.AppendQueryDelimited("names", names, ",", true); - } - if (propertyFilters != null) - { - uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); - } - if (statuses != null) - { - uri.AppendQueryDelimited("statuses", statuses, ",", true); - } - if (minCreatedDateTime != null) - { - uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); - } - if (maxCreatedDateTime != null) - { - uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); - } - if (minLastModifiedDateTime != null) - { - uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); - } - if (maxLastModifiedDateTime != null) - { - uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); - } - if (maxPageSize != null) - { - uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Returns a paginated list of farm resources across all farmers. + /// Creates or updates a farm resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the farm resource. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// + /// Schema for Request Body: + /// { + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -332,49 +218,16 @@ private HttpMessage CreateListByFarmerIdRequest(string farmerId, IEnumerable /// /// - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task ListAsync(IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual async Task CreateOrUpdateAsync(string farmerId, string farmId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRequest(ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("FarmsClient.List"); + using var scope = _clientDiagnostics.CreateScope("FarmsClient.CreateOrUpdate"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, farmId, content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -383,28 +236,39 @@ public virtual async Task ListAsync(IEnumerable ids = null, IE } } - /// Returns a paginated list of farm resources across all farmers. + /// Creates or updates a farm resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the farm resource. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// + /// Schema for Request Body: + /// { + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -422,49 +286,16 @@ public virtual async Task ListAsync(IEnumerable ids = null, IE /// /// /// - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual Response List(IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual Response CreateOrUpdate(string farmerId, string farmId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRequest(ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("FarmsClient.List"); + using var scope = _clientDiagnostics.CreateScope("FarmsClient.CreateOrUpdate"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, farmId, content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -473,76 +304,12 @@ public virtual Response List(IEnumerable ids = null, IEnumerable } } - private HttpMessage CreateListRequest(IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farms", false); - if (ids != null) - { - uri.AppendQueryDelimited("ids", ids, ",", true); - } - if (names != null) - { - uri.AppendQueryDelimited("names", names, ",", true); - } - if (propertyFilters != null) - { - uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); - } - if (statuses != null) - { - uri.AppendQueryDelimited("statuses", statuses, ",", true); - } - if (minCreatedDateTime != null) - { - uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); - } - if (maxCreatedDateTime != null) - { - uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); - } - if (minLastModifiedDateTime != null) - { - uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); - } - if (maxLastModifiedDateTime != null) - { - uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); - } - if (maxPageSize != null) - { - uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets a specified farm resource under a particular farmer. + /// Deletes a specified farm resource under a particular farmer. + /// ID of the farmer. + /// ID of the farm. + /// The request options. + /// or is null. /// - /// Schema for Response Body: - /// { - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// /// Schema for Response Error: /// { /// error: { @@ -560,35 +327,16 @@ private HttpMessage CreateListRequest(IEnumerable ids, IEnumerable /// /// - /// ID of the associated farmer resource. - /// ID of the farm resource. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetAsync(string farmerId, string farmId, RequestOptions options = null) + public virtual async Task DeleteAsync(string farmerId, string farmId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRequest(farmerId, farmId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("FarmsClient.Get"); + using var scope = _clientDiagnostics.CreateScope("FarmsClient.Delete"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(farmerId, farmId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -597,22 +345,12 @@ public virtual async Task GetAsync(string farmerId, string farmId, Req } } - /// Gets a specified farm resource under a particular farmer. + /// Deletes a specified farm resource under a particular farmer. + /// ID of the farmer. + /// ID of the farm. + /// The request options. + /// or is null. /// - /// Schema for Response Body: - /// { - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// /// Schema for Response Error: /// { /// error: { @@ -630,35 +368,16 @@ public virtual async Task GetAsync(string farmerId, string farmId, Req /// /// /// - /// ID of the associated farmer resource. - /// ID of the farm resource. - /// The request options. #pragma warning disable AZC0002 - public virtual Response Get(string farmerId, string farmId, RequestOptions options = null) + public virtual Response Delete(string farmerId, string farmId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRequest(farmerId, farmId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("FarmsClient.Get"); + using var scope = _clientDiagnostics.CreateScope("FarmsClient.Delete"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(farmerId, farmId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -667,53 +386,29 @@ public virtual Response Get(string farmerId, string farmId, RequestOptions optio } } - private HttpMessage CreateGetRequest(string farmerId, string farmId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/farms/", false); - uri.AppendPath(farmId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Creates or updates a farm resource under a particular farmer. + /// Get a cascade delete job for specified farm. + /// ID of the job. + /// The request options. + /// is null. /// - /// Schema for Request Body: - /// { - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// /// Schema for Response Body: /// { /// farmerId: string, + /// resourceId: string, + /// resourceType: string, /// id: string, - /// eTag: string, /// status: string, + /// durationInSeconds: number, + /// message: string, /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), + /// lastActionDateTime: string (ISO 8601 Format), + /// startTime: string (ISO 8601 Format), + /// endTime: string (ISO 8601 Format), /// name: string, /// description: string, /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -731,37 +426,16 @@ private HttpMessage CreateGetRequest(string farmerId, string farmId) /// /// /// - /// ID of the associated farmer resource. - /// ID of the farm resource. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task CreateOrUpdateAsync(string farmerId, string farmId, RequestContent content, RequestOptions options = null) + public virtual async Task GetCascadeDeleteJobDetailsAsync(string jobId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, farmId, content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("FarmsClient.CreateOrUpdate"); + using var scope = _clientDiagnostics.CreateScope("FarmsClient.GetCascadeDeleteJobDetails"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -770,36 +444,29 @@ public virtual async Task CreateOrUpdateAsync(string farmerId, string } } - /// Creates or updates a farm resource under a particular farmer. + /// Get a cascade delete job for specified farm. + /// ID of the job. + /// The request options. + /// is null. /// - /// Schema for Request Body: - /// { - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// /// Schema for Response Body: /// { /// farmerId: string, + /// resourceId: string, + /// resourceType: string, /// id: string, - /// eTag: string, /// status: string, + /// durationInSeconds: number, + /// message: string, /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), + /// lastActionDateTime: string (ISO 8601 Format), + /// startTime: string (ISO 8601 Format), + /// endTime: string (ISO 8601 Format), /// name: string, /// description: string, /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -817,37 +484,16 @@ public virtual async Task CreateOrUpdateAsync(string farmerId, string /// /// /// - /// ID of the associated farmer resource. - /// ID of the farm resource. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual Response CreateOrUpdate(string farmerId, string farmId, RequestContent content, RequestOptions options = null) + public virtual Response GetCascadeDeleteJobDetails(string jobId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, farmId, content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("FarmsClient.CreateOrUpdate"); + using var scope = _clientDiagnostics.CreateScope("FarmsClient.GetCascadeDeleteJobDetails"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -856,28 +502,47 @@ public virtual Response CreateOrUpdate(string farmerId, string farmId, RequestCo } } - private HttpMessage CreateCreateOrUpdateRequest(string farmerId, string farmId, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/farms/", false); - uri.AppendPath(farmId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/merge-patch+json"); - request.Content = content; - return message; - } - - /// Deletes a specified farm resource under a particular farmer. - /// - /// Schema for Response Error: + /// Returns a paginated list of farm resources under a particular farmer. + /// ID of the associated farmer. + /// The request options. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// is null. + /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string + /// } + /// + /// Schema for Response Error: /// { /// error: { /// code: string, @@ -894,45 +559,70 @@ private HttpMessage CreateCreateOrUpdateRequest(string farmerId, string farmId, /// /// /// - /// ID of the farmer. - /// ID of the farm. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task DeleteAsync(string farmerId, string farmId, RequestOptions options = null) + public virtual AsyncPageable ListByFarmerIdAsync(string farmerId, RequestOptions options, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(farmerId, farmId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("FarmsClient.Delete"); - scope.Start(); - try + if (farmerId == null) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + throw new ArgumentNullException(nameof(farmerId)); } - catch (Exception e) + + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "FarmsClient.ListByFarmerId"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) { - scope.Failed(e); - throw; + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListByFarmerIdRequest(farmerId, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListByFarmerIdNextPageRequest(nextLink, farmerId, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - /// Deletes a specified farm resource under a particular farmer. + /// Returns a paginated list of farm resources under a particular farmer. + /// ID of the associated farmer. + /// The request options. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// is null. /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string + /// } + /// /// Schema for Response Error: /// { /// error: { @@ -950,81 +640,68 @@ public virtual async Task DeleteAsync(string farmerId, string farmId, /// /// /// - /// ID of the farmer. - /// ID of the farm. - /// The request options. #pragma warning disable AZC0002 - public virtual Response Delete(string farmerId, string farmId, RequestOptions options = null) + public virtual Pageable ListByFarmerId(string farmerId, RequestOptions options, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(farmerId, farmId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("FarmsClient.Delete"); - scope.Start(); - try + if (farmerId == null) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + throw new ArgumentNullException(nameof(farmerId)); } - catch (Exception e) + + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "FarmsClient.ListByFarmerId"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) { - scope.Failed(e); - throw; + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListByFarmerIdRequest(farmerId, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListByFarmerIdNextPageRequest(nextLink, farmerId, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - private HttpMessage CreateDeleteRequest(string farmerId, string farmId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/farms/", false); - uri.AppendPath(farmId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Get a cascade delete job for specified farm. + /// Returns a paginated list of farm resources across all farmers. + /// The request options. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. /// /// Schema for Response Body: /// { - /// farmerId: string, - /// resourceId: string, - /// resourceType: string, - /// id: string, - /// status: string, - /// durationInSeconds: number, - /// message: string, - /// createdDateTime: string (ISO 8601 Format), - /// lastActionDateTime: string (ISO 8601 Format), - /// startTime: string (ISO 8601 Format), - /// endTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// value: [ + /// { + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1042,63 +719,63 @@ private HttpMessage CreateDeleteRequest(string farmerId, string farmId) /// /// /// - /// ID of the job. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetCascadeDeleteJobDetailsAsync(string jobId, RequestOptions options = null) + public virtual AsyncPageable ListAsync(RequestOptions options, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("FarmsClient.GetCascadeDeleteJobDetails"); - scope.Start(); - try + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "FarmsClient.List"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) + do { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; + var message = string.IsNullOrEmpty(nextLink) + ? CreateListRequest(ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListNextPageRequest(nextLink, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - /// Get a cascade delete job for specified farm. + /// Returns a paginated list of farm resources across all farmers. + /// The request options. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. /// /// Schema for Response Body: /// { - /// farmerId: string, - /// resourceId: string, - /// resourceType: string, - /// id: string, - /// status: string, - /// durationInSeconds: number, - /// message: string, - /// createdDateTime: string (ISO 8601 Format), - /// lastActionDateTime: string (ISO 8601 Format), - /// startTime: string (ISO 8601 Format), - /// endTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// value: [ + /// { + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1116,58 +793,31 @@ public virtual async Task GetCascadeDeleteJobDetailsAsync(string jobId /// /// /// - /// ID of the job. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetCascadeDeleteJobDetails(string jobId, RequestOptions options = null) + public virtual Pageable List(RequestOptions options, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("FarmsClient.GetCascadeDeleteJobDetails"); - scope.Start(); - try + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "FarmsClient.List"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else + do { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; + var message = string.IsNullOrEmpty(nextLink) + ? CreateListRequest(ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListNextPageRequest(nextLink, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - private HttpMessage CreateGetCascadeDeleteJobDetailsRequest(string jobId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farms/cascade-delete/", false); - uri.AppendPath(jobId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Create a cascade delete job for specified farm. + /// Job ID supplied by end user. + /// ID of the associated farmer. + /// ID of the farm to be deleted. + /// The request options. + /// , , or is null. /// /// Schema for Response Body: /// { @@ -1187,7 +837,6 @@ private HttpMessage CreateGetCascadeDeleteJobDetailsRequest(string jobId) /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1205,36 +854,16 @@ private HttpMessage CreateGetCascadeDeleteJobDetailsRequest(string jobId) /// /// /// - /// Job ID supplied by end user. - /// ID of the associated farmer. - /// ID of the farm to be deleted. - /// The request options. #pragma warning disable AZC0002 public virtual async Task> CreateCascadeDeleteJobAsync(string jobId, string farmerId, string farmId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId, farmId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("FarmsClient.CreateCascadeDeleteJob"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "FarmsClient.CreateCascadeDeleteJob"); - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "FarmsClient.CreateCascadeDeleteJob"); - } + using HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId, farmId); + return await LowLevelOperationHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, "FarmsClient.CreateCascadeDeleteJob", OperationFinalStateVia.Location, options).ConfigureAwait(false); } catch (Exception e) { @@ -1244,6 +873,11 @@ public virtual async Task> CreateCascadeDeleteJobAsync(str } /// Create a cascade delete job for specified farm. + /// Job ID supplied by end user. + /// ID of the associated farmer. + /// ID of the farm to be deleted. + /// The request options. + /// , , or is null. /// /// Schema for Response Body: /// { @@ -1263,7 +897,6 @@ public virtual async Task> CreateCascadeDeleteJobAsync(str /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1281,59 +914,330 @@ public virtual async Task> CreateCascadeDeleteJobAsync(str /// /// /// - /// Job ID supplied by end user. - /// ID of the associated farmer. - /// ID of the farm to be deleted. - /// The request options. #pragma warning disable AZC0002 public virtual Operation CreateCascadeDeleteJob(string jobId, string farmerId, string farmId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId, farmId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("FarmsClient.CreateCascadeDeleteJob"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) + using HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId, farmId); + return LowLevelOperationHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, "FarmsClient.CreateCascadeDeleteJob", OperationFinalStateVia.Location, options); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + internal HttpMessage CreateListByFarmerIdRequest(string farmerId, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/farms", false); + if (ids != null) + { + foreach (var param in ids) { - switch (message.Response.Status) - { - case 202: - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "FarmsClient.CreateCascadeDeleteJob"); - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } + uri.AppendQuery("ids", param, true); } - else + } + if (names != null) + { + foreach (var param in names) { - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "FarmsClient.CreateCascadeDeleteJob"); + uri.AppendQuery("names", param, true); } } - catch (Exception e) + if (propertyFilters != null) { - scope.Failed(e); - throw; + foreach (var param in propertyFilters) + { + uri.AppendQuery("propertyFilters", param, true); + } + } + if (statuses != null) + { + foreach (var param in statuses) + { + uri.AppendQuery("statuses", param, true); + } + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; } - private HttpMessage CreateCreateCascadeDeleteJobRequest(string jobId, string farmerId, string farmId) + internal HttpMessage CreateListRequest(IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farms", false); + if (ids != null) + { + foreach (var param in ids) + { + uri.AppendQuery("ids", param, true); + } + } + if (names != null) + { + foreach (var param in names) + { + uri.AppendQuery("names", param, true); + } + } + if (propertyFilters != null) + { + foreach (var param in propertyFilters) + { + uri.AppendQuery("propertyFilters", param, true); + } + } + if (statuses != null) + { + foreach (var param in statuses) + { + uri.AppendQuery("statuses", param, true); + } + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetRequest(string farmerId, string farmId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/farms/", false); + uri.AppendPath(farmId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string farmerId, string farmId, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/farms/", false); + uri.AppendPath(farmId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/merge-patch+json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200201.Instance; + return message; + } + + internal HttpMessage CreateDeleteRequest(string farmerId, string farmId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/farms/", false); + uri.AppendPath(farmId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier204.Instance; + return message; + } + + internal HttpMessage CreateGetCascadeDeleteJobDetailsRequest(string jobId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farms/cascade-delete/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateCascadeDeleteJobRequest(string jobId, string farmerId, string farmId) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); + uri.Reset(_endpoint); uri.AppendPath("/farms/cascade-delete/", false); uri.AppendPath(jobId, true); uri.AppendQuery("farmerId", farmerId, true); uri.AppendQuery("farmId", farmId, true); - uri.AppendQuery("api-version", apiVersion, true); + uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier202.Instance; return message; } + + internal HttpMessage CreateListByFarmerIdNextPageRequest(string nextLink, string farmerId, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier200201 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200201(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + 201 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier204 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier204(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 204 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier202 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier202(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 202 => false, + _ => true + }; + } + } } } diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/FieldsClient.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/FieldsClient.cs index e727ad17b1358..99a40f76d514f 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/FieldsClient.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/FieldsClient.cs @@ -7,6 +7,8 @@ using System; using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; @@ -17,14 +19,16 @@ namespace Azure.Verticals.AgriFood.Farming /// The Fields service client. public partial class FieldsClient { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of FieldsClient for mocking. protected FieldsClient() @@ -35,6 +39,7 @@ protected FieldsClient() /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. + /// or is null. public FieldsClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) { if (endpoint == null) @@ -47,39 +52,36 @@ public FieldsClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOpt } options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); _tokenCredential = credential; - var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); - _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { authPolicy }, new ResponseClassifier()); - this.endpoint = endpoint; - apiVersion = options.Version; + _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; } - /// Returns a paginated list of field resources under a particular farmer. + /// Gets a specified field resource under a particular farmer. + /// ID of the associated farmer. + /// ID of the field. + /// The request options. + /// or is null. /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// farmId: string, - /// farmerId: string, - /// primaryBoundaryId: string, - /// boundaryIds: [string], - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// farmId: string, + /// farmerId: string, + /// primaryBoundaryId: string, + /// boundaryIds: [string], + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -97,51 +99,16 @@ public FieldsClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOpt /// /// /// - /// ID of the associated farmer. - /// Farm Ids of the resource. - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task ListByFarmerIdAsync(string farmerId, IEnumerable farmIds = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual async Task GetAsync(string farmerId, string fieldId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListByFarmerIdRequest(farmerId, farmIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("FieldsClient.ListByFarmerId"); + using var scope = _clientDiagnostics.CreateScope("FieldsClient.Get"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRequest(farmerId, fieldId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -150,31 +117,28 @@ public virtual async Task ListByFarmerIdAsync(string farmerId, IEnumer } } - /// Returns a paginated list of field resources under a particular farmer. + /// Gets a specified field resource under a particular farmer. + /// ID of the associated farmer. + /// ID of the field. + /// The request options. + /// or is null. /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// farmId: string, - /// farmerId: string, - /// primaryBoundaryId: string, - /// boundaryIds: [string], - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// farmId: string, + /// farmerId: string, + /// primaryBoundaryId: string, + /// boundaryIds: [string], + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -192,51 +156,16 @@ public virtual async Task ListByFarmerIdAsync(string farmerId, IEnumer /// /// /// - /// ID of the associated farmer. - /// Farm Ids of the resource. - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual Response ListByFarmerId(string farmerId, IEnumerable farmIds = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual Response Get(string farmerId, string fieldId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListByFarmerIdRequest(farmerId, farmIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("FieldsClient.ListByFarmerId"); + using var scope = _clientDiagnostics.CreateScope("FieldsClient.Get"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRequest(farmerId, fieldId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -245,91 +174,45 @@ public virtual Response ListByFarmerId(string farmerId, IEnumerable farm } } - private HttpMessage CreateListByFarmerIdRequest(string farmerId, IEnumerable farmIds, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/fields", false); - if (farmIds != null) - { - uri.AppendQueryDelimited("farmIds", farmIds, ",", true); - } - if (ids != null) - { - uri.AppendQueryDelimited("ids", ids, ",", true); - } - if (names != null) - { - uri.AppendQueryDelimited("names", names, ",", true); - } - if (propertyFilters != null) - { - uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); - } - if (statuses != null) - { - uri.AppendQueryDelimited("statuses", statuses, ",", true); - } - if (minCreatedDateTime != null) - { - uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); - } - if (maxCreatedDateTime != null) - { - uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); - } - if (minLastModifiedDateTime != null) - { - uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); - } - if (maxLastModifiedDateTime != null) - { - uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); - } - if (maxPageSize != null) - { - uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Returns a paginated list of field resources across all farmers. + /// Creates or Updates a field resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the field resource. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// + /// Schema for Request Body: + /// { + /// farmId: string, + /// farmerId: string, + /// primaryBoundaryId: string, + /// boundaryIds: [string], + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// farmId: string, - /// farmerId: string, - /// primaryBoundaryId: string, - /// boundaryIds: [string], - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// farmId: string, + /// farmerId: string, + /// primaryBoundaryId: string, + /// boundaryIds: [string], + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -347,50 +230,16 @@ private HttpMessage CreateListByFarmerIdRequest(string farmerId, IEnumerable /// /// - /// Farm Ids of the resource. - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task ListAsync(IEnumerable farmIds = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual async Task CreateOrUpdateAsync(string farmerId, string fieldId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRequest(farmIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("FieldsClient.List"); + using var scope = _clientDiagnostics.CreateScope("FieldsClient.CreateOrUpdate"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, fieldId, content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -399,31 +248,45 @@ public virtual async Task ListAsync(IEnumerable farmIds = null } } - /// Returns a paginated list of field resources across all farmers. + /// Creates or Updates a field resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the field resource. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// + /// Schema for Request Body: + /// { + /// farmId: string, + /// farmerId: string, + /// primaryBoundaryId: string, + /// boundaryIds: [string], + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// farmId: string, - /// farmerId: string, - /// primaryBoundaryId: string, - /// boundaryIds: [string], - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// farmId: string, + /// farmerId: string, + /// primaryBoundaryId: string, + /// boundaryIds: [string], + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -441,50 +304,16 @@ public virtual async Task ListAsync(IEnumerable farmIds = null /// /// /// - /// Farm Ids of the resource. - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual Response List(IEnumerable farmIds = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual Response CreateOrUpdate(string farmerId, string fieldId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRequest(farmIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("FieldsClient.List"); + using var scope = _clientDiagnostics.CreateScope("FieldsClient.CreateOrUpdate"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, fieldId, content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -493,83 +322,12 @@ public virtual Response List(IEnumerable farmIds = null, IEnumerable farmIds, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/fields", false); - if (farmIds != null) - { - uri.AppendQueryDelimited("farmIds", farmIds, ",", true); - } - if (ids != null) - { - uri.AppendQueryDelimited("ids", ids, ",", true); - } - if (names != null) - { - uri.AppendQueryDelimited("names", names, ",", true); - } - if (propertyFilters != null) - { - uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); - } - if (statuses != null) - { - uri.AppendQueryDelimited("statuses", statuses, ",", true); - } - if (minCreatedDateTime != null) - { - uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); - } - if (maxCreatedDateTime != null) - { - uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); - } - if (minLastModifiedDateTime != null) - { - uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); - } - if (maxLastModifiedDateTime != null) - { - uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); - } - if (maxPageSize != null) - { - uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets a specified field resource under a particular farmer. + /// Deletes a specified field resource under a particular farmer. + /// ID of the farmer. + /// ID of the field. + /// The request options. + /// or is null. /// - /// Schema for Response Body: - /// { - /// farmId: string, - /// farmerId: string, - /// primaryBoundaryId: string, - /// boundaryIds: [string], - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// /// Schema for Response Error: /// { /// error: { @@ -587,35 +345,16 @@ private HttpMessage CreateListRequest(IEnumerable farmIds, IEnumerable /// /// - /// ID of the associated farmer. - /// ID of the field. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetAsync(string farmerId, string fieldId, RequestOptions options = null) + public virtual async Task DeleteAsync(string farmerId, string fieldId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRequest(farmerId, fieldId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("FieldsClient.Get"); + using var scope = _clientDiagnostics.CreateScope("FieldsClient.Delete"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(farmerId, fieldId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -624,25 +363,12 @@ public virtual async Task GetAsync(string farmerId, string fieldId, Re } } - /// Gets a specified field resource under a particular farmer. + /// Deletes a specified field resource under a particular farmer. + /// ID of the farmer. + /// ID of the field. + /// The request options. + /// or is null. /// - /// Schema for Response Body: - /// { - /// farmId: string, - /// farmerId: string, - /// primaryBoundaryId: string, - /// boundaryIds: [string], - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// /// Schema for Response Error: /// { /// error: { @@ -660,35 +386,16 @@ public virtual async Task GetAsync(string farmerId, string fieldId, Re /// /// /// - /// ID of the associated farmer. - /// ID of the field. - /// The request options. #pragma warning disable AZC0002 - public virtual Response Get(string farmerId, string fieldId, RequestOptions options = null) + public virtual Response Delete(string farmerId, string fieldId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRequest(farmerId, fieldId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("FieldsClient.Get"); + using var scope = _clientDiagnostics.CreateScope("FieldsClient.Delete"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(farmerId, fieldId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -697,59 +404,29 @@ public virtual Response Get(string farmerId, string fieldId, RequestOptions opti } } - private HttpMessage CreateGetRequest(string farmerId, string fieldId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/fields/", false); - uri.AppendPath(fieldId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Creates or Updates a field resource under a particular farmer. + /// Get a cascade delete job for specified field. + /// ID of the job. + /// The request options. + /// is null. /// - /// Schema for Request Body: - /// { - /// farmId: string, - /// farmerId: string, - /// primaryBoundaryId: string, - /// boundaryIds: [string], - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// /// Schema for Response Body: /// { - /// farmId: string, /// farmerId: string, - /// primaryBoundaryId: string, - /// boundaryIds: [string], + /// resourceId: string, + /// resourceType: string, /// id: string, - /// eTag: string, /// status: string, + /// durationInSeconds: number, + /// message: string, /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), + /// lastActionDateTime: string (ISO 8601 Format), + /// startTime: string (ISO 8601 Format), + /// endTime: string (ISO 8601 Format), /// name: string, /// description: string, /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -767,37 +444,16 @@ private HttpMessage CreateGetRequest(string farmerId, string fieldId) /// /// /// - /// ID of the associated farmer resource. - /// ID of the field resource. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task CreateOrUpdateAsync(string farmerId, string fieldId, RequestContent content, RequestOptions options = null) + public virtual async Task GetCascadeDeleteJobDetailsAsync(string jobId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, fieldId, content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("FieldsClient.CreateOrUpdate"); + using var scope = _clientDiagnostics.CreateScope("FieldsClient.GetCascadeDeleteJobDetails"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -806,42 +462,29 @@ public virtual async Task CreateOrUpdateAsync(string farmerId, string } } - /// Creates or Updates a field resource under a particular farmer. + /// Get a cascade delete job for specified field. + /// ID of the job. + /// The request options. + /// is null. /// - /// Schema for Request Body: + /// Schema for Response Body: /// { - /// farmId: string, - /// farmerId: string, - /// primaryBoundaryId: string, - /// boundaryIds: [string], - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// - /// Schema for Response Body: - /// { - /// farmId: string, /// farmerId: string, - /// primaryBoundaryId: string, - /// boundaryIds: [string], + /// resourceId: string, + /// resourceType: string, /// id: string, - /// eTag: string, /// status: string, + /// durationInSeconds: number, + /// message: string, /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), + /// lastActionDateTime: string (ISO 8601 Format), + /// startTime: string (ISO 8601 Format), + /// endTime: string (ISO 8601 Format), /// name: string, /// description: string, /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -859,37 +502,16 @@ public virtual async Task CreateOrUpdateAsync(string farmerId, string /// /// /// - /// ID of the associated farmer resource. - /// ID of the field resource. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual Response CreateOrUpdate(string farmerId, string fieldId, RequestContent content, RequestOptions options = null) + public virtual Response GetCascadeDeleteJobDetails(string jobId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, fieldId, content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("FieldsClient.CreateOrUpdate"); + using var scope = _clientDiagnostics.CreateScope("FieldsClient.GetCascadeDeleteJobDetails"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -898,27 +520,50 @@ public virtual Response CreateOrUpdate(string farmerId, string fieldId, RequestC } } - private HttpMessage CreateCreateOrUpdateRequest(string farmerId, string fieldId, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/fields/", false); - uri.AppendPath(fieldId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/merge-patch+json"); - request.Content = content; - return message; - } - - /// Deletes a specified field resource under a particular farmer. + /// Returns a paginated list of field resources under a particular farmer. + /// ID of the associated farmer. + /// The request options. + /// Farm Ids of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// is null. /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// farmId: string, + /// farmerId: string, + /// primaryBoundaryId: string, + /// boundaryIds: [string], + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string + /// } + /// /// Schema for Response Error: /// { /// error: { @@ -936,45 +581,74 @@ private HttpMessage CreateCreateOrUpdateRequest(string farmerId, string fieldId, /// /// /// - /// ID of the farmer. - /// ID of the field. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task DeleteAsync(string farmerId, string fieldId, RequestOptions options = null) + public virtual AsyncPageable ListByFarmerIdAsync(string farmerId, RequestOptions options, IEnumerable farmIds = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(farmerId, fieldId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("FieldsClient.Delete"); - scope.Start(); - try + if (farmerId == null) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + throw new ArgumentNullException(nameof(farmerId)); } - catch (Exception e) + + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "FieldsClient.ListByFarmerId"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) { - scope.Failed(e); - throw; + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListByFarmerIdRequest(farmerId, farmIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListByFarmerIdNextPageRequest(nextLink, farmerId, farmIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - /// Deletes a specified field resource under a particular farmer. + /// Returns a paginated list of field resources under a particular farmer. + /// ID of the associated farmer. + /// The request options. + /// Farm Ids of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// is null. /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// farmId: string, + /// farmerId: string, + /// primaryBoundaryId: string, + /// boundaryIds: [string], + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string + /// } + /// /// Schema for Response Error: /// { /// error: { @@ -992,81 +666,72 @@ public virtual async Task DeleteAsync(string farmerId, string fieldId, /// /// /// - /// ID of the farmer. - /// ID of the field. - /// The request options. #pragma warning disable AZC0002 - public virtual Response Delete(string farmerId, string fieldId, RequestOptions options = null) + public virtual Pageable ListByFarmerId(string farmerId, RequestOptions options, IEnumerable farmIds = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(farmerId, fieldId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("FieldsClient.Delete"); - scope.Start(); - try + if (farmerId == null) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + throw new ArgumentNullException(nameof(farmerId)); } - catch (Exception e) + + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "FieldsClient.ListByFarmerId"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) { - scope.Failed(e); - throw; + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListByFarmerIdRequest(farmerId, farmIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListByFarmerIdNextPageRequest(nextLink, farmerId, farmIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - private HttpMessage CreateDeleteRequest(string farmerId, string fieldId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/fields/", false); - uri.AppendPath(fieldId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Get a cascade delete job for specified field. + /// Returns a paginated list of field resources across all farmers. + /// The request options. + /// Farm Ids of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. /// /// Schema for Response Body: /// { - /// farmerId: string, - /// resourceId: string, - /// resourceType: string, - /// id: string, - /// status: string, - /// durationInSeconds: number, - /// message: string, - /// createdDateTime: string (ISO 8601 Format), - /// lastActionDateTime: string (ISO 8601 Format), - /// startTime: string (ISO 8601 Format), - /// endTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// value: [ + /// { + /// farmId: string, + /// farmerId: string, + /// primaryBoundaryId: string, + /// boundaryIds: [string], + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1084,63 +749,67 @@ private HttpMessage CreateDeleteRequest(string farmerId, string fieldId) /// /// /// - /// ID of the job. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetCascadeDeleteJobDetailsAsync(string jobId, RequestOptions options = null) + public virtual AsyncPageable ListAsync(RequestOptions options, IEnumerable farmIds = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("FieldsClient.GetCascadeDeleteJobDetails"); - scope.Start(); - try + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "FieldsClient.List"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else + do { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; + var message = string.IsNullOrEmpty(nextLink) + ? CreateListRequest(farmIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListNextPageRequest(nextLink, farmIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - /// Get a cascade delete job for specified field. + /// Returns a paginated list of field resources across all farmers. + /// The request options. + /// Farm Ids of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. /// /// Schema for Response Body: /// { - /// farmerId: string, - /// resourceId: string, - /// resourceType: string, - /// id: string, - /// status: string, - /// durationInSeconds: number, - /// message: string, - /// createdDateTime: string (ISO 8601 Format), - /// lastActionDateTime: string (ISO 8601 Format), - /// startTime: string (ISO 8601 Format), - /// endTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// value: [ + /// { + /// farmId: string, + /// farmerId: string, + /// primaryBoundaryId: string, + /// boundaryIds: [string], + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1158,58 +827,31 @@ public virtual async Task GetCascadeDeleteJobDetailsAsync(string jobId /// /// /// - /// ID of the job. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetCascadeDeleteJobDetails(string jobId, RequestOptions options = null) + public virtual Pageable List(RequestOptions options, IEnumerable farmIds = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("FieldsClient.GetCascadeDeleteJobDetails"); - scope.Start(); - try + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "FieldsClient.List"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) + do { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + var message = string.IsNullOrEmpty(nextLink) + ? CreateListRequest(farmIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListNextPageRequest(nextLink, farmIds, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - private HttpMessage CreateGetCascadeDeleteJobDetailsRequest(string jobId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/fields/cascade-delete/", false); - uri.AppendPath(jobId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; } /// Create a cascade delete job for specified field. + /// Job ID supplied by end user. + /// ID of the associated farmer. + /// ID of the field to be deleted. + /// The request options. + /// , , or is null. /// /// Schema for Response Body: /// { @@ -1229,7 +871,6 @@ private HttpMessage CreateGetCascadeDeleteJobDetailsRequest(string jobId) /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1247,36 +888,16 @@ private HttpMessage CreateGetCascadeDeleteJobDetailsRequest(string jobId) /// /// /// - /// Job ID supplied by end user. - /// ID of the associated farmer. - /// ID of the field to be deleted. - /// The request options. #pragma warning disable AZC0002 public virtual async Task> CreateCascadeDeleteJobAsync(string jobId, string farmerId, string fieldId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId, fieldId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("FieldsClient.CreateCascadeDeleteJob"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "FieldsClient.CreateCascadeDeleteJob"); - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "FieldsClient.CreateCascadeDeleteJob"); - } + using HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId, fieldId); + return await LowLevelOperationHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, "FieldsClient.CreateCascadeDeleteJob", OperationFinalStateVia.Location, options).ConfigureAwait(false); } catch (Exception e) { @@ -1286,6 +907,11 @@ public virtual async Task> CreateCascadeDeleteJobAsync(str } /// Create a cascade delete job for specified field. + /// Job ID supplied by end user. + /// ID of the associated farmer. + /// ID of the field to be deleted. + /// The request options. + /// , , or is null. /// /// Schema for Response Body: /// { @@ -1305,7 +931,6 @@ public virtual async Task> CreateCascadeDeleteJobAsync(str /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1323,59 +948,344 @@ public virtual async Task> CreateCascadeDeleteJobAsync(str /// /// /// - /// Job ID supplied by end user. - /// ID of the associated farmer. - /// ID of the field to be deleted. - /// The request options. #pragma warning disable AZC0002 public virtual Operation CreateCascadeDeleteJob(string jobId, string farmerId, string fieldId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId, fieldId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("FieldsClient.CreateCascadeDeleteJob"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) + using HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId, fieldId); + return LowLevelOperationHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, "FieldsClient.CreateCascadeDeleteJob", OperationFinalStateVia.Location, options); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + internal HttpMessage CreateListByFarmerIdRequest(string farmerId, IEnumerable farmIds, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/fields", false); + if (farmIds != null) + { + foreach (var param in farmIds) + { + uri.AppendQuery("farmIds", param, true); + } + } + if (ids != null) + { + foreach (var param in ids) { - switch (message.Response.Status) - { - case 202: - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "FieldsClient.CreateCascadeDeleteJob"); - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } + uri.AppendQuery("ids", param, true); } - else + } + if (names != null) + { + foreach (var param in names) { - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "FieldsClient.CreateCascadeDeleteJob"); + uri.AppendQuery("names", param, true); } } - catch (Exception e) + if (propertyFilters != null) { - scope.Failed(e); - throw; + foreach (var param in propertyFilters) + { + uri.AppendQuery("propertyFilters", param, true); + } + } + if (statuses != null) + { + foreach (var param in statuses) + { + uri.AppendQuery("statuses", param, true); + } + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateListRequest(IEnumerable farmIds, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/fields", false); + if (farmIds != null) + { + foreach (var param in farmIds) + { + uri.AppendQuery("farmIds", param, true); + } + } + if (ids != null) + { + foreach (var param in ids) + { + uri.AppendQuery("ids", param, true); + } + } + if (names != null) + { + foreach (var param in names) + { + uri.AppendQuery("names", param, true); + } + } + if (propertyFilters != null) + { + foreach (var param in propertyFilters) + { + uri.AppendQuery("propertyFilters", param, true); + } + } + if (statuses != null) + { + foreach (var param in statuses) + { + uri.AppendQuery("statuses", param, true); + } + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetRequest(string farmerId, string fieldId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/fields/", false); + uri.AppendPath(fieldId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string farmerId, string fieldId, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/fields/", false); + uri.AppendPath(fieldId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/merge-patch+json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200201.Instance; + return message; + } + + internal HttpMessage CreateDeleteRequest(string farmerId, string fieldId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/fields/", false); + uri.AppendPath(fieldId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier204.Instance; + return message; + } + + internal HttpMessage CreateGetCascadeDeleteJobDetailsRequest(string jobId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/fields/cascade-delete/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; } - private HttpMessage CreateCreateCascadeDeleteJobRequest(string jobId, string farmerId, string fieldId) + internal HttpMessage CreateCreateCascadeDeleteJobRequest(string jobId, string farmerId, string fieldId) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); + uri.Reset(_endpoint); uri.AppendPath("/fields/cascade-delete/", false); uri.AppendPath(jobId, true); uri.AppendQuery("farmerId", farmerId, true); uri.AppendQuery("fieldId", fieldId, true); - uri.AppendQuery("api-version", apiVersion, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier202.Instance; + return message; + } + + internal HttpMessage CreateListByFarmerIdNextPageRequest(string nextLink, string farmerId, IEnumerable farmIds, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, IEnumerable farmIds, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; return message; } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier200201 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200201(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + 201 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier204 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier204(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 204 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier202 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier202(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 202 => false, + _ => true + }; + } + } } } diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/HarvestDataClient.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/HarvestDataClient.cs index c44081fb5e63b..b24d57c24cd91 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/HarvestDataClient.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/HarvestDataClient.cs @@ -7,6 +7,8 @@ using System; using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; @@ -17,14 +19,16 @@ namespace Azure.Verticals.AgriFood.Farming /// The HarvestData service client. public partial class HarvestDataClient { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of HarvestDataClient for mocking. protected HarvestDataClient() @@ -35,6 +39,7 @@ protected HarvestDataClient() /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. + /// or is null. public HarvestDataClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) { if (endpoint == null) @@ -47,64 +52,61 @@ public HarvestDataClient(Uri endpoint, TokenCredential credential, FarmBeatsClie } options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); _tokenCredential = credential; - var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); - _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { authPolicy }, new ResponseClassifier()); - this.endpoint = endpoint; - apiVersion = options.Version; + _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; } - /// Returns a paginated list of harvest data resources under a particular farm. + /// Get a specified harvest data resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the harvest data resource. + /// The request options. + /// or is null. /// /// Schema for Response Body: /// { - /// value: [ + /// totalYield: { + /// unit: string, + /// value: number + /// }, + /// avgYield: Measure, + /// totalWetMass: Measure, + /// avgWetMass: Measure, + /// avgMoisture: Measure, + /// avgSpeed: Measure, + /// harvestProductDetails: [ /// { - /// totalYield: { - /// unit: string, - /// value: number - /// }, + /// productName: string, + /// area: Measure, + /// totalYield: Measure, /// avgYield: Measure, - /// totalWetMass: Measure, - /// avgWetMass: Measure, /// avgMoisture: Measure, - /// avgSpeed: Measure, - /// harvestProductDetails: [ - /// { - /// productName: string, - /// area: Measure, - /// totalYield: Measure, - /// avgYield: Measure, - /// avgMoisture: Measure, - /// totalWetMass: Measure, - /// avgWetMass: Measure - /// } - /// ], - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// totalWetMass: Measure, + /// avgWetMass: Measure /// } /// ], - /// $skipToken: string, - /// nextLink: string + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -122,73 +124,16 @@ public HarvestDataClient(Uri endpoint, TokenCredential credential, FarmBeatsClie /// /// /// - /// ID of the associated farmer. - /// Minimum Yield value(inclusive). - /// Maximum Yield value (inclusive). - /// Minimum AvgYield value(inclusive). - /// Maximum AvgYield value (inclusive). - /// Minimum Total WetMass value(inclusive). - /// Maximum Total WetMass value (inclusive). - /// Minimum AvgWetMass value(inclusive). - /// Maximum AvgWetMass value (inclusive). - /// Minimum AvgMoisture value(inclusive). - /// Maximum AvgMoisture value (inclusive). - /// Minimum AvgSpeed value(inclusive). - /// Maximum AvgSpeed value (inclusive). - /// Sources of the operation data. - /// Boundary IDs associated with operation data. - /// Operation boundary IDs associated with operation data. - /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum area for which operation was applied (inclusive). - /// Maximum area for which operation was applied (inclusive). - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task ListByFarmerIdAsync(string farmerId, double? minTotalYield = null, double? maxTotalYield = null, double? minAvgYield = null, double? maxAvgYield = null, double? minTotalWetMass = null, double? maxTotalWetMass = null, double? minAvgWetMass = null, double? maxAvgWetMass = null, double? minAvgMoisture = null, double? maxAvgMoisture = null, double? minAvgSpeed = null, double? maxAvgSpeed = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual async Task GetAsync(string farmerId, string harvestDataId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListByFarmerIdRequest(farmerId, minTotalYield, maxTotalYield, minAvgYield, maxAvgYield, minTotalWetMass, maxTotalWetMass, minAvgWetMass, maxAvgWetMass, minAvgMoisture, maxAvgMoisture, minAvgSpeed, maxAvgSpeed, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("HarvestDataClient.ListByFarmerId"); + using var scope = _clientDiagnostics.CreateScope("HarvestDataClient.Get"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRequest(farmerId, harvestDataId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -197,56 +142,53 @@ public virtual async Task ListByFarmerIdAsync(string farmerId, double? } } - /// Returns a paginated list of harvest data resources under a particular farm. + /// Get a specified harvest data resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the harvest data resource. + /// The request options. + /// or is null. /// /// Schema for Response Body: /// { - /// value: [ + /// totalYield: { + /// unit: string, + /// value: number + /// }, + /// avgYield: Measure, + /// totalWetMass: Measure, + /// avgWetMass: Measure, + /// avgMoisture: Measure, + /// avgSpeed: Measure, + /// harvestProductDetails: [ /// { - /// totalYield: { - /// unit: string, - /// value: number - /// }, + /// productName: string, + /// area: Measure, + /// totalYield: Measure, /// avgYield: Measure, - /// totalWetMass: Measure, - /// avgWetMass: Measure, /// avgMoisture: Measure, - /// avgSpeed: Measure, - /// harvestProductDetails: [ - /// { - /// productName: string, - /// area: Measure, - /// totalYield: Measure, - /// avgYield: Measure, - /// avgMoisture: Measure, - /// totalWetMass: Measure, - /// avgWetMass: Measure - /// } - /// ], - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// totalWetMass: Measure, + /// avgWetMass: Measure /// } /// ], - /// $skipToken: string, - /// nextLink: string + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -264,73 +206,16 @@ public virtual async Task ListByFarmerIdAsync(string farmerId, double? /// /// /// - /// ID of the associated farmer. - /// Minimum Yield value(inclusive). - /// Maximum Yield value (inclusive). - /// Minimum AvgYield value(inclusive). - /// Maximum AvgYield value (inclusive). - /// Minimum Total WetMass value(inclusive). - /// Maximum Total WetMass value (inclusive). - /// Minimum AvgWetMass value(inclusive). - /// Maximum AvgWetMass value (inclusive). - /// Minimum AvgMoisture value(inclusive). - /// Maximum AvgMoisture value (inclusive). - /// Minimum AvgSpeed value(inclusive). - /// Maximum AvgSpeed value (inclusive). - /// Sources of the operation data. - /// Boundary IDs associated with operation data. - /// Operation boundary IDs associated with operation data. - /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum area for which operation was applied (inclusive). - /// Maximum area for which operation was applied (inclusive). - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual Response ListByFarmerId(string farmerId, double? minTotalYield = null, double? maxTotalYield = null, double? minAvgYield = null, double? maxAvgYield = null, double? minTotalWetMass = null, double? maxTotalWetMass = null, double? minAvgWetMass = null, double? maxAvgWetMass = null, double? minAvgMoisture = null, double? maxAvgMoisture = null, double? minAvgSpeed = null, double? maxAvgSpeed = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual Response Get(string farmerId, string harvestDataId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListByFarmerIdRequest(farmerId, minTotalYield, maxTotalYield, minAvgYield, maxAvgYield, minTotalWetMass, maxTotalWetMass, minAvgWetMass, maxAvgWetMass, minAvgMoisture, maxAvgMoisture, minAvgSpeed, maxAvgSpeed, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("HarvestDataClient.ListByFarmerId"); + using var scope = _clientDiagnostics.CreateScope("HarvestDataClient.Get"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRequest(farmerId, harvestDataId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -339,345 +224,95 @@ public virtual Response ListByFarmerId(string farmerId, double? minTotalYield = } } - private HttpMessage CreateListByFarmerIdRequest(string farmerId, double? minTotalYield, double? maxTotalYield, double? minAvgYield, double? maxAvgYield, double? minTotalWetMass, double? maxTotalWetMass, double? minAvgWetMass, double? maxAvgWetMass, double? minAvgMoisture, double? maxAvgMoisture, double? minAvgSpeed, double? maxAvgSpeed, IEnumerable sources, IEnumerable associatedBoundaryIds, IEnumerable operationBoundaryIds, DateTimeOffset? minOperationStartDateTime, DateTimeOffset? maxOperationStartDateTime, DateTimeOffset? minOperationEndDateTime, DateTimeOffset? maxOperationEndDateTime, DateTimeOffset? minOperationModifiedDateTime, DateTimeOffset? maxOperationModifiedDateTime, double? minArea, double? maxArea, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/harvest-data", false); - if (minTotalYield != null) - { - uri.AppendQuery("minTotalYield", minTotalYield.Value, true); - } - if (maxTotalYield != null) - { - uri.AppendQuery("maxTotalYield", maxTotalYield.Value, true); - } - if (minAvgYield != null) - { - uri.AppendQuery("minAvgYield", minAvgYield.Value, true); - } - if (maxAvgYield != null) - { - uri.AppendQuery("maxAvgYield", maxAvgYield.Value, true); - } - if (minTotalWetMass != null) - { - uri.AppendQuery("minTotalWetMass", minTotalWetMass.Value, true); - } - if (maxTotalWetMass != null) - { - uri.AppendQuery("maxTotalWetMass", maxTotalWetMass.Value, true); - } - if (minAvgWetMass != null) - { - uri.AppendQuery("minAvgWetMass", minAvgWetMass.Value, true); - } - if (maxAvgWetMass != null) - { - uri.AppendQuery("maxAvgWetMass", maxAvgWetMass.Value, true); - } - if (minAvgMoisture != null) - { - uri.AppendQuery("minAvgMoisture", minAvgMoisture.Value, true); - } - if (maxAvgMoisture != null) - { - uri.AppendQuery("maxAvgMoisture", maxAvgMoisture.Value, true); - } - if (minAvgSpeed != null) - { - uri.AppendQuery("minAvgSpeed", minAvgSpeed.Value, true); - } - if (maxAvgSpeed != null) - { - uri.AppendQuery("maxAvgSpeed", maxAvgSpeed.Value, true); - } - if (sources != null) - { - uri.AppendQueryDelimited("sources", sources, ",", true); - } - if (associatedBoundaryIds != null) - { - uri.AppendQueryDelimited("associatedBoundaryIds", associatedBoundaryIds, ",", true); - } - if (operationBoundaryIds != null) - { - uri.AppendQueryDelimited("operationBoundaryIds", operationBoundaryIds, ",", true); - } - if (minOperationStartDateTime != null) - { - uri.AppendQuery("minOperationStartDateTime", minOperationStartDateTime.Value, "O", true); - } - if (maxOperationStartDateTime != null) - { - uri.AppendQuery("maxOperationStartDateTime", maxOperationStartDateTime.Value, "O", true); - } - if (minOperationEndDateTime != null) - { - uri.AppendQuery("minOperationEndDateTime", minOperationEndDateTime.Value, "O", true); - } - if (maxOperationEndDateTime != null) - { - uri.AppendQuery("maxOperationEndDateTime", maxOperationEndDateTime.Value, "O", true); - } - if (minOperationModifiedDateTime != null) - { - uri.AppendQuery("minOperationModifiedDateTime", minOperationModifiedDateTime.Value, "O", true); - } - if (maxOperationModifiedDateTime != null) - { - uri.AppendQuery("maxOperationModifiedDateTime", maxOperationModifiedDateTime.Value, "O", true); - } - if (minArea != null) - { - uri.AppendQuery("minArea", minArea.Value, true); - } - if (maxArea != null) - { - uri.AppendQuery("maxArea", maxArea.Value, true); - } - if (ids != null) - { - uri.AppendQueryDelimited("ids", ids, ",", true); - } - if (names != null) - { - uri.AppendQueryDelimited("names", names, ",", true); - } - if (propertyFilters != null) - { - uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); - } - if (statuses != null) - { - uri.AppendQueryDelimited("statuses", statuses, ",", true); - } - if (minCreatedDateTime != null) - { - uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); - } - if (maxCreatedDateTime != null) - { - uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); - } - if (minLastModifiedDateTime != null) - { - uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); - } - if (maxLastModifiedDateTime != null) - { - uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); - } - if (maxPageSize != null) - { - uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Returns a paginated list of harvest data resources across all farmers. + /// Creates or updates harvest data resource under a particular farmer. + /// ID of the farmer. + /// ID of the harvest data resource. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// - /// Schema for Response Body: + /// Schema for Request Body: /// { - /// value: [ + /// totalYield: { + /// unit: string, + /// value: number + /// }, + /// avgYield: Measure, + /// totalWetMass: Measure, + /// avgWetMass: Measure, + /// avgMoisture: Measure, + /// avgSpeed: Measure, + /// harvestProductDetails: [ /// { - /// totalYield: { - /// unit: string, - /// value: number - /// }, + /// productName: string, + /// area: Measure, + /// totalYield: Measure, /// avgYield: Measure, - /// totalWetMass: Measure, - /// avgWetMass: Measure, /// avgMoisture: Measure, - /// avgSpeed: Measure, - /// harvestProductDetails: [ - /// { - /// productName: string, - /// area: Measure, - /// totalYield: Measure, - /// avgYield: Measure, - /// avgMoisture: Measure, - /// totalWetMass: Measure, - /// avgWetMass: Measure - /// } - /// ], - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// totalWetMass: Measure, + /// avgWetMass: Measure /// } /// ], - /// $skipToken: string, - /// nextLink: string - /// } - /// - /// - /// Schema for Response Error: - /// { - /// error: { - /// code: string, - /// message: string, - /// target: string, - /// details: [Error], - /// innererror: { - /// code: string, - /// innererror: InnerError - /// } - /// }, - /// traceId: string + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// - /// - /// Minimum Yield value(inclusive). - /// Maximum Yield value (inclusive). - /// Minimum AvgYield value(inclusive). - /// Maximum AvgYield value (inclusive). - /// Minimum Total WetMass value(inclusive). - /// Maximum Total WetMass value (inclusive). - /// Minimum AvgWetMass value(inclusive). - /// Maximum AvgWetMass value (inclusive). - /// Minimum AvgMoisture value(inclusive). - /// Maximum AvgMoisture value (inclusive). - /// Minimum AvgSpeed value(inclusive). - /// Maximum AvgSpeed value (inclusive). - /// Sources of the operation data. - /// Boundary IDs associated with operation data. - /// Operation boundary IDs associated with operation data. - /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum area for which operation was applied (inclusive). - /// Maximum area for which operation was applied (inclusive). - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. -#pragma warning disable AZC0002 - public virtual async Task ListAsync(double? minTotalYield = null, double? maxTotalYield = null, double? minAvgYield = null, double? maxAvgYield = null, double? minTotalWetMass = null, double? maxTotalWetMass = null, double? minAvgWetMass = null, double? maxAvgWetMass = null, double? minAvgMoisture = null, double? maxAvgMoisture = null, double? minAvgSpeed = null, double? maxAvgSpeed = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) -#pragma warning restore AZC0002 - { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRequest(minTotalYield, maxTotalYield, minAvgYield, maxAvgYield, minTotalWetMass, maxTotalWetMass, minAvgWetMass, maxAvgWetMass, minAvgMoisture, maxAvgMoisture, minAvgSpeed, maxAvgSpeed, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("HarvestDataClient.List"); - scope.Start(); - try - { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Returns a paginated list of harvest data resources across all farmers. - /// /// Schema for Response Body: /// { - /// value: [ + /// totalYield: { + /// unit: string, + /// value: number + /// }, + /// avgYield: Measure, + /// totalWetMass: Measure, + /// avgWetMass: Measure, + /// avgMoisture: Measure, + /// avgSpeed: Measure, + /// harvestProductDetails: [ /// { - /// totalYield: { - /// unit: string, - /// value: number - /// }, + /// productName: string, + /// area: Measure, + /// totalYield: Measure, /// avgYield: Measure, - /// totalWetMass: Measure, - /// avgWetMass: Measure, /// avgMoisture: Measure, - /// avgSpeed: Measure, - /// harvestProductDetails: [ - /// { - /// productName: string, - /// area: Measure, - /// totalYield: Measure, - /// avgYield: Measure, - /// avgMoisture: Measure, - /// totalWetMass: Measure, - /// avgWetMass: Measure - /// } - /// ], - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// totalWetMass: Measure, + /// avgWetMass: Measure /// } /// ], - /// $skipToken: string, - /// nextLink: string + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -695,72 +330,16 @@ public virtual async Task ListAsync(double? minTotalYield = null, doub /// /// /// - /// Minimum Yield value(inclusive). - /// Maximum Yield value (inclusive). - /// Minimum AvgYield value(inclusive). - /// Maximum AvgYield value (inclusive). - /// Minimum Total WetMass value(inclusive). - /// Maximum Total WetMass value (inclusive). - /// Minimum AvgWetMass value(inclusive). - /// Maximum AvgWetMass value (inclusive). - /// Minimum AvgMoisture value(inclusive). - /// Maximum AvgMoisture value (inclusive). - /// Minimum AvgSpeed value(inclusive). - /// Maximum AvgSpeed value (inclusive). - /// Sources of the operation data. - /// Boundary IDs associated with operation data. - /// Operation boundary IDs associated with operation data. - /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum area for which operation was applied (inclusive). - /// Maximum area for which operation was applied (inclusive). - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual Response List(double? minTotalYield = null, double? maxTotalYield = null, double? minAvgYield = null, double? maxAvgYield = null, double? minTotalWetMass = null, double? maxTotalWetMass = null, double? minAvgWetMass = null, double? maxAvgWetMass = null, double? minAvgMoisture = null, double? maxAvgMoisture = null, double? minAvgSpeed = null, double? maxAvgSpeed = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual async Task CreateOrUpdateAsync(string farmerId, string harvestDataId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRequest(minTotalYield, maxTotalYield, minAvgYield, maxAvgYield, minTotalWetMass, maxTotalWetMass, minAvgWetMass, maxAvgWetMass, minAvgMoisture, maxAvgMoisture, minAvgSpeed, maxAvgSpeed, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("HarvestDataClient.List"); + using var scope = _clientDiagnostics.CreateScope("HarvestDataClient.CreateOrUpdate"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, harvestDataId, content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -769,154 +348,54 @@ public virtual Response List(double? minTotalYield = null, double? maxTotalYield } } - private HttpMessage CreateListRequest(double? minTotalYield, double? maxTotalYield, double? minAvgYield, double? maxAvgYield, double? minTotalWetMass, double? maxTotalWetMass, double? minAvgWetMass, double? maxAvgWetMass, double? minAvgMoisture, double? maxAvgMoisture, double? minAvgSpeed, double? maxAvgSpeed, IEnumerable sources, IEnumerable associatedBoundaryIds, IEnumerable operationBoundaryIds, DateTimeOffset? minOperationStartDateTime, DateTimeOffset? maxOperationStartDateTime, DateTimeOffset? minOperationEndDateTime, DateTimeOffset? maxOperationEndDateTime, DateTimeOffset? minOperationModifiedDateTime, DateTimeOffset? maxOperationModifiedDateTime, double? minArea, double? maxArea, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/harvest-data", false); - if (minTotalYield != null) - { - uri.AppendQuery("minTotalYield", minTotalYield.Value, true); - } - if (maxTotalYield != null) - { - uri.AppendQuery("maxTotalYield", maxTotalYield.Value, true); - } - if (minAvgYield != null) - { - uri.AppendQuery("minAvgYield", minAvgYield.Value, true); - } - if (maxAvgYield != null) - { - uri.AppendQuery("maxAvgYield", maxAvgYield.Value, true); - } - if (minTotalWetMass != null) - { - uri.AppendQuery("minTotalWetMass", minTotalWetMass.Value, true); - } - if (maxTotalWetMass != null) - { - uri.AppendQuery("maxTotalWetMass", maxTotalWetMass.Value, true); - } - if (minAvgWetMass != null) - { - uri.AppendQuery("minAvgWetMass", minAvgWetMass.Value, true); - } - if (maxAvgWetMass != null) - { - uri.AppendQuery("maxAvgWetMass", maxAvgWetMass.Value, true); - } - if (minAvgMoisture != null) - { - uri.AppendQuery("minAvgMoisture", minAvgMoisture.Value, true); - } - if (maxAvgMoisture != null) - { - uri.AppendQuery("maxAvgMoisture", maxAvgMoisture.Value, true); - } - if (minAvgSpeed != null) - { - uri.AppendQuery("minAvgSpeed", minAvgSpeed.Value, true); - } - if (maxAvgSpeed != null) - { - uri.AppendQuery("maxAvgSpeed", maxAvgSpeed.Value, true); - } - if (sources != null) - { - uri.AppendQueryDelimited("sources", sources, ",", true); - } - if (associatedBoundaryIds != null) - { - uri.AppendQueryDelimited("associatedBoundaryIds", associatedBoundaryIds, ",", true); - } - if (operationBoundaryIds != null) - { - uri.AppendQueryDelimited("operationBoundaryIds", operationBoundaryIds, ",", true); - } - if (minOperationStartDateTime != null) - { - uri.AppendQuery("minOperationStartDateTime", minOperationStartDateTime.Value, "O", true); - } - if (maxOperationStartDateTime != null) - { - uri.AppendQuery("maxOperationStartDateTime", maxOperationStartDateTime.Value, "O", true); - } - if (minOperationEndDateTime != null) - { - uri.AppendQuery("minOperationEndDateTime", minOperationEndDateTime.Value, "O", true); - } - if (maxOperationEndDateTime != null) - { - uri.AppendQuery("maxOperationEndDateTime", maxOperationEndDateTime.Value, "O", true); - } - if (minOperationModifiedDateTime != null) - { - uri.AppendQuery("minOperationModifiedDateTime", minOperationModifiedDateTime.Value, "O", true); - } - if (maxOperationModifiedDateTime != null) - { - uri.AppendQuery("maxOperationModifiedDateTime", maxOperationModifiedDateTime.Value, "O", true); - } - if (minArea != null) - { - uri.AppendQuery("minArea", minArea.Value, true); - } - if (maxArea != null) - { - uri.AppendQuery("maxArea", maxArea.Value, true); - } - if (ids != null) - { - uri.AppendQueryDelimited("ids", ids, ",", true); - } - if (names != null) - { - uri.AppendQueryDelimited("names", names, ",", true); - } - if (propertyFilters != null) - { - uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); - } - if (statuses != null) - { - uri.AppendQueryDelimited("statuses", statuses, ",", true); - } - if (minCreatedDateTime != null) - { - uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); - } - if (maxCreatedDateTime != null) - { - uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); - } - if (minLastModifiedDateTime != null) - { - uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); - } - if (maxLastModifiedDateTime != null) - { - uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); - } - if (maxPageSize != null) - { - uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Get a specified harvest data resource under a particular farmer. + /// Creates or updates harvest data resource under a particular farmer. + /// ID of the farmer. + /// ID of the harvest data resource. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// + /// Schema for Request Body: + /// { + /// totalYield: { + /// unit: string, + /// value: number + /// }, + /// avgYield: Measure, + /// totalWetMass: Measure, + /// avgWetMass: Measure, + /// avgMoisture: Measure, + /// avgSpeed: Measure, + /// harvestProductDetails: [ + /// { + /// productName: string, + /// area: Measure, + /// totalYield: Measure, + /// avgYield: Measure, + /// avgMoisture: Measure, + /// totalWetMass: Measure, + /// avgWetMass: Measure + /// } + /// ], + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// /// Schema for Response Body: /// { /// totalYield: { @@ -958,7 +437,88 @@ private HttpMessage CreateListRequest(double? minTotalYield, double? maxTotalYie /// properties: Dictionary<string, AnyObject> /// } /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [Error], + /// innererror: { + /// code: string, + /// innererror: InnerError + /// } + /// }, + /// traceId: string + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual Response CreateOrUpdate(string farmerId, string harvestDataId, RequestContent content, RequestOptions options = null) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("HarvestDataClient.CreateOrUpdate"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, harvestDataId, content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a specified harvest data resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the harvest data. + /// The request options. + /// or is null. + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [Error], + /// innererror: { + /// code: string, + /// innererror: InnerError + /// } + /// }, + /// traceId: string + /// } + /// /// + /// +#pragma warning disable AZC0002 + public virtual async Task DeleteAsync(string farmerId, string harvestDataId, RequestOptions options = null) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("HarvestDataClient.Delete"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteRequest(farmerId, harvestDataId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Deletes a specified harvest data resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the harvest data. + /// The request options. + /// or is null. + /// /// Schema for Response Error: /// { /// error: { @@ -976,35 +536,16 @@ private HttpMessage CreateListRequest(double? minTotalYield, double? maxTotalYie /// /// /// - /// ID of the associated farmer resource. - /// ID of the harvest data resource. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetAsync(string farmerId, string harvestDataId, RequestOptions options = null) + public virtual Response Delete(string farmerId, string harvestDataId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRequest(farmerId, harvestDataId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("HarvestDataClient.Get"); + using var scope = _clientDiagnostics.CreateScope("HarvestDataClient.Delete"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(farmerId, harvestDataId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1013,50 +554,97 @@ public virtual async Task GetAsync(string farmerId, string harvestData } } - /// Get a specified harvest data resource under a particular farmer. + /// Returns a paginated list of harvest data resources under a particular farm. + /// ID of the associated farmer. + /// The request options. + /// Minimum Yield value(inclusive). + /// Maximum Yield value (inclusive). + /// Minimum AvgYield value(inclusive). + /// Maximum AvgYield value (inclusive). + /// Minimum Total WetMass value(inclusive). + /// Maximum Total WetMass value (inclusive). + /// Minimum AvgWetMass value(inclusive). + /// Maximum AvgWetMass value (inclusive). + /// Minimum AvgMoisture value(inclusive). + /// Maximum AvgMoisture value (inclusive). + /// Minimum AvgSpeed value(inclusive). + /// Maximum AvgSpeed value (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// is null. /// /// Schema for Response Body: /// { - /// totalYield: { - /// unit: string, - /// value: number - /// }, - /// avgYield: Measure, - /// totalWetMass: Measure, - /// avgWetMass: Measure, - /// avgMoisture: Measure, - /// avgSpeed: Measure, - /// harvestProductDetails: [ + /// value: [ /// { - /// productName: string, - /// area: Measure, - /// totalYield: Measure, + /// totalYield: { + /// unit: string, + /// value: number + /// }, /// avgYield: Measure, - /// avgMoisture: Measure, /// totalWetMass: Measure, - /// avgWetMass: Measure + /// avgWetMass: Measure, + /// avgMoisture: Measure, + /// avgSpeed: Measure, + /// harvestProductDetails: [ + /// { + /// productName: string, + /// area: Measure, + /// totalYield: Measure, + /// avgYield: Measure, + /// avgMoisture: Measure, + /// totalWetMass: Measure, + /// avgWetMass: Measure + /// } + /// ], + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// ], - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// $skipToken: string, + /// nextLink: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1074,146 +662,121 @@ public virtual async Task GetAsync(string farmerId, string harvestData /// /// /// - /// ID of the associated farmer resource. - /// ID of the harvest data resource. - /// The request options. #pragma warning disable AZC0002 - public virtual Response Get(string farmerId, string harvestDataId, RequestOptions options = null) + public virtual AsyncPageable ListByFarmerIdAsync(string farmerId, RequestOptions options, double? minTotalYield = null, double? maxTotalYield = null, double? minAvgYield = null, double? maxAvgYield = null, double? minTotalWetMass = null, double? maxTotalWetMass = null, double? minAvgWetMass = null, double? maxAvgWetMass = null, double? minAvgMoisture = null, double? maxAvgMoisture = null, double? minAvgSpeed = null, double? maxAvgSpeed = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRequest(farmerId, harvestDataId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("HarvestDataClient.Get"); - scope.Start(); - try + if (farmerId == null) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + throw new ArgumentNullException(nameof(farmerId)); } - catch (Exception e) + + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "HarvestDataClient.ListByFarmerId"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) { - scope.Failed(e); - throw; + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListByFarmerIdRequest(farmerId, minTotalYield, maxTotalYield, minAvgYield, maxAvgYield, minTotalWetMass, maxTotalWetMass, minAvgWetMass, maxAvgWetMass, minAvgMoisture, maxAvgMoisture, minAvgSpeed, maxAvgSpeed, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListByFarmerIdNextPageRequest(nextLink, farmerId, minTotalYield, maxTotalYield, minAvgYield, maxAvgYield, minTotalWetMass, maxTotalWetMass, minAvgWetMass, maxAvgWetMass, minAvgMoisture, maxAvgMoisture, minAvgSpeed, maxAvgSpeed, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - private HttpMessage CreateGetRequest(string farmerId, string harvestDataId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/harvest-data/", false); - uri.AppendPath(harvestDataId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Creates or updates harvest data resource under a particular farmer. + /// Returns a paginated list of harvest data resources under a particular farm. + /// ID of the associated farmer. + /// The request options. + /// Minimum Yield value(inclusive). + /// Maximum Yield value (inclusive). + /// Minimum AvgYield value(inclusive). + /// Maximum AvgYield value (inclusive). + /// Minimum Total WetMass value(inclusive). + /// Maximum Total WetMass value (inclusive). + /// Minimum AvgWetMass value(inclusive). + /// Maximum AvgWetMass value (inclusive). + /// Minimum AvgMoisture value(inclusive). + /// Maximum AvgMoisture value (inclusive). + /// Minimum AvgSpeed value(inclusive). + /// Maximum AvgSpeed value (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// is null. /// - /// Schema for Request Body: - /// { - /// totalYield: { - /// unit: string, - /// value: number - /// }, - /// avgYield: Measure, - /// totalWetMass: Measure, - /// avgWetMass: Measure, - /// avgMoisture: Measure, - /// avgSpeed: Measure, - /// harvestProductDetails: [ - /// { - /// productName: string, - /// area: Measure, - /// totalYield: Measure, - /// avgYield: Measure, - /// avgMoisture: Measure, - /// totalWetMass: Measure, - /// avgWetMass: Measure - /// } - /// ], - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// /// Schema for Response Body: /// { - /// totalYield: { - /// unit: string, - /// value: number - /// }, - /// avgYield: Measure, - /// totalWetMass: Measure, - /// avgWetMass: Measure, - /// avgMoisture: Measure, - /// avgSpeed: Measure, - /// harvestProductDetails: [ + /// value: [ /// { - /// productName: string, - /// area: Measure, - /// totalYield: Measure, + /// totalYield: { + /// unit: string, + /// value: number + /// }, /// avgYield: Measure, - /// avgMoisture: Measure, /// totalWetMass: Measure, - /// avgWetMass: Measure + /// avgWetMass: Measure, + /// avgMoisture: Measure, + /// avgSpeed: Measure, + /// harvestProductDetails: [ + /// { + /// productName: string, + /// area: Measure, + /// totalYield: Measure, + /// avgYield: Measure, + /// avgMoisture: Measure, + /// totalWetMass: Measure, + /// avgWetMass: Measure + /// } + /// ], + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// ], - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// $skipToken: string, + /// nextLink: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1231,131 +794,244 @@ private HttpMessage CreateGetRequest(string farmerId, string harvestDataId) /// /// /// - /// ID of the farmer. - /// ID of the harvest data resource. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task CreateOrUpdateAsync(string farmerId, string harvestDataId, RequestContent content, RequestOptions options = null) + public virtual Pageable ListByFarmerId(string farmerId, RequestOptions options, double? minTotalYield = null, double? maxTotalYield = null, double? minAvgYield = null, double? maxAvgYield = null, double? minTotalWetMass = null, double? maxTotalWetMass = null, double? minAvgWetMass = null, double? maxAvgWetMass = null, double? minAvgMoisture = null, double? maxAvgMoisture = null, double? minAvgSpeed = null, double? maxAvgSpeed = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, harvestDataId, content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("HarvestDataClient.CreateOrUpdate"); - scope.Start(); - try + if (farmerId == null) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + throw new ArgumentNullException(nameof(farmerId)); } - catch (Exception e) + + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "HarvestDataClient.ListByFarmerId"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) { - scope.Failed(e); - throw; + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListByFarmerIdRequest(farmerId, minTotalYield, maxTotalYield, minAvgYield, maxAvgYield, minTotalWetMass, maxTotalWetMass, minAvgWetMass, maxAvgWetMass, minAvgMoisture, maxAvgMoisture, minAvgSpeed, maxAvgSpeed, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListByFarmerIdNextPageRequest(nextLink, farmerId, minTotalYield, maxTotalYield, minAvgYield, maxAvgYield, minTotalWetMass, maxTotalWetMass, minAvgWetMass, maxAvgWetMass, minAvgMoisture, maxAvgMoisture, minAvgSpeed, maxAvgSpeed, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - /// Creates or updates harvest data resource under a particular farmer. + /// Returns a paginated list of harvest data resources across all farmers. + /// The request options. + /// Minimum Yield value(inclusive). + /// Maximum Yield value (inclusive). + /// Minimum AvgYield value(inclusive). + /// Maximum AvgYield value (inclusive). + /// Minimum Total WetMass value(inclusive). + /// Maximum Total WetMass value (inclusive). + /// Minimum AvgWetMass value(inclusive). + /// Maximum AvgWetMass value (inclusive). + /// Minimum AvgMoisture value(inclusive). + /// Maximum AvgMoisture value (inclusive). + /// Minimum AvgSpeed value(inclusive). + /// Maximum AvgSpeed value (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. /// - /// Schema for Request Body: + /// Schema for Response Body: /// { - /// totalYield: { - /// unit: string, - /// value: number - /// }, - /// avgYield: Measure, - /// totalWetMass: Measure, - /// avgWetMass: Measure, - /// avgMoisture: Measure, - /// avgSpeed: Measure, - /// harvestProductDetails: [ + /// value: [ /// { - /// productName: string, - /// area: Measure, - /// totalYield: Measure, + /// totalYield: { + /// unit: string, + /// value: number + /// }, /// avgYield: Measure, - /// avgMoisture: Measure, /// totalWetMass: Measure, - /// avgWetMass: Measure + /// avgWetMass: Measure, + /// avgMoisture: Measure, + /// avgSpeed: Measure, + /// harvestProductDetails: [ + /// { + /// productName: string, + /// area: Measure, + /// totalYield: Measure, + /// avgYield: Measure, + /// avgMoisture: Measure, + /// totalWetMass: Measure, + /// avgWetMass: Measure + /// } + /// ], + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// ], - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// $skipToken: string, + /// nextLink: string + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [Error], + /// innererror: { + /// code: string, + /// innererror: InnerError + /// } + /// }, + /// traceId: string /// } /// /// + /// +#pragma warning disable AZC0002 + public virtual AsyncPageable ListAsync(RequestOptions options, double? minTotalYield = null, double? maxTotalYield = null, double? minAvgYield = null, double? maxAvgYield = null, double? minTotalWetMass = null, double? maxTotalWetMass = null, double? minAvgWetMass = null, double? maxAvgWetMass = null, double? minAvgMoisture = null, double? maxAvgMoisture = null, double? minAvgSpeed = null, double? maxAvgSpeed = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) +#pragma warning restore AZC0002 + { + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "HarvestDataClient.List"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListRequest(minTotalYield, maxTotalYield, minAvgYield, maxAvgYield, minTotalWetMass, maxTotalWetMass, minAvgWetMass, maxAvgWetMass, minAvgMoisture, maxAvgMoisture, minAvgSpeed, maxAvgSpeed, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListNextPageRequest(nextLink, minTotalYield, maxTotalYield, minAvgYield, maxAvgYield, minTotalWetMass, maxTotalWetMass, minAvgWetMass, maxAvgWetMass, minAvgMoisture, maxAvgMoisture, minAvgSpeed, maxAvgSpeed, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + /// Returns a paginated list of harvest data resources across all farmers. + /// The request options. + /// Minimum Yield value(inclusive). + /// Maximum Yield value (inclusive). + /// Minimum AvgYield value(inclusive). + /// Maximum AvgYield value (inclusive). + /// Minimum Total WetMass value(inclusive). + /// Maximum Total WetMass value (inclusive). + /// Minimum AvgWetMass value(inclusive). + /// Maximum AvgWetMass value (inclusive). + /// Minimum AvgMoisture value(inclusive). + /// Maximum AvgMoisture value (inclusive). + /// Minimum AvgSpeed value(inclusive). + /// Maximum AvgSpeed value (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// /// Schema for Response Body: /// { - /// totalYield: { - /// unit: string, - /// value: number - /// }, - /// avgYield: Measure, - /// totalWetMass: Measure, - /// avgWetMass: Measure, - /// avgMoisture: Measure, - /// avgSpeed: Measure, - /// harvestProductDetails: [ + /// value: [ /// { - /// productName: string, - /// area: Measure, - /// totalYield: Measure, + /// totalYield: { + /// unit: string, + /// value: number + /// }, /// avgYield: Measure, - /// avgMoisture: Measure, /// totalWetMass: Measure, - /// avgWetMass: Measure + /// avgWetMass: Measure, + /// avgMoisture: Measure, + /// avgSpeed: Measure, + /// harvestProductDetails: [ + /// { + /// productName: string, + /// area: Measure, + /// totalYield: Measure, + /// avgYield: Measure, + /// avgMoisture: Measure, + /// totalWetMass: Measure, + /// avgWetMass: Measure + /// } + /// ], + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// ], - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// $skipToken: string, + /// nextLink: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1373,191 +1049,486 @@ public virtual async Task CreateOrUpdateAsync(string farmerId, string /// /// /// - /// ID of the farmer. - /// ID of the harvest data resource. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual Response CreateOrUpdate(string farmerId, string harvestDataId, RequestContent content, RequestOptions options = null) + public virtual Pageable List(RequestOptions options, double? minTotalYield = null, double? maxTotalYield = null, double? minAvgYield = null, double? maxAvgYield = null, double? minTotalWetMass = null, double? maxTotalWetMass = null, double? minAvgWetMass = null, double? maxAvgWetMass = null, double? minAvgMoisture = null, double? maxAvgMoisture = null, double? minAvgSpeed = null, double? maxAvgSpeed = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, harvestDataId, content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("HarvestDataClient.CreateOrUpdate"); - scope.Start(); - try + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "HarvestDataClient.List"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListRequest(minTotalYield, maxTotalYield, minAvgYield, maxAvgYield, minTotalWetMass, maxTotalWetMass, minAvgWetMass, maxAvgWetMass, minAvgMoisture, maxAvgMoisture, minAvgSpeed, maxAvgSpeed, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListNextPageRequest(nextLink, minTotalYield, maxTotalYield, minAvgYield, maxAvgYield, minTotalWetMass, maxTotalWetMass, minAvgWetMass, maxAvgWetMass, minAvgMoisture, maxAvgMoisture, minAvgSpeed, maxAvgSpeed, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + internal HttpMessage CreateListByFarmerIdRequest(string farmerId, double? minTotalYield, double? maxTotalYield, double? minAvgYield, double? maxAvgYield, double? minTotalWetMass, double? maxTotalWetMass, double? minAvgWetMass, double? maxAvgWetMass, double? minAvgMoisture, double? maxAvgMoisture, double? minAvgSpeed, double? maxAvgSpeed, IEnumerable sources, IEnumerable associatedBoundaryIds, IEnumerable operationBoundaryIds, DateTimeOffset? minOperationStartDateTime, DateTimeOffset? maxOperationStartDateTime, DateTimeOffset? minOperationEndDateTime, DateTimeOffset? maxOperationEndDateTime, DateTimeOffset? minOperationModifiedDateTime, DateTimeOffset? maxOperationModifiedDateTime, double? minArea, double? maxArea, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/harvest-data", false); + if (minTotalYield != null) + { + uri.AppendQuery("minTotalYield", minTotalYield.Value, true); + } + if (maxTotalYield != null) + { + uri.AppendQuery("maxTotalYield", maxTotalYield.Value, true); + } + if (minAvgYield != null) + { + uri.AppendQuery("minAvgYield", minAvgYield.Value, true); + } + if (maxAvgYield != null) + { + uri.AppendQuery("maxAvgYield", maxAvgYield.Value, true); + } + if (minTotalWetMass != null) + { + uri.AppendQuery("minTotalWetMass", minTotalWetMass.Value, true); + } + if (maxTotalWetMass != null) + { + uri.AppendQuery("maxTotalWetMass", maxTotalWetMass.Value, true); + } + if (minAvgWetMass != null) + { + uri.AppendQuery("minAvgWetMass", minAvgWetMass.Value, true); + } + if (maxAvgWetMass != null) + { + uri.AppendQuery("maxAvgWetMass", maxAvgWetMass.Value, true); + } + if (minAvgMoisture != null) + { + uri.AppendQuery("minAvgMoisture", minAvgMoisture.Value, true); + } + if (maxAvgMoisture != null) + { + uri.AppendQuery("maxAvgMoisture", maxAvgMoisture.Value, true); + } + if (minAvgSpeed != null) + { + uri.AppendQuery("minAvgSpeed", minAvgSpeed.Value, true); + } + if (maxAvgSpeed != null) + { + uri.AppendQuery("maxAvgSpeed", maxAvgSpeed.Value, true); + } + if (sources != null) + { + foreach (var param in sources) + { + uri.AppendQuery("sources", param, true); + } + } + if (associatedBoundaryIds != null) + { + foreach (var param in associatedBoundaryIds) + { + uri.AppendQuery("associatedBoundaryIds", param, true); + } + } + if (operationBoundaryIds != null) + { + foreach (var param in operationBoundaryIds) + { + uri.AppendQuery("operationBoundaryIds", param, true); + } + } + if (minOperationStartDateTime != null) + { + uri.AppendQuery("minOperationStartDateTime", minOperationStartDateTime.Value, "O", true); + } + if (maxOperationStartDateTime != null) + { + uri.AppendQuery("maxOperationStartDateTime", maxOperationStartDateTime.Value, "O", true); + } + if (minOperationEndDateTime != null) + { + uri.AppendQuery("minOperationEndDateTime", minOperationEndDateTime.Value, "O", true); + } + if (maxOperationEndDateTime != null) + { + uri.AppendQuery("maxOperationEndDateTime", maxOperationEndDateTime.Value, "O", true); + } + if (minOperationModifiedDateTime != null) + { + uri.AppendQuery("minOperationModifiedDateTime", minOperationModifiedDateTime.Value, "O", true); + } + if (maxOperationModifiedDateTime != null) + { + uri.AppendQuery("maxOperationModifiedDateTime", maxOperationModifiedDateTime.Value, "O", true); + } + if (minArea != null) + { + uri.AppendQuery("minArea", minArea.Value, true); + } + if (maxArea != null) + { + uri.AppendQuery("maxArea", maxArea.Value, true); + } + if (ids != null) + { + foreach (var param in ids) + { + uri.AppendQuery("ids", param, true); + } + } + if (names != null) + { + foreach (var param in names) + { + uri.AppendQuery("names", param, true); + } + } + if (propertyFilters != null) + { + foreach (var param in propertyFilters) + { + uri.AppendQuery("propertyFilters", param, true); + } + } + if (statuses != null) + { + foreach (var param in statuses) + { + uri.AppendQuery("statuses", param, true); + } + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateListRequest(double? minTotalYield, double? maxTotalYield, double? minAvgYield, double? maxAvgYield, double? minTotalWetMass, double? maxTotalWetMass, double? minAvgWetMass, double? maxAvgWetMass, double? minAvgMoisture, double? maxAvgMoisture, double? minAvgSpeed, double? maxAvgSpeed, IEnumerable sources, IEnumerable associatedBoundaryIds, IEnumerable operationBoundaryIds, DateTimeOffset? minOperationStartDateTime, DateTimeOffset? maxOperationStartDateTime, DateTimeOffset? minOperationEndDateTime, DateTimeOffset? maxOperationEndDateTime, DateTimeOffset? minOperationModifiedDateTime, DateTimeOffset? maxOperationModifiedDateTime, double? minArea, double? maxArea, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/harvest-data", false); + if (minTotalYield != null) + { + uri.AppendQuery("minTotalYield", minTotalYield.Value, true); + } + if (maxTotalYield != null) + { + uri.AppendQuery("maxTotalYield", maxTotalYield.Value, true); + } + if (minAvgYield != null) + { + uri.AppendQuery("minAvgYield", minAvgYield.Value, true); + } + if (maxAvgYield != null) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) + uri.AppendQuery("maxAvgYield", maxAvgYield.Value, true); + } + if (minTotalWetMass != null) + { + uri.AppendQuery("minTotalWetMass", minTotalWetMass.Value, true); + } + if (maxTotalWetMass != null) + { + uri.AppendQuery("maxTotalWetMass", maxTotalWetMass.Value, true); + } + if (minAvgWetMass != null) + { + uri.AppendQuery("minAvgWetMass", minAvgWetMass.Value, true); + } + if (maxAvgWetMass != null) + { + uri.AppendQuery("maxAvgWetMass", maxAvgWetMass.Value, true); + } + if (minAvgMoisture != null) + { + uri.AppendQuery("minAvgMoisture", minAvgMoisture.Value, true); + } + if (maxAvgMoisture != null) + { + uri.AppendQuery("maxAvgMoisture", maxAvgMoisture.Value, true); + } + if (minAvgSpeed != null) + { + uri.AppendQuery("minAvgSpeed", minAvgSpeed.Value, true); + } + if (maxAvgSpeed != null) + { + uri.AppendQuery("maxAvgSpeed", maxAvgSpeed.Value, true); + } + if (sources != null) + { + foreach (var param in sources) { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } + uri.AppendQuery("sources", param, true); } - else + } + if (associatedBoundaryIds != null) + { + foreach (var param in associatedBoundaryIds) { - return message.Response; + uri.AppendQuery("associatedBoundaryIds", param, true); } } - catch (Exception e) + if (operationBoundaryIds != null) { - scope.Failed(e); - throw; + foreach (var param in operationBoundaryIds) + { + uri.AppendQuery("operationBoundaryIds", param, true); + } + } + if (minOperationStartDateTime != null) + { + uri.AppendQuery("minOperationStartDateTime", minOperationStartDateTime.Value, "O", true); + } + if (maxOperationStartDateTime != null) + { + uri.AppendQuery("maxOperationStartDateTime", maxOperationStartDateTime.Value, "O", true); + } + if (minOperationEndDateTime != null) + { + uri.AppendQuery("minOperationEndDateTime", minOperationEndDateTime.Value, "O", true); + } + if (maxOperationEndDateTime != null) + { + uri.AppendQuery("maxOperationEndDateTime", maxOperationEndDateTime.Value, "O", true); + } + if (minOperationModifiedDateTime != null) + { + uri.AppendQuery("minOperationModifiedDateTime", minOperationModifiedDateTime.Value, "O", true); + } + if (maxOperationModifiedDateTime != null) + { + uri.AppendQuery("maxOperationModifiedDateTime", maxOperationModifiedDateTime.Value, "O", true); + } + if (minArea != null) + { + uri.AppendQuery("minArea", minArea.Value, true); + } + if (maxArea != null) + { + uri.AppendQuery("maxArea", maxArea.Value, true); + } + if (ids != null) + { + foreach (var param in ids) + { + uri.AppendQuery("ids", param, true); + } + } + if (names != null) + { + foreach (var param in names) + { + uri.AppendQuery("names", param, true); + } + } + if (propertyFilters != null) + { + foreach (var param in propertyFilters) + { + uri.AppendQuery("propertyFilters", param, true); + } + } + if (statuses != null) + { + foreach (var param in statuses) + { + uri.AppendQuery("statuses", param, true); + } + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetRequest(string farmerId, string harvestDataId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/harvest-data/", false); + uri.AppendPath(harvestDataId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; } - private HttpMessage CreateCreateOrUpdateRequest(string farmerId, string harvestDataId, RequestContent content) + internal HttpMessage CreateCreateOrUpdateRequest(string farmerId, string harvestDataId, RequestContent content) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Patch; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); + uri.Reset(_endpoint); uri.AppendPath("/farmers/", false); uri.AppendPath(farmerId, true); uri.AppendPath("/harvest-data/", false); uri.AppendPath(harvestDataId, true); - uri.AppendQuery("api-version", apiVersion, true); + uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); request.Headers.Add("Content-Type", "application/merge-patch+json"); request.Content = content; + message.ResponseClassifier = ResponseClassifier200201.Instance; return message; } - /// Deletes a specified harvest data resource under a particular farmer. - /// - /// Schema for Response Error: - /// { - /// error: { - /// code: string, - /// message: string, - /// target: string, - /// details: [Error], - /// innererror: { - /// code: string, - /// innererror: InnerError - /// } - /// }, - /// traceId: string - /// } - /// - /// - /// - /// ID of the associated farmer resource. - /// ID of the harvest data. - /// The request options. -#pragma warning disable AZC0002 - public virtual async Task DeleteAsync(string farmerId, string harvestDataId, RequestOptions options = null) -#pragma warning restore AZC0002 + internal HttpMessage CreateDeleteRequest(string farmerId, string harvestDataId) { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(farmerId, harvestDataId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("HarvestDataClient.Delete"); - scope.Start(); - try - { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/harvest-data/", false); + uri.AppendPath(harvestDataId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier204.Instance; + return message; } - /// Deletes a specified harvest data resource under a particular farmer. - /// - /// Schema for Response Error: - /// { - /// error: { - /// code: string, - /// message: string, - /// target: string, - /// details: [Error], - /// innererror: { - /// code: string, - /// innererror: InnerError - /// } - /// }, - /// traceId: string - /// } - /// - /// - /// - /// ID of the associated farmer resource. - /// ID of the harvest data. - /// The request options. -#pragma warning disable AZC0002 - public virtual Response Delete(string farmerId, string harvestDataId, RequestOptions options = null) -#pragma warning restore AZC0002 + internal HttpMessage CreateListByFarmerIdNextPageRequest(string nextLink, string farmerId, double? minTotalYield, double? maxTotalYield, double? minAvgYield, double? maxAvgYield, double? minTotalWetMass, double? maxTotalWetMass, double? minAvgWetMass, double? maxAvgWetMass, double? minAvgMoisture, double? maxAvgMoisture, double? minAvgSpeed, double? maxAvgSpeed, IEnumerable sources, IEnumerable associatedBoundaryIds, IEnumerable operationBoundaryIds, DateTimeOffset? minOperationStartDateTime, DateTimeOffset? maxOperationStartDateTime, DateTimeOffset? minOperationEndDateTime, DateTimeOffset? maxOperationEndDateTime, DateTimeOffset? minOperationModifiedDateTime, DateTimeOffset? maxOperationModifiedDateTime, double? minArea, double? maxArea, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(farmerId, harvestDataId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("HarvestDataClient.Delete"); - scope.Start(); - try - { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; } - private HttpMessage CreateDeleteRequest(string farmerId, string harvestDataId) + internal HttpMessage CreateListNextPageRequest(string nextLink, double? minTotalYield, double? maxTotalYield, double? minAvgYield, double? maxAvgYield, double? minTotalWetMass, double? maxTotalWetMass, double? minAvgWetMass, double? maxAvgWetMass, double? minAvgMoisture, double? maxAvgMoisture, double? minAvgSpeed, double? maxAvgSpeed, IEnumerable sources, IEnumerable associatedBoundaryIds, IEnumerable operationBoundaryIds, DateTimeOffset? minOperationStartDateTime, DateTimeOffset? maxOperationStartDateTime, DateTimeOffset? minOperationEndDateTime, DateTimeOffset? maxOperationEndDateTime, DateTimeOffset? minOperationModifiedDateTime, DateTimeOffset? maxOperationModifiedDateTime, double? minArea, double? maxArea, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Delete; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/harvest-data/", false); - uri.AppendPath(harvestDataId, true); - uri.AppendQuery("api-version", apiVersion, true); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; return message; } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier200201 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200201(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + 201 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier204 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier204(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 204 => false, + _ => true + }; + } + } } } diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/ImageProcessingClient.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/ImageProcessingClient.cs index e650889c9d2a4..e68c159db6e93 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/ImageProcessingClient.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/ImageProcessingClient.cs @@ -16,14 +16,16 @@ namespace Azure.Verticals.AgriFood.Farming /// The ImageProcessing service client. public partial class ImageProcessingClient { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of ImageProcessingClient for mocking. protected ImageProcessingClient() @@ -34,6 +36,7 @@ protected ImageProcessingClient() /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. + /// or is null. public ImageProcessingClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) { if (endpoint == null) @@ -46,21 +49,24 @@ public ImageProcessingClient(Uri endpoint, TokenCredential credential, FarmBeats } options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); _tokenCredential = credential; - var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); - _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { authPolicy }, new ResponseClassifier()); - this.endpoint = endpoint; - apiVersion = options.Version; + _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; } - /// Create a ImageProcessing Rasterize job. + /// Get ImageProcessing Rasterize job's details. + /// ID of the job. + /// The request options. + /// is null. /// - /// Schema for Request Body: + /// Schema for Response Body: /// { - /// farmerId: string (required), - /// shapefileAttachmentId: string (required), - /// shapefileColumnNames: [string] (required), + /// farmerId: string, + /// shapefileAttachmentId: string, + /// shapefileColumnNames: [string], /// id: string, /// status: string, /// durationInSeconds: number, @@ -75,6 +81,30 @@ public ImageProcessingClient(Uri endpoint, TokenCredential credential, FarmBeats /// } /// /// + /// +#pragma warning disable AZC0002 + public virtual async Task GetRasterizeJobAsync(string jobId, RequestOptions options) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("ImageProcessingClient.GetRasterizeJob"); + scope.Start(); + try + { + using HttpMessage message = CreateGetRasterizeJobRequest(jobId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get ImageProcessing Rasterize job's details. + /// ID of the job. + /// The request options. + /// is null. + /// /// Schema for Response Body: /// { /// farmerId: string, @@ -95,35 +125,16 @@ public ImageProcessingClient(Uri endpoint, TokenCredential credential, FarmBeats /// /// /// - /// JobId provided by user. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task> CreateRasterizeJobAsync(string jobId, RequestContent content, RequestOptions options = null) + public virtual Response GetRasterizeJob(string jobId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateRasterizeJobRequest(jobId, content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("ImageProcessingClient.CreateRasterizeJob"); + using var scope = _clientDiagnostics.CreateScope("ImageProcessingClient.GetRasterizeJob"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "ImageProcessingClient.CreateRasterizeJob"); - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "ImageProcessingClient.CreateRasterizeJob"); - } + using HttpMessage message = CreateGetRasterizeJobRequest(jobId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -133,6 +144,10 @@ public virtual async Task> CreateRasterizeJobAsync(string } /// Create a ImageProcessing Rasterize job. + /// JobId provided by user. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -152,7 +167,6 @@ public virtual async Task> CreateRasterizeJobAsync(string /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Body: /// { /// farmerId: string, @@ -173,35 +187,16 @@ public virtual async Task> CreateRasterizeJobAsync(string /// /// /// - /// JobId provided by user. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual Operation CreateRasterizeJob(string jobId, RequestContent content, RequestOptions options = null) + public virtual async Task> CreateRasterizeJobAsync(string jobId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateRasterizeJobRequest(jobId, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("ImageProcessingClient.CreateRasterizeJob"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "ImageProcessingClient.CreateRasterizeJob"); - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "ImageProcessingClient.CreateRasterizeJob"); - } + using HttpMessage message = CreateCreateRasterizeJobRequest(jobId, content); + return await LowLevelOperationHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, "ImageProcessingClient.CreateRasterizeJob", OperationFinalStateVia.Location, options).ConfigureAwait(false); } catch (Exception e) { @@ -210,30 +205,17 @@ public virtual Operation CreateRasterizeJob(string jobId, RequestCon } } - private HttpMessage CreateCreateRasterizeJobRequest(string jobId, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/image-processing/rasterize/", false); - uri.AppendPath(jobId, 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; - } - - /// Get ImageProcessing Rasterize job's details. + /// Create a ImageProcessing Rasterize job. + /// JobId provided by user. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// - /// Schema for Response Body: + /// Schema for Request Body: /// { - /// farmerId: string, - /// shapefileAttachmentId: string, - /// shapefileColumnNames: [string], + /// farmerId: string (required), + /// shapefileAttachmentId: string (required), + /// shapefileColumnNames: [string] (required), /// id: string, /// status: string, /// durationInSeconds: number, @@ -247,46 +229,6 @@ private HttpMessage CreateCreateRasterizeJobRequest(string jobId, RequestContent /// properties: Dictionary<string, AnyObject> /// } /// - /// - /// - /// ID of the job. - /// The request options. -#pragma warning disable AZC0002 - public virtual async Task GetRasterizeJobAsync(string jobId, RequestOptions options = null) -#pragma warning restore AZC0002 - { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRasterizeJobRequest(jobId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("ImageProcessingClient.GetRasterizeJob"); - scope.Start(); - try - { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get ImageProcessing Rasterize job's details. - /// /// Schema for Response Body: /// { /// farmerId: string, @@ -307,34 +249,16 @@ public virtual async Task GetRasterizeJobAsync(string jobId, RequestOp /// /// /// - /// ID of the job. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetRasterizeJob(string jobId, RequestOptions options = null) + public virtual Operation CreateRasterizeJob(string jobId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRasterizeJobRequest(jobId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("ImageProcessingClient.GetRasterizeJob"); + using var scope = _clientDiagnostics.CreateScope("ImageProcessingClient.CreateRasterizeJob"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateRasterizeJobRequest(jobId, content); + return LowLevelOperationHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, "ImageProcessingClient.CreateRasterizeJob", OperationFinalStateVia.Location, options); } catch (Exception e) { @@ -343,19 +267,65 @@ public virtual Response GetRasterizeJob(string jobId, RequestOptions options = n } } - private HttpMessage CreateGetRasterizeJobRequest(string jobId) + internal HttpMessage CreateCreateRasterizeJobRequest(string jobId, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/image-processing/rasterize/", false); + uri.AppendPath(jobId, 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; + message.ResponseClassifier = ResponseClassifier202.Instance; + return message; + } + + internal HttpMessage CreateGetRasterizeJobRequest(string jobId) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); + uri.Reset(_endpoint); uri.AppendPath("/image-processing/rasterize/", false); uri.AppendPath(jobId, true); - uri.AppendQuery("api-version", apiVersion, true); + uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; return message; } + + private sealed class ResponseClassifier202 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier202(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 202 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } } } diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/OAuthProvidersClient.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/OAuthProvidersClient.cs index 82f73d8dc45d5..4cff9cdd708c2 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/OAuthProvidersClient.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/OAuthProvidersClient.cs @@ -7,6 +7,8 @@ using System; using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; @@ -17,14 +19,16 @@ namespace Azure.Verticals.AgriFood.Farming /// The OAuthProviders service client. public partial class OAuthProvidersClient { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of OAuthProvidersClient for mocking. protected OAuthProvidersClient() @@ -35,6 +39,7 @@ protected OAuthProvidersClient() /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. + /// or is null. public OAuthProvidersClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) { if (endpoint == null) @@ -47,253 +52,18 @@ public OAuthProvidersClient(Uri endpoint, TokenCredential credential, FarmBeatsC } options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); _tokenCredential = credential; - var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); - _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { authPolicy }, new ResponseClassifier()); - this.endpoint = endpoint; - apiVersion = options.Version; - } - - /// Returns a paginated list of oauthProvider resources. - /// - /// Schema for Response Body: - /// { - /// value: [ - /// { - /// appId: string, - /// appSecret: string, - /// apiKey: string, - /// isProductionApp: boolean, - /// id: string, - /// eTag: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string - /// } - /// - /// - /// Schema for Response Error: - /// { - /// error: { - /// code: string, - /// message: string, - /// target: string, - /// details: [Error], - /// innererror: { - /// code: string, - /// innererror: InnerError - /// } - /// }, - /// traceId: string - /// } - /// - /// - /// - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. -#pragma warning disable AZC0002 - public virtual async Task ListAsync(IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) -#pragma warning restore AZC0002 - { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRequest(ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("OAuthProvidersClient.List"); - scope.Start(); - try - { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Returns a paginated list of oauthProvider resources. - /// - /// Schema for Response Body: - /// { - /// value: [ - /// { - /// appId: string, - /// appSecret: string, - /// apiKey: string, - /// isProductionApp: boolean, - /// id: string, - /// eTag: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string - /// } - /// - /// - /// Schema for Response Error: - /// { - /// error: { - /// code: string, - /// message: string, - /// target: string, - /// details: [Error], - /// innererror: { - /// code: string, - /// innererror: InnerError - /// } - /// }, - /// traceId: string - /// } - /// - /// - /// - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. -#pragma warning disable AZC0002 - public virtual Response List(IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) -#pragma warning restore AZC0002 - { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRequest(ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("OAuthProvidersClient.List"); - scope.Start(); - try - { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - private HttpMessage CreateListRequest(IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/oauth/providers", false); - if (ids != null) - { - uri.AppendQueryDelimited("ids", ids, ",", true); - } - if (names != null) - { - uri.AppendQueryDelimited("names", names, ",", true); - } - if (propertyFilters != null) - { - uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); - } - if (statuses != null) - { - uri.AppendQueryDelimited("statuses", statuses, ",", true); - } - if (minCreatedDateTime != null) - { - uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); - } - if (maxCreatedDateTime != null) - { - uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); - } - if (minLastModifiedDateTime != null) - { - uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); - } - if (maxLastModifiedDateTime != null) - { - uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); - } - if (maxPageSize != null) - { - uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; + _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; } /// Get a specified oauthProvider resource. + /// ID of the oauthProvider resource. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -310,7 +80,6 @@ private HttpMessage CreateListRequest(IEnumerable ids, IEnumerable - /// /// Schema for Response Error: /// { /// error: { @@ -328,34 +97,16 @@ private HttpMessage CreateListRequest(IEnumerable ids, IEnumerable /// /// - /// ID of the oauthProvider resource. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetAsync(string oauthProviderId, RequestOptions options = null) + public virtual async Task GetAsync(string oauthProviderId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRequest(oauthProviderId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("OAuthProvidersClient.Get"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRequest(oauthProviderId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -365,6 +116,9 @@ public virtual async Task GetAsync(string oauthProviderId, RequestOpti } /// Get a specified oauthProvider resource. + /// ID of the oauthProvider resource. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -381,7 +135,6 @@ public virtual async Task GetAsync(string oauthProviderId, RequestOpti /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -399,34 +152,16 @@ public virtual async Task GetAsync(string oauthProviderId, RequestOpti /// /// /// - /// ID of the oauthProvider resource. - /// The request options. #pragma warning disable AZC0002 - public virtual Response Get(string oauthProviderId, RequestOptions options = null) + public virtual Response Get(string oauthProviderId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRequest(oauthProviderId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("OAuthProvidersClient.Get"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRequest(oauthProviderId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -435,22 +170,11 @@ public virtual Response Get(string oauthProviderId, RequestOptions options = nul } } - private HttpMessage CreateGetRequest(string oauthProviderId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/oauth/providers/", false); - uri.AppendPath(oauthProviderId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Creates or updates an oauthProvider resource. + /// ID of oauthProvider resource. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -467,7 +191,6 @@ private HttpMessage CreateGetRequest(string oauthProviderId) /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Body: /// { /// appId: string, @@ -483,7 +206,6 @@ private HttpMessage CreateGetRequest(string oauthProviderId) /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -501,36 +223,16 @@ private HttpMessage CreateGetRequest(string oauthProviderId) /// /// /// - /// ID of oauthProvider resource. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task CreateOrUpdateAsync(string oauthProviderId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(oauthProviderId, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("OAuthProvidersClient.CreateOrUpdate"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(oauthProviderId, content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -540,6 +242,10 @@ public virtual async Task CreateOrUpdateAsync(string oauthProviderId, } /// Creates or updates an oauthProvider resource. + /// ID of oauthProvider resource. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -556,7 +262,6 @@ public virtual async Task CreateOrUpdateAsync(string oauthProviderId, /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Body: /// { /// appId: string, @@ -572,7 +277,6 @@ public virtual async Task CreateOrUpdateAsync(string oauthProviderId, /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -590,36 +294,16 @@ public virtual async Task CreateOrUpdateAsync(string oauthProviderId, /// /// /// - /// ID of oauthProvider resource. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response CreateOrUpdate(string oauthProviderId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(oauthProviderId, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("OAuthProvidersClient.CreateOrUpdate"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(oauthProviderId, content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -628,24 +312,10 @@ public virtual Response CreateOrUpdate(string oauthProviderId, RequestContent co } } - private HttpMessage CreateCreateOrUpdateRequest(string oauthProviderId, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/oauth/providers/", false); - uri.AppendPath(oauthProviderId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/merge-patch+json"); - request.Content = content; - return message; - } - /// Deletes an specified oauthProvider resource. + /// ID of oauthProvider. + /// The request options. + /// is null. /// /// Schema for Response Error: /// { @@ -664,34 +334,16 @@ private HttpMessage CreateCreateOrUpdateRequest(string oauthProviderId, RequestC /// /// /// - /// ID of oauthProvider. - /// The request options. #pragma warning disable AZC0002 public virtual async Task DeleteAsync(string oauthProviderId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(oauthProviderId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("OAuthProvidersClient.Delete"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(oauthProviderId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -701,6 +353,9 @@ public virtual async Task DeleteAsync(string oauthProviderId, RequestO } /// Deletes an specified oauthProvider resource. + /// ID of oauthProvider. + /// The request options. + /// is null. /// /// Schema for Response Error: /// { @@ -719,55 +374,346 @@ public virtual async Task DeleteAsync(string oauthProviderId, RequestO /// /// /// - /// ID of oauthProvider. - /// The request options. #pragma warning disable AZC0002 public virtual Response Delete(string oauthProviderId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(oauthProviderId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("OAuthProvidersClient.Delete"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) + using HttpMessage message = CreateDeleteRequest(oauthProviderId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Returns a paginated list of oauthProvider resources. + /// The request options. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// appId: string, + /// appSecret: string, + /// apiKey: string, + /// isProductionApp: boolean, + /// id: string, + /// eTag: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [Error], + /// innererror: { + /// code: string, + /// innererror: InnerError + /// } + /// }, + /// traceId: string + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual AsyncPageable ListAsync(RequestOptions options, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) +#pragma warning restore AZC0002 + { + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "OAuthProvidersClient.List"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) + { + do { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } + var message = string.IsNullOrEmpty(nextLink) + ? CreateListRequest(ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListNextPageRequest(nextLink, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + /// Returns a paginated list of oauthProvider resources. + /// The request options. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// appId: string, + /// appSecret: string, + /// apiKey: string, + /// isProductionApp: boolean, + /// id: string, + /// eTag: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [Error], + /// innererror: { + /// code: string, + /// innererror: InnerError + /// } + /// }, + /// traceId: string + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual Pageable List(RequestOptions options, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) +#pragma warning restore AZC0002 + { + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "OAuthProvidersClient.List"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListRequest(ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListNextPageRequest(nextLink, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + internal HttpMessage CreateListRequest(IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/oauth/providers", false); + if (ids != null) + { + foreach (var param in ids) + { + uri.AppendQuery("ids", param, true); } - else + } + if (names != null) + { + foreach (var param in names) { - return message.Response; + uri.AppendQuery("names", param, true); } } - catch (Exception e) + if (propertyFilters != null) { - scope.Failed(e); - throw; + foreach (var param in propertyFilters) + { + uri.AppendQuery("propertyFilters", param, true); + } + } + if (statuses != null) + { + foreach (var param in statuses) + { + uri.AppendQuery("statuses", param, true); + } + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetRequest(string oauthProviderId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/oauth/providers/", false); + uri.AppendPath(oauthProviderId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; } - private HttpMessage CreateDeleteRequest(string oauthProviderId) + internal HttpMessage CreateCreateOrUpdateRequest(string oauthProviderId, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/oauth/providers/", false); + uri.AppendPath(oauthProviderId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/merge-patch+json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200201.Instance; + return message; + } + + internal HttpMessage CreateDeleteRequest(string oauthProviderId) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); + uri.Reset(_endpoint); uri.AppendPath("/oauth/providers/", false); uri.AppendPath(oauthProviderId, true); - uri.AppendQuery("api-version", apiVersion, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier204.Instance; + return message; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; return message; } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier200201 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200201(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + 201 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier204 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier204(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 204 => false, + _ => true + }; + } + } } } diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/OAuthTokensClient.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/OAuthTokensClient.cs index 2cc2879bc6d59..851efd314d8bc 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/OAuthTokensClient.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/OAuthTokensClient.cs @@ -7,6 +7,8 @@ using System; using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; @@ -17,14 +19,16 @@ namespace Azure.Verticals.AgriFood.Farming /// The OAuthTokens service client. public partial class OAuthTokensClient { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of OAuthTokensClient for mocking. protected OAuthTokensClient() @@ -35,6 +39,7 @@ protected OAuthTokensClient() /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. + /// or is null. public OAuthTokensClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) { if (endpoint == null) @@ -47,33 +52,26 @@ public OAuthTokensClient(Uri endpoint, TokenCredential credential, FarmBeatsClie } options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); _tokenCredential = credential; - var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); - _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { authPolicy }, new ResponseClassifier()); - this.endpoint = endpoint; - apiVersion = options.Version; + _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; } - /// Returns a list of OAuthToken documents. + /// Returns Connection link needed in the OAuth flow. + /// The content to send as the body of the request. + /// The request options. /// - /// Schema for Response Body: + /// Schema for Request Body: /// { - /// value: [ - /// { - /// farmerId: string, - /// authProviderId: string, - /// isValid: boolean, - /// eTag: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format) - /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// farmerId: string (required), + /// oAuthProviderId: string (required), + /// userRedirectLink: string (required), + /// userRedirectState: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -91,45 +89,16 @@ public OAuthTokensClient(Uri endpoint, TokenCredential credential, FarmBeatsClie /// /// /// - /// Name of AuthProvider. - /// List of farmers. - /// If the token object is valid. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task ListAsync(IEnumerable authProviderIds = null, IEnumerable farmerIds = null, bool? isValid = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual async Task GetOAuthConnectionLinkAsync(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRequest(authProviderIds, farmerIds, isValid, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("OAuthTokensClient.List"); + using var scope = _clientDiagnostics.CreateScope("OAuthTokensClient.GetOAuthConnectionLink"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetOAuthConnectionLinkRequest(content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -138,25 +107,18 @@ public virtual async Task ListAsync(IEnumerable authProviderId } } - /// Returns a list of OAuthToken documents. + /// Returns Connection link needed in the OAuth flow. + /// The content to send as the body of the request. + /// The request options. /// - /// Schema for Response Body: + /// Schema for Request Body: /// { - /// value: [ - /// { - /// farmerId: string, - /// authProviderId: string, - /// isValid: boolean, - /// eTag: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format) - /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// farmerId: string (required), + /// oAuthProviderId: string (required), + /// userRedirectLink: string (required), + /// userRedirectState: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -174,45 +136,16 @@ public virtual async Task ListAsync(IEnumerable authProviderId /// /// /// - /// Name of AuthProvider. - /// List of farmers. - /// If the token object is valid. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual Response List(IEnumerable authProviderIds = null, IEnumerable farmerIds = null, bool? isValid = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual Response GetOAuthConnectionLink(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRequest(authProviderIds, farmerIds, isValid, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("OAuthTokensClient.List"); + using var scope = _clientDiagnostics.CreateScope("OAuthTokensClient.GetOAuthConnectionLink"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetOAuthConnectionLinkRequest(content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -221,67 +154,29 @@ public virtual Response List(IEnumerable authProviderIds = null, IEnumer } } - private HttpMessage CreateListRequest(IEnumerable authProviderIds, IEnumerable farmerIds, bool? isValid, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/oauth/tokens", false); - if (authProviderIds != null) - { - uri.AppendQueryDelimited("authProviderIds", authProviderIds, ",", true); - } - if (farmerIds != null) - { - uri.AppendQueryDelimited("farmerIds", farmerIds, ",", true); - } - if (isValid != null) - { - uri.AppendQuery("isValid", isValid.Value, true); - } - if (minCreatedDateTime != null) - { - uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); - } - if (maxCreatedDateTime != null) - { - uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); - } - if (minLastModifiedDateTime != null) - { - uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); - } - if (maxLastModifiedDateTime != null) - { - uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); - } - if (maxPageSize != null) - { - uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Returns Connection link needed in the OAuth flow. + /// Get cascade delete job details for OAuth tokens for specified job ID. + /// ID of the job. + /// The request options. + /// is null. /// - /// Schema for Request Body: + /// Schema for Response Body: /// { - /// farmerId: string (required), - /// oAuthProviderId: string (required), - /// userRedirectLink: string (required), - /// userRedirectState: string + /// farmerId: string, + /// resourceId: string, + /// resourceType: string, + /// id: string, + /// status: string, + /// durationInSeconds: number, + /// message: string, + /// createdDateTime: string (ISO 8601 Format), + /// lastActionDateTime: string (ISO 8601 Format), + /// startTime: string (ISO 8601 Format), + /// endTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -299,34 +194,16 @@ private HttpMessage CreateListRequest(IEnumerable authProviderIds, IEnum /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetOAuthConnectionLinkAsync(RequestContent content, RequestOptions options = null) + public virtual async Task GetCascadeDeleteJobDetailsAsync(string jobId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetOAuthConnectionLinkRequest(content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("OAuthTokensClient.GetOAuthConnectionLink"); + using var scope = _clientDiagnostics.CreateScope("OAuthTokensClient.GetCascadeDeleteJobDetails"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -335,17 +212,29 @@ public virtual async Task GetOAuthConnectionLinkAsync(RequestContent c } } - /// Returns Connection link needed in the OAuth flow. + /// Get cascade delete job details for OAuth tokens for specified job ID. + /// ID of the job. + /// The request options. + /// is null. /// - /// Schema for Request Body: + /// Schema for Response Body: /// { - /// farmerId: string (required), - /// oAuthProviderId: string (required), - /// userRedirectLink: string (required), - /// userRedirectState: string + /// farmerId: string, + /// resourceId: string, + /// resourceType: string, + /// id: string, + /// status: string, + /// durationInSeconds: number, + /// message: string, + /// createdDateTime: string (ISO 8601 Format), + /// lastActionDateTime: string (ISO 8601 Format), + /// startTime: string (ISO 8601 Format), + /// endTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -363,34 +252,16 @@ public virtual async Task GetOAuthConnectionLinkAsync(RequestContent c /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetOAuthConnectionLink(RequestContent content, RequestOptions options = null) + public virtual Response GetCascadeDeleteJobDetails(string jobId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetOAuthConnectionLinkRequest(content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("OAuthTokensClient.GetOAuthConnectionLink"); + using var scope = _clientDiagnostics.CreateScope("OAuthTokensClient.GetCascadeDeleteJobDetails"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -399,43 +270,37 @@ public virtual Response GetOAuthConnectionLink(RequestContent content, RequestOp } } - private HttpMessage CreateGetOAuthConnectionLinkRequest(RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/oauth/tokens/:connect", 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; - } - - /// Get cascade delete job details for OAuth tokens for specified job ID. + /// Returns a list of OAuthToken documents. + /// The request options. + /// Name of AuthProvider. + /// List of farmers. + /// If the token object is valid. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. /// /// Schema for Response Body: /// { - /// farmerId: string, - /// resourceId: string, - /// resourceType: string, - /// id: string, - /// status: string, - /// durationInSeconds: number, - /// message: string, - /// createdDateTime: string (ISO 8601 Format), - /// lastActionDateTime: string (ISO 8601 Format), - /// startTime: string (ISO 8601 Format), - /// endTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// value: [ + /// { + /// farmerId: string, + /// authProviderId: string, + /// isValid: boolean, + /// eTag: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format) + /// } + /// ], + /// $skipToken: string, + /// nextLink: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -453,63 +318,56 @@ private HttpMessage CreateGetOAuthConnectionLinkRequest(RequestContent content) /// /// /// - /// ID of the job. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetCascadeDeleteJobDetailsAsync(string jobId, RequestOptions options = null) + public virtual AsyncPageable ListAsync(RequestOptions options, IEnumerable authProviderIds = null, IEnumerable farmerIds = null, bool? isValid = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("OAuthTokensClient.GetCascadeDeleteJobDetails"); - scope.Start(); - try + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "OAuthTokensClient.List"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else + do { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; + var message = string.IsNullOrEmpty(nextLink) + ? CreateListRequest(authProviderIds, farmerIds, isValid, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListNextPageRequest(nextLink, authProviderIds, farmerIds, isValid, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - /// Get cascade delete job details for OAuth tokens for specified job ID. + /// Returns a list of OAuthToken documents. + /// The request options. + /// Name of AuthProvider. + /// List of farmers. + /// If the token object is valid. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. /// /// Schema for Response Body: /// { - /// farmerId: string, - /// resourceId: string, - /// resourceType: string, - /// id: string, - /// status: string, - /// durationInSeconds: number, - /// message: string, - /// createdDateTime: string (ISO 8601 Format), - /// lastActionDateTime: string (ISO 8601 Format), - /// startTime: string (ISO 8601 Format), - /// endTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// value: [ + /// { + /// farmerId: string, + /// authProviderId: string, + /// isValid: boolean, + /// eTag: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format) + /// } + /// ], + /// $skipToken: string, + /// nextLink: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -527,58 +385,31 @@ public virtual async Task GetCascadeDeleteJobDetailsAsync(string jobId /// /// /// - /// ID of the job. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetCascadeDeleteJobDetails(string jobId, RequestOptions options = null) + public virtual Pageable List(RequestOptions options, IEnumerable authProviderIds = null, IEnumerable farmerIds = null, bool? isValid = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("OAuthTokensClient.GetCascadeDeleteJobDetails"); - scope.Start(); - try + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "OAuthTokensClient.List"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) + do { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; + var message = string.IsNullOrEmpty(nextLink) + ? CreateListRequest(authProviderIds, farmerIds, isValid, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListNextPageRequest(nextLink, authProviderIds, farmerIds, isValid, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - private HttpMessage CreateGetCascadeDeleteJobDetailsRequest(string jobId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/oauth/tokens/remove/", false); - uri.AppendPath(jobId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Create a cascade delete job for OAuth tokens. + /// Job ID supplied by end user. + /// ID of the farmer. + /// ID of the OAuthProvider. + /// The request options. + /// , , or is null. /// /// Schema for Response Body: /// { @@ -598,7 +429,6 @@ private HttpMessage CreateGetCascadeDeleteJobDetailsRequest(string jobId) /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -616,36 +446,16 @@ private HttpMessage CreateGetCascadeDeleteJobDetailsRequest(string jobId) /// /// /// - /// Job ID supplied by end user. - /// ID of the farmer. - /// ID of the OAuthProvider. - /// The request options. #pragma warning disable AZC0002 public virtual async Task> CreateCascadeDeleteJobAsync(string jobId, string farmerId, string oauthProviderId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId, oauthProviderId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("OAuthTokensClient.CreateCascadeDeleteJob"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "OAuthTokensClient.CreateCascadeDeleteJob"); - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "OAuthTokensClient.CreateCascadeDeleteJob"); - } + using HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId, oauthProviderId); + return await LowLevelOperationHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, "OAuthTokensClient.CreateCascadeDeleteJob", OperationFinalStateVia.Location, options).ConfigureAwait(false); } catch (Exception e) { @@ -655,6 +465,11 @@ public virtual async Task> CreateCascadeDeleteJobAsync(str } /// Create a cascade delete job for OAuth tokens. + /// Job ID supplied by end user. + /// ID of the farmer. + /// ID of the OAuthProvider. + /// The request options. + /// , , or is null. /// /// Schema for Response Body: /// { @@ -674,7 +489,6 @@ public virtual async Task> CreateCascadeDeleteJobAsync(str /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -692,59 +506,171 @@ public virtual async Task> CreateCascadeDeleteJobAsync(str /// /// /// - /// Job ID supplied by end user. - /// ID of the farmer. - /// ID of the OAuthProvider. - /// The request options. #pragma warning disable AZC0002 public virtual Operation CreateCascadeDeleteJob(string jobId, string farmerId, string oauthProviderId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId, oauthProviderId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("OAuthTokensClient.CreateCascadeDeleteJob"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) + using HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId, oauthProviderId); + return LowLevelOperationHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, "OAuthTokensClient.CreateCascadeDeleteJob", OperationFinalStateVia.Location, options); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + internal HttpMessage CreateListRequest(IEnumerable authProviderIds, IEnumerable farmerIds, bool? isValid, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/oauth/tokens", false); + if (authProviderIds != null) + { + foreach (var param in authProviderIds) { - switch (message.Response.Status) - { - case 202: - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "OAuthTokensClient.CreateCascadeDeleteJob"); - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } + uri.AppendQuery("authProviderIds", param, true); } - else + } + if (farmerIds != null) + { + foreach (var param in farmerIds) { - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "OAuthTokensClient.CreateCascadeDeleteJob"); + uri.AppendQuery("farmerIds", param, true); } } - catch (Exception e) + if (isValid != null) { - scope.Failed(e); - throw; + uri.AppendQuery("isValid", isValid.Value, true); + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; } - private HttpMessage CreateCreateCascadeDeleteJobRequest(string jobId, string farmerId, string oauthProviderId) + internal HttpMessage CreateGetOAuthConnectionLinkRequest(RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/oauth/tokens/:connect", 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; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetCascadeDeleteJobDetailsRequest(string jobId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/oauth/tokens/remove/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateCascadeDeleteJobRequest(string jobId, string farmerId, string oauthProviderId) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); + uri.Reset(_endpoint); uri.AppendPath("/oauth/tokens/remove/", false); uri.AppendPath(jobId, true); uri.AppendQuery("farmerId", farmerId, true); uri.AppendQuery("oauthProviderId", oauthProviderId, true); - uri.AppendQuery("api-version", apiVersion, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier202.Instance; + return message; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, IEnumerable authProviderIds, IEnumerable farmerIds, bool? isValid, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; return message; } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier202 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier202(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 202 => false, + _ => true + }; + } + } } } diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/PlantingDataClient.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/PlantingDataClient.cs index 82257767963ea..427764ddb7cd1 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/PlantingDataClient.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/PlantingDataClient.cs @@ -7,6 +7,8 @@ using System; using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; @@ -17,14 +19,16 @@ namespace Azure.Verticals.AgriFood.Farming /// The PlantingData service client. public partial class PlantingDataClient { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of PlantingDataClient for mocking. protected PlantingDataClient() @@ -35,6 +39,7 @@ protected PlantingDataClient() /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. + /// or is null. public PlantingDataClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) { if (endpoint == null) @@ -47,58 +52,55 @@ public PlantingDataClient(Uri endpoint, TokenCredential credential, FarmBeatsCli } options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); _tokenCredential = credential; - var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); - _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { authPolicy }, new ResponseClassifier()); - this.endpoint = endpoint; - apiVersion = options.Version; + _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; } - /// Returns a paginated list of planting data resources under a particular farm. + /// Get a specified planting data resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the planting data resource. + /// The request options. + /// or is null. /// /// Schema for Response Body: /// { - /// value: [ + /// avgPlantingRate: { + /// unit: string, + /// value: number + /// }, + /// totalMaterial: Measure, + /// avgMaterial: Measure, + /// plantingProductDetails: [ /// { - /// avgPlantingRate: { - /// unit: string, - /// value: number - /// }, - /// totalMaterial: Measure, - /// avgMaterial: Measure, - /// plantingProductDetails: [ - /// { - /// productName: string, - /// area: Measure, - /// totalMaterial: Measure, - /// avgMaterial: Measure - /// } - /// ], + /// productName: string, /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// totalMaterial: Measure, + /// avgMaterial: Measure /// } /// ], - /// $skipToken: string, - /// nextLink: string + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -116,67 +118,16 @@ public PlantingDataClient(Uri endpoint, TokenCredential credential, FarmBeatsCli /// /// /// - /// ID of the associated farmer. - /// Minimum AvgPlantingRate value(inclusive). - /// Maximum AvgPlantingRate value (inclusive). - /// Minimum TotalMaterial value(inclusive). - /// Maximum TotalMaterial value (inclusive). - /// Minimum AvgMaterial value(inclusive). - /// Maximum AvgMaterial value (inclusive). - /// Sources of the operation data. - /// Boundary IDs associated with operation data. - /// Operation boundary IDs associated with operation data. - /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum area for which operation was applied (inclusive). - /// Maximum area for which operation was applied (inclusive). - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task ListByFarmerIdAsync(string farmerId, double? minAvgPlantingRate = null, double? maxAvgPlantingRate = null, double? minTotalMaterial = null, double? maxTotalMaterial = null, double? minAvgMaterial = null, double? maxAvgMaterial = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual async Task GetAsync(string farmerId, string plantingDataId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListByFarmerIdRequest(farmerId, minAvgPlantingRate, maxAvgPlantingRate, minTotalMaterial, maxTotalMaterial, minAvgMaterial, maxAvgMaterial, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PlantingDataClient.ListByFarmerId"); + using var scope = _clientDiagnostics.CreateScope("PlantingDataClient.Get"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRequest(farmerId, plantingDataId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -185,50 +136,47 @@ public virtual async Task ListByFarmerIdAsync(string farmerId, double? } } - /// Returns a paginated list of planting data resources under a particular farm. + /// Get a specified planting data resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the planting data resource. + /// The request options. + /// or is null. /// /// Schema for Response Body: /// { - /// value: [ + /// avgPlantingRate: { + /// unit: string, + /// value: number + /// }, + /// totalMaterial: Measure, + /// avgMaterial: Measure, + /// plantingProductDetails: [ /// { - /// avgPlantingRate: { - /// unit: string, - /// value: number - /// }, - /// totalMaterial: Measure, - /// avgMaterial: Measure, - /// plantingProductDetails: [ - /// { - /// productName: string, - /// area: Measure, - /// totalMaterial: Measure, - /// avgMaterial: Measure - /// } - /// ], + /// productName: string, /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// totalMaterial: Measure, + /// avgMaterial: Measure /// } /// ], - /// $skipToken: string, - /// nextLink: string + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -246,67 +194,16 @@ public virtual async Task ListByFarmerIdAsync(string farmerId, double? /// /// /// - /// ID of the associated farmer. - /// Minimum AvgPlantingRate value(inclusive). - /// Maximum AvgPlantingRate value (inclusive). - /// Minimum TotalMaterial value(inclusive). - /// Maximum TotalMaterial value (inclusive). - /// Minimum AvgMaterial value(inclusive). - /// Maximum AvgMaterial value (inclusive). - /// Sources of the operation data. - /// Boundary IDs associated with operation data. - /// Operation boundary IDs associated with operation data. - /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum area for which operation was applied (inclusive). - /// Maximum area for which operation was applied (inclusive). - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual Response ListByFarmerId(string farmerId, double? minAvgPlantingRate = null, double? maxAvgPlantingRate = null, double? minTotalMaterial = null, double? maxTotalMaterial = null, double? minAvgMaterial = null, double? maxAvgMaterial = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual Response Get(string farmerId, string plantingDataId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListByFarmerIdRequest(farmerId, minAvgPlantingRate, maxAvgPlantingRate, minTotalMaterial, maxTotalMaterial, minAvgMaterial, maxAvgMaterial, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PlantingDataClient.ListByFarmerId"); + using var scope = _clientDiagnostics.CreateScope("PlantingDataClient.Get"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRequest(farmerId, plantingDataId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -315,174 +212,83 @@ public virtual Response ListByFarmerId(string farmerId, double? minAvgPlantingRa } } - private HttpMessage CreateListByFarmerIdRequest(string farmerId, double? minAvgPlantingRate, double? maxAvgPlantingRate, double? minTotalMaterial, double? maxTotalMaterial, double? minAvgMaterial, double? maxAvgMaterial, IEnumerable sources, IEnumerable associatedBoundaryIds, IEnumerable operationBoundaryIds, DateTimeOffset? minOperationStartDateTime, DateTimeOffset? maxOperationStartDateTime, DateTimeOffset? minOperationEndDateTime, DateTimeOffset? maxOperationEndDateTime, DateTimeOffset? minOperationModifiedDateTime, DateTimeOffset? maxOperationModifiedDateTime, double? minArea, double? maxArea, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/planting-data", false); - if (minAvgPlantingRate != null) - { - uri.AppendQuery("minAvgPlantingRate", minAvgPlantingRate.Value, true); - } - if (maxAvgPlantingRate != null) - { - uri.AppendQuery("maxAvgPlantingRate", maxAvgPlantingRate.Value, true); - } - if (minTotalMaterial != null) - { - uri.AppendQuery("minTotalMaterial", minTotalMaterial.Value, true); - } - if (maxTotalMaterial != null) - { - uri.AppendQuery("maxTotalMaterial", maxTotalMaterial.Value, true); - } - if (minAvgMaterial != null) - { - uri.AppendQuery("minAvgMaterial", minAvgMaterial.Value, true); - } - if (maxAvgMaterial != null) - { - uri.AppendQuery("maxAvgMaterial", maxAvgMaterial.Value, true); - } - if (sources != null) - { - uri.AppendQueryDelimited("sources", sources, ",", true); - } - if (associatedBoundaryIds != null) - { - uri.AppendQueryDelimited("associatedBoundaryIds", associatedBoundaryIds, ",", true); - } - if (operationBoundaryIds != null) - { - uri.AppendQueryDelimited("operationBoundaryIds", operationBoundaryIds, ",", true); - } - if (minOperationStartDateTime != null) - { - uri.AppendQuery("minOperationStartDateTime", minOperationStartDateTime.Value, "O", true); - } - if (maxOperationStartDateTime != null) - { - uri.AppendQuery("maxOperationStartDateTime", maxOperationStartDateTime.Value, "O", true); - } - if (minOperationEndDateTime != null) - { - uri.AppendQuery("minOperationEndDateTime", minOperationEndDateTime.Value, "O", true); - } - if (maxOperationEndDateTime != null) - { - uri.AppendQuery("maxOperationEndDateTime", maxOperationEndDateTime.Value, "O", true); - } - if (minOperationModifiedDateTime != null) - { - uri.AppendQuery("minOperationModifiedDateTime", minOperationModifiedDateTime.Value, "O", true); - } - if (maxOperationModifiedDateTime != null) - { - uri.AppendQuery("maxOperationModifiedDateTime", maxOperationModifiedDateTime.Value, "O", true); - } - if (minArea != null) - { - uri.AppendQuery("minArea", minArea.Value, true); - } - if (maxArea != null) - { - uri.AppendQuery("maxArea", maxArea.Value, true); - } - if (ids != null) - { - uri.AppendQueryDelimited("ids", ids, ",", true); - } - if (names != null) - { - uri.AppendQueryDelimited("names", names, ",", true); - } - if (propertyFilters != null) - { - uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); - } - if (statuses != null) - { - uri.AppendQueryDelimited("statuses", statuses, ",", true); - } - if (minCreatedDateTime != null) - { - uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); - } - if (maxCreatedDateTime != null) - { - uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); - } - if (minLastModifiedDateTime != null) - { - uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); - } - if (maxLastModifiedDateTime != null) - { - uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); - } - if (maxPageSize != null) - { - uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Returns a paginated list of planting data resources across all farmers. + /// Creates or updates an planting data resource under a particular farmer. + /// ID of the associated farmer. + /// ID of the planting data resource. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// - /// Schema for Response Body: + /// Schema for Request Body: /// { - /// value: [ + /// avgPlantingRate: { + /// unit: string, + /// value: number + /// }, + /// totalMaterial: Measure, + /// avgMaterial: Measure, + /// plantingProductDetails: [ /// { - /// avgPlantingRate: { - /// unit: string, - /// value: number - /// }, + /// productName: string, + /// area: Measure, /// totalMaterial: Measure, - /// avgMaterial: Measure, - /// plantingProductDetails: [ - /// { - /// productName: string, - /// area: Measure, - /// totalMaterial: Measure, - /// avgMaterial: Measure - /// } - /// ], + /// avgMaterial: Measure + /// } + /// ], + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// + /// Schema for Response Body: + /// { + /// avgPlantingRate: { + /// unit: string, + /// value: number + /// }, + /// totalMaterial: Measure, + /// avgMaterial: Measure, + /// plantingProductDetails: [ + /// { + /// productName: string, /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// totalMaterial: Measure, + /// avgMaterial: Measure /// } /// ], - /// $skipToken: string, - /// nextLink: string + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -500,66 +306,16 @@ private HttpMessage CreateListByFarmerIdRequest(string farmerId, double? minAvgP /// /// /// - /// Minimum AvgPlantingRate value(inclusive). - /// Maximum AvgPlantingRate value (inclusive). - /// Minimum TotalMaterial value(inclusive). - /// Maximum TotalMaterial value (inclusive). - /// Minimum AvgMaterial value(inclusive). - /// Maximum AvgMaterial value (inclusive). - /// Sources of the operation data. - /// Boundary IDs associated with operation data. - /// Operation boundary IDs associated with operation data. - /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum area for which operation was applied (inclusive). - /// Maximum area for which operation was applied (inclusive). - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task ListAsync(double? minAvgPlantingRate = null, double? maxAvgPlantingRate = null, double? minTotalMaterial = null, double? maxTotalMaterial = null, double? minAvgMaterial = null, double? maxAvgMaterial = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual async Task CreateOrUpdateAsync(string farmerId, string plantingDataId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRequest(minAvgPlantingRate, maxAvgPlantingRate, minTotalMaterial, maxTotalMaterial, minAvgMaterial, maxAvgMaterial, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PlantingDataClient.List"); + using var scope = _clientDiagnostics.CreateScope("PlantingDataClient.CreateOrUpdate"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, plantingDataId, content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -568,270 +324,24 @@ public virtual async Task ListAsync(double? minAvgPlantingRate = null, } } - /// Returns a paginated list of planting data resources across all farmers. + /// Creates or updates an planting data resource under a particular farmer. + /// ID of the associated farmer. + /// ID of the planting data resource. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// - /// Schema for Response Body: + /// Schema for Request Body: /// { - /// value: [ + /// avgPlantingRate: { + /// unit: string, + /// value: number + /// }, + /// totalMaterial: Measure, + /// avgMaterial: Measure, + /// plantingProductDetails: [ /// { - /// avgPlantingRate: { - /// unit: string, - /// value: number - /// }, - /// totalMaterial: Measure, - /// avgMaterial: Measure, - /// plantingProductDetails: [ - /// { - /// productName: string, - /// area: Measure, - /// totalMaterial: Measure, - /// avgMaterial: Measure - /// } - /// ], - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string - /// } - /// - /// - /// Schema for Response Error: - /// { - /// error: { - /// code: string, - /// message: string, - /// target: string, - /// details: [Error], - /// innererror: { - /// code: string, - /// innererror: InnerError - /// } - /// }, - /// traceId: string - /// } - /// - /// - /// - /// Minimum AvgPlantingRate value(inclusive). - /// Maximum AvgPlantingRate value (inclusive). - /// Minimum TotalMaterial value(inclusive). - /// Maximum TotalMaterial value (inclusive). - /// Minimum AvgMaterial value(inclusive). - /// Maximum AvgMaterial value (inclusive). - /// Sources of the operation data. - /// Boundary IDs associated with operation data. - /// Operation boundary IDs associated with operation data. - /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum area for which operation was applied (inclusive). - /// Maximum area for which operation was applied (inclusive). - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. -#pragma warning disable AZC0002 - public virtual Response List(double? minAvgPlantingRate = null, double? maxAvgPlantingRate = null, double? minTotalMaterial = null, double? maxTotalMaterial = null, double? minAvgMaterial = null, double? maxAvgMaterial = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) -#pragma warning restore AZC0002 - { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRequest(minAvgPlantingRate, maxAvgPlantingRate, minTotalMaterial, maxTotalMaterial, minAvgMaterial, maxAvgMaterial, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PlantingDataClient.List"); - scope.Start(); - try - { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - private HttpMessage CreateListRequest(double? minAvgPlantingRate, double? maxAvgPlantingRate, double? minTotalMaterial, double? maxTotalMaterial, double? minAvgMaterial, double? maxAvgMaterial, IEnumerable sources, IEnumerable associatedBoundaryIds, IEnumerable operationBoundaryIds, DateTimeOffset? minOperationStartDateTime, DateTimeOffset? maxOperationStartDateTime, DateTimeOffset? minOperationEndDateTime, DateTimeOffset? maxOperationEndDateTime, DateTimeOffset? minOperationModifiedDateTime, DateTimeOffset? maxOperationModifiedDateTime, double? minArea, double? maxArea, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/planting-data", false); - if (minAvgPlantingRate != null) - { - uri.AppendQuery("minAvgPlantingRate", minAvgPlantingRate.Value, true); - } - if (maxAvgPlantingRate != null) - { - uri.AppendQuery("maxAvgPlantingRate", maxAvgPlantingRate.Value, true); - } - if (minTotalMaterial != null) - { - uri.AppendQuery("minTotalMaterial", minTotalMaterial.Value, true); - } - if (maxTotalMaterial != null) - { - uri.AppendQuery("maxTotalMaterial", maxTotalMaterial.Value, true); - } - if (minAvgMaterial != null) - { - uri.AppendQuery("minAvgMaterial", minAvgMaterial.Value, true); - } - if (maxAvgMaterial != null) - { - uri.AppendQuery("maxAvgMaterial", maxAvgMaterial.Value, true); - } - if (sources != null) - { - uri.AppendQueryDelimited("sources", sources, ",", true); - } - if (associatedBoundaryIds != null) - { - uri.AppendQueryDelimited("associatedBoundaryIds", associatedBoundaryIds, ",", true); - } - if (operationBoundaryIds != null) - { - uri.AppendQueryDelimited("operationBoundaryIds", operationBoundaryIds, ",", true); - } - if (minOperationStartDateTime != null) - { - uri.AppendQuery("minOperationStartDateTime", minOperationStartDateTime.Value, "O", true); - } - if (maxOperationStartDateTime != null) - { - uri.AppendQuery("maxOperationStartDateTime", maxOperationStartDateTime.Value, "O", true); - } - if (minOperationEndDateTime != null) - { - uri.AppendQuery("minOperationEndDateTime", minOperationEndDateTime.Value, "O", true); - } - if (maxOperationEndDateTime != null) - { - uri.AppendQuery("maxOperationEndDateTime", maxOperationEndDateTime.Value, "O", true); - } - if (minOperationModifiedDateTime != null) - { - uri.AppendQuery("minOperationModifiedDateTime", minOperationModifiedDateTime.Value, "O", true); - } - if (maxOperationModifiedDateTime != null) - { - uri.AppendQuery("maxOperationModifiedDateTime", maxOperationModifiedDateTime.Value, "O", true); - } - if (minArea != null) - { - uri.AppendQuery("minArea", minArea.Value, true); - } - if (maxArea != null) - { - uri.AppendQuery("maxArea", maxArea.Value, true); - } - if (ids != null) - { - uri.AppendQueryDelimited("ids", ids, ",", true); - } - if (names != null) - { - uri.AppendQueryDelimited("names", names, ",", true); - } - if (propertyFilters != null) - { - uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); - } - if (statuses != null) - { - uri.AppendQueryDelimited("statuses", statuses, ",", true); - } - if (minCreatedDateTime != null) - { - uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); - } - if (maxCreatedDateTime != null) - { - uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); - } - if (minLastModifiedDateTime != null) - { - uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); - } - if (maxLastModifiedDateTime != null) - { - uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); - } - if (maxPageSize != null) - { - uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Get a specified planting data resource under a particular farmer. - /// - /// Schema for Response Body: - /// { - /// avgPlantingRate: { - /// unit: string, - /// value: number - /// }, - /// totalMaterial: Measure, - /// avgMaterial: Measure, - /// plantingProductDetails: [ - /// { - /// productName: string, + /// productName: string, /// area: Measure, /// totalMaterial: Measure, /// avgMaterial: Measure @@ -856,63 +366,6 @@ private HttpMessage CreateListRequest(double? minAvgPlantingRate, double? maxAvg /// properties: Dictionary<string, AnyObject> /// } /// - /// - /// Schema for Response Error: - /// { - /// error: { - /// code: string, - /// message: string, - /// target: string, - /// details: [Error], - /// innererror: { - /// code: string, - /// innererror: InnerError - /// } - /// }, - /// traceId: string - /// } - /// - /// - /// - /// ID of the associated farmer resource. - /// ID of the planting data resource. - /// The request options. -#pragma warning disable AZC0002 - public virtual async Task GetAsync(string farmerId, string plantingDataId, RequestOptions options = null) -#pragma warning restore AZC0002 - { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRequest(farmerId, plantingDataId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PlantingDataClient.Get"); - scope.Start(); - try - { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get a specified planting data resource under a particular farmer. - /// /// Schema for Response Body: /// { /// avgPlantingRate: { @@ -948,7 +401,6 @@ public virtual async Task GetAsync(string farmerId, string plantingDat /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -966,182 +418,16 @@ public virtual async Task GetAsync(string farmerId, string plantingDat /// /// /// - /// ID of the associated farmer resource. - /// ID of the planting data resource. - /// The request options. -#pragma warning disable AZC0002 - public virtual Response Get(string farmerId, string plantingDataId, RequestOptions options = null) -#pragma warning restore AZC0002 - { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRequest(farmerId, plantingDataId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PlantingDataClient.Get"); - scope.Start(); - try - { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - private HttpMessage CreateGetRequest(string farmerId, string plantingDataId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/planting-data/", false); - uri.AppendPath(plantingDataId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Creates or updates an planting data resource under a particular farmer. - /// - /// Schema for Request Body: - /// { - /// avgPlantingRate: { - /// unit: string, - /// value: number - /// }, - /// totalMaterial: Measure, - /// avgMaterial: Measure, - /// plantingProductDetails: [ - /// { - /// productName: string, - /// area: Measure, - /// totalMaterial: Measure, - /// avgMaterial: Measure - /// } - /// ], - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// - /// Schema for Response Body: - /// { - /// avgPlantingRate: { - /// unit: string, - /// value: number - /// }, - /// totalMaterial: Measure, - /// avgMaterial: Measure, - /// plantingProductDetails: [ - /// { - /// productName: string, - /// area: Measure, - /// totalMaterial: Measure, - /// avgMaterial: Measure - /// } - /// ], - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// - /// Schema for Response Error: - /// { - /// error: { - /// code: string, - /// message: string, - /// target: string, - /// details: [Error], - /// innererror: { - /// code: string, - /// innererror: InnerError - /// } - /// }, - /// traceId: string - /// } - /// - /// - /// - /// ID of the associated farmer. - /// ID of the planting data resource. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task CreateOrUpdateAsync(string farmerId, string plantingDataId, RequestContent content, RequestOptions options = null) + public virtual Response CreateOrUpdate(string farmerId, string plantingDataId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, plantingDataId, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PlantingDataClient.CreateOrUpdate"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, plantingDataId, content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1150,80 +436,12 @@ public virtual async Task CreateOrUpdateAsync(string farmerId, string } } - /// Creates or updates an planting data resource under a particular farmer. + /// Deletes a specified planting data resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the planting data. + /// The request options. + /// or is null. /// - /// Schema for Request Body: - /// { - /// avgPlantingRate: { - /// unit: string, - /// value: number - /// }, - /// totalMaterial: Measure, - /// avgMaterial: Measure, - /// plantingProductDetails: [ - /// { - /// productName: string, - /// area: Measure, - /// totalMaterial: Measure, - /// avgMaterial: Measure - /// } - /// ], - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// - /// Schema for Response Body: - /// { - /// avgPlantingRate: { - /// unit: string, - /// value: number - /// }, - /// totalMaterial: Measure, - /// avgMaterial: Measure, - /// plantingProductDetails: [ - /// { - /// productName: string, - /// area: Measure, - /// totalMaterial: Measure, - /// avgMaterial: Measure - /// } - /// ], - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// /// Schema for Response Error: /// { /// error: { @@ -1241,37 +459,16 @@ public virtual async Task CreateOrUpdateAsync(string farmerId, string /// /// /// - /// ID of the associated farmer. - /// ID of the planting data resource. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual Response CreateOrUpdate(string farmerId, string plantingDataId, RequestContent content, RequestOptions options = null) + public virtual async Task DeleteAsync(string farmerId, string plantingDataId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, plantingDataId, content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PlantingDataClient.CreateOrUpdate"); + using var scope = _clientDiagnostics.CreateScope("PlantingDataClient.Delete"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(farmerId, plantingDataId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1280,26 +477,11 @@ public virtual Response CreateOrUpdate(string farmerId, string plantingDataId, R } } - private HttpMessage CreateCreateOrUpdateRequest(string farmerId, string plantingDataId, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/planting-data/", false); - uri.AppendPath(plantingDataId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/merge-patch+json"); - request.Content = content; - return message; - } - /// Deletes a specified planting data resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the planting data. + /// The request options. + /// or is null. /// /// Schema for Response Error: /// { @@ -1318,35 +500,16 @@ private HttpMessage CreateCreateOrUpdateRequest(string farmerId, string planting /// /// /// - /// ID of the associated farmer resource. - /// ID of the planting data. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task DeleteAsync(string farmerId, string plantingDataId, RequestOptions options = null) + public virtual Response Delete(string farmerId, string plantingDataId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(farmerId, plantingDataId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PlantingDataClient.Delete"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(farmerId, plantingDataId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1355,9 +518,86 @@ public virtual async Task DeleteAsync(string farmerId, string planting } } - /// Deletes a specified planting data resource under a particular farmer. - /// - /// Schema for Response Error: + /// Returns a paginated list of planting data resources under a particular farm. + /// ID of the associated farmer. + /// The request options. + /// Minimum AvgPlantingRate value(inclusive). + /// Maximum AvgPlantingRate value (inclusive). + /// Minimum TotalMaterial value(inclusive). + /// Maximum TotalMaterial value (inclusive). + /// Minimum AvgMaterial value(inclusive). + /// Maximum AvgMaterial value (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// is null. + /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// avgPlantingRate: { + /// unit: string, + /// value: number + /// }, + /// totalMaterial: Measure, + /// avgMaterial: Measure, + /// plantingProductDetails: [ + /// { + /// productName: string, + /// area: Measure, + /// totalMaterial: Measure, + /// avgMaterial: Measure + /// } + /// ], + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string + /// } + /// + /// Schema for Response Error: /// { /// error: { /// code: string, @@ -1374,58 +614,789 @@ public virtual async Task DeleteAsync(string farmerId, string planting /// /// /// - /// ID of the associated farmer resource. - /// ID of the planting data. - /// The request options. #pragma warning disable AZC0002 - public virtual Response Delete(string farmerId, string plantingDataId, RequestOptions options = null) + public virtual AsyncPageable ListByFarmerIdAsync(string farmerId, RequestOptions options, double? minAvgPlantingRate = null, double? maxAvgPlantingRate = null, double? minTotalMaterial = null, double? maxTotalMaterial = null, double? minAvgMaterial = null, double? maxAvgMaterial = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(farmerId, plantingDataId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PlantingDataClient.Delete"); - scope.Start(); - try + if (farmerId == null) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + throw new ArgumentNullException(nameof(farmerId)); } - catch (Exception e) + + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "PlantingDataClient.ListByFarmerId"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) { - scope.Failed(e); - throw; + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListByFarmerIdRequest(farmerId, minAvgPlantingRate, maxAvgPlantingRate, minTotalMaterial, maxTotalMaterial, minAvgMaterial, maxAvgMaterial, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListByFarmerIdNextPageRequest(nextLink, farmerId, minAvgPlantingRate, maxAvgPlantingRate, minTotalMaterial, maxTotalMaterial, minAvgMaterial, maxAvgMaterial, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - private HttpMessage CreateDeleteRequest(string farmerId, string plantingDataId) + /// Returns a paginated list of planting data resources under a particular farm. + /// ID of the associated farmer. + /// The request options. + /// Minimum AvgPlantingRate value(inclusive). + /// Maximum AvgPlantingRate value (inclusive). + /// Minimum TotalMaterial value(inclusive). + /// Maximum TotalMaterial value (inclusive). + /// Minimum AvgMaterial value(inclusive). + /// Maximum AvgMaterial value (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// is null. + /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// avgPlantingRate: { + /// unit: string, + /// value: number + /// }, + /// totalMaterial: Measure, + /// avgMaterial: Measure, + /// plantingProductDetails: [ + /// { + /// productName: string, + /// area: Measure, + /// totalMaterial: Measure, + /// avgMaterial: Measure + /// } + /// ], + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [Error], + /// innererror: { + /// code: string, + /// innererror: InnerError + /// } + /// }, + /// traceId: string + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual Pageable ListByFarmerId(string farmerId, RequestOptions options, double? minAvgPlantingRate = null, double? maxAvgPlantingRate = null, double? minTotalMaterial = null, double? maxTotalMaterial = null, double? minAvgMaterial = null, double? maxAvgMaterial = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) +#pragma warning restore AZC0002 { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/planting-data/", false); - uri.AppendPath(plantingDataId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; + if (farmerId == null) + { + throw new ArgumentNullException(nameof(farmerId)); + } + + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "PlantingDataClient.ListByFarmerId"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListByFarmerIdRequest(farmerId, minAvgPlantingRate, maxAvgPlantingRate, minTotalMaterial, maxTotalMaterial, minAvgMaterial, maxAvgMaterial, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListByFarmerIdNextPageRequest(nextLink, farmerId, minAvgPlantingRate, maxAvgPlantingRate, minTotalMaterial, maxTotalMaterial, minAvgMaterial, maxAvgMaterial, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + /// Returns a paginated list of planting data resources across all farmers. + /// The request options. + /// Minimum AvgPlantingRate value(inclusive). + /// Maximum AvgPlantingRate value (inclusive). + /// Minimum TotalMaterial value(inclusive). + /// Maximum TotalMaterial value (inclusive). + /// Minimum AvgMaterial value(inclusive). + /// Maximum AvgMaterial value (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// avgPlantingRate: { + /// unit: string, + /// value: number + /// }, + /// totalMaterial: Measure, + /// avgMaterial: Measure, + /// plantingProductDetails: [ + /// { + /// productName: string, + /// area: Measure, + /// totalMaterial: Measure, + /// avgMaterial: Measure + /// } + /// ], + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [Error], + /// innererror: { + /// code: string, + /// innererror: InnerError + /// } + /// }, + /// traceId: string + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual AsyncPageable ListAsync(RequestOptions options, double? minAvgPlantingRate = null, double? maxAvgPlantingRate = null, double? minTotalMaterial = null, double? maxTotalMaterial = null, double? minAvgMaterial = null, double? maxAvgMaterial = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) +#pragma warning restore AZC0002 + { + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "PlantingDataClient.List"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListRequest(minAvgPlantingRate, maxAvgPlantingRate, minTotalMaterial, maxTotalMaterial, minAvgMaterial, maxAvgMaterial, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListNextPageRequest(nextLink, minAvgPlantingRate, maxAvgPlantingRate, minTotalMaterial, maxTotalMaterial, minAvgMaterial, maxAvgMaterial, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + /// Returns a paginated list of planting data resources across all farmers. + /// The request options. + /// Minimum AvgPlantingRate value(inclusive). + /// Maximum AvgPlantingRate value (inclusive). + /// Minimum TotalMaterial value(inclusive). + /// Maximum TotalMaterial value (inclusive). + /// Minimum AvgMaterial value(inclusive). + /// Maximum AvgMaterial value (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// avgPlantingRate: { + /// unit: string, + /// value: number + /// }, + /// totalMaterial: Measure, + /// avgMaterial: Measure, + /// plantingProductDetails: [ + /// { + /// productName: string, + /// area: Measure, + /// totalMaterial: Measure, + /// avgMaterial: Measure + /// } + /// ], + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [Error], + /// innererror: { + /// code: string, + /// innererror: InnerError + /// } + /// }, + /// traceId: string + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual Pageable List(RequestOptions options, double? minAvgPlantingRate = null, double? maxAvgPlantingRate = null, double? minTotalMaterial = null, double? maxTotalMaterial = null, double? minAvgMaterial = null, double? maxAvgMaterial = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) +#pragma warning restore AZC0002 + { + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "PlantingDataClient.List"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListRequest(minAvgPlantingRate, maxAvgPlantingRate, minTotalMaterial, maxTotalMaterial, minAvgMaterial, maxAvgMaterial, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListNextPageRequest(nextLink, minAvgPlantingRate, maxAvgPlantingRate, minTotalMaterial, maxTotalMaterial, minAvgMaterial, maxAvgMaterial, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + internal HttpMessage CreateListByFarmerIdRequest(string farmerId, double? minAvgPlantingRate, double? maxAvgPlantingRate, double? minTotalMaterial, double? maxTotalMaterial, double? minAvgMaterial, double? maxAvgMaterial, IEnumerable sources, IEnumerable associatedBoundaryIds, IEnumerable operationBoundaryIds, DateTimeOffset? minOperationStartDateTime, DateTimeOffset? maxOperationStartDateTime, DateTimeOffset? minOperationEndDateTime, DateTimeOffset? maxOperationEndDateTime, DateTimeOffset? minOperationModifiedDateTime, DateTimeOffset? maxOperationModifiedDateTime, double? minArea, double? maxArea, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/planting-data", false); + if (minAvgPlantingRate != null) + { + uri.AppendQuery("minAvgPlantingRate", minAvgPlantingRate.Value, true); + } + if (maxAvgPlantingRate != null) + { + uri.AppendQuery("maxAvgPlantingRate", maxAvgPlantingRate.Value, true); + } + if (minTotalMaterial != null) + { + uri.AppendQuery("minTotalMaterial", minTotalMaterial.Value, true); + } + if (maxTotalMaterial != null) + { + uri.AppendQuery("maxTotalMaterial", maxTotalMaterial.Value, true); + } + if (minAvgMaterial != null) + { + uri.AppendQuery("minAvgMaterial", minAvgMaterial.Value, true); + } + if (maxAvgMaterial != null) + { + uri.AppendQuery("maxAvgMaterial", maxAvgMaterial.Value, true); + } + if (sources != null) + { + foreach (var param in sources) + { + uri.AppendQuery("sources", param, true); + } + } + if (associatedBoundaryIds != null) + { + foreach (var param in associatedBoundaryIds) + { + uri.AppendQuery("associatedBoundaryIds", param, true); + } + } + if (operationBoundaryIds != null) + { + foreach (var param in operationBoundaryIds) + { + uri.AppendQuery("operationBoundaryIds", param, true); + } + } + if (minOperationStartDateTime != null) + { + uri.AppendQuery("minOperationStartDateTime", minOperationStartDateTime.Value, "O", true); + } + if (maxOperationStartDateTime != null) + { + uri.AppendQuery("maxOperationStartDateTime", maxOperationStartDateTime.Value, "O", true); + } + if (minOperationEndDateTime != null) + { + uri.AppendQuery("minOperationEndDateTime", minOperationEndDateTime.Value, "O", true); + } + if (maxOperationEndDateTime != null) + { + uri.AppendQuery("maxOperationEndDateTime", maxOperationEndDateTime.Value, "O", true); + } + if (minOperationModifiedDateTime != null) + { + uri.AppendQuery("minOperationModifiedDateTime", minOperationModifiedDateTime.Value, "O", true); + } + if (maxOperationModifiedDateTime != null) + { + uri.AppendQuery("maxOperationModifiedDateTime", maxOperationModifiedDateTime.Value, "O", true); + } + if (minArea != null) + { + uri.AppendQuery("minArea", minArea.Value, true); + } + if (maxArea != null) + { + uri.AppendQuery("maxArea", maxArea.Value, true); + } + if (ids != null) + { + foreach (var param in ids) + { + uri.AppendQuery("ids", param, true); + } + } + if (names != null) + { + foreach (var param in names) + { + uri.AppendQuery("names", param, true); + } + } + if (propertyFilters != null) + { + foreach (var param in propertyFilters) + { + uri.AppendQuery("propertyFilters", param, true); + } + } + if (statuses != null) + { + foreach (var param in statuses) + { + uri.AppendQuery("statuses", param, true); + } + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateListRequest(double? minAvgPlantingRate, double? maxAvgPlantingRate, double? minTotalMaterial, double? maxTotalMaterial, double? minAvgMaterial, double? maxAvgMaterial, IEnumerable sources, IEnumerable associatedBoundaryIds, IEnumerable operationBoundaryIds, DateTimeOffset? minOperationStartDateTime, DateTimeOffset? maxOperationStartDateTime, DateTimeOffset? minOperationEndDateTime, DateTimeOffset? maxOperationEndDateTime, DateTimeOffset? minOperationModifiedDateTime, DateTimeOffset? maxOperationModifiedDateTime, double? minArea, double? maxArea, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/planting-data", false); + if (minAvgPlantingRate != null) + { + uri.AppendQuery("minAvgPlantingRate", minAvgPlantingRate.Value, true); + } + if (maxAvgPlantingRate != null) + { + uri.AppendQuery("maxAvgPlantingRate", maxAvgPlantingRate.Value, true); + } + if (minTotalMaterial != null) + { + uri.AppendQuery("minTotalMaterial", minTotalMaterial.Value, true); + } + if (maxTotalMaterial != null) + { + uri.AppendQuery("maxTotalMaterial", maxTotalMaterial.Value, true); + } + if (minAvgMaterial != null) + { + uri.AppendQuery("minAvgMaterial", minAvgMaterial.Value, true); + } + if (maxAvgMaterial != null) + { + uri.AppendQuery("maxAvgMaterial", maxAvgMaterial.Value, true); + } + if (sources != null) + { + foreach (var param in sources) + { + uri.AppendQuery("sources", param, true); + } + } + if (associatedBoundaryIds != null) + { + foreach (var param in associatedBoundaryIds) + { + uri.AppendQuery("associatedBoundaryIds", param, true); + } + } + if (operationBoundaryIds != null) + { + foreach (var param in operationBoundaryIds) + { + uri.AppendQuery("operationBoundaryIds", param, true); + } + } + if (minOperationStartDateTime != null) + { + uri.AppendQuery("minOperationStartDateTime", minOperationStartDateTime.Value, "O", true); + } + if (maxOperationStartDateTime != null) + { + uri.AppendQuery("maxOperationStartDateTime", maxOperationStartDateTime.Value, "O", true); + } + if (minOperationEndDateTime != null) + { + uri.AppendQuery("minOperationEndDateTime", minOperationEndDateTime.Value, "O", true); + } + if (maxOperationEndDateTime != null) + { + uri.AppendQuery("maxOperationEndDateTime", maxOperationEndDateTime.Value, "O", true); + } + if (minOperationModifiedDateTime != null) + { + uri.AppendQuery("minOperationModifiedDateTime", minOperationModifiedDateTime.Value, "O", true); + } + if (maxOperationModifiedDateTime != null) + { + uri.AppendQuery("maxOperationModifiedDateTime", maxOperationModifiedDateTime.Value, "O", true); + } + if (minArea != null) + { + uri.AppendQuery("minArea", minArea.Value, true); + } + if (maxArea != null) + { + uri.AppendQuery("maxArea", maxArea.Value, true); + } + if (ids != null) + { + foreach (var param in ids) + { + uri.AppendQuery("ids", param, true); + } + } + if (names != null) + { + foreach (var param in names) + { + uri.AppendQuery("names", param, true); + } + } + if (propertyFilters != null) + { + foreach (var param in propertyFilters) + { + uri.AppendQuery("propertyFilters", param, true); + } + } + if (statuses != null) + { + foreach (var param in statuses) + { + uri.AppendQuery("statuses", param, true); + } + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetRequest(string farmerId, string plantingDataId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/planting-data/", false); + uri.AppendPath(plantingDataId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string farmerId, string plantingDataId, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/planting-data/", false); + uri.AppendPath(plantingDataId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/merge-patch+json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200201.Instance; + return message; + } + + internal HttpMessage CreateDeleteRequest(string farmerId, string plantingDataId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/planting-data/", false); + uri.AppendPath(plantingDataId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier204.Instance; + return message; + } + + internal HttpMessage CreateListByFarmerIdNextPageRequest(string nextLink, string farmerId, double? minAvgPlantingRate, double? maxAvgPlantingRate, double? minTotalMaterial, double? maxTotalMaterial, double? minAvgMaterial, double? maxAvgMaterial, IEnumerable sources, IEnumerable associatedBoundaryIds, IEnumerable operationBoundaryIds, DateTimeOffset? minOperationStartDateTime, DateTimeOffset? maxOperationStartDateTime, DateTimeOffset? minOperationEndDateTime, DateTimeOffset? maxOperationEndDateTime, DateTimeOffset? minOperationModifiedDateTime, DateTimeOffset? maxOperationModifiedDateTime, double? minArea, double? maxArea, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, double? minAvgPlantingRate, double? maxAvgPlantingRate, double? minTotalMaterial, double? maxTotalMaterial, double? minAvgMaterial, double? maxAvgMaterial, IEnumerable sources, IEnumerable associatedBoundaryIds, IEnumerable operationBoundaryIds, DateTimeOffset? minOperationStartDateTime, DateTimeOffset? maxOperationStartDateTime, DateTimeOffset? minOperationEndDateTime, DateTimeOffset? maxOperationEndDateTime, DateTimeOffset? minOperationModifiedDateTime, DateTimeOffset? maxOperationModifiedDateTime, double? minArea, double? maxArea, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier200201 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200201(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + 201 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier204 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier204(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 204 => false, + _ => true + }; + } } } } diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/ScenesClient.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/ScenesClient.cs index 62329aac54fd9..c1a62b5454889 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/ScenesClient.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/ScenesClient.cs @@ -7,6 +7,8 @@ using System; using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; @@ -17,14 +19,16 @@ namespace Azure.Verticals.AgriFood.Farming /// The Scenes service client. public partial class ScenesClient { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of ScenesClient for mocking. protected ScenesClient() @@ -35,6 +39,7 @@ protected ScenesClient() /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. + /// or is null. public ScenesClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) { if (endpoint == null) @@ -47,46 +52,111 @@ public ScenesClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOpt } options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); _tokenCredential = credential; - var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); - _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { authPolicy }, new ResponseClassifier()); - this.endpoint = endpoint; - apiVersion = options.Version; + _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; } - /// Returns a paginated list of scene resources. + /// Get a satellite data ingestion job. + /// ID of the job. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// sceneDateTime: string (ISO 8601 Format), - /// provider: string, - /// source: string, - /// imageFiles: [ - /// { - /// fileLink: string, - /// name: string, - /// imageFormat: "TIF", - /// resolution: number - /// } - /// ], - /// imageFormat: "TIF", - /// cloudCoverPercentage: number, - /// darkPixelPercentage: number, - /// ndviMedianValue: number, - /// boundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string + /// farmerId: string, + /// boundaryId: string, + /// startDateTime: string (ISO 8601 Format), + /// endDateTime: string (ISO 8601 Format), + /// provider: "Microsoft", + /// source: "Sentinel_2_L2A", + /// data: { + /// imageNames: [string], + /// imageFormats: [string], + /// imageResolutions: [number] + /// }, + /// id: string, + /// status: string, + /// durationInSeconds: number, + /// message: string, + /// createdDateTime: string (ISO 8601 Format), + /// lastActionDateTime: string (ISO 8601 Format), + /// startTime: string (ISO 8601 Format), + /// endTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [Error], + /// innererror: { + /// code: string, + /// innererror: InnerError /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// }, + /// traceId: string /// } /// /// + /// +#pragma warning disable AZC0002 + public virtual async Task GetSatelliteDataIngestionJobDetailsAsync(string jobId, RequestOptions options) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("ScenesClient.GetSatelliteDataIngestionJobDetails"); + scope.Start(); + try + { + using HttpMessage message = CreateGetSatelliteDataIngestionJobDetailsRequest(jobId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get a satellite data ingestion job. + /// ID of the job. + /// The request options. + /// is null. + /// + /// Schema for Response Body: + /// { + /// farmerId: string, + /// boundaryId: string, + /// startDateTime: string (ISO 8601 Format), + /// endDateTime: string (ISO 8601 Format), + /// provider: "Microsoft", + /// source: "Sentinel_2_L2A", + /// data: { + /// imageNames: [string], + /// imageFormats: [string], + /// imageResolutions: [number] + /// }, + /// id: string, + /// status: string, + /// durationInSeconds: number, + /// message: string, + /// createdDateTime: string (ISO 8601 Format), + /// lastActionDateTime: string (ISO 8601 Format), + /// startTime: string (ISO 8601 Format), + /// endTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// /// Schema for Response Error: /// { /// error: { @@ -104,49 +174,96 @@ public ScenesClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOpt /// /// /// - /// Provider name of scene data. - /// FarmerId. - /// BoundaryId. - /// Source name of scene data, default value Sentinel_2_L2A (Sentinel 2 L2A). - /// Scene start UTC datetime (inclusive), sample format: yyyy-MM-ddThh:mm:ssZ. - /// Scene end UTC datetime (inclusive), sample format: yyyy-MM-dThh:mm:ssZ. - /// Filter scenes with cloud coverage percentage less than max value. Range [0 to 100.0]. - /// Filter scenes with dark pixel coverage percentage less than max value. Range [0 to 100.0]. - /// List of image names to be filtered. - /// List of image resolutions in meters to be filtered. - /// List of image formats to be filtered. - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. +#pragma warning disable AZC0002 + public virtual Response GetSatelliteDataIngestionJobDetails(string jobId, RequestOptions options) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("ScenesClient.GetSatelliteDataIngestionJobDetails"); + scope.Start(); + try + { + using HttpMessage message = CreateGetSatelliteDataIngestionJobDetailsRequest(jobId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Downloads and returns file stream as response for the given input filePath. + /// cloud storage path of scene file. /// The request options. + /// is null. + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [Error], + /// innererror: { + /// code: string, + /// innererror: InnerError + /// } + /// }, + /// traceId: string + /// } + /// + /// + /// #pragma warning disable AZC0002 - public virtual async Task ListAsync(string provider, string farmerId, string boundaryId, string source = null, DateTimeOffset? startDateTime = null, DateTimeOffset? endDateTime = null, double? maxCloudCoveragePercentage = null, double? maxDarkPixelCoveragePercentage = null, IEnumerable imageNames = null, IEnumerable imageResolutions = null, IEnumerable imageFormats = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual async Task DownloadAsync(string filePath, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRequest(provider, farmerId, boundaryId, source, startDateTime, endDateTime, maxCloudCoveragePercentage, maxDarkPixelCoveragePercentage, imageNames, imageResolutions, imageFormats, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("ScenesClient.List"); + using var scope = _clientDiagnostics.CreateScope("ScenesClient.Download"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDownloadRequest(filePath); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Downloads and returns file stream as response for the given input filePath. + /// cloud storage path of scene file. + /// The request options. + /// is null. + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [Error], + /// innererror: { + /// code: string, + /// innererror: InnerError + /// } + /// }, + /// traceId: string + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual Response Download(string filePath, RequestOptions options) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("ScenesClient.Download"); + scope.Start(); + try + { + using HttpMessage message = CreateDownloadRequest(filePath); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -156,6 +273,24 @@ public virtual async Task ListAsync(string provider, string farmerId, } /// Returns a paginated list of scene resources. + /// Provider name of scene data. + /// FarmerId. + /// BoundaryId. + /// The request options. + /// Source name of scene data, default value Sentinel_2_L2A (Sentinel 2 L2A). + /// Scene start UTC datetime (inclusive), sample format: yyyy-MM-ddThh:mm:ssZ. + /// Scene end UTC datetime (inclusive), sample format: yyyy-MM-dThh:mm:ssZ. + /// Filter scenes with cloud coverage percentage less than max value. Range [0 to 100.0]. + /// Filter scenes with dark pixel coverage percentage less than max value. Range [0 to 100.0]. + /// List of image names to be filtered. + /// List of image resolutions in meters to be filtered. + /// List of image formats to be filtered. + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// , , or is null. /// /// Schema for Response Body: /// { @@ -186,7 +321,6 @@ public virtual async Task ListAsync(string provider, string farmerId, /// nextLink: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -204,9 +338,43 @@ public virtual async Task ListAsync(string provider, string farmerId, /// /// /// +#pragma warning disable AZC0002 + public virtual AsyncPageable ListAsync(string provider, string farmerId, string boundaryId, RequestOptions options, string source = null, DateTimeOffset? startDateTime = null, DateTimeOffset? endDateTime = null, double? maxCloudCoveragePercentage = null, double? maxDarkPixelCoveragePercentage = null, IEnumerable imageNames = null, IEnumerable imageResolutions = null, IEnumerable imageFormats = null, int? maxPageSize = null, string skipToken = null) +#pragma warning restore AZC0002 + { + if (provider == null) + { + throw new ArgumentNullException(nameof(provider)); + } + if (farmerId == null) + { + throw new ArgumentNullException(nameof(farmerId)); + } + if (boundaryId == null) + { + throw new ArgumentNullException(nameof(boundaryId)); + } + + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "ScenesClient.List"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListRequest(provider, farmerId, boundaryId, source, startDateTime, endDateTime, maxCloudCoveragePercentage, maxDarkPixelCoveragePercentage, imageNames, imageResolutions, imageFormats, maxPageSize, skipToken) + : CreateListNextPageRequest(nextLink, provider, farmerId, boundaryId, source, startDateTime, endDateTime, maxCloudCoveragePercentage, maxDarkPixelCoveragePercentage, imageNames, imageResolutions, imageFormats, maxPageSize, skipToken); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + /// Returns a paginated list of scene resources. /// Provider name of scene data. /// FarmerId. /// BoundaryId. + /// The request options. /// Source name of scene data, default value Sentinel_2_L2A (Sentinel 2 L2A). /// Scene start UTC datetime (inclusive), sample format: yyyy-MM-ddThh:mm:ssZ. /// Scene end UTC datetime (inclusive), sample format: yyyy-MM-dThh:mm:ssZ. @@ -220,154 +388,37 @@ public virtual async Task ListAsync(string provider, string farmerId, /// Minimum = 10, Maximum = 1000, Default value = 50. /// /// Skip token for getting next set of results. - /// The request options. -#pragma warning disable AZC0002 - public virtual Response List(string provider, string farmerId, string boundaryId, string source = null, DateTimeOffset? startDateTime = null, DateTimeOffset? endDateTime = null, double? maxCloudCoveragePercentage = null, double? maxDarkPixelCoveragePercentage = null, IEnumerable imageNames = null, IEnumerable imageResolutions = null, IEnumerable imageFormats = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) -#pragma warning restore AZC0002 - { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRequest(provider, farmerId, boundaryId, source, startDateTime, endDateTime, maxCloudCoveragePercentage, maxDarkPixelCoveragePercentage, imageNames, imageResolutions, imageFormats, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("ScenesClient.List"); - scope.Start(); - try - { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - private HttpMessage CreateListRequest(string provider, string farmerId, string boundaryId, string source, DateTimeOffset? startDateTime, DateTimeOffset? endDateTime, double? maxCloudCoveragePercentage, double? maxDarkPixelCoveragePercentage, IEnumerable imageNames, IEnumerable imageResolutions, IEnumerable imageFormats, int? maxPageSize, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/scenes", false); - uri.AppendQuery("provider", provider, true); - uri.AppendQuery("farmerId", farmerId, true); - uri.AppendQuery("boundaryId", boundaryId, true); - if (source != null) - { - uri.AppendQuery("source", source, true); - } - if (startDateTime != null) - { - uri.AppendQuery("startDateTime", startDateTime.Value, "O", true); - } - if (endDateTime != null) - { - uri.AppendQuery("endDateTime", endDateTime.Value, "O", true); - } - if (maxCloudCoveragePercentage != null) - { - uri.AppendQuery("maxCloudCoveragePercentage", maxCloudCoveragePercentage.Value, true); - } - if (maxDarkPixelCoveragePercentage != null) - { - uri.AppendQuery("maxDarkPixelCoveragePercentage", maxDarkPixelCoveragePercentage.Value, true); - } - if (imageNames != null) - { - uri.AppendQueryDelimited("imageNames", imageNames, ",", true); - } - if (imageResolutions != null) - { - uri.AppendQueryDelimited("imageResolutions", imageResolutions, ",", true); - } - if (imageFormats != null) - { - uri.AppendQueryDelimited("imageFormats", imageFormats, ",", true); - } - if (maxPageSize != null) - { - uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Create a satellite data ingestion job. + /// , , or is null. /// - /// Schema for Request Body: - /// { - /// farmerId: string (required), - /// boundaryId: string (required), - /// startDateTime: string (ISO 8601 Format) (required), - /// endDateTime: string (ISO 8601 Format) (required), - /// provider: "Microsoft", - /// source: "Sentinel_2_L2A", - /// data: { - /// imageNames: [string], - /// imageFormats: [string], - /// imageResolutions: [number] - /// }, - /// id: string, - /// status: string, - /// durationInSeconds: number, - /// message: string, - /// createdDateTime: string (ISO 8601 Format), - /// lastActionDateTime: string (ISO 8601 Format), - /// startTime: string (ISO 8601 Format), - /// endTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// /// Schema for Response Body: /// { - /// farmerId: string, - /// boundaryId: string, - /// startDateTime: string (ISO 8601 Format), - /// endDateTime: string (ISO 8601 Format), - /// provider: "Microsoft", - /// source: "Sentinel_2_L2A", - /// data: { - /// imageNames: [string], - /// imageFormats: [string], - /// imageResolutions: [number] - /// }, - /// id: string, - /// status: string, - /// durationInSeconds: number, - /// message: string, - /// createdDateTime: string (ISO 8601 Format), - /// lastActionDateTime: string (ISO 8601 Format), - /// startTime: string (ISO 8601 Format), - /// endTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// value: [ + /// { + /// sceneDateTime: string (ISO 8601 Format), + /// provider: string, + /// source: string, + /// imageFiles: [ + /// { + /// fileLink: string, + /// name: string, + /// imageFormat: "TIF", + /// resolution: number + /// } + /// ], + /// imageFormat: "TIF", + /// cloudCoverPercentage: number, + /// darkPixelPercentage: number, + /// ndviMedianValue: number, + /// boundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string + /// } + /// ], + /// $skipToken: string, + /// nextLink: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -385,44 +436,43 @@ private HttpMessage CreateListRequest(string provider, string farmerId, string b /// /// /// - /// JobId provided by user. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task> CreateSatelliteDataIngestionJobAsync(string jobId, RequestContent content, RequestOptions options = null) + public virtual Pageable List(string provider, string farmerId, string boundaryId, RequestOptions options, string source = null, DateTimeOffset? startDateTime = null, DateTimeOffset? endDateTime = null, double? maxCloudCoveragePercentage = null, double? maxDarkPixelCoveragePercentage = null, IEnumerable imageNames = null, IEnumerable imageResolutions = null, IEnumerable imageFormats = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateSatelliteDataIngestionJobRequest(jobId, content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("ScenesClient.CreateSatelliteDataIngestionJob"); - scope.Start(); - try + if (provider == null) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "ScenesClient.CreateSatelliteDataIngestionJob"); - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "ScenesClient.CreateSatelliteDataIngestionJob"); - } + throw new ArgumentNullException(nameof(provider)); } - catch (Exception e) + if (farmerId == null) + { + throw new ArgumentNullException(nameof(farmerId)); + } + if (boundaryId == null) + { + throw new ArgumentNullException(nameof(boundaryId)); + } + + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "ScenesClient.List"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) { - scope.Failed(e); - throw; + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListRequest(provider, farmerId, boundaryId, source, startDateTime, endDateTime, maxCloudCoveragePercentage, maxDarkPixelCoveragePercentage, imageNames, imageResolutions, imageFormats, maxPageSize, skipToken) + : CreateListNextPageRequest(nextLink, provider, farmerId, boundaryId, source, startDateTime, endDateTime, maxCloudCoveragePercentage, maxDarkPixelCoveragePercentage, imageNames, imageResolutions, imageFormats, maxPageSize, skipToken); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } /// Create a satellite data ingestion job. + /// JobId provided by user. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -450,7 +500,6 @@ public virtual async Task> CreateSatelliteDataIngestionJob /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Body: /// { /// farmerId: string, @@ -477,7 +526,6 @@ public virtual async Task> CreateSatelliteDataIngestionJob /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -495,35 +543,16 @@ public virtual async Task> CreateSatelliteDataIngestionJob /// /// /// - /// JobId provided by user. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual Operation CreateSatelliteDataIngestionJob(string jobId, RequestContent content, RequestOptions options = null) + public virtual async Task> CreateSatelliteDataIngestionJobAsync(string jobId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateSatelliteDataIngestionJobRequest(jobId, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("ScenesClient.CreateSatelliteDataIngestionJob"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "ScenesClient.CreateSatelliteDataIngestionJob"); - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "ScenesClient.CreateSatelliteDataIngestionJob"); - } + using HttpMessage message = CreateCreateSatelliteDataIngestionJobRequest(jobId, content); + return await LowLevelOperationHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, "ScenesClient.CreateSatelliteDataIngestionJob", OperationFinalStateVia.Location, options).ConfigureAwait(false); } catch (Exception e) { @@ -532,31 +561,18 @@ public virtual Operation CreateSatelliteDataIngestionJob(string jobI } } - private HttpMessage CreateCreateSatelliteDataIngestionJobRequest(string jobId, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/scenes/satellite/ingest-data/", false); - uri.AppendPath(jobId, 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; - } - - /// Get a satellite data ingestion job. + /// Create a satellite data ingestion job. + /// JobId provided by user. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// - /// Schema for Response Body: + /// Schema for Request Body: /// { - /// farmerId: string, - /// boundaryId: string, - /// startDateTime: string (ISO 8601 Format), - /// endDateTime: string (ISO 8601 Format), + /// farmerId: string (required), + /// boundaryId: string (required), + /// startDateTime: string (ISO 8601 Format) (required), + /// endDateTime: string (ISO 8601 Format) (required), /// provider: "Microsoft", /// source: "Sentinel_2_L2A", /// data: { @@ -577,62 +593,6 @@ private HttpMessage CreateCreateSatelliteDataIngestionJobRequest(string jobId, R /// properties: Dictionary<string, AnyObject> /// } /// - /// - /// Schema for Response Error: - /// { - /// error: { - /// code: string, - /// message: string, - /// target: string, - /// details: [Error], - /// innererror: { - /// code: string, - /// innererror: InnerError - /// } - /// }, - /// traceId: string - /// } - /// - /// - /// - /// ID of the job. - /// The request options. -#pragma warning disable AZC0002 - public virtual async Task GetSatelliteDataIngestionJobDetailsAsync(string jobId, RequestOptions options = null) -#pragma warning restore AZC0002 - { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetSatelliteDataIngestionJobDetailsRequest(jobId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("ScenesClient.GetSatelliteDataIngestionJobDetails"); - scope.Start(); - try - { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get a satellite data ingestion job. - /// /// Schema for Response Body: /// { /// farmerId: string, @@ -659,7 +619,6 @@ public virtual async Task GetSatelliteDataIngestionJobDetailsAsync(str /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -677,34 +636,16 @@ public virtual async Task GetSatelliteDataIngestionJobDetailsAsync(str /// /// /// - /// ID of the job. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetSatelliteDataIngestionJobDetails(string jobId, RequestOptions options = null) + public virtual Operation CreateSatelliteDataIngestionJob(string jobId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetSatelliteDataIngestionJobDetailsRequest(jobId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("ScenesClient.GetSatelliteDataIngestionJobDetails"); + using var scope = _clientDiagnostics.CreateScope("ScenesClient.CreateSatelliteDataIngestionJob"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateSatelliteDataIngestionJobRequest(jobId, content); + return LowLevelOperationHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, "ScenesClient.CreateSatelliteDataIngestionJob", OperationFinalStateVia.Location, options); } catch (Exception e) { @@ -713,144 +654,162 @@ public virtual Response GetSatelliteDataIngestionJobDetails(string jobId, Reques } } - private HttpMessage CreateGetSatelliteDataIngestionJobDetailsRequest(string jobId) + internal HttpMessage CreateListRequest(string provider, string farmerId, string boundaryId, string source, DateTimeOffset? startDateTime, DateTimeOffset? endDateTime, double? maxCloudCoveragePercentage, double? maxDarkPixelCoveragePercentage, IEnumerable imageNames, IEnumerable imageResolutions, IEnumerable imageFormats, int? maxPageSize, string skipToken) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/scenes/satellite/ingest-data/", false); - uri.AppendPath(jobId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Downloads and returns file stream as response for the given input filePath. - /// - /// Schema for Response Error: - /// { - /// error: { - /// code: string, - /// message: string, - /// target: string, - /// details: [Error], - /// innererror: { - /// code: string, - /// innererror: InnerError - /// } - /// }, - /// traceId: string - /// } - /// - /// - /// - /// cloud storage path of scene file. - /// The request options. -#pragma warning disable AZC0002 - public virtual async Task DownloadAsync(string filePath, RequestOptions options = null) -#pragma warning restore AZC0002 - { - options ??= new RequestOptions(); - using HttpMessage message = CreateDownloadRequest(filePath); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("ScenesClient.Download"); - scope.Start(); - try + uri.Reset(_endpoint); + uri.AppendPath("/scenes", false); + uri.AppendQuery("provider", provider, true); + uri.AppendQuery("farmerId", farmerId, true); + uri.AppendQuery("boundaryId", boundaryId, true); + if (source != null) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + uri.AppendQuery("source", source, true); } - catch (Exception e) + if (startDateTime != null) { - scope.Failed(e); - throw; + uri.AppendQuery("startDateTime", startDateTime.Value, "O", true); } - } - - /// Downloads and returns file stream as response for the given input filePath. - /// - /// Schema for Response Error: - /// { - /// error: { - /// code: string, - /// message: string, - /// target: string, - /// details: [Error], - /// innererror: { - /// code: string, - /// innererror: InnerError - /// } - /// }, - /// traceId: string - /// } - /// - /// - /// - /// cloud storage path of scene file. - /// The request options. -#pragma warning disable AZC0002 - public virtual Response Download(string filePath, RequestOptions options = null) -#pragma warning restore AZC0002 - { - options ??= new RequestOptions(); - using HttpMessage message = CreateDownloadRequest(filePath); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("ScenesClient.Download"); - scope.Start(); - try + if (endDateTime != null) + { + uri.AppendQuery("endDateTime", endDateTime.Value, "O", true); + } + if (maxCloudCoveragePercentage != null) + { + uri.AppendQuery("maxCloudCoveragePercentage", maxCloudCoveragePercentage.Value, true); + } + if (maxDarkPixelCoveragePercentage != null) + { + uri.AppendQuery("maxDarkPixelCoveragePercentage", maxDarkPixelCoveragePercentage.Value, true); + } + if (imageNames != null) + { + foreach (var param in imageNames) + { + uri.AppendQuery("imageNames", param, true); + } + } + if (imageResolutions != null) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) + foreach (var param in imageResolutions) { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } + uri.AppendQuery("imageResolutions", param, true); } - else + } + if (imageFormats != null) + { + foreach (var param in imageFormats) { - return message.Response; + uri.AppendQuery("imageFormats", param, true); } } - catch (Exception e) + if (maxPageSize != null) { - scope.Failed(e); - throw; + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateSatelliteDataIngestionJobRequest(string jobId, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/scenes/satellite/ingest-data/", false); + uri.AppendPath(jobId, 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; + message.ResponseClassifier = ResponseClassifier202.Instance; + return message; + } + + internal HttpMessage CreateGetSatelliteDataIngestionJobDetailsRequest(string jobId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/scenes/satellite/ingest-data/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; } - private HttpMessage CreateDownloadRequest(string filePath) + internal HttpMessage CreateDownloadRequest(string filePath) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); + uri.Reset(_endpoint); uri.AppendPath("/scenes/downloadFiles", false); uri.AppendQuery("filePath", filePath, true); - uri.AppendQuery("api-version", apiVersion, true); + uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/octet-stream, application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string provider, string farmerId, string boundaryId, string source, DateTimeOffset? startDateTime, DateTimeOffset? endDateTime, double? maxCloudCoveragePercentage, double? maxDarkPixelCoveragePercentage, IEnumerable imageNames, IEnumerable imageResolutions, IEnumerable imageFormats, int? maxPageSize, string skipToken) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; return message; } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier202 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier202(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 202 => false, + _ => true + }; + } + } } } diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/SeasonalFieldsClient.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/SeasonalFieldsClient.cs index fcbbd94ec8ef3..83a49ac38be50 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/SeasonalFieldsClient.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/SeasonalFieldsClient.cs @@ -7,6 +7,8 @@ using System; using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; @@ -17,14 +19,16 @@ namespace Azure.Verticals.AgriFood.Farming /// The SeasonalFields service client. public partial class SeasonalFieldsClient { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of SeasonalFieldsClient for mocking. protected SeasonalFieldsClient() @@ -35,6 +39,7 @@ protected SeasonalFieldsClient() /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. + /// or is null. public SeasonalFieldsClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) { if (endpoint == null) @@ -47,48 +52,45 @@ public SeasonalFieldsClient(Uri endpoint, TokenCredential credential, FarmBeatsC } options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); _tokenCredential = credential; - var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); - _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { authPolicy }, new ResponseClassifier()); - this.endpoint = endpoint; - apiVersion = options.Version; + _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; } - /// Returns a paginated list of seasonal field resources under a particular farmer. + /// Gets a specified seasonal field resource under a particular farmer. + /// ID of the associated farmer. + /// ID of the seasonal field. + /// The request options. + /// or is null. /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// farmerId: string, - /// primaryBoundaryId: string, - /// boundaryIds: [string], - /// farmId: string, - /// fieldId: string, - /// seasonId: string, - /// cropVarietyIds: [string], - /// cropId: string, - /// avgYieldValue: number, - /// avgYieldUnit: string, - /// avgSeedPopulationValue: number, - /// avgSeedPopulationUnit: string, - /// plantingDateTime: string (ISO 8601 Format), - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// farmerId: string, + /// primaryBoundaryId: string, + /// boundaryIds: [string], + /// farmId: string, + /// fieldId: string, + /// seasonId: string, + /// cropVarietyIds: [string], + /// cropId: string, + /// avgYieldValue: number, + /// avgYieldUnit: string, + /// avgSeedPopulationValue: number, + /// avgSeedPopulationUnit: string, + /// plantingDateTime: string (ISO 8601 Format), + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -106,63 +108,16 @@ public SeasonalFieldsClient(Uri endpoint, TokenCredential credential, FarmBeatsC /// /// /// - /// ID of the associated farmer. - /// Farm Ids of the resource. - /// Field Ids of the resource. - /// Season Ids of the resource. - /// CropVarietyIds of the resource. - /// Ids of the crop it belongs to. - /// Minimum average yield value of the seasonal field(inclusive). - /// Maximum average yield value of the seasonal field(inclusive). - /// Unit of the average yield value attribute. - /// Minimum average seed population value of the seasonal field(inclusive). - /// Maximum average seed population value of the seasonal field(inclusive). - /// Unit of average seed population value attribute. - /// Minimum planting datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. - /// Maximum planting datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task ListByFarmerIdAsync(string farmerId, IEnumerable farmIds = null, IEnumerable fieldIds = null, IEnumerable seasonIds = null, IEnumerable cropVarietyIds = null, IEnumerable cropIds = null, double? minAvgYieldValue = null, double? maxAvgYieldValue = null, string avgYieldUnit = null, double? minAvgSeedPopulationValue = null, double? maxAvgSeedPopulationValue = null, string avgSeedPopulationUnit = null, DateTimeOffset? minPlantingDateTime = null, DateTimeOffset? maxPlantingDateTime = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual async Task GetAsync(string farmerId, string seasonalFieldId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListByFarmerIdRequest(farmerId, farmIds, fieldIds, seasonIds, cropVarietyIds, cropIds, minAvgYieldValue, maxAvgYieldValue, avgYieldUnit, minAvgSeedPopulationValue, maxAvgSeedPopulationValue, avgSeedPopulationUnit, minPlantingDateTime, maxPlantingDateTime, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.ListByFarmerId"); + using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.Get"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRequest(farmerId, seasonalFieldId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -171,40 +126,37 @@ public virtual async Task ListByFarmerIdAsync(string farmerId, IEnumer } } - /// Returns a paginated list of seasonal field resources under a particular farmer. + /// Gets a specified seasonal field resource under a particular farmer. + /// ID of the associated farmer. + /// ID of the seasonal field. + /// The request options. + /// or is null. /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// farmerId: string, - /// primaryBoundaryId: string, - /// boundaryIds: [string], - /// farmId: string, - /// fieldId: string, - /// seasonId: string, - /// cropVarietyIds: [string], - /// cropId: string, - /// avgYieldValue: number, - /// avgYieldUnit: string, - /// avgSeedPopulationValue: number, - /// avgSeedPopulationUnit: string, - /// plantingDateTime: string (ISO 8601 Format), - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// farmerId: string, + /// primaryBoundaryId: string, + /// boundaryIds: [string], + /// farmId: string, + /// fieldId: string, + /// seasonId: string, + /// cropVarietyIds: [string], + /// cropId: string, + /// avgYieldValue: number, + /// avgYieldUnit: string, + /// avgSeedPopulationValue: number, + /// avgSeedPopulationUnit: string, + /// plantingDateTime: string (ISO 8601 Format), + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -222,63 +174,16 @@ public virtual async Task ListByFarmerIdAsync(string farmerId, IEnumer /// /// /// - /// ID of the associated farmer. - /// Farm Ids of the resource. - /// Field Ids of the resource. - /// Season Ids of the resource. - /// CropVarietyIds of the resource. - /// Ids of the crop it belongs to. - /// Minimum average yield value of the seasonal field(inclusive). - /// Maximum average yield value of the seasonal field(inclusive). - /// Unit of the average yield value attribute. - /// Minimum average seed population value of the seasonal field(inclusive). - /// Maximum average seed population value of the seasonal field(inclusive). - /// Unit of average seed population value attribute. - /// Minimum planting datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. - /// Maximum planting datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual Response ListByFarmerId(string farmerId, IEnumerable farmIds = null, IEnumerable fieldIds = null, IEnumerable seasonIds = null, IEnumerable cropVarietyIds = null, IEnumerable cropIds = null, double? minAvgYieldValue = null, double? maxAvgYieldValue = null, string avgYieldUnit = null, double? minAvgSeedPopulationValue = null, double? maxAvgSeedPopulationValue = null, string avgSeedPopulationUnit = null, DateTimeOffset? minPlantingDateTime = null, DateTimeOffset? maxPlantingDateTime = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual Response Get(string farmerId, string seasonalFieldId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListByFarmerIdRequest(farmerId, farmIds, fieldIds, seasonIds, cropVarietyIds, cropIds, minAvgYieldValue, maxAvgYieldValue, avgYieldUnit, minAvgSeedPopulationValue, maxAvgSeedPopulationValue, avgSeedPopulationUnit, minPlantingDateTime, maxPlantingDateTime, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.ListByFarmerId"); + using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.Get"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRequest(farmerId, seasonalFieldId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -287,148 +192,63 @@ public virtual Response ListByFarmerId(string farmerId, IEnumerable farm } } - private HttpMessage CreateListByFarmerIdRequest(string farmerId, IEnumerable farmIds, IEnumerable fieldIds, IEnumerable seasonIds, IEnumerable cropVarietyIds, IEnumerable cropIds, double? minAvgYieldValue, double? maxAvgYieldValue, string avgYieldUnit, double? minAvgSeedPopulationValue, double? maxAvgSeedPopulationValue, string avgSeedPopulationUnit, DateTimeOffset? minPlantingDateTime, DateTimeOffset? maxPlantingDateTime, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/seasonal-fields", false); - if (farmIds != null) - { - uri.AppendQueryDelimited("farmIds", farmIds, ",", true); - } - if (fieldIds != null) - { - uri.AppendQueryDelimited("fieldIds", fieldIds, ",", true); - } - if (seasonIds != null) - { - uri.AppendQueryDelimited("seasonIds", seasonIds, ",", true); - } - if (cropVarietyIds != null) - { - uri.AppendQueryDelimited("cropVarietyIds", cropVarietyIds, ",", true); - } - if (cropIds != null) - { - uri.AppendQueryDelimited("cropIds", cropIds, ",", true); - } - if (minAvgYieldValue != null) - { - uri.AppendQuery("minAvgYieldValue", minAvgYieldValue.Value, true); - } - if (maxAvgYieldValue != null) - { - uri.AppendQuery("maxAvgYieldValue", maxAvgYieldValue.Value, true); - } - if (avgYieldUnit != null) - { - uri.AppendQuery("avgYieldUnit", avgYieldUnit, true); - } - if (minAvgSeedPopulationValue != null) - { - uri.AppendQuery("minAvgSeedPopulationValue", minAvgSeedPopulationValue.Value, true); - } - if (maxAvgSeedPopulationValue != null) - { - uri.AppendQuery("maxAvgSeedPopulationValue", maxAvgSeedPopulationValue.Value, true); - } - if (avgSeedPopulationUnit != null) - { - uri.AppendQuery("avgSeedPopulationUnit", avgSeedPopulationUnit, true); - } - if (minPlantingDateTime != null) - { - uri.AppendQuery("minPlantingDateTime", minPlantingDateTime.Value, "O", true); - } - if (maxPlantingDateTime != null) - { - uri.AppendQuery("maxPlantingDateTime", maxPlantingDateTime.Value, "O", true); - } - if (ids != null) - { - uri.AppendQueryDelimited("ids", ids, ",", true); - } - if (names != null) - { - uri.AppendQueryDelimited("names", names, ",", true); - } - if (propertyFilters != null) - { - uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); - } - if (statuses != null) - { - uri.AppendQueryDelimited("statuses", statuses, ",", true); - } - if (minCreatedDateTime != null) - { - uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); - } - if (maxCreatedDateTime != null) - { - uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); - } - if (minLastModifiedDateTime != null) - { - uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); - } - if (maxLastModifiedDateTime != null) - { - uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); - } - if (maxPageSize != null) - { - uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Returns a paginated list of seasonal field resources across all farmers. + /// Creates or Updates a seasonal field resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the seasonal field resource. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// + /// Schema for Request Body: + /// { + /// farmerId: string, + /// primaryBoundaryId: string, + /// boundaryIds: [string], + /// farmId: string, + /// fieldId: string, + /// seasonId: string, + /// cropVarietyIds: [string], + /// cropId: string, + /// avgYieldValue: number, + /// avgYieldUnit: string, + /// avgSeedPopulationValue: number, + /// avgSeedPopulationUnit: string, + /// plantingDateTime: string (ISO 8601 Format), + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// farmerId: string, - /// primaryBoundaryId: string, - /// boundaryIds: [string], - /// farmId: string, - /// fieldId: string, - /// seasonId: string, - /// cropVarietyIds: [string], - /// cropId: string, - /// avgYieldValue: number, - /// avgYieldUnit: string, - /// avgSeedPopulationValue: number, - /// avgSeedPopulationUnit: string, - /// plantingDateTime: string (ISO 8601 Format), - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// farmerId: string, + /// primaryBoundaryId: string, + /// boundaryIds: [string], + /// farmId: string, + /// fieldId: string, + /// seasonId: string, + /// cropVarietyIds: [string], + /// cropId: string, + /// avgYieldValue: number, + /// avgYieldUnit: string, + /// avgSeedPopulationValue: number, + /// avgSeedPopulationUnit: string, + /// plantingDateTime: string (ISO 8601 Format), + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -446,62 +266,16 @@ private HttpMessage CreateListByFarmerIdRequest(string farmerId, IEnumerable /// /// - /// Farm Ids of the resource. - /// Field Ids of the resource. - /// Season Ids of the resource. - /// CropVarietyIds of the resource. - /// Ids of the crop it belongs to. - /// Minimum average yield value of the seasonal field(inclusive). - /// Maximum average yield value of the seasonal field(inclusive). - /// Unit of the average yield value attribute. - /// Minimum average seed population value of the seasonal field(inclusive). - /// Maximum average seed population value of the seasonal field(inclusive). - /// Unit of average seed population value attribute. - /// Minimum planting datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. - /// Maximum planting datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task ListAsync(IEnumerable farmIds = null, IEnumerable fieldIds = null, IEnumerable seasonIds = null, IEnumerable cropVarietyIds = null, IEnumerable cropIds = null, double? minAvgYieldValue = null, double? maxAvgYieldValue = null, string avgYieldUnit = null, double? minAvgSeedPopulationValue = null, double? maxAvgSeedPopulationValue = null, string avgSeedPopulationUnit = null, DateTimeOffset? minPlantingDateTime = null, DateTimeOffset? maxPlantingDateTime = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual async Task CreateOrUpdateAsync(string farmerId, string seasonalFieldId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRequest(farmIds, fieldIds, seasonIds, cropVarietyIds, cropIds, minAvgYieldValue, maxAvgYieldValue, avgYieldUnit, minAvgSeedPopulationValue, maxAvgSeedPopulationValue, avgSeedPopulationUnit, minPlantingDateTime, maxPlantingDateTime, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.List"); + using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.CreateOrUpdate"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, seasonalFieldId, content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -510,40 +284,63 @@ public virtual async Task ListAsync(IEnumerable farmIds = null } } - /// Returns a paginated list of seasonal field resources across all farmers. + /// Creates or Updates a seasonal field resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the seasonal field resource. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// + /// Schema for Request Body: + /// { + /// farmerId: string, + /// primaryBoundaryId: string, + /// boundaryIds: [string], + /// farmId: string, + /// fieldId: string, + /// seasonId: string, + /// cropVarietyIds: [string], + /// cropId: string, + /// avgYieldValue: number, + /// avgYieldUnit: string, + /// avgSeedPopulationValue: number, + /// avgSeedPopulationUnit: string, + /// plantingDateTime: string (ISO 8601 Format), + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// farmerId: string, - /// primaryBoundaryId: string, - /// boundaryIds: [string], - /// farmId: string, - /// fieldId: string, - /// seasonId: string, - /// cropVarietyIds: [string], - /// cropId: string, - /// avgYieldValue: number, - /// avgYieldUnit: string, - /// avgSeedPopulationValue: number, - /// avgSeedPopulationUnit: string, - /// plantingDateTime: string (ISO 8601 Format), - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// farmerId: string, + /// primaryBoundaryId: string, + /// boundaryIds: [string], + /// farmId: string, + /// fieldId: string, + /// seasonId: string, + /// cropVarietyIds: [string], + /// cropId: string, + /// avgYieldValue: number, + /// avgYieldUnit: string, + /// avgSeedPopulationValue: number, + /// avgSeedPopulationUnit: string, + /// plantingDateTime: string (ISO 8601 Format), + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -561,62 +358,16 @@ public virtual async Task ListAsync(IEnumerable farmIds = null /// /// /// - /// Farm Ids of the resource. - /// Field Ids of the resource. - /// Season Ids of the resource. - /// CropVarietyIds of the resource. - /// Ids of the crop it belongs to. - /// Minimum average yield value of the seasonal field(inclusive). - /// Maximum average yield value of the seasonal field(inclusive). - /// Unit of the average yield value attribute. - /// Minimum average seed population value of the seasonal field(inclusive). - /// Maximum average seed population value of the seasonal field(inclusive). - /// Unit of average seed population value attribute. - /// Minimum planting datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. - /// Maximum planting datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual Response List(IEnumerable farmIds = null, IEnumerable fieldIds = null, IEnumerable seasonIds = null, IEnumerable cropVarietyIds = null, IEnumerable cropIds = null, double? minAvgYieldValue = null, double? maxAvgYieldValue = null, string avgYieldUnit = null, double? minAvgSeedPopulationValue = null, double? maxAvgSeedPopulationValue = null, string avgSeedPopulationUnit = null, DateTimeOffset? minPlantingDateTime = null, DateTimeOffset? maxPlantingDateTime = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual Response CreateOrUpdate(string farmerId, string seasonalFieldId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRequest(farmIds, fieldIds, seasonIds, cropVarietyIds, cropIds, minAvgYieldValue, maxAvgYieldValue, avgYieldUnit, minAvgSeedPopulationValue, maxAvgSeedPopulationValue, avgSeedPopulationUnit, minPlantingDateTime, maxPlantingDateTime, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.List"); + using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.CreateOrUpdate"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, seasonalFieldId, content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -625,140 +376,12 @@ public virtual Response List(IEnumerable farmIds = null, IEnumerable farmIds, IEnumerable fieldIds, IEnumerable seasonIds, IEnumerable cropVarietyIds, IEnumerable cropIds, double? minAvgYieldValue, double? maxAvgYieldValue, string avgYieldUnit, double? minAvgSeedPopulationValue, double? maxAvgSeedPopulationValue, string avgSeedPopulationUnit, DateTimeOffset? minPlantingDateTime, DateTimeOffset? maxPlantingDateTime, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/seasonal-fields", false); - if (farmIds != null) - { - uri.AppendQueryDelimited("farmIds", farmIds, ",", true); - } - if (fieldIds != null) - { - uri.AppendQueryDelimited("fieldIds", fieldIds, ",", true); - } - if (seasonIds != null) - { - uri.AppendQueryDelimited("seasonIds", seasonIds, ",", true); - } - if (cropVarietyIds != null) - { - uri.AppendQueryDelimited("cropVarietyIds", cropVarietyIds, ",", true); - } - if (cropIds != null) - { - uri.AppendQueryDelimited("cropIds", cropIds, ",", true); - } - if (minAvgYieldValue != null) - { - uri.AppendQuery("minAvgYieldValue", minAvgYieldValue.Value, true); - } - if (maxAvgYieldValue != null) - { - uri.AppendQuery("maxAvgYieldValue", maxAvgYieldValue.Value, true); - } - if (avgYieldUnit != null) - { - uri.AppendQuery("avgYieldUnit", avgYieldUnit, true); - } - if (minAvgSeedPopulationValue != null) - { - uri.AppendQuery("minAvgSeedPopulationValue", minAvgSeedPopulationValue.Value, true); - } - if (maxAvgSeedPopulationValue != null) - { - uri.AppendQuery("maxAvgSeedPopulationValue", maxAvgSeedPopulationValue.Value, true); - } - if (avgSeedPopulationUnit != null) - { - uri.AppendQuery("avgSeedPopulationUnit", avgSeedPopulationUnit, true); - } - if (minPlantingDateTime != null) - { - uri.AppendQuery("minPlantingDateTime", minPlantingDateTime.Value, "O", true); - } - if (maxPlantingDateTime != null) - { - uri.AppendQuery("maxPlantingDateTime", maxPlantingDateTime.Value, "O", true); - } - if (ids != null) - { - uri.AppendQueryDelimited("ids", ids, ",", true); - } - if (names != null) - { - uri.AppendQueryDelimited("names", names, ",", true); - } - if (propertyFilters != null) - { - uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); - } - if (statuses != null) - { - uri.AppendQueryDelimited("statuses", statuses, ",", true); - } - if (minCreatedDateTime != null) - { - uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); - } - if (maxCreatedDateTime != null) - { - uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); - } - if (minLastModifiedDateTime != null) - { - uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); - } - if (maxLastModifiedDateTime != null) - { - uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); - } - if (maxPageSize != null) - { - uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets a specified seasonal field resource under a particular farmer. + /// Deletes a specified seasonal-field resource under a particular farmer. + /// ID of the farmer. + /// ID of the seasonal field. + /// The request options. + /// or is null. /// - /// Schema for Response Body: - /// { - /// farmerId: string, - /// primaryBoundaryId: string, - /// boundaryIds: [string], - /// farmId: string, - /// fieldId: string, - /// seasonId: string, - /// cropVarietyIds: [string], - /// cropId: string, - /// avgYieldValue: number, - /// avgYieldUnit: string, - /// avgSeedPopulationValue: number, - /// avgSeedPopulationUnit: string, - /// plantingDateTime: string (ISO 8601 Format), - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// /// Schema for Response Error: /// { /// error: { @@ -776,35 +399,16 @@ private HttpMessage CreateListRequest(IEnumerable farmIds, IEnumerable /// /// - /// ID of the associated farmer. - /// ID of the seasonal field. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetAsync(string farmerId, string seasonalFieldId, RequestOptions options = null) + public virtual async Task DeleteAsync(string farmerId, string seasonalFieldId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRequest(farmerId, seasonalFieldId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.Get"); + using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.Delete"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(farmerId, seasonalFieldId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -813,34 +417,12 @@ public virtual async Task GetAsync(string farmerId, string seasonalFie } } - /// Gets a specified seasonal field resource under a particular farmer. + /// Deletes a specified seasonal-field resource under a particular farmer. + /// ID of the farmer. + /// ID of the seasonal field. + /// The request options. + /// or is null. /// - /// Schema for Response Body: - /// { - /// farmerId: string, - /// primaryBoundaryId: string, - /// boundaryIds: [string], - /// farmId: string, - /// fieldId: string, - /// seasonId: string, - /// cropVarietyIds: [string], - /// cropId: string, - /// avgYieldValue: number, - /// avgYieldUnit: string, - /// avgSeedPopulationValue: number, - /// avgSeedPopulationUnit: string, - /// plantingDateTime: string (ISO 8601 Format), - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// /// Schema for Response Error: /// { /// error: { @@ -858,35 +440,16 @@ public virtual async Task GetAsync(string farmerId, string seasonalFie /// /// /// - /// ID of the associated farmer. - /// ID of the seasonal field. - /// The request options. #pragma warning disable AZC0002 - public virtual Response Get(string farmerId, string seasonalFieldId, RequestOptions options = null) + public virtual Response Delete(string farmerId, string seasonalFieldId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRequest(farmerId, seasonalFieldId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.Get"); + using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.Delete"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(farmerId, seasonalFieldId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -895,77 +458,29 @@ public virtual Response Get(string farmerId, string seasonalFieldId, RequestOpti } } - private HttpMessage CreateGetRequest(string farmerId, string seasonalFieldId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/seasonal-fields/", false); - uri.AppendPath(seasonalFieldId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Creates or Updates a seasonal field resource under a particular farmer. + /// Get cascade delete job for specified seasonal field. + /// ID of the job. + /// The request options. + /// is null. /// - /// Schema for Request Body: - /// { - /// farmerId: string, - /// primaryBoundaryId: string, - /// boundaryIds: [string], - /// farmId: string, - /// fieldId: string, - /// seasonId: string, - /// cropVarietyIds: [string], - /// cropId: string, - /// avgYieldValue: number, - /// avgYieldUnit: string, - /// avgSeedPopulationValue: number, - /// avgSeedPopulationUnit: string, - /// plantingDateTime: string (ISO 8601 Format), - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// /// Schema for Response Body: /// { /// farmerId: string, - /// primaryBoundaryId: string, - /// boundaryIds: [string], - /// farmId: string, - /// fieldId: string, - /// seasonId: string, - /// cropVarietyIds: [string], - /// cropId: string, - /// avgYieldValue: number, - /// avgYieldUnit: string, - /// avgSeedPopulationValue: number, - /// avgSeedPopulationUnit: string, - /// plantingDateTime: string (ISO 8601 Format), + /// resourceId: string, + /// resourceType: string, /// id: string, - /// eTag: string, /// status: string, + /// durationInSeconds: number, + /// message: string, /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), + /// lastActionDateTime: string (ISO 8601 Format), + /// startTime: string (ISO 8601 Format), + /// endTime: string (ISO 8601 Format), /// name: string, /// description: string, /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -983,37 +498,16 @@ private HttpMessage CreateGetRequest(string farmerId, string seasonalFieldId) /// /// /// - /// ID of the associated farmer resource. - /// ID of the seasonal field resource. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task CreateOrUpdateAsync(string farmerId, string seasonalFieldId, RequestContent content, RequestOptions options = null) + public virtual async Task GetCascadeDeleteJobDetailsAsync(string jobId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, seasonalFieldId, content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.CreateOrUpdate"); + using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.GetCascadeDeleteJobDetails"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1022,60 +516,29 @@ public virtual async Task CreateOrUpdateAsync(string farmerId, string } } - /// Creates or Updates a seasonal field resource under a particular farmer. + /// Get cascade delete job for specified seasonal field. + /// ID of the job. + /// The request options. + /// is null. /// - /// Schema for Request Body: - /// { - /// farmerId: string, - /// primaryBoundaryId: string, - /// boundaryIds: [string], - /// farmId: string, - /// fieldId: string, - /// seasonId: string, - /// cropVarietyIds: [string], - /// cropId: string, - /// avgYieldValue: number, - /// avgYieldUnit: string, - /// avgSeedPopulationValue: number, - /// avgSeedPopulationUnit: string, - /// plantingDateTime: string (ISO 8601 Format), - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// /// Schema for Response Body: /// { /// farmerId: string, - /// primaryBoundaryId: string, - /// boundaryIds: [string], - /// farmId: string, - /// fieldId: string, - /// seasonId: string, - /// cropVarietyIds: [string], - /// cropId: string, - /// avgYieldValue: number, - /// avgYieldUnit: string, - /// avgSeedPopulationValue: number, - /// avgSeedPopulationUnit: string, - /// plantingDateTime: string (ISO 8601 Format), + /// resourceId: string, + /// resourceType: string, /// id: string, - /// eTag: string, /// status: string, + /// durationInSeconds: number, + /// message: string, /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), + /// lastActionDateTime: string (ISO 8601 Format), + /// startTime: string (ISO 8601 Format), + /// endTime: string (ISO 8601 Format), /// name: string, /// description: string, /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1093,37 +556,16 @@ public virtual async Task CreateOrUpdateAsync(string farmerId, string /// /// /// - /// ID of the associated farmer resource. - /// ID of the seasonal field resource. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual Response CreateOrUpdate(string farmerId, string seasonalFieldId, RequestContent content, RequestOptions options = null) + public virtual Response GetCascadeDeleteJobDetails(string jobId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, seasonalFieldId, content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.CreateOrUpdate"); + using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.GetCascadeDeleteJobDetails"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1132,27 +574,71 @@ public virtual Response CreateOrUpdate(string farmerId, string seasonalFieldId, } } - private HttpMessage CreateCreateOrUpdateRequest(string farmerId, string seasonalFieldId, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/seasonal-fields/", false); - uri.AppendPath(seasonalFieldId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/merge-patch+json"); - request.Content = content; - return message; - } - - /// Deletes a specified seasonal-field resource under a particular farmer. + /// Returns a paginated list of seasonal field resources under a particular farmer. + /// ID of the associated farmer. + /// The request options. + /// Farm Ids of the resource. + /// Field Ids of the resource. + /// Season Ids of the resource. + /// CropVarietyIds of the resource. + /// Ids of the crop it belongs to. + /// Minimum average yield value of the seasonal field(inclusive). + /// Maximum average yield value of the seasonal field(inclusive). + /// Unit of the average yield value attribute. + /// Minimum average seed population value of the seasonal field(inclusive). + /// Maximum average seed population value of the seasonal field(inclusive). + /// Unit of average seed population value attribute. + /// Minimum planting datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Maximum planting datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// is null. /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// farmerId: string, + /// primaryBoundaryId: string, + /// boundaryIds: [string], + /// farmId: string, + /// fieldId: string, + /// seasonId: string, + /// cropVarietyIds: [string], + /// cropId: string, + /// avgYieldValue: number, + /// avgYieldUnit: string, + /// avgSeedPopulationValue: number, + /// avgSeedPopulationUnit: string, + /// plantingDateTime: string (ISO 8601 Format), + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string + /// } + /// /// Schema for Response Error: /// { /// error: { @@ -1170,45 +656,95 @@ private HttpMessage CreateCreateOrUpdateRequest(string farmerId, string seasonal /// /// /// - /// ID of the farmer. - /// ID of the seasonal field. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task DeleteAsync(string farmerId, string seasonalFieldId, RequestOptions options = null) + public virtual AsyncPageable ListByFarmerIdAsync(string farmerId, RequestOptions options, IEnumerable farmIds = null, IEnumerable fieldIds = null, IEnumerable seasonIds = null, IEnumerable cropVarietyIds = null, IEnumerable cropIds = null, double? minAvgYieldValue = null, double? maxAvgYieldValue = null, string avgYieldUnit = null, double? minAvgSeedPopulationValue = null, double? maxAvgSeedPopulationValue = null, string avgSeedPopulationUnit = null, DateTimeOffset? minPlantingDateTime = null, DateTimeOffset? maxPlantingDateTime = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(farmerId, seasonalFieldId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.Delete"); - scope.Start(); - try + if (farmerId == null) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + throw new ArgumentNullException(nameof(farmerId)); } - catch (Exception e) + + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "SeasonalFieldsClient.ListByFarmerId"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) { - scope.Failed(e); - throw; + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListByFarmerIdRequest(farmerId, farmIds, fieldIds, seasonIds, cropVarietyIds, cropIds, minAvgYieldValue, maxAvgYieldValue, avgYieldUnit, minAvgSeedPopulationValue, maxAvgSeedPopulationValue, avgSeedPopulationUnit, minPlantingDateTime, maxPlantingDateTime, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListByFarmerIdNextPageRequest(nextLink, farmerId, farmIds, fieldIds, seasonIds, cropVarietyIds, cropIds, minAvgYieldValue, maxAvgYieldValue, avgYieldUnit, minAvgSeedPopulationValue, maxAvgSeedPopulationValue, avgSeedPopulationUnit, minPlantingDateTime, maxPlantingDateTime, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - /// Deletes a specified seasonal-field resource under a particular farmer. + /// Returns a paginated list of seasonal field resources under a particular farmer. + /// ID of the associated farmer. + /// The request options. + /// Farm Ids of the resource. + /// Field Ids of the resource. + /// Season Ids of the resource. + /// CropVarietyIds of the resource. + /// Ids of the crop it belongs to. + /// Minimum average yield value of the seasonal field(inclusive). + /// Maximum average yield value of the seasonal field(inclusive). + /// Unit of the average yield value attribute. + /// Minimum average seed population value of the seasonal field(inclusive). + /// Maximum average seed population value of the seasonal field(inclusive). + /// Unit of average seed population value attribute. + /// Minimum planting datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Maximum planting datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// is null. /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// farmerId: string, + /// primaryBoundaryId: string, + /// boundaryIds: [string], + /// farmId: string, + /// fieldId: string, + /// seasonId: string, + /// cropVarietyIds: [string], + /// cropId: string, + /// avgYieldValue: number, + /// avgYieldUnit: string, + /// avgSeedPopulationValue: number, + /// avgSeedPopulationUnit: string, + /// plantingDateTime: string (ISO 8601 Format), + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string + /// } + /// /// Schema for Response Error: /// { /// error: { @@ -1226,81 +762,93 @@ public virtual async Task DeleteAsync(string farmerId, string seasonal /// /// /// - /// ID of the farmer. - /// ID of the seasonal field. - /// The request options. #pragma warning disable AZC0002 - public virtual Response Delete(string farmerId, string seasonalFieldId, RequestOptions options = null) + public virtual Pageable ListByFarmerId(string farmerId, RequestOptions options, IEnumerable farmIds = null, IEnumerable fieldIds = null, IEnumerable seasonIds = null, IEnumerable cropVarietyIds = null, IEnumerable cropIds = null, double? minAvgYieldValue = null, double? maxAvgYieldValue = null, string avgYieldUnit = null, double? minAvgSeedPopulationValue = null, double? maxAvgSeedPopulationValue = null, string avgSeedPopulationUnit = null, DateTimeOffset? minPlantingDateTime = null, DateTimeOffset? maxPlantingDateTime = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(farmerId, seasonalFieldId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.Delete"); - scope.Start(); - try + if (farmerId == null) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + throw new ArgumentNullException(nameof(farmerId)); } - catch (Exception e) + + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "SeasonalFieldsClient.ListByFarmerId"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) { - scope.Failed(e); - throw; + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListByFarmerIdRequest(farmerId, farmIds, fieldIds, seasonIds, cropVarietyIds, cropIds, minAvgYieldValue, maxAvgYieldValue, avgYieldUnit, minAvgSeedPopulationValue, maxAvgSeedPopulationValue, avgSeedPopulationUnit, minPlantingDateTime, maxPlantingDateTime, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListByFarmerIdNextPageRequest(nextLink, farmerId, farmIds, fieldIds, seasonIds, cropVarietyIds, cropIds, minAvgYieldValue, maxAvgYieldValue, avgYieldUnit, minAvgSeedPopulationValue, maxAvgSeedPopulationValue, avgSeedPopulationUnit, minPlantingDateTime, maxPlantingDateTime, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - private HttpMessage CreateDeleteRequest(string farmerId, string seasonalFieldId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/seasonal-fields/", false); - uri.AppendPath(seasonalFieldId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Get cascade delete job for specified seasonal field. - /// - /// Schema for Response Body: + /// Returns a paginated list of seasonal field resources across all farmers. + /// The request options. + /// Farm Ids of the resource. + /// Field Ids of the resource. + /// Season Ids of the resource. + /// CropVarietyIds of the resource. + /// Ids of the crop it belongs to. + /// Minimum average yield value of the seasonal field(inclusive). + /// Maximum average yield value of the seasonal field(inclusive). + /// Unit of the average yield value attribute. + /// Minimum average seed population value of the seasonal field(inclusive). + /// Maximum average seed population value of the seasonal field(inclusive). + /// Unit of average seed population value attribute. + /// Minimum planting datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Maximum planting datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// + /// Schema for Response Body: /// { - /// farmerId: string, - /// resourceId: string, - /// resourceType: string, - /// id: string, - /// status: string, - /// durationInSeconds: number, - /// message: string, - /// createdDateTime: string (ISO 8601 Format), - /// lastActionDateTime: string (ISO 8601 Format), - /// startTime: string (ISO 8601 Format), - /// endTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// value: [ + /// { + /// farmerId: string, + /// primaryBoundaryId: string, + /// boundaryIds: [string], + /// farmId: string, + /// fieldId: string, + /// seasonId: string, + /// cropVarietyIds: [string], + /// cropId: string, + /// avgYieldValue: number, + /// avgYieldUnit: string, + /// avgSeedPopulationValue: number, + /// avgSeedPopulationUnit: string, + /// plantingDateTime: string (ISO 8601 Format), + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1318,63 +866,88 @@ private HttpMessage CreateDeleteRequest(string farmerId, string seasonalFieldId) /// /// /// - /// ID of the job. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetCascadeDeleteJobDetailsAsync(string jobId, RequestOptions options = null) + public virtual AsyncPageable ListAsync(RequestOptions options, IEnumerable farmIds = null, IEnumerable fieldIds = null, IEnumerable seasonIds = null, IEnumerable cropVarietyIds = null, IEnumerable cropIds = null, double? minAvgYieldValue = null, double? maxAvgYieldValue = null, string avgYieldUnit = null, double? minAvgSeedPopulationValue = null, double? maxAvgSeedPopulationValue = null, string avgSeedPopulationUnit = null, DateTimeOffset? minPlantingDateTime = null, DateTimeOffset? maxPlantingDateTime = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.GetCascadeDeleteJobDetails"); - scope.Start(); - try + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "SeasonalFieldsClient.List"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) + do { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; + var message = string.IsNullOrEmpty(nextLink) + ? CreateListRequest(farmIds, fieldIds, seasonIds, cropVarietyIds, cropIds, minAvgYieldValue, maxAvgYieldValue, avgYieldUnit, minAvgSeedPopulationValue, maxAvgSeedPopulationValue, avgSeedPopulationUnit, minPlantingDateTime, maxPlantingDateTime, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListNextPageRequest(nextLink, farmIds, fieldIds, seasonIds, cropVarietyIds, cropIds, minAvgYieldValue, maxAvgYieldValue, avgYieldUnit, minAvgSeedPopulationValue, maxAvgSeedPopulationValue, avgSeedPopulationUnit, minPlantingDateTime, maxPlantingDateTime, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - /// Get cascade delete job for specified seasonal field. + /// Returns a paginated list of seasonal field resources across all farmers. + /// The request options. + /// Farm Ids of the resource. + /// Field Ids of the resource. + /// Season Ids of the resource. + /// CropVarietyIds of the resource. + /// Ids of the crop it belongs to. + /// Minimum average yield value of the seasonal field(inclusive). + /// Maximum average yield value of the seasonal field(inclusive). + /// Unit of the average yield value attribute. + /// Minimum average seed population value of the seasonal field(inclusive). + /// Maximum average seed population value of the seasonal field(inclusive). + /// Unit of average seed population value attribute. + /// Minimum planting datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Maximum planting datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. /// /// Schema for Response Body: /// { - /// farmerId: string, - /// resourceId: string, - /// resourceType: string, - /// id: string, - /// status: string, - /// durationInSeconds: number, - /// message: string, - /// createdDateTime: string (ISO 8601 Format), - /// lastActionDateTime: string (ISO 8601 Format), - /// startTime: string (ISO 8601 Format), - /// endTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// value: [ + /// { + /// farmerId: string, + /// primaryBoundaryId: string, + /// boundaryIds: [string], + /// farmId: string, + /// fieldId: string, + /// seasonId: string, + /// cropVarietyIds: [string], + /// cropId: string, + /// avgYieldValue: number, + /// avgYieldUnit: string, + /// avgSeedPopulationValue: number, + /// avgSeedPopulationUnit: string, + /// plantingDateTime: string (ISO 8601 Format), + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1392,58 +965,31 @@ public virtual async Task GetCascadeDeleteJobDetailsAsync(string jobId /// /// /// - /// ID of the job. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetCascadeDeleteJobDetails(string jobId, RequestOptions options = null) + public virtual Pageable List(RequestOptions options, IEnumerable farmIds = null, IEnumerable fieldIds = null, IEnumerable seasonIds = null, IEnumerable cropVarietyIds = null, IEnumerable cropIds = null, double? minAvgYieldValue = null, double? maxAvgYieldValue = null, string avgYieldUnit = null, double? minAvgSeedPopulationValue = null, double? maxAvgSeedPopulationValue = null, string avgSeedPopulationUnit = null, DateTimeOffset? minPlantingDateTime = null, DateTimeOffset? maxPlantingDateTime = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetCascadeDeleteJobDetailsRequest(jobId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.GetCascadeDeleteJobDetails"); - scope.Start(); - try + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "SeasonalFieldsClient.List"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else + do { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; + var message = string.IsNullOrEmpty(nextLink) + ? CreateListRequest(farmIds, fieldIds, seasonIds, cropVarietyIds, cropIds, minAvgYieldValue, maxAvgYieldValue, avgYieldUnit, minAvgSeedPopulationValue, maxAvgSeedPopulationValue, avgSeedPopulationUnit, minPlantingDateTime, maxPlantingDateTime, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListNextPageRequest(nextLink, farmIds, fieldIds, seasonIds, cropVarietyIds, cropIds, minAvgYieldValue, maxAvgYieldValue, avgYieldUnit, minAvgSeedPopulationValue, maxAvgSeedPopulationValue, avgSeedPopulationUnit, minPlantingDateTime, maxPlantingDateTime, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - private HttpMessage CreateGetCascadeDeleteJobDetailsRequest(string jobId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/seasonal-fields/cascade-delete/", false); - uri.AppendPath(jobId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Create a cascade delete job for specified seasonal field. + /// Job ID supplied by end user. + /// ID of the associated farmer. + /// ID of the seasonalField to be deleted. + /// The request options. + /// , , or is null. /// /// Schema for Response Body: /// { @@ -1463,7 +1009,6 @@ private HttpMessage CreateGetCascadeDeleteJobDetailsRequest(string jobId) /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1481,36 +1026,16 @@ private HttpMessage CreateGetCascadeDeleteJobDetailsRequest(string jobId) /// /// /// - /// Job ID supplied by end user. - /// ID of the associated farmer. - /// ID of the seasonalField to be deleted. - /// The request options. #pragma warning disable AZC0002 public virtual async Task> CreateCascadeDeleteJobAsync(string jobId, string farmerId, string seasonalFieldId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId, seasonalFieldId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.CreateCascadeDeleteJob"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "SeasonalFieldsClient.CreateCascadeDeleteJob"); - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "SeasonalFieldsClient.CreateCascadeDeleteJob"); - } + using HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId, seasonalFieldId); + return await LowLevelOperationHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, "SeasonalFieldsClient.CreateCascadeDeleteJob", OperationFinalStateVia.Location, options).ConfigureAwait(false); } catch (Exception e) { @@ -1520,6 +1045,11 @@ public virtual async Task> CreateCascadeDeleteJobAsync(str } /// Create a cascade delete job for specified seasonal field. + /// Job ID supplied by end user. + /// ID of the associated farmer. + /// ID of the seasonalField to be deleted. + /// The request options. + /// , , or is null. /// /// Schema for Response Body: /// { @@ -1539,7 +1069,6 @@ public virtual async Task> CreateCascadeDeleteJobAsync(str /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1557,36 +1086,16 @@ public virtual async Task> CreateCascadeDeleteJobAsync(str /// /// /// - /// Job ID supplied by end user. - /// ID of the associated farmer. - /// ID of the seasonalField to be deleted. - /// The request options. #pragma warning disable AZC0002 public virtual Operation CreateCascadeDeleteJob(string jobId, string farmerId, string seasonalFieldId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId, seasonalFieldId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("SeasonalFieldsClient.CreateCascadeDeleteJob"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "SeasonalFieldsClient.CreateCascadeDeleteJob"); - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "SeasonalFieldsClient.CreateCascadeDeleteJob"); - } + using HttpMessage message = CreateCreateCascadeDeleteJobRequest(jobId, farmerId, seasonalFieldId); + return LowLevelOperationHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, "SeasonalFieldsClient.CreateCascadeDeleteJob", OperationFinalStateVia.Location, options); } catch (Exception e) { @@ -1595,21 +1104,446 @@ public virtual Operation CreateCascadeDeleteJob(string jobId, string } } - private HttpMessage CreateCreateCascadeDeleteJobRequest(string jobId, string farmerId, string seasonalFieldId) + internal HttpMessage CreateListByFarmerIdRequest(string farmerId, IEnumerable farmIds, IEnumerable fieldIds, IEnumerable seasonIds, IEnumerable cropVarietyIds, IEnumerable cropIds, double? minAvgYieldValue, double? maxAvgYieldValue, string avgYieldUnit, double? minAvgSeedPopulationValue, double? maxAvgSeedPopulationValue, string avgSeedPopulationUnit, DateTimeOffset? minPlantingDateTime, DateTimeOffset? maxPlantingDateTime, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Put; + request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/seasonal-fields/cascade-delete/", false); - uri.AppendPath(jobId, true); - uri.AppendQuery("farmerId", farmerId, true); - uri.AppendQuery("seasonalFieldId", seasonalFieldId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/seasonal-fields", false); + if (farmIds != null) + { + foreach (var param in farmIds) + { + uri.AppendQuery("farmIds", param, true); + } + } + if (fieldIds != null) + { + foreach (var param in fieldIds) + { + uri.AppendQuery("fieldIds", param, true); + } + } + if (seasonIds != null) + { + foreach (var param in seasonIds) + { + uri.AppendQuery("seasonIds", param, true); + } + } + if (cropVarietyIds != null) + { + foreach (var param in cropVarietyIds) + { + uri.AppendQuery("cropVarietyIds", param, true); + } + } + if (cropIds != null) + { + foreach (var param in cropIds) + { + uri.AppendQuery("cropIds", param, true); + } + } + if (minAvgYieldValue != null) + { + uri.AppendQuery("minAvgYieldValue", minAvgYieldValue.Value, true); + } + if (maxAvgYieldValue != null) + { + uri.AppendQuery("maxAvgYieldValue", maxAvgYieldValue.Value, true); + } + if (avgYieldUnit != null) + { + uri.AppendQuery("avgYieldUnit", avgYieldUnit, true); + } + if (minAvgSeedPopulationValue != null) + { + uri.AppendQuery("minAvgSeedPopulationValue", minAvgSeedPopulationValue.Value, true); + } + if (maxAvgSeedPopulationValue != null) + { + uri.AppendQuery("maxAvgSeedPopulationValue", maxAvgSeedPopulationValue.Value, true); + } + if (avgSeedPopulationUnit != null) + { + uri.AppendQuery("avgSeedPopulationUnit", avgSeedPopulationUnit, true); + } + if (minPlantingDateTime != null) + { + uri.AppendQuery("minPlantingDateTime", minPlantingDateTime.Value, "O", true); + } + if (maxPlantingDateTime != null) + { + uri.AppendQuery("maxPlantingDateTime", maxPlantingDateTime.Value, "O", true); + } + if (ids != null) + { + foreach (var param in ids) + { + uri.AppendQuery("ids", param, true); + } + } + if (names != null) + { + foreach (var param in names) + { + uri.AppendQuery("names", param, true); + } + } + if (propertyFilters != null) + { + foreach (var param in propertyFilters) + { + uri.AppendQuery("propertyFilters", param, true); + } + } + if (statuses != null) + { + foreach (var param in statuses) + { + uri.AppendQuery("statuses", param, true); + } + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateListRequest(IEnumerable farmIds, IEnumerable fieldIds, IEnumerable seasonIds, IEnumerable cropVarietyIds, IEnumerable cropIds, double? minAvgYieldValue, double? maxAvgYieldValue, string avgYieldUnit, double? minAvgSeedPopulationValue, double? maxAvgSeedPopulationValue, string avgSeedPopulationUnit, DateTimeOffset? minPlantingDateTime, DateTimeOffset? maxPlantingDateTime, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/seasonal-fields", false); + if (farmIds != null) + { + foreach (var param in farmIds) + { + uri.AppendQuery("farmIds", param, true); + } + } + if (fieldIds != null) + { + foreach (var param in fieldIds) + { + uri.AppendQuery("fieldIds", param, true); + } + } + if (seasonIds != null) + { + foreach (var param in seasonIds) + { + uri.AppendQuery("seasonIds", param, true); + } + } + if (cropVarietyIds != null) + { + foreach (var param in cropVarietyIds) + { + uri.AppendQuery("cropVarietyIds", param, true); + } + } + if (cropIds != null) + { + foreach (var param in cropIds) + { + uri.AppendQuery("cropIds", param, true); + } + } + if (minAvgYieldValue != null) + { + uri.AppendQuery("minAvgYieldValue", minAvgYieldValue.Value, true); + } + if (maxAvgYieldValue != null) + { + uri.AppendQuery("maxAvgYieldValue", maxAvgYieldValue.Value, true); + } + if (avgYieldUnit != null) + { + uri.AppendQuery("avgYieldUnit", avgYieldUnit, true); + } + if (minAvgSeedPopulationValue != null) + { + uri.AppendQuery("minAvgSeedPopulationValue", minAvgSeedPopulationValue.Value, true); + } + if (maxAvgSeedPopulationValue != null) + { + uri.AppendQuery("maxAvgSeedPopulationValue", maxAvgSeedPopulationValue.Value, true); + } + if (avgSeedPopulationUnit != null) + { + uri.AppendQuery("avgSeedPopulationUnit", avgSeedPopulationUnit, true); + } + if (minPlantingDateTime != null) + { + uri.AppendQuery("minPlantingDateTime", minPlantingDateTime.Value, "O", true); + } + if (maxPlantingDateTime != null) + { + uri.AppendQuery("maxPlantingDateTime", maxPlantingDateTime.Value, "O", true); + } + if (ids != null) + { + foreach (var param in ids) + { + uri.AppendQuery("ids", param, true); + } + } + if (names != null) + { + foreach (var param in names) + { + uri.AppendQuery("names", param, true); + } + } + if (propertyFilters != null) + { + foreach (var param in propertyFilters) + { + uri.AppendQuery("propertyFilters", param, true); + } + } + if (statuses != null) + { + foreach (var param in statuses) + { + uri.AppendQuery("statuses", param, true); + } + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetRequest(string farmerId, string seasonalFieldId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/seasonal-fields/", false); + uri.AppendPath(seasonalFieldId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string farmerId, string seasonalFieldId, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/seasonal-fields/", false); + uri.AppendPath(seasonalFieldId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/merge-patch+json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200201.Instance; + return message; + } + + internal HttpMessage CreateDeleteRequest(string farmerId, string seasonalFieldId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/seasonal-fields/", false); + uri.AppendPath(seasonalFieldId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier204.Instance; + return message; + } + + internal HttpMessage CreateGetCascadeDeleteJobDetailsRequest(string jobId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/seasonal-fields/cascade-delete/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateCascadeDeleteJobRequest(string jobId, string farmerId, string seasonalFieldId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/seasonal-fields/cascade-delete/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("farmerId", farmerId, true); + uri.AppendQuery("seasonalFieldId", seasonalFieldId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier202.Instance; + return message; + } + + internal HttpMessage CreateListByFarmerIdNextPageRequest(string nextLink, string farmerId, IEnumerable farmIds, IEnumerable fieldIds, IEnumerable seasonIds, IEnumerable cropVarietyIds, IEnumerable cropIds, double? minAvgYieldValue, double? maxAvgYieldValue, string avgYieldUnit, double? minAvgSeedPopulationValue, double? maxAvgSeedPopulationValue, string avgSeedPopulationUnit, DateTimeOffset? minPlantingDateTime, DateTimeOffset? maxPlantingDateTime, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, IEnumerable farmIds, IEnumerable fieldIds, IEnumerable seasonIds, IEnumerable cropVarietyIds, IEnumerable cropIds, double? minAvgYieldValue, double? maxAvgYieldValue, string avgYieldUnit, double? minAvgSeedPopulationValue, double? maxAvgSeedPopulationValue, string avgSeedPopulationUnit, DateTimeOffset? minPlantingDateTime, DateTimeOffset? maxPlantingDateTime, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier200201 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200201(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + 201 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier204 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier204(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 204 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier202 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier202(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 202 => false, + _ => true + }; + } } } } diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/SeasonsClient.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/SeasonsClient.cs index 7029445f527d0..39f2b10d6d9b7 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/SeasonsClient.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/SeasonsClient.cs @@ -7,6 +7,8 @@ using System; using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; @@ -17,14 +19,16 @@ namespace Azure.Verticals.AgriFood.Farming /// The Seasons service client. public partial class SeasonsClient { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of SeasonsClient for mocking. protected SeasonsClient() @@ -35,6 +39,7 @@ protected SeasonsClient() /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. + /// or is null. public SeasonsClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) { if (endpoint == null) @@ -47,38 +52,34 @@ public SeasonsClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOp } options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); _tokenCredential = credential; - var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); - _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { authPolicy }, new ResponseClassifier()); - this.endpoint = endpoint; - apiVersion = options.Version; + _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; } - /// Returns a paginated list of season resources. + /// Gets a specified season resource. + /// ID of the season. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// startDateTime: string (ISO 8601 Format), - /// endDateTime: string (ISO 8601 Format), - /// year: number, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// startDateTime: string (ISO 8601 Format), + /// endDateTime: string (ISO 8601 Format), + /// year: number, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -96,54 +97,16 @@ public SeasonsClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOp /// /// /// - /// Minimum season start datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. - /// Maximum season start datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. - /// Minimum season end datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. - /// Maximum season end datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. - /// Years of the resource. - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task ListAsync(DateTimeOffset? minStartDateTime = null, DateTimeOffset? maxStartDateTime = null, DateTimeOffset? minEndDateTime = null, DateTimeOffset? maxEndDateTime = null, IEnumerable years = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual async Task GetAsync(string seasonId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRequest(minStartDateTime, maxStartDateTime, minEndDateTime, maxEndDateTime, years, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("SeasonsClient.List"); + using var scope = _clientDiagnostics.CreateScope("SeasonsClient.Get"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRequest(seasonId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -152,30 +115,26 @@ public virtual async Task ListAsync(DateTimeOffset? minStartDateTime = } } - /// Returns a paginated list of season resources. + /// Gets a specified season resource. + /// ID of the season. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// startDateTime: string (ISO 8601 Format), - /// endDateTime: string (ISO 8601 Format), - /// year: number, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// startDateTime: string (ISO 8601 Format), + /// endDateTime: string (ISO 8601 Format), + /// year: number, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -193,54 +152,16 @@ public virtual async Task ListAsync(DateTimeOffset? minStartDateTime = /// /// /// - /// Minimum season start datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. - /// Maximum season start datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. - /// Minimum season end datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. - /// Maximum season end datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. - /// Years of the resource. - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual Response List(DateTimeOffset? minStartDateTime = null, DateTimeOffset? maxStartDateTime = null, DateTimeOffset? minEndDateTime = null, DateTimeOffset? maxEndDateTime = null, IEnumerable years = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual Response Get(string seasonId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRequest(minStartDateTime, maxStartDateTime, minEndDateTime, maxEndDateTime, years, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("SeasonsClient.List"); + using var scope = _clientDiagnostics.CreateScope("SeasonsClient.Get"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRequest(seasonId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -249,82 +170,27 @@ public virtual Response List(DateTimeOffset? minStartDateTime = null, DateTimeOf } } - private HttpMessage CreateListRequest(DateTimeOffset? minStartDateTime, DateTimeOffset? maxStartDateTime, DateTimeOffset? minEndDateTime, DateTimeOffset? maxEndDateTime, IEnumerable years, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/seasons", false); - if (minStartDateTime != null) - { - uri.AppendQuery("minStartDateTime", minStartDateTime.Value, "O", true); - } - if (maxStartDateTime != null) - { - uri.AppendQuery("maxStartDateTime", maxStartDateTime.Value, "O", true); - } - if (minEndDateTime != null) - { - uri.AppendQuery("minEndDateTime", minEndDateTime.Value, "O", true); - } - if (maxEndDateTime != null) - { - uri.AppendQuery("maxEndDateTime", maxEndDateTime.Value, "O", true); - } - if (years != null) - { - uri.AppendQueryDelimited("years", years, ",", true); - } - if (ids != null) - { - uri.AppendQueryDelimited("ids", ids, ",", true); - } - if (names != null) - { - uri.AppendQueryDelimited("names", names, ",", true); - } - if (propertyFilters != null) - { - uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); - } - if (statuses != null) - { - uri.AppendQueryDelimited("statuses", statuses, ",", true); - } - if (minCreatedDateTime != null) - { - uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); - } - if (maxCreatedDateTime != null) - { - uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); - } - if (minLastModifiedDateTime != null) - { - uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); - } - if (maxLastModifiedDateTime != null) - { - uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); - } - if (maxPageSize != null) - { - uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets a specified season resource. + /// Creates or updates a season resource. + /// ID of the season resource. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// + /// Schema for Request Body: + /// { + /// startDateTime: string (ISO 8601 Format), + /// endDateTime: string (ISO 8601 Format), + /// year: number, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// /// Schema for Response Body: /// { /// startDateTime: string (ISO 8601 Format), @@ -340,7 +206,6 @@ private HttpMessage CreateListRequest(DateTimeOffset? minStartDateTime, DateTime /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -358,34 +223,16 @@ private HttpMessage CreateListRequest(DateTimeOffset? minStartDateTime, DateTime /// /// /// - /// ID of the season. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetAsync(string seasonId, RequestOptions options = null) + public virtual async Task CreateOrUpdateAsync(string seasonId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRequest(seasonId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("SeasonsClient.Get"); + using var scope = _clientDiagnostics.CreateScope("SeasonsClient.CreateOrUpdate"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(seasonId, content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -394,8 +241,27 @@ public virtual async Task GetAsync(string seasonId, RequestOptions opt } } - /// Gets a specified season resource. + /// Creates or updates a season resource. + /// ID of the season resource. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// + /// Schema for Request Body: + /// { + /// startDateTime: string (ISO 8601 Format), + /// endDateTime: string (ISO 8601 Format), + /// year: number, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// /// Schema for Response Body: /// { /// startDateTime: string (ISO 8601 Format), @@ -411,7 +277,6 @@ public virtual async Task GetAsync(string seasonId, RequestOptions opt /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -429,34 +294,16 @@ public virtual async Task GetAsync(string seasonId, RequestOptions opt /// /// /// - /// ID of the season. - /// The request options. #pragma warning disable AZC0002 - public virtual Response Get(string seasonId, RequestOptions options = null) + public virtual Response CreateOrUpdate(string seasonId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRequest(seasonId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("SeasonsClient.Get"); + using var scope = _clientDiagnostics.CreateScope("SeasonsClient.CreateOrUpdate"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(seasonId, content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -465,55 +312,11 @@ public virtual Response Get(string seasonId, RequestOptions options = null) } } - private HttpMessage CreateGetRequest(string seasonId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/seasons/", false); - uri.AppendPath(seasonId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Creates or updates a season resource. + /// Deletes a specified season resource. + /// ID of the season. + /// The request options. + /// is null. /// - /// Schema for Request Body: - /// { - /// startDateTime: string (ISO 8601 Format), - /// endDateTime: string (ISO 8601 Format), - /// year: number, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// - /// Schema for Response Body: - /// { - /// startDateTime: string (ISO 8601 Format), - /// endDateTime: string (ISO 8601 Format), - /// year: number, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// /// Schema for Response Error: /// { /// error: { @@ -531,36 +334,16 @@ private HttpMessage CreateGetRequest(string seasonId) /// /// /// - /// ID of the season resource. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task CreateOrUpdateAsync(string seasonId, RequestContent content, RequestOptions options = null) + public virtual async Task DeleteAsync(string seasonId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(seasonId, content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("SeasonsClient.CreateOrUpdate"); + using var scope = _clientDiagnostics.CreateScope("SeasonsClient.Delete"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(seasonId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -569,40 +352,11 @@ public virtual async Task CreateOrUpdateAsync(string seasonId, Request } } - /// Creates or updates a season resource. + /// Deletes a specified season resource. + /// ID of the season. + /// The request options. + /// is null. /// - /// Schema for Request Body: - /// { - /// startDateTime: string (ISO 8601 Format), - /// endDateTime: string (ISO 8601 Format), - /// year: number, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// - /// Schema for Response Body: - /// { - /// startDateTime: string (ISO 8601 Format), - /// endDateTime: string (ISO 8601 Format), - /// year: number, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// /// Schema for Response Error: /// { /// error: { @@ -620,36 +374,16 @@ public virtual async Task CreateOrUpdateAsync(string seasonId, Request /// /// /// - /// ID of the season resource. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual Response CreateOrUpdate(string seasonId, RequestContent content, RequestOptions options = null) + public virtual Response Delete(string seasonId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(seasonId, content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("SeasonsClient.CreateOrUpdate"); + using var scope = _clientDiagnostics.CreateScope("SeasonsClient.Delete"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(seasonId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -658,25 +392,51 @@ public virtual Response CreateOrUpdate(string seasonId, RequestContent content, } } - private HttpMessage CreateCreateOrUpdateRequest(string seasonId, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/seasons/", false); - uri.AppendPath(seasonId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/merge-patch+json"); - request.Content = content; - return message; - } - - /// Deletes a specified season resource. + /// Returns a paginated list of season resources. + /// The request options. + /// Minimum season start datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Maximum season start datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Minimum season end datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Maximum season end datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Years of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// startDateTime: string (ISO 8601 Format), + /// endDateTime: string (ISO 8601 Format), + /// year: number, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string + /// } + /// /// Schema for Response Error: /// { /// error: { @@ -694,44 +454,70 @@ private HttpMessage CreateCreateOrUpdateRequest(string seasonId, RequestContent /// /// /// - /// ID of the season. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task DeleteAsync(string seasonId, RequestOptions options = null) + public virtual AsyncPageable ListAsync(RequestOptions options, DateTimeOffset? minStartDateTime = null, DateTimeOffset? maxStartDateTime = null, DateTimeOffset? minEndDateTime = null, DateTimeOffset? maxEndDateTime = null, IEnumerable years = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(seasonId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("SeasonsClient.Delete"); - scope.Start(); - try + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "SeasonsClient.List"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else + do { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; + var message = string.IsNullOrEmpty(nextLink) + ? CreateListRequest(minStartDateTime, maxStartDateTime, minEndDateTime, maxEndDateTime, years, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListNextPageRequest(nextLink, minStartDateTime, maxStartDateTime, minEndDateTime, maxEndDateTime, years, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - /// Deletes a specified season resource. + /// Returns a paginated list of season resources. + /// The request options. + /// Minimum season start datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Maximum season start datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Minimum season end datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Maximum season end datetime, sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Years of the resource. + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// startDateTime: string (ISO 8601 Format), + /// endDateTime: string (ISO 8601 Format), + /// year: number, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string + /// } + /// /// Schema for Response Error: /// { /// error: { @@ -749,55 +535,218 @@ public virtual async Task DeleteAsync(string seasonId, RequestOptions /// /// /// - /// ID of the season. - /// The request options. #pragma warning disable AZC0002 - public virtual Response Delete(string seasonId, RequestOptions options = null) + public virtual Pageable List(RequestOptions options, DateTimeOffset? minStartDateTime = null, DateTimeOffset? maxStartDateTime = null, DateTimeOffset? minEndDateTime = null, DateTimeOffset? maxEndDateTime = null, IEnumerable years = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(seasonId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("SeasonsClient.Delete"); - scope.Start(); - try + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "SeasonsClient.List"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListRequest(minStartDateTime, maxStartDateTime, minEndDateTime, maxEndDateTime, years, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListNextPageRequest(nextLink, minStartDateTime, maxStartDateTime, minEndDateTime, maxEndDateTime, years, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + internal HttpMessage CreateListRequest(DateTimeOffset? minStartDateTime, DateTimeOffset? maxStartDateTime, DateTimeOffset? minEndDateTime, DateTimeOffset? maxEndDateTime, IEnumerable years, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/seasons", false); + if (minStartDateTime != null) + { + uri.AppendQuery("minStartDateTime", minStartDateTime.Value, "O", true); + } + if (maxStartDateTime != null) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) + uri.AppendQuery("maxStartDateTime", maxStartDateTime.Value, "O", true); + } + if (minEndDateTime != null) + { + uri.AppendQuery("minEndDateTime", minEndDateTime.Value, "O", true); + } + if (maxEndDateTime != null) + { + uri.AppendQuery("maxEndDateTime", maxEndDateTime.Value, "O", true); + } + if (years != null) + { + foreach (var param in years) { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } + uri.AppendQuery("years", param, true); } - else + } + if (ids != null) + { + foreach (var param in ids) { - return message.Response; + uri.AppendQuery("ids", param, true); } } - catch (Exception e) + if (names != null) { - scope.Failed(e); - throw; + foreach (var param in names) + { + uri.AppendQuery("names", param, true); + } + } + if (propertyFilters != null) + { + foreach (var param in propertyFilters) + { + uri.AppendQuery("propertyFilters", param, true); + } + } + if (statuses != null) + { + foreach (var param in statuses) + { + uri.AppendQuery("statuses", param, true); + } + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetRequest(string seasonId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/seasons/", false); + uri.AppendPath(seasonId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string seasonId, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/seasons/", false); + uri.AppendPath(seasonId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/merge-patch+json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200201.Instance; + return message; } - private HttpMessage CreateDeleteRequest(string seasonId) + internal HttpMessage CreateDeleteRequest(string seasonId) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); + uri.Reset(_endpoint); uri.AppendPath("/seasons/", false); uri.AppendPath(seasonId, true); - uri.AppendQuery("api-version", apiVersion, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier204.Instance; + return message; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, DateTimeOffset? minStartDateTime, DateTimeOffset? maxStartDateTime, DateTimeOffset? minEndDateTime, DateTimeOffset? maxEndDateTime, IEnumerable years, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; return message; } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier200201 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200201(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + 201 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier204 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier204(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 204 => false, + _ => true + }; + } + } } } diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/TillageDataClient.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/TillageDataClient.cs index 4cc7742367bca..61a08e2d492c9 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/TillageDataClient.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/TillageDataClient.cs @@ -7,6 +7,8 @@ using System; using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; @@ -17,14 +19,16 @@ namespace Azure.Verticals.AgriFood.Farming /// The TillageData service client. public partial class TillageDataClient { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of TillageDataClient for mocking. protected TillageDataClient() @@ -35,6 +39,7 @@ protected TillageDataClient() /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. + /// or is null. public TillageDataClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) { if (endpoint == null) @@ -47,49 +52,46 @@ public TillageDataClient(Uri endpoint, TokenCredential credential, FarmBeatsClie } options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); _tokenCredential = credential; - var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); - _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { authPolicy }, new ResponseClassifier()); - this.endpoint = endpoint; - apiVersion = options.Version; + _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; } - /// Returns a paginated list of tillage data resources under a particular farm. + /// Get a specified tillage data resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the tillage data resource. + /// The request options. + /// or is null. /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// tillageDepth: { - /// unit: string, - /// value: number - /// }, - /// tillagePressure: Measure, - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// tillageDepth: { + /// unit: string, + /// value: number + /// }, + /// tillagePressure: Measure, + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -107,65 +109,16 @@ public TillageDataClient(Uri endpoint, TokenCredential credential, FarmBeatsClie /// /// /// - /// ID of the associated farmer. - /// Minimum measured tillage depth (inclusive). - /// Maximum measured tillage depth (inclusive). - /// Minimum pressure applied by a tillage implement (inclusive). - /// Maximum pressure applied by a tillage implement (inclusive). - /// Sources of the operation data. - /// Boundary IDs associated with operation data. - /// Operation boundary IDs associated with operation data. - /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum area for which operation was applied (inclusive). - /// Maximum area for which operation was applied (inclusive). - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task ListByFarmerIdAsync(string farmerId, double? minTillageDepth = null, double? maxTillageDepth = null, double? minTillagePressure = null, double? maxTillagePressure = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual async Task GetAsync(string farmerId, string tillageDataId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListByFarmerIdRequest(farmerId, minTillageDepth, maxTillageDepth, minTillagePressure, maxTillagePressure, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("TillageDataClient.ListByFarmerId"); + using var scope = _clientDiagnostics.CreateScope("TillageDataClient.Get"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRequest(farmerId, tillageDataId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -174,41 +127,38 @@ public virtual async Task ListByFarmerIdAsync(string farmerId, double? } } - /// Returns a paginated list of tillage data resources under a particular farm. + /// Get a specified tillage data resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the tillage data resource. + /// The request options. + /// or is null. /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// tillageDepth: { - /// unit: string, - /// value: number - /// }, - /// tillagePressure: Measure, - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// tillageDepth: { + /// unit: string, + /// value: number + /// }, + /// tillagePressure: Measure, + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -226,65 +176,16 @@ public virtual async Task ListByFarmerIdAsync(string farmerId, double? /// /// /// - /// ID of the associated farmer. - /// Minimum measured tillage depth (inclusive). - /// Maximum measured tillage depth (inclusive). - /// Minimum pressure applied by a tillage implement (inclusive). - /// Maximum pressure applied by a tillage implement (inclusive). - /// Sources of the operation data. - /// Boundary IDs associated with operation data. - /// Operation boundary IDs associated with operation data. - /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum area for which operation was applied (inclusive). - /// Maximum area for which operation was applied (inclusive). - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual Response ListByFarmerId(string farmerId, double? minTillageDepth = null, double? maxTillageDepth = null, double? minTillagePressure = null, double? maxTillagePressure = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual Response Get(string farmerId, string tillageDataId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListByFarmerIdRequest(farmerId, minTillageDepth, maxTillageDepth, minTillagePressure, maxTillagePressure, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("TillageDataClient.ListByFarmerId"); + using var scope = _clientDiagnostics.CreateScope("TillageDataClient.Get"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRequest(farmerId, tillageDataId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -293,157 +194,65 @@ public virtual Response ListByFarmerId(string farmerId, double? minTillageDepth } } - private HttpMessage CreateListByFarmerIdRequest(string farmerId, double? minTillageDepth, double? maxTillageDepth, double? minTillagePressure, double? maxTillagePressure, IEnumerable sources, IEnumerable associatedBoundaryIds, IEnumerable operationBoundaryIds, DateTimeOffset? minOperationStartDateTime, DateTimeOffset? maxOperationStartDateTime, DateTimeOffset? minOperationEndDateTime, DateTimeOffset? maxOperationEndDateTime, DateTimeOffset? minOperationModifiedDateTime, DateTimeOffset? maxOperationModifiedDateTime, double? minArea, double? maxArea, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/tillage-data", false); - if (minTillageDepth != null) - { - uri.AppendQuery("minTillageDepth", minTillageDepth.Value, true); - } - if (maxTillageDepth != null) - { - uri.AppendQuery("maxTillageDepth", maxTillageDepth.Value, true); - } - if (minTillagePressure != null) - { - uri.AppendQuery("minTillagePressure", minTillagePressure.Value, true); - } - if (maxTillagePressure != null) - { - uri.AppendQuery("maxTillagePressure", maxTillagePressure.Value, true); - } - if (sources != null) - { - uri.AppendQueryDelimited("sources", sources, ",", true); - } - if (associatedBoundaryIds != null) - { - uri.AppendQueryDelimited("associatedBoundaryIds", associatedBoundaryIds, ",", true); - } - if (operationBoundaryIds != null) - { - uri.AppendQueryDelimited("operationBoundaryIds", operationBoundaryIds, ",", true); - } - if (minOperationStartDateTime != null) - { - uri.AppendQuery("minOperationStartDateTime", minOperationStartDateTime.Value, "O", true); - } - if (maxOperationStartDateTime != null) - { - uri.AppendQuery("maxOperationStartDateTime", maxOperationStartDateTime.Value, "O", true); - } - if (minOperationEndDateTime != null) - { - uri.AppendQuery("minOperationEndDateTime", minOperationEndDateTime.Value, "O", true); - } - if (maxOperationEndDateTime != null) - { - uri.AppendQuery("maxOperationEndDateTime", maxOperationEndDateTime.Value, "O", true); - } - if (minOperationModifiedDateTime != null) - { - uri.AppendQuery("minOperationModifiedDateTime", minOperationModifiedDateTime.Value, "O", true); - } - if (maxOperationModifiedDateTime != null) - { - uri.AppendQuery("maxOperationModifiedDateTime", maxOperationModifiedDateTime.Value, "O", true); - } - if (minArea != null) - { - uri.AppendQuery("minArea", minArea.Value, true); - } - if (maxArea != null) - { - uri.AppendQuery("maxArea", maxArea.Value, true); - } - if (ids != null) - { - uri.AppendQueryDelimited("ids", ids, ",", true); - } - if (names != null) - { - uri.AppendQueryDelimited("names", names, ",", true); - } - if (propertyFilters != null) - { - uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); - } - if (statuses != null) - { - uri.AppendQueryDelimited("statuses", statuses, ",", true); - } - if (minCreatedDateTime != null) - { - uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); - } - if (maxCreatedDateTime != null) - { - uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); - } - if (minLastModifiedDateTime != null) - { - uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); - } - if (maxLastModifiedDateTime != null) - { - uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); - } - if (maxPageSize != null) - { - uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Returns a paginated list of tillage data resources across all farmers. + /// Creates or updates an tillage data resource under a particular farmer. + /// ID of the associated farmer. + /// ID of the tillage data resource. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// + /// Schema for Request Body: + /// { + /// tillageDepth: { + /// unit: string, + /// value: number + /// }, + /// tillagePressure: Measure, + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// tillageDepth: { - /// unit: string, - /// value: number - /// }, - /// tillagePressure: Measure, - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// tillageDepth: { + /// unit: string, + /// value: number + /// }, + /// tillagePressure: Measure, + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -461,64 +270,16 @@ private HttpMessage CreateListByFarmerIdRequest(string farmerId, double? minTill /// /// /// - /// Minimum measured tillage depth (inclusive). - /// Maximum measured tillage depth (inclusive). - /// Minimum pressure applied by a tillage implement (inclusive). - /// Maximum pressure applied by a tillage implement (inclusive). - /// Sources of the operation data. - /// Boundary IDs associated with operation data. - /// Operation boundary IDs associated with operation data. - /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum area for which operation was applied (inclusive). - /// Maximum area for which operation was applied (inclusive). - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task ListAsync(double? minTillageDepth = null, double? maxTillageDepth = null, double? minTillagePressure = null, double? maxTillagePressure = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual async Task CreateOrUpdateAsync(string farmerId, string tillageDataId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRequest(minTillageDepth, maxTillageDepth, minTillagePressure, maxTillagePressure, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("TillageDataClient.List"); + using var scope = _clientDiagnostics.CreateScope("TillageDataClient.CreateOrUpdate"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, tillageDataId, content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -527,41 +288,65 @@ public virtual async Task ListAsync(double? minTillageDepth = null, do } } - /// Returns a paginated list of tillage data resources across all farmers. + /// Creates or updates an tillage data resource under a particular farmer. + /// ID of the associated farmer. + /// ID of the tillage data resource. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// + /// Schema for Request Body: + /// { + /// tillageDepth: { + /// unit: string, + /// value: number + /// }, + /// tillagePressure: Measure, + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// tillageDepth: { - /// unit: string, - /// value: number - /// }, - /// tillagePressure: Measure, - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// tillageDepth: { + /// unit: string, + /// value: number + /// }, + /// tillagePressure: Measure, + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -579,64 +364,16 @@ public virtual async Task ListAsync(double? minTillageDepth = null, do /// /// /// - /// Minimum measured tillage depth (inclusive). - /// Maximum measured tillage depth (inclusive). - /// Minimum pressure applied by a tillage implement (inclusive). - /// Maximum pressure applied by a tillage implement (inclusive). - /// Sources of the operation data. - /// Boundary IDs associated with operation data. - /// Operation boundary IDs associated with operation data. - /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). - /// Minimum area for which operation was applied (inclusive). - /// Maximum area for which operation was applied (inclusive). - /// Ids of the resource. - /// Names of the resource. - /// - /// Filters on key-value pairs within the Properties object. - /// eg. "{testKey} eq {testValue}". - /// - /// Statuses of the resource. - /// Minimum creation date of resource (inclusive). - /// Maximum creation date of resource (inclusive). - /// Minimum last modified date of resource (inclusive). - /// Maximum last modified date of resource (inclusive). - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual Response List(double? minTillageDepth = null, double? maxTillageDepth = null, double? minTillagePressure = null, double? maxTillagePressure = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual Response CreateOrUpdate(string farmerId, string tillageDataId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRequest(minTillageDepth, maxTillageDepth, minTillagePressure, maxTillagePressure, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("TillageDataClient.List"); + using var scope = _clientDiagnostics.CreateScope("TillageDataClient.CreateOrUpdate"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, tillageDataId, content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -645,149 +382,12 @@ public virtual Response List(double? minTillageDepth = null, double? maxTillageD } } - private HttpMessage CreateListRequest(double? minTillageDepth, double? maxTillageDepth, double? minTillagePressure, double? maxTillagePressure, IEnumerable sources, IEnumerable associatedBoundaryIds, IEnumerable operationBoundaryIds, DateTimeOffset? minOperationStartDateTime, DateTimeOffset? maxOperationStartDateTime, DateTimeOffset? minOperationEndDateTime, DateTimeOffset? maxOperationEndDateTime, DateTimeOffset? minOperationModifiedDateTime, DateTimeOffset? maxOperationModifiedDateTime, double? minArea, double? maxArea, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/tillage-data", false); - if (minTillageDepth != null) - { - uri.AppendQuery("minTillageDepth", minTillageDepth.Value, true); - } - if (maxTillageDepth != null) - { - uri.AppendQuery("maxTillageDepth", maxTillageDepth.Value, true); - } - if (minTillagePressure != null) - { - uri.AppendQuery("minTillagePressure", minTillagePressure.Value, true); - } - if (maxTillagePressure != null) - { - uri.AppendQuery("maxTillagePressure", maxTillagePressure.Value, true); - } - if (sources != null) - { - uri.AppendQueryDelimited("sources", sources, ",", true); - } - if (associatedBoundaryIds != null) - { - uri.AppendQueryDelimited("associatedBoundaryIds", associatedBoundaryIds, ",", true); - } - if (operationBoundaryIds != null) - { - uri.AppendQueryDelimited("operationBoundaryIds", operationBoundaryIds, ",", true); - } - if (minOperationStartDateTime != null) - { - uri.AppendQuery("minOperationStartDateTime", minOperationStartDateTime.Value, "O", true); - } - if (maxOperationStartDateTime != null) - { - uri.AppendQuery("maxOperationStartDateTime", maxOperationStartDateTime.Value, "O", true); - } - if (minOperationEndDateTime != null) - { - uri.AppendQuery("minOperationEndDateTime", minOperationEndDateTime.Value, "O", true); - } - if (maxOperationEndDateTime != null) - { - uri.AppendQuery("maxOperationEndDateTime", maxOperationEndDateTime.Value, "O", true); - } - if (minOperationModifiedDateTime != null) - { - uri.AppendQuery("minOperationModifiedDateTime", minOperationModifiedDateTime.Value, "O", true); - } - if (maxOperationModifiedDateTime != null) - { - uri.AppendQuery("maxOperationModifiedDateTime", maxOperationModifiedDateTime.Value, "O", true); - } - if (minArea != null) - { - uri.AppendQuery("minArea", minArea.Value, true); - } - if (maxArea != null) - { - uri.AppendQuery("maxArea", maxArea.Value, true); - } - if (ids != null) - { - uri.AppendQueryDelimited("ids", ids, ",", true); - } - if (names != null) - { - uri.AppendQueryDelimited("names", names, ",", true); - } - if (propertyFilters != null) - { - uri.AppendQueryDelimited("propertyFilters", propertyFilters, ",", true); - } - if (statuses != null) - { - uri.AppendQueryDelimited("statuses", statuses, ",", true); - } - if (minCreatedDateTime != null) - { - uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); - } - if (maxCreatedDateTime != null) - { - uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); - } - if (minLastModifiedDateTime != null) - { - uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); - } - if (maxLastModifiedDateTime != null) - { - uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); - } - if (maxPageSize != null) - { - uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Get a specified tillage data resource under a particular farmer. + /// Deletes a specified tillage data resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the tillage data. + /// The request options. + /// or is null. /// - /// Schema for Response Body: - /// { - /// tillageDepth: { - /// unit: string, - /// value: number - /// }, - /// tillagePressure: Measure, - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// /// Schema for Response Error: /// { /// error: { @@ -805,35 +405,16 @@ private HttpMessage CreateListRequest(double? minTillageDepth, double? maxTillag /// /// /// - /// ID of the associated farmer resource. - /// ID of the tillage data resource. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetAsync(string farmerId, string tillageDataId, RequestOptions options = null) + public virtual async Task DeleteAsync(string farmerId, string tillageDataId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRequest(farmerId, tillageDataId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("TillageDataClient.Get"); + using var scope = _clientDiagnostics.CreateScope("TillageDataClient.Delete"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(farmerId, tillageDataId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -842,35 +423,12 @@ public virtual async Task GetAsync(string farmerId, string tillageData } } - /// Get a specified tillage data resource under a particular farmer. + /// Deletes a specified tillage data resource under a particular farmer. + /// ID of the associated farmer resource. + /// ID of the tillage data. + /// The request options. + /// or is null. /// - /// Schema for Response Body: - /// { - /// tillageDepth: { - /// unit: string, - /// value: number - /// }, - /// tillagePressure: Measure, - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// /// Schema for Response Error: /// { /// error: { @@ -888,35 +446,16 @@ public virtual async Task GetAsync(string farmerId, string tillageData /// /// /// - /// ID of the associated farmer resource. - /// ID of the tillage data resource. - /// The request options. #pragma warning disable AZC0002 - public virtual Response Get(string farmerId, string tillageDataId, RequestOptions options = null) + public virtual Response Delete(string farmerId, string tillageDataId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRequest(farmerId, tillageDataId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("TillageDataClient.Get"); + using var scope = _clientDiagnostics.CreateScope("TillageDataClient.Delete"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(farmerId, tillageDataId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -925,79 +464,74 @@ public virtual Response Get(string farmerId, string tillageDataId, RequestOption } } - private HttpMessage CreateGetRequest(string farmerId, string tillageDataId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/tillage-data/", false); - uri.AppendPath(tillageDataId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Creates or updates an tillage data resource under a particular farmer. - /// - /// Schema for Request Body: - /// { - /// tillageDepth: { - /// unit: string, - /// value: number - /// }, - /// tillagePressure: Measure, - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// + /// Returns a paginated list of tillage data resources under a particular farm. + /// ID of the associated farmer. + /// The request options. + /// Minimum measured tillage depth (inclusive). + /// Maximum measured tillage depth (inclusive). + /// Minimum pressure applied by a tillage implement (inclusive). + /// Maximum pressure applied by a tillage implement (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// is null. + /// /// Schema for Response Body: /// { - /// tillageDepth: { - /// unit: string, - /// value: number - /// }, - /// tillagePressure: Measure, - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// value: [ + /// { + /// tillageDepth: { + /// unit: string, + /// value: number + /// }, + /// tillagePressure: Measure, + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1015,101 +549,98 @@ private HttpMessage CreateGetRequest(string farmerId, string tillageDataId) /// /// /// - /// ID of the associated farmer. - /// ID of the tillage data resource. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task CreateOrUpdateAsync(string farmerId, string tillageDataId, RequestContent content, RequestOptions options = null) + public virtual AsyncPageable ListByFarmerIdAsync(string farmerId, RequestOptions options, double? minTillageDepth = null, double? maxTillageDepth = null, double? minTillagePressure = null, double? maxTillagePressure = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, tillageDataId, content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("TillageDataClient.CreateOrUpdate"); - scope.Start(); - try + if (farmerId == null) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + throw new ArgumentNullException(nameof(farmerId)); } - catch (Exception e) + + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "TillageDataClient.ListByFarmerId"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) { - scope.Failed(e); - throw; + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListByFarmerIdRequest(farmerId, minTillageDepth, maxTillageDepth, minTillagePressure, maxTillagePressure, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListByFarmerIdNextPageRequest(nextLink, farmerId, minTillageDepth, maxTillageDepth, minTillagePressure, maxTillagePressure, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - /// Creates or updates an tillage data resource under a particular farmer. + /// Returns a paginated list of tillage data resources under a particular farm. + /// ID of the associated farmer. + /// The request options. + /// Minimum measured tillage depth (inclusive). + /// Maximum measured tillage depth (inclusive). + /// Minimum pressure applied by a tillage implement (inclusive). + /// Maximum pressure applied by a tillage implement (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// is null. /// - /// Schema for Request Body: - /// { - /// tillageDepth: { - /// unit: string, - /// value: number - /// }, - /// tillagePressure: Measure, - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> - /// } - /// - /// /// Schema for Response Body: /// { - /// tillageDepth: { - /// unit: string, - /// value: number - /// }, - /// tillagePressure: Measure, - /// area: Measure, - /// source: string, - /// operationModifiedDateTime: string (ISO 8601 Format), - /// operationStartDateTime: string (ISO 8601 Format), - /// operationEndDateTime: string (ISO 8601 Format), - /// attachmentsLink: string, - /// associatedBoundaryId: string, - /// operationBoundaryId: string, - /// farmerId: string, - /// id: string, - /// eTag: string, - /// status: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// value: [ + /// { + /// tillageDepth: { + /// unit: string, + /// value: number + /// }, + /// tillagePressure: Measure, + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1127,66 +658,96 @@ public virtual async Task CreateOrUpdateAsync(string farmerId, string /// /// /// - /// ID of the associated farmer. - /// ID of the tillage data resource. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual Response CreateOrUpdate(string farmerId, string tillageDataId, RequestContent content, RequestOptions options = null) + public virtual Pageable ListByFarmerId(string farmerId, RequestOptions options, double? minTillageDepth = null, double? maxTillageDepth = null, double? minTillagePressure = null, double? maxTillagePressure = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(farmerId, tillageDataId, content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("TillageDataClient.CreateOrUpdate"); - scope.Start(); - try + if (farmerId == null) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + throw new ArgumentNullException(nameof(farmerId)); } - catch (Exception e) + + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "TillageDataClient.ListByFarmerId"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) { - scope.Failed(e); - throw; + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListByFarmerIdRequest(farmerId, minTillageDepth, maxTillageDepth, minTillagePressure, maxTillagePressure, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListByFarmerIdNextPageRequest(nextLink, farmerId, minTillageDepth, maxTillageDepth, minTillagePressure, maxTillagePressure, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - private HttpMessage CreateCreateOrUpdateRequest(string farmerId, string tillageDataId, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/farmers/", false); - uri.AppendPath(farmerId, true); - uri.AppendPath("/tillage-data/", false); - uri.AppendPath(tillageDataId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/merge-patch+json"); - request.Content = content; - return message; - } - - /// Deletes a specified tillage data resource under a particular farmer. + /// Returns a paginated list of tillage data resources across all farmers. + /// The request options. + /// Minimum measured tillage depth (inclusive). + /// Maximum measured tillage depth (inclusive). + /// Minimum pressure applied by a tillage implement (inclusive). + /// Maximum pressure applied by a tillage implement (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// tillageDepth: { + /// unit: string, + /// value: number + /// }, + /// tillagePressure: Measure, + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string + /// } + /// /// Schema for Response Error: /// { /// error: { @@ -1204,45 +765,91 @@ private HttpMessage CreateCreateOrUpdateRequest(string farmerId, string tillageD /// /// /// - /// ID of the associated farmer resource. - /// ID of the tillage data. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task DeleteAsync(string farmerId, string tillageDataId, RequestOptions options = null) + public virtual AsyncPageable ListAsync(RequestOptions options, double? minTillageDepth = null, double? maxTillageDepth = null, double? minTillagePressure = null, double? maxTillagePressure = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(farmerId, tillageDataId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("TillageDataClient.Delete"); - scope.Start(); - try + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "TillageDataClient.List"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) + do { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; + var message = string.IsNullOrEmpty(nextLink) + ? CreateListRequest(minTillageDepth, maxTillageDepth, minTillagePressure, maxTillagePressure, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListNextPageRequest(nextLink, minTillageDepth, maxTillageDepth, minTillagePressure, maxTillagePressure, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - /// Deletes a specified tillage data resource under a particular farmer. + /// Returns a paginated list of tillage data resources across all farmers. + /// The request options. + /// Minimum measured tillage depth (inclusive). + /// Maximum measured tillage depth (inclusive). + /// Minimum pressure applied by a tillage implement (inclusive). + /// Maximum pressure applied by a tillage implement (inclusive). + /// Sources of the operation data. + /// Boundary IDs associated with operation data. + /// Operation boundary IDs associated with operation data. + /// Minimum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum start date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum end date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Maximum modified date-time of the operation data, sample format: yyyy-MM-ddTHH:mm:ssZ (inclusive). + /// Minimum area for which operation was applied (inclusive). + /// Maximum area for which operation was applied (inclusive). + /// Ids of the resource. + /// Names of the resource. + /// + /// Filters on key-value pairs within the Properties object. + /// eg. "{testKey} eq {testValue}". + /// + /// Statuses of the resource. + /// Minimum creation date of resource (inclusive). + /// Maximum creation date of resource (inclusive). + /// Minimum last modified date of resource (inclusive). + /// Maximum last modified date of resource (inclusive). + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// tillageDepth: { + /// unit: string, + /// value: number + /// }, + /// tillagePressure: Measure, + /// area: Measure, + /// source: string, + /// operationModifiedDateTime: string (ISO 8601 Format), + /// operationStartDateTime: string (ISO 8601 Format), + /// operationEndDateTime: string (ISO 8601 Format), + /// attachmentsLink: string, + /// associatedBoundaryId: string, + /// operationBoundaryId: string, + /// farmerId: string, + /// id: string, + /// eTag: string, + /// status: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string + /// } + /// /// Schema for Response Error: /// { /// error: { @@ -1260,58 +867,422 @@ public virtual async Task DeleteAsync(string farmerId, string tillageD /// /// /// - /// ID of the associated farmer resource. - /// ID of the tillage data. - /// The request options. #pragma warning disable AZC0002 - public virtual Response Delete(string farmerId, string tillageDataId, RequestOptions options = null) + public virtual Pageable List(RequestOptions options, double? minTillageDepth = null, double? maxTillageDepth = null, double? minTillagePressure = null, double? maxTillagePressure = null, IEnumerable sources = null, IEnumerable associatedBoundaryIds = null, IEnumerable operationBoundaryIds = null, DateTimeOffset? minOperationStartDateTime = null, DateTimeOffset? maxOperationStartDateTime = null, DateTimeOffset? minOperationEndDateTime = null, DateTimeOffset? maxOperationEndDateTime = null, DateTimeOffset? minOperationModifiedDateTime = null, DateTimeOffset? maxOperationModifiedDateTime = null, double? minArea = null, double? maxArea = null, IEnumerable ids = null, IEnumerable names = null, IEnumerable propertyFilters = null, IEnumerable statuses = null, DateTimeOffset? minCreatedDateTime = null, DateTimeOffset? maxCreatedDateTime = null, DateTimeOffset? minLastModifiedDateTime = null, DateTimeOffset? maxLastModifiedDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(farmerId, tillageDataId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("TillageDataClient.Delete"); - scope.Start(); - try + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "TillageDataClient.List"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListRequest(minTillageDepth, maxTillageDepth, minTillagePressure, maxTillagePressure, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken) + : CreateListNextPageRequest(nextLink, minTillageDepth, maxTillageDepth, minTillagePressure, maxTillagePressure, sources, associatedBoundaryIds, operationBoundaryIds, minOperationStartDateTime, maxOperationStartDateTime, minOperationEndDateTime, maxOperationEndDateTime, minOperationModifiedDateTime, maxOperationModifiedDateTime, minArea, maxArea, ids, names, propertyFilters, statuses, minCreatedDateTime, maxCreatedDateTime, minLastModifiedDateTime, maxLastModifiedDateTime, maxPageSize, skipToken); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + internal HttpMessage CreateListByFarmerIdRequest(string farmerId, double? minTillageDepth, double? maxTillageDepth, double? minTillagePressure, double? maxTillagePressure, IEnumerable sources, IEnumerable associatedBoundaryIds, IEnumerable operationBoundaryIds, DateTimeOffset? minOperationStartDateTime, DateTimeOffset? maxOperationStartDateTime, DateTimeOffset? minOperationEndDateTime, DateTimeOffset? maxOperationEndDateTime, DateTimeOffset? minOperationModifiedDateTime, DateTimeOffset? maxOperationModifiedDateTime, double? minArea, double? maxArea, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/tillage-data", false); + if (minTillageDepth != null) + { + uri.AppendQuery("minTillageDepth", minTillageDepth.Value, true); + } + if (maxTillageDepth != null) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) + uri.AppendQuery("maxTillageDepth", maxTillageDepth.Value, true); + } + if (minTillagePressure != null) + { + uri.AppendQuery("minTillagePressure", minTillagePressure.Value, true); + } + if (maxTillagePressure != null) + { + uri.AppendQuery("maxTillagePressure", maxTillagePressure.Value, true); + } + if (sources != null) + { + foreach (var param in sources) { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } + uri.AppendQuery("sources", param, true); } - else + } + if (associatedBoundaryIds != null) + { + foreach (var param in associatedBoundaryIds) { - return message.Response; + uri.AppendQuery("associatedBoundaryIds", param, true); } } - catch (Exception e) + if (operationBoundaryIds != null) { - scope.Failed(e); - throw; + foreach (var param in operationBoundaryIds) + { + uri.AppendQuery("operationBoundaryIds", param, true); + } + } + if (minOperationStartDateTime != null) + { + uri.AppendQuery("minOperationStartDateTime", minOperationStartDateTime.Value, "O", true); + } + if (maxOperationStartDateTime != null) + { + uri.AppendQuery("maxOperationStartDateTime", maxOperationStartDateTime.Value, "O", true); } + if (minOperationEndDateTime != null) + { + uri.AppendQuery("minOperationEndDateTime", minOperationEndDateTime.Value, "O", true); + } + if (maxOperationEndDateTime != null) + { + uri.AppendQuery("maxOperationEndDateTime", maxOperationEndDateTime.Value, "O", true); + } + if (minOperationModifiedDateTime != null) + { + uri.AppendQuery("minOperationModifiedDateTime", minOperationModifiedDateTime.Value, "O", true); + } + if (maxOperationModifiedDateTime != null) + { + uri.AppendQuery("maxOperationModifiedDateTime", maxOperationModifiedDateTime.Value, "O", true); + } + if (minArea != null) + { + uri.AppendQuery("minArea", minArea.Value, true); + } + if (maxArea != null) + { + uri.AppendQuery("maxArea", maxArea.Value, true); + } + if (ids != null) + { + foreach (var param in ids) + { + uri.AppendQuery("ids", param, true); + } + } + if (names != null) + { + foreach (var param in names) + { + uri.AppendQuery("names", param, true); + } + } + if (propertyFilters != null) + { + foreach (var param in propertyFilters) + { + uri.AppendQuery("propertyFilters", param, true); + } + } + if (statuses != null) + { + foreach (var param in statuses) + { + uri.AppendQuery("statuses", param, true); + } + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; } - private HttpMessage CreateDeleteRequest(string farmerId, string tillageDataId) + internal HttpMessage CreateListRequest(double? minTillageDepth, double? maxTillageDepth, double? minTillagePressure, double? maxTillagePressure, IEnumerable sources, IEnumerable associatedBoundaryIds, IEnumerable operationBoundaryIds, DateTimeOffset? minOperationStartDateTime, DateTimeOffset? maxOperationStartDateTime, DateTimeOffset? minOperationEndDateTime, DateTimeOffset? maxOperationEndDateTime, DateTimeOffset? minOperationModifiedDateTime, DateTimeOffset? maxOperationModifiedDateTime, double? minArea, double? maxArea, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/tillage-data", false); + if (minTillageDepth != null) + { + uri.AppendQuery("minTillageDepth", minTillageDepth.Value, true); + } + if (maxTillageDepth != null) + { + uri.AppendQuery("maxTillageDepth", maxTillageDepth.Value, true); + } + if (minTillagePressure != null) + { + uri.AppendQuery("minTillagePressure", minTillagePressure.Value, true); + } + if (maxTillagePressure != null) + { + uri.AppendQuery("maxTillagePressure", maxTillagePressure.Value, true); + } + if (sources != null) + { + foreach (var param in sources) + { + uri.AppendQuery("sources", param, true); + } + } + if (associatedBoundaryIds != null) + { + foreach (var param in associatedBoundaryIds) + { + uri.AppendQuery("associatedBoundaryIds", param, true); + } + } + if (operationBoundaryIds != null) + { + foreach (var param in operationBoundaryIds) + { + uri.AppendQuery("operationBoundaryIds", param, true); + } + } + if (minOperationStartDateTime != null) + { + uri.AppendQuery("minOperationStartDateTime", minOperationStartDateTime.Value, "O", true); + } + if (maxOperationStartDateTime != null) + { + uri.AppendQuery("maxOperationStartDateTime", maxOperationStartDateTime.Value, "O", true); + } + if (minOperationEndDateTime != null) + { + uri.AppendQuery("minOperationEndDateTime", minOperationEndDateTime.Value, "O", true); + } + if (maxOperationEndDateTime != null) + { + uri.AppendQuery("maxOperationEndDateTime", maxOperationEndDateTime.Value, "O", true); + } + if (minOperationModifiedDateTime != null) + { + uri.AppendQuery("minOperationModifiedDateTime", minOperationModifiedDateTime.Value, "O", true); + } + if (maxOperationModifiedDateTime != null) + { + uri.AppendQuery("maxOperationModifiedDateTime", maxOperationModifiedDateTime.Value, "O", true); + } + if (minArea != null) + { + uri.AppendQuery("minArea", minArea.Value, true); + } + if (maxArea != null) + { + uri.AppendQuery("maxArea", maxArea.Value, true); + } + if (ids != null) + { + foreach (var param in ids) + { + uri.AppendQuery("ids", param, true); + } + } + if (names != null) + { + foreach (var param in names) + { + uri.AppendQuery("names", param, true); + } + } + if (propertyFilters != null) + { + foreach (var param in propertyFilters) + { + uri.AppendQuery("propertyFilters", param, true); + } + } + if (statuses != null) + { + foreach (var param in statuses) + { + uri.AppendQuery("statuses", param, true); + } + } + if (minCreatedDateTime != null) + { + uri.AppendQuery("minCreatedDateTime", minCreatedDateTime.Value, "O", true); + } + if (maxCreatedDateTime != null) + { + uri.AppendQuery("maxCreatedDateTime", maxCreatedDateTime.Value, "O", true); + } + if (minLastModifiedDateTime != null) + { + uri.AppendQuery("minLastModifiedDateTime", minLastModifiedDateTime.Value, "O", true); + } + if (maxLastModifiedDateTime != null) + { + uri.AppendQuery("maxLastModifiedDateTime", maxLastModifiedDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetRequest(string farmerId, string tillageDataId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/tillage-data/", false); + uri.AppendPath(tillageDataId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateOrUpdateRequest(string farmerId, string tillageDataId, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/farmers/", false); + uri.AppendPath(farmerId, true); + uri.AppendPath("/tillage-data/", false); + uri.AppendPath(tillageDataId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/merge-patch+json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200201.Instance; + return message; + } + + internal HttpMessage CreateDeleteRequest(string farmerId, string tillageDataId) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); + uri.Reset(_endpoint); uri.AppendPath("/farmers/", false); uri.AppendPath(farmerId, true); uri.AppendPath("/tillage-data/", false); uri.AppendPath(tillageDataId, true); - uri.AppendQuery("api-version", apiVersion, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier204.Instance; + return message; + } + + internal HttpMessage CreateListByFarmerIdNextPageRequest(string nextLink, string farmerId, double? minTillageDepth, double? maxTillageDepth, double? minTillagePressure, double? maxTillagePressure, IEnumerable sources, IEnumerable associatedBoundaryIds, IEnumerable operationBoundaryIds, DateTimeOffset? minOperationStartDateTime, DateTimeOffset? maxOperationStartDateTime, DateTimeOffset? minOperationEndDateTime, DateTimeOffset? maxOperationEndDateTime, DateTimeOffset? minOperationModifiedDateTime, DateTimeOffset? maxOperationModifiedDateTime, double? minArea, double? maxArea, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, double? minTillageDepth, double? maxTillageDepth, double? minTillagePressure, double? maxTillagePressure, IEnumerable sources, IEnumerable associatedBoundaryIds, IEnumerable operationBoundaryIds, DateTimeOffset? minOperationStartDateTime, DateTimeOffset? maxOperationStartDateTime, DateTimeOffset? minOperationEndDateTime, DateTimeOffset? maxOperationEndDateTime, DateTimeOffset? minOperationModifiedDateTime, DateTimeOffset? maxOperationModifiedDateTime, double? minArea, double? maxArea, IEnumerable ids, IEnumerable names, IEnumerable propertyFilters, IEnumerable statuses, DateTimeOffset? minCreatedDateTime, DateTimeOffset? maxCreatedDateTime, DateTimeOffset? minLastModifiedDateTime, DateTimeOffset? maxLastModifiedDateTime, int? maxPageSize, string skipToken) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; return message; } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier200201 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200201(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + 201 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier204 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier204(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 204 => false, + _ => true + }; + } + } } } diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/WeatherClient.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/WeatherClient.cs index f8a035ec4636b..6d5cc10c48af0 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/WeatherClient.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/src/Generated/WeatherClient.cs @@ -6,6 +6,9 @@ #nullable disable using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; @@ -16,14 +19,16 @@ namespace Azure.Verticals.AgriFood.Farming /// The Weather service client. public partial class WeatherClient { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://farmbeats.azure.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of WeatherClient for mocking. protected WeatherClient() @@ -34,6 +39,7 @@ protected WeatherClient() /// The endpoint of your FarmBeats resource (protocol and hostname, for example: https://{resourceName}.farmbeats.azure.net). /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. + /// or is null. public WeatherClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOptions options = null) { if (endpoint == null) @@ -46,62 +52,41 @@ public WeatherClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOp } options ??= new FarmBeatsClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); _tokenCredential = credential; - var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); - _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { authPolicy }, new ResponseClassifier()); - this.endpoint = endpoint; - apiVersion = options.Version; + _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; } - /// Returns a paginated list of weather data. + /// Get weather ingestion job. + /// ID of the job. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// farmerId: string, - /// boundaryId: string, - /// extensionId: string, - /// location: { - /// latitude: number, - /// longitude: number - /// }, - /// dateTime: string (ISO 8601 Format), - /// unitSystemCode: string, - /// extensionVersion: string, - /// weatherDataType: string, - /// granularity: string, - /// cloudCover: { - /// unit: string, - /// value: number - /// }, - /// dewPoint: Measure, - /// growingDegreeDay: Measure, - /// precipitation: Measure, - /// pressure: Measure, - /// relativeHumidity: Measure, - /// soilMoisture: Measure, - /// soilTemperature: Measure, - /// temperature: Measure, - /// visibility: Measure, - /// wetBulbTemperature: Measure, - /// windChill: Measure, - /// windDirection: Measure, - /// windGust: Measure, - /// windSpeed: Measure, - /// id: string, - /// eTag: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// boundaryId: string, + /// farmerId: string, + /// extensionId: string, + /// extensionApiName: string, + /// extensionApiInput: Dictionary<string, AnyObject>, + /// extensionDataProviderAppId: string, + /// extensionDataProviderApiKey: string, + /// id: string, + /// status: string, + /// durationInSeconds: number, + /// message: string, + /// createdDateTime: string (ISO 8601 Format), + /// lastActionDateTime: string (ISO 8601 Format), + /// startTime: string (ISO 8601 Format), + /// endTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -119,45 +104,16 @@ public WeatherClient(Uri endpoint, TokenCredential credential, FarmBeatsClientOp /// /// /// - /// Farmer ID. - /// Boundary ID. - /// ID of the weather extension. - /// Type of weather data (forecast/historical). - /// Granularity of weather data (daily/hourly). - /// Weather data start UTC date-time (inclusive), sample format: yyyy-MM-ddTHH:mm:ssZ. - /// Weather data end UTC date-time (inclusive), sample format: yyyy-MM-ddTHH:mm:ssZ. - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task ListAsync(string farmerId, string boundaryId, string extensionId, string weatherDataType, string granularity, DateTimeOffset? startDateTime = null, DateTimeOffset? endDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual async Task GetDataIngestionJobDetailsAsync(string jobId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRequest(farmerId, boundaryId, extensionId, weatherDataType, granularity, startDateTime, endDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("WeatherClient.List"); + using var scope = _clientDiagnostics.CreateScope("WeatherClient.GetDataIngestionJobDetails"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetDataIngestionJobDetailsRequest(jobId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -166,54 +122,33 @@ public virtual async Task ListAsync(string farmerId, string boundaryId } } - /// Returns a paginated list of weather data. + /// Get weather ingestion job. + /// ID of the job. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// farmerId: string, - /// boundaryId: string, - /// extensionId: string, - /// location: { - /// latitude: number, - /// longitude: number - /// }, - /// dateTime: string (ISO 8601 Format), - /// unitSystemCode: string, - /// extensionVersion: string, - /// weatherDataType: string, - /// granularity: string, - /// cloudCover: { - /// unit: string, - /// value: number - /// }, - /// dewPoint: Measure, - /// growingDegreeDay: Measure, - /// precipitation: Measure, - /// pressure: Measure, - /// relativeHumidity: Measure, - /// soilMoisture: Measure, - /// soilTemperature: Measure, - /// temperature: Measure, - /// visibility: Measure, - /// wetBulbTemperature: Measure, - /// windChill: Measure, - /// windDirection: Measure, - /// windGust: Measure, - /// windSpeed: Measure, - /// id: string, - /// eTag: string, - /// createdDateTime: string (ISO 8601 Format), - /// modifiedDateTime: string (ISO 8601 Format), - /// properties: Dictionary<string, AnyObject> - /// } - /// ], - /// $skipToken: string, - /// nextLink: string + /// boundaryId: string, + /// farmerId: string, + /// extensionId: string, + /// extensionApiName: string, + /// extensionApiInput: Dictionary<string, AnyObject>, + /// extensionDataProviderAppId: string, + /// extensionDataProviderApiKey: string, + /// id: string, + /// status: string, + /// durationInSeconds: number, + /// message: string, + /// createdDateTime: string (ISO 8601 Format), + /// lastActionDateTime: string (ISO 8601 Format), + /// startTime: string (ISO 8601 Format), + /// endTime: string (ISO 8601 Format), + /// name: string, + /// description: string, + /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -231,45 +166,16 @@ public virtual async Task ListAsync(string farmerId, string boundaryId /// /// /// - /// Farmer ID. - /// Boundary ID. - /// ID of the weather extension. - /// Type of weather data (forecast/historical). - /// Granularity of weather data (daily/hourly). - /// Weather data start UTC date-time (inclusive), sample format: yyyy-MM-ddTHH:mm:ssZ. - /// Weather data end UTC date-time (inclusive), sample format: yyyy-MM-ddTHH:mm:ssZ. - /// - /// Maximum number of items needed (inclusive). - /// Minimum = 10, Maximum = 1000, Default value = 50. - /// - /// Skip token for getting next set of results. - /// The request options. #pragma warning disable AZC0002 - public virtual Response List(string farmerId, string boundaryId, string extensionId, string weatherDataType, string granularity, DateTimeOffset? startDateTime = null, DateTimeOffset? endDateTime = null, int? maxPageSize = null, string skipToken = null, RequestOptions options = null) + public virtual Response GetDataIngestionJobDetails(string jobId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRequest(farmerId, boundaryId, extensionId, weatherDataType, granularity, startDateTime, endDateTime, maxPageSize, skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("WeatherClient.List"); + using var scope = _clientDiagnostics.CreateScope("WeatherClient.GetDataIngestionJobDetails"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetDataIngestionJobDetailsRequest(jobId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -278,52 +184,20 @@ public virtual Response List(string farmerId, string boundaryId, string extensio } } - private HttpMessage CreateListRequest(string farmerId, string boundaryId, string extensionId, string weatherDataType, string granularity, DateTimeOffset? startDateTime, DateTimeOffset? endDateTime, int? maxPageSize, string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/weather", false); - uri.AppendQuery("farmerId", farmerId, true); - uri.AppendQuery("boundaryId", boundaryId, true); - uri.AppendQuery("extensionId", extensionId, true); - uri.AppendQuery("weatherDataType", weatherDataType, true); - uri.AppendQuery("granularity", granularity, true); - if (startDateTime != null) - { - uri.AppendQuery("startDateTime", startDateTime.Value, "O", true); - } - if (endDateTime != null) - { - uri.AppendQuery("endDateTime", endDateTime.Value, "O", true); - } - if (maxPageSize != null) - { - uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); - } - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Get weather ingestion job. + /// Get weather data delete job. + /// ID of the job. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { - /// boundaryId: string, - /// farmerId: string, /// extensionId: string, - /// extensionApiName: string, - /// extensionApiInput: Dictionary<string, AnyObject>, - /// extensionDataProviderAppId: string, - /// extensionDataProviderApiKey: string, + /// farmerId: string, + /// boundaryId: string, + /// weatherDataType: string, + /// granularity: string, + /// startDateTime: string (ISO 8601 Format), + /// endDateTime: string (ISO 8601 Format), /// id: string, /// status: string, /// durationInSeconds: number, @@ -337,7 +211,6 @@ private HttpMessage CreateListRequest(string farmerId, string boundaryId, string /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -355,34 +228,16 @@ private HttpMessage CreateListRequest(string farmerId, string boundaryId, string /// /// /// - /// ID of the job. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetDataIngestionJobDetailsAsync(string jobId, RequestOptions options = null) + public virtual async Task GetDataDeleteJobDetailsAsync(string jobId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetDataIngestionJobDetailsRequest(jobId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("WeatherClient.GetDataIngestionJobDetails"); + using var scope = _clientDiagnostics.CreateScope("WeatherClient.GetDataDeleteJobDetails"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetDataDeleteJobDetailsRequest(jobId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -391,17 +246,20 @@ public virtual async Task GetDataIngestionJobDetailsAsync(string jobId } } - /// Get weather ingestion job. + /// Get weather data delete job. + /// ID of the job. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { - /// boundaryId: string, - /// farmerId: string, /// extensionId: string, - /// extensionApiName: string, - /// extensionApiInput: Dictionary<string, AnyObject>, - /// extensionDataProviderAppId: string, - /// extensionDataProviderApiKey: string, + /// farmerId: string, + /// boundaryId: string, + /// weatherDataType: string, + /// granularity: string, + /// startDateTime: string (ISO 8601 Format), + /// endDateTime: string (ISO 8601 Format), /// id: string, /// status: string, /// durationInSeconds: number, @@ -415,7 +273,6 @@ public virtual async Task GetDataIngestionJobDetailsAsync(string jobId /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -433,34 +290,16 @@ public virtual async Task GetDataIngestionJobDetailsAsync(string jobId /// /// /// - /// ID of the job. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetDataIngestionJobDetails(string jobId, RequestOptions options = null) + public virtual Response GetDataDeleteJobDetails(string jobId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetDataIngestionJobDetailsRequest(jobId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("WeatherClient.GetDataIngestionJobDetails"); + using var scope = _clientDiagnostics.CreateScope("WeatherClient.GetDataDeleteJobDetails"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetDataDeleteJobDetailsRequest(jobId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -469,69 +308,185 @@ public virtual Response GetDataIngestionJobDetails(string jobId, RequestOptions } } - private HttpMessage CreateGetDataIngestionJobDetailsRequest(string jobId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/weather/ingest-data/", false); - uri.AppendPath(jobId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Create a weather data ingestion job. + /// Returns a paginated list of weather data. + /// Farmer ID. + /// Boundary ID. + /// ID of the weather extension. + /// Type of weather data (forecast/historical). + /// Granularity of weather data (daily/hourly). + /// The request options. + /// Weather data start UTC date-time (inclusive), sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Weather data end UTC date-time (inclusive), sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// , , , , or is null. /// - /// Schema for Request Body: + /// Schema for Response Body: /// { - /// boundaryId: string (required), - /// farmerId: string (required), - /// extensionId: string (required), - /// extensionApiName: string (required), - /// extensionApiInput: Dictionary<string, AnyObject> (required), - /// extensionDataProviderAppId: string, - /// extensionDataProviderApiKey: string, - /// id: string, - /// status: string, - /// durationInSeconds: number, - /// message: string, - /// createdDateTime: string (ISO 8601 Format), - /// lastActionDateTime: string (ISO 8601 Format), - /// startTime: string (ISO 8601 Format), - /// endTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// value: [ + /// { + /// farmerId: string, + /// boundaryId: string, + /// extensionId: string, + /// location: { + /// latitude: number, + /// longitude: number + /// }, + /// dateTime: string (ISO 8601 Format), + /// unitSystemCode: string, + /// extensionVersion: string, + /// weatherDataType: string, + /// granularity: string, + /// cloudCover: { + /// unit: string, + /// value: number + /// }, + /// dewPoint: Measure, + /// growingDegreeDay: Measure, + /// precipitation: Measure, + /// pressure: Measure, + /// relativeHumidity: Measure, + /// soilMoisture: Measure, + /// soilTemperature: Measure, + /// temperature: Measure, + /// visibility: Measure, + /// wetBulbTemperature: Measure, + /// windChill: Measure, + /// windDirection: Measure, + /// windGust: Measure, + /// windSpeed: Measure, + /// id: string, + /// eTag: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [Error], + /// innererror: { + /// code: string, + /// innererror: InnerError + /// } + /// }, + /// traceId: string /// } /// /// + /// +#pragma warning disable AZC0002 + public virtual AsyncPageable ListAsync(string farmerId, string boundaryId, string extensionId, string weatherDataType, string granularity, RequestOptions options, DateTimeOffset? startDateTime = null, DateTimeOffset? endDateTime = null, int? maxPageSize = null, string skipToken = null) +#pragma warning restore AZC0002 + { + if (farmerId == null) + { + throw new ArgumentNullException(nameof(farmerId)); + } + if (boundaryId == null) + { + throw new ArgumentNullException(nameof(boundaryId)); + } + if (extensionId == null) + { + throw new ArgumentNullException(nameof(extensionId)); + } + if (weatherDataType == null) + { + throw new ArgumentNullException(nameof(weatherDataType)); + } + if (granularity == null) + { + throw new ArgumentNullException(nameof(granularity)); + } + + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "WeatherClient.List"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListRequest(farmerId, boundaryId, extensionId, weatherDataType, granularity, startDateTime, endDateTime, maxPageSize, skipToken) + : CreateListNextPageRequest(nextLink, farmerId, boundaryId, extensionId, weatherDataType, granularity, startDateTime, endDateTime, maxPageSize, skipToken); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + /// Returns a paginated list of weather data. + /// Farmer ID. + /// Boundary ID. + /// ID of the weather extension. + /// Type of weather data (forecast/historical). + /// Granularity of weather data (daily/hourly). + /// The request options. + /// Weather data start UTC date-time (inclusive), sample format: yyyy-MM-ddTHH:mm:ssZ. + /// Weather data end UTC date-time (inclusive), sample format: yyyy-MM-ddTHH:mm:ssZ. + /// + /// Maximum number of items needed (inclusive). + /// Minimum = 10, Maximum = 1000, Default value = 50. + /// + /// Skip token for getting next set of results. + /// , , , , or is null. + /// /// Schema for Response Body: /// { - /// boundaryId: string, - /// farmerId: string, - /// extensionId: string, - /// extensionApiName: string, - /// extensionApiInput: Dictionary<string, AnyObject>, - /// extensionDataProviderAppId: string, - /// extensionDataProviderApiKey: string, - /// id: string, - /// status: string, - /// durationInSeconds: number, - /// message: string, - /// createdDateTime: string (ISO 8601 Format), - /// lastActionDateTime: string (ISO 8601 Format), - /// startTime: string (ISO 8601 Format), - /// endTime: string (ISO 8601 Format), - /// name: string, - /// description: string, - /// properties: Dictionary<string, AnyObject> + /// value: [ + /// { + /// farmerId: string, + /// boundaryId: string, + /// extensionId: string, + /// location: { + /// latitude: number, + /// longitude: number + /// }, + /// dateTime: string (ISO 8601 Format), + /// unitSystemCode: string, + /// extensionVersion: string, + /// weatherDataType: string, + /// granularity: string, + /// cloudCover: { + /// unit: string, + /// value: number + /// }, + /// dewPoint: Measure, + /// growingDegreeDay: Measure, + /// precipitation: Measure, + /// pressure: Measure, + /// relativeHumidity: Measure, + /// soilMoisture: Measure, + /// soilTemperature: Measure, + /// temperature: Measure, + /// visibility: Measure, + /// wetBulbTemperature: Measure, + /// windChill: Measure, + /// windDirection: Measure, + /// windGust: Measure, + /// windSpeed: Measure, + /// id: string, + /// eTag: string, + /// createdDateTime: string (ISO 8601 Format), + /// modifiedDateTime: string (ISO 8601 Format), + /// properties: Dictionary<string, AnyObject> + /// } + /// ], + /// $skipToken: string, + /// nextLink: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -549,44 +504,51 @@ private HttpMessage CreateGetDataIngestionJobDetailsRequest(string jobId) /// /// /// - /// Job id supplied by user. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task> CreateDataIngestionJobAsync(string jobId, RequestContent content, RequestOptions options = null) + public virtual Pageable List(string farmerId, string boundaryId, string extensionId, string weatherDataType, string granularity, RequestOptions options, DateTimeOffset? startDateTime = null, DateTimeOffset? endDateTime = null, int? maxPageSize = null, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateDataIngestionJobRequest(jobId, content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("WeatherClient.CreateDataIngestionJob"); - scope.Start(); - try + if (farmerId == null) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "WeatherClient.CreateDataIngestionJob"); - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "WeatherClient.CreateDataIngestionJob"); - } + throw new ArgumentNullException(nameof(farmerId)); } - catch (Exception e) + if (boundaryId == null) { - scope.Failed(e); - throw; + throw new ArgumentNullException(nameof(boundaryId)); + } + if (extensionId == null) + { + throw new ArgumentNullException(nameof(extensionId)); + } + if (weatherDataType == null) + { + throw new ArgumentNullException(nameof(weatherDataType)); + } + if (granularity == null) + { + throw new ArgumentNullException(nameof(granularity)); + } + + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "WeatherClient.List"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateListRequest(farmerId, boundaryId, extensionId, weatherDataType, granularity, startDateTime, endDateTime, maxPageSize, skipToken) + : CreateListNextPageRequest(nextLink, farmerId, boundaryId, extensionId, weatherDataType, granularity, startDateTime, endDateTime, maxPageSize, skipToken); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } /// Create a weather data ingestion job. + /// Job id supplied by user. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -610,7 +572,6 @@ public virtual async Task> CreateDataIngestionJobAsync(str /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Body: /// { /// boundaryId: string, @@ -633,7 +594,6 @@ public virtual async Task> CreateDataIngestionJobAsync(str /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -651,35 +611,16 @@ public virtual async Task> CreateDataIngestionJobAsync(str /// /// /// - /// Job id supplied by user. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual Operation CreateDataIngestionJob(string jobId, RequestContent content, RequestOptions options = null) + public virtual async Task> CreateDataIngestionJobAsync(string jobId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateDataIngestionJobRequest(jobId, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WeatherClient.CreateDataIngestionJob"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "WeatherClient.CreateDataIngestionJob"); - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "WeatherClient.CreateDataIngestionJob"); - } + using HttpMessage message = CreateCreateDataIngestionJobRequest(jobId, content); + return await LowLevelOperationHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, "WeatherClient.CreateDataIngestionJob", OperationFinalStateVia.Location, options).ConfigureAwait(false); } catch (Exception e) { @@ -688,34 +629,21 @@ public virtual Operation CreateDataIngestionJob(string jobId, Reques } } - private HttpMessage CreateCreateDataIngestionJobRequest(string jobId, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/weather/ingest-data/", false); - uri.AppendPath(jobId, 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; - } - - /// Get weather data delete job. + /// Create a weather data ingestion job. + /// Job id supplied by user. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// - /// Schema for Response Body: + /// Schema for Request Body: /// { - /// extensionId: string, - /// farmerId: string, - /// boundaryId: string, - /// weatherDataType: string, - /// granularity: string, - /// startDateTime: string (ISO 8601 Format), - /// endDateTime: string (ISO 8601 Format), + /// boundaryId: string (required), + /// farmerId: string (required), + /// extensionId: string (required), + /// extensionApiName: string (required), + /// extensionApiInput: Dictionary<string, AnyObject> (required), + /// extensionDataProviderAppId: string, + /// extensionDataProviderApiKey: string, /// id: string, /// status: string, /// durationInSeconds: number, @@ -729,71 +657,15 @@ private HttpMessage CreateCreateDataIngestionJobRequest(string jobId, RequestCon /// properties: Dictionary<string, AnyObject> /// } /// - /// - /// Schema for Response Error: - /// { - /// error: { - /// code: string, - /// message: string, - /// target: string, - /// details: [Error], - /// innererror: { - /// code: string, - /// innererror: InnerError - /// } - /// }, - /// traceId: string - /// } - /// - /// - /// - /// ID of the job. - /// The request options. -#pragma warning disable AZC0002 - public virtual async Task GetDataDeleteJobDetailsAsync(string jobId, RequestOptions options = null) -#pragma warning restore AZC0002 - { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetDataDeleteJobDetailsRequest(jobId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("WeatherClient.GetDataDeleteJobDetails"); - scope.Start(); - try - { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get weather data delete job. - /// /// Schema for Response Body: /// { - /// extensionId: string, - /// farmerId: string, /// boundaryId: string, - /// weatherDataType: string, - /// granularity: string, - /// startDateTime: string (ISO 8601 Format), - /// endDateTime: string (ISO 8601 Format), + /// farmerId: string, + /// extensionId: string, + /// extensionApiName: string, + /// extensionApiInput: Dictionary<string, AnyObject>, + /// extensionDataProviderAppId: string, + /// extensionDataProviderApiKey: string, /// id: string, /// status: string, /// durationInSeconds: number, @@ -807,7 +679,6 @@ public virtual async Task GetDataDeleteJobDetailsAsync(string jobId, R /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -825,34 +696,16 @@ public virtual async Task GetDataDeleteJobDetailsAsync(string jobId, R /// /// /// - /// ID of the job. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetDataDeleteJobDetails(string jobId, RequestOptions options = null) + public virtual Operation CreateDataIngestionJob(string jobId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetDataDeleteJobDetailsRequest(jobId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("WeatherClient.GetDataDeleteJobDetails"); + using var scope = _clientDiagnostics.CreateScope("WeatherClient.CreateDataIngestionJob"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateDataIngestionJobRequest(jobId, content); + return LowLevelOperationHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, "WeatherClient.CreateDataIngestionJob", OperationFinalStateVia.Location, options); } catch (Exception e) { @@ -861,22 +714,11 @@ public virtual Response GetDataDeleteJobDetails(string jobId, RequestOptions opt } } - private HttpMessage CreateGetDataDeleteJobDetailsRequest(string jobId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/weather/delete-data/", false); - uri.AppendPath(jobId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Create a weather data delete job. + /// Job ID supplied by end user. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -900,7 +742,6 @@ private HttpMessage CreateGetDataDeleteJobDetailsRequest(string jobId) /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Body: /// { /// extensionId: string, @@ -923,7 +764,6 @@ private HttpMessage CreateGetDataDeleteJobDetailsRequest(string jobId) /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -941,35 +781,16 @@ private HttpMessage CreateGetDataDeleteJobDetailsRequest(string jobId) /// /// /// - /// Job ID supplied by end user. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task> CreateDataDeleteJobAsync(string jobId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateDataDeleteJobRequest(jobId, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WeatherClient.CreateDataDeleteJob"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "WeatherClient.CreateDataDeleteJob"); - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "WeatherClient.CreateDataDeleteJob"); - } + using HttpMessage message = CreateCreateDataDeleteJobRequest(jobId, content); + return await LowLevelOperationHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, "WeatherClient.CreateDataDeleteJob", OperationFinalStateVia.Location, options).ConfigureAwait(false); } catch (Exception e) { @@ -979,6 +800,10 @@ public virtual async Task> CreateDataDeleteJobAsync(string } /// Create a weather data delete job. + /// Job ID supplied by end user. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -1002,7 +827,6 @@ public virtual async Task> CreateDataDeleteJobAsync(string /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Body: /// { /// extensionId: string, @@ -1025,7 +849,6 @@ public virtual async Task> CreateDataDeleteJobAsync(string /// properties: Dictionary<string, AnyObject> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1043,35 +866,16 @@ public virtual async Task> CreateDataDeleteJobAsync(string /// /// /// - /// Job ID supplied by end user. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Operation CreateDataDeleteJob(string jobId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateDataDeleteJobRequest(jobId, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WeatherClient.CreateDataDeleteJob"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "WeatherClient.CreateDataDeleteJob"); - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.Location, "WeatherClient.CreateDataDeleteJob"); - } + using HttpMessage message = CreateCreateDataDeleteJobRequest(jobId, content); + return LowLevelOperationHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, "WeatherClient.CreateDataDeleteJob", OperationFinalStateVia.Location, options); } catch (Exception e) { @@ -1080,21 +884,149 @@ public virtual Operation CreateDataDeleteJob(string jobId, RequestCo } } - private HttpMessage CreateCreateDataDeleteJobRequest(string jobId, RequestContent content) + internal HttpMessage CreateListRequest(string farmerId, string boundaryId, string extensionId, string weatherDataType, string granularity, DateTimeOffset? startDateTime, DateTimeOffset? endDateTime, int? maxPageSize, string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/weather", false); + uri.AppendQuery("farmerId", farmerId, true); + uri.AppendQuery("boundaryId", boundaryId, true); + uri.AppendQuery("extensionId", extensionId, true); + uri.AppendQuery("weatherDataType", weatherDataType, true); + uri.AppendQuery("granularity", granularity, true); + if (startDateTime != null) + { + uri.AppendQuery("startDateTime", startDateTime.Value, "O", true); + } + if (endDateTime != null) + { + uri.AppendQuery("endDateTime", endDateTime.Value, "O", true); + } + if (maxPageSize != null) + { + uri.AppendQuery("$maxPageSize", maxPageSize.Value, true); + } + if (skipToken != null) + { + uri.AppendQuery("$skipToken", skipToken, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetDataIngestionJobDetailsRequest(string jobId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/weather/ingest-data/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateDataIngestionJobRequest(string jobId, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/weather/ingest-data/", false); + uri.AppendPath(jobId, 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; + message.ResponseClassifier = ResponseClassifier202.Instance; + return message; + } + + internal HttpMessage CreateGetDataDeleteJobDetailsRequest(string jobId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/weather/delete-data/", false); + uri.AppendPath(jobId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateDataDeleteJobRequest(string jobId, RequestContent content) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Put; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); + uri.Reset(_endpoint); uri.AppendPath("/weather/delete-data/", false); uri.AppendPath(jobId, true); - uri.AppendQuery("api-version", apiVersion, 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; + message.ResponseClassifier = ResponseClassifier202.Instance; + return message; + } + + internal HttpMessage CreateListNextPageRequest(string nextLink, string farmerId, string boundaryId, string extensionId, string weatherDataType, string granularity, DateTimeOffset? startDateTime, DateTimeOffset? endDateTime, int? maxPageSize, string skipToken) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; return message; } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier202 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier202(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 202 => false, + _ => true + }; + } + } } } diff --git a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/FarmBeatsClientLiveTests.cs b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/FarmBeatsClientLiveTests.cs index 9f41820b623b6..0f76f593a0178 100644 --- a/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/FarmBeatsClientLiveTests.cs +++ b/sdk/agrifood/Azure.Verticals.AgriFood.Farming/tests/FarmBeatsClientLiveTests.cs @@ -28,7 +28,7 @@ public async Task FarmersSmokeTest() Assert.IsTrue(HasProperty(createdBodyJson, "createdDateTime")); Assert.IsTrue(HasProperty(createdBodyJson, "modifiedDateTime")); - Response fetchResponse = await client.GetAsync(farmerId); + Response fetchResponse = await client.GetAsync(farmerId, new()); JsonElement fetchBodyJson = JsonDocument.Parse(GetContentFromResponse(fetchResponse)).RootElement; Assert.AreEqual(createdBodyJson.GetProperty("id").GetString(), fetchBodyJson.GetProperty("id").GetString()); diff --git a/sdk/compute/Azure.ResourceManager.Compute/api/Azure.ResourceManager.Compute.netstandard2.0.cs b/sdk/compute/Azure.ResourceManager.Compute/api/Azure.ResourceManager.Compute.netstandard2.0.cs index cc2feb92dc7b5..e3c82c729eaee 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/api/Azure.ResourceManager.Compute.netstandard2.0.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/api/Azure.ResourceManager.Compute.netstandard2.0.cs @@ -79,10 +79,10 @@ public partial class AvailabilitySetData : Azure.ResourceManager.Models.TrackedR public AvailabilitySetData(Azure.ResourceManager.Resources.Models.Location location) : base (default(Azure.ResourceManager.Resources.Models.Location)) { } public int? PlatformFaultDomainCount { get { throw null; } set { } } public int? PlatformUpdateDomainCount { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.SubResource ProximityPlacementGroup { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource ProximityPlacementGroup { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.Sku Sku { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList Statuses { get { throw null; } } - public System.Collections.Generic.IList VirtualMachines { get { throw null; } } + public System.Collections.Generic.IList VirtualMachines { get { throw null; } } } public partial class CloudService : Azure.ResourceManager.Core.ArmResource { @@ -203,7 +203,7 @@ public DedicatedHostData(Azure.ResourceManager.Resources.Models.Location locatio public string ProvisioningState { get { throw null; } } public System.DateTimeOffset? ProvisioningTime { get { throw null; } } public Azure.ResourceManager.Compute.Models.Sku Sku { get { throw null; } set { } } - public System.Collections.Generic.IReadOnlyList VirtualMachines { get { throw null; } } + public System.Collections.Generic.IReadOnlyList VirtualMachines { get { throw null; } } } public partial class DedicatedHostGroup : Azure.ResourceManager.Core.ArmResource { @@ -248,7 +248,7 @@ protected DedicatedHostGroupContainer() { } public partial class DedicatedHostGroupData : Azure.ResourceManager.Models.TrackedResource { public DedicatedHostGroupData(Azure.ResourceManager.Resources.Models.Location location) : base (default(Azure.ResourceManager.Resources.Models.Location)) { } - public System.Collections.Generic.IReadOnlyList Hosts { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Hosts { get { throw null; } } public Azure.ResourceManager.Compute.Models.DedicatedHostGroupInstanceView InstanceView { get { throw null; } } public int? PlatformFaultDomainCount { get { throw null; } set { } } public bool? SupportAutomaticPlacement { get { throw null; } set { } } @@ -761,7 +761,7 @@ public ImageData(Azure.ResourceManager.Resources.Models.Location location) : bas public Azure.ResourceManager.Compute.Models.ExtendedLocation ExtendedLocation { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.HyperVGenerationTypes? HyperVGeneration { get { throw null; } set { } } public string ProvisioningState { get { throw null; } } - public Azure.ResourceManager.Compute.Models.SubResource SourceVirtualMachine { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource SourceVirtualMachine { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.ImageStorageProfile StorageProfile { get { throw null; } set { } } } public partial class PrivateEndpointConnection : Azure.ResourceManager.Core.ArmResource @@ -796,7 +796,7 @@ protected PrivateEndpointConnectionContainer() { } public partial class PrivateEndpointConnectionData : Azure.ResourceManager.Models.Resource { public PrivateEndpointConnectionData() { } - public Azure.ResourceManager.Compute.Models.PrivateEndpoint PrivateEndpoint { get { throw null; } } + public Azure.ResourceManager.Resources.Models.SubResource PrivateEndpoint { get { throw null; } } public Azure.ResourceManager.Compute.Models.PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.PrivateEndpointConnectionProvisioningState? ProvisioningState { get { throw null; } } } @@ -945,7 +945,7 @@ public partial class RestorePointData : Azure.ResourceManager.Models.Resource { public RestorePointData() { } public Azure.ResourceManager.Compute.Models.ConsistencyModeTypes? ConsistencyMode { get { throw null; } } - public System.Collections.Generic.IList ExcludeDisks { get { throw null; } } + public System.Collections.Generic.IList ExcludeDisks { get { throw null; } } public Azure.ResourceManager.Compute.Models.RestorePointProvisioningDetails ProvisioningDetails { get { throw null; } } public string ProvisioningState { get { throw null; } } public Azure.ResourceManager.Compute.Models.RestorePointSourceMetadata SourceMetadata { get { throw null; } } @@ -1204,9 +1204,10 @@ protected UpdateDomainContainer() { } public virtual Azure.Response GetIfExists(string updateDomain, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string updateDomain, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class UpdateDomainData : Azure.ResourceManager.Resources.Models.SubResource + public partial class UpdateDomainData { public UpdateDomainData() { } + public string Id { get { throw null; } } public string Name { get { throw null; } } } public partial class VirtualMachine : Azure.ResourceManager.Core.ArmResource @@ -1290,15 +1291,15 @@ public partial class VirtualMachineData : Azure.ResourceManager.Models.TrackedRe { public VirtualMachineData(Azure.ResourceManager.Resources.Models.Location location) : base (default(Azure.ResourceManager.Resources.Models.Location)) { } public Azure.ResourceManager.Compute.Models.AdditionalCapabilities AdditionalCapabilities { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.SubResource AvailabilitySet { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource AvailabilitySet { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.BillingProfile BillingProfile { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.DiagnosticsProfile DiagnosticsProfile { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.VirtualMachineEvictionPolicyTypes? EvictionPolicy { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.ExtendedLocation ExtendedLocation { get { throw null; } set { } } public string ExtensionsTimeBudget { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.HardwareProfile HardwareProfile { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.SubResource Host { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.SubResource HostGroup { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource Host { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource HostGroup { get { throw null; } set { } } public Azure.ResourceManager.Resources.Models.ResourceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.VirtualMachineInstanceView InstanceView { get { throw null; } } public string LicenseType { get { throw null; } set { } } @@ -1308,13 +1309,13 @@ public VirtualMachineData(Azure.ResourceManager.Resources.Models.Location locati public int? PlatformFaultDomain { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.VirtualMachinePriorityTypes? Priority { get { throw null; } set { } } public string ProvisioningState { get { throw null; } } - public Azure.ResourceManager.Compute.Models.SubResource ProximityPlacementGroup { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource ProximityPlacementGroup { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList Resources { get { throw null; } } public Azure.ResourceManager.Compute.Models.ScheduledEventsProfile ScheduledEventsProfile { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.SecurityProfile SecurityProfile { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.StorageProfile StorageProfile { get { throw null; } set { } } public string UserData { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.SubResource VirtualMachineScaleSet { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource VirtualMachineScaleSet { get { throw null; } set { } } public string VmId { get { throw null; } } public System.Collections.Generic.IList Zones { get { throw null; } } } @@ -1544,14 +1545,14 @@ public VirtualMachineScaleSetData(Azure.ResourceManager.Resources.Models.Locatio public Azure.ResourceManager.Compute.Models.AutomaticRepairsPolicy AutomaticRepairsPolicy { get { throw null; } set { } } public bool? DoNotRunExtensionsOnOverprovisionedVMs { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.ExtendedLocation ExtendedLocation { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.SubResource HostGroup { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource HostGroup { get { throw null; } set { } } public Azure.ResourceManager.Resources.Models.ResourceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.OrchestrationMode? OrchestrationMode { get { throw null; } set { } } public bool? Overprovision { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.Plan Plan { get { throw null; } set { } } public int? PlatformFaultDomainCount { get { throw null; } set { } } public string ProvisioningState { get { throw null; } } - public Azure.ResourceManager.Compute.Models.SubResource ProximityPlacementGroup { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource ProximityPlacementGroup { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.ScaleInPolicy ScaleInPolicy { get { throw null; } set { } } public bool? SinglePlacementGroup { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.Sku Sku { get { throw null; } set { } } @@ -1592,7 +1593,7 @@ protected VirtualMachineScaleSetExtensionContainer() { } public virtual Azure.Response GetIfExists(string vmssExtensionName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string vmssExtensionName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class VirtualMachineScaleSetExtensionData : Azure.ResourceManager.Resources.Models.SubResource + public partial class VirtualMachineScaleSetExtensionData : Azure.ResourceManager.Compute.Models.SubResourceReadOnly { public VirtualMachineScaleSetExtensionData() { } public bool? AutoUpgradeMinorVersion { get { throw null; } set { } } @@ -1705,7 +1706,7 @@ public partial class VirtualMachineScaleSetVMData : Azure.ResourceManager.Models { public VirtualMachineScaleSetVMData(Azure.ResourceManager.Resources.Models.Location location) : base (default(Azure.ResourceManager.Resources.Models.Location)) { } public Azure.ResourceManager.Compute.Models.AdditionalCapabilities AdditionalCapabilities { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.SubResource AvailabilitySet { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource AvailabilitySet { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.DiagnosticsProfile DiagnosticsProfile { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.HardwareProfile HardwareProfile { get { throw null; } set { } } public string InstanceId { get { throw null; } } @@ -1727,7 +1728,7 @@ public VirtualMachineScaleSetVMData(Azure.ResourceManager.Resources.Models.Locat public string VmId { get { throw null; } } public System.Collections.Generic.IReadOnlyList Zones { get { throw null; } } } - public partial class VirtualMachineScaleSetVMExtensionData : Azure.ResourceManager.Resources.Models.SubResource + public partial class VirtualMachineScaleSetVMExtensionData : Azure.ResourceManager.Compute.Models.SubResourceReadOnly { public VirtualMachineScaleSetVMExtensionData() { } public bool? AutoUpgradeMinorVersion { get { throw null; } set { } } @@ -1834,11 +1835,6 @@ public AdditionalUnattendContent() { } public static bool operator !=(Azure.ResourceManager.Compute.Models.AggregatedReplicationState left, Azure.ResourceManager.Compute.Models.AggregatedReplicationState right) { throw null; } public override string ToString() { throw null; } } - public partial class ApiEntityReference - { - public ApiEntityReference() { } - public string Id { get { throw null; } set { } } - } public partial class ApiError { internal ApiError() { } @@ -1901,10 +1897,10 @@ public partial class AvailabilitySetUpdate : Azure.ResourceManager.Compute.Model public AvailabilitySetUpdate() { } public int? PlatformFaultDomainCount { get { throw null; } set { } } public int? PlatformUpdateDomainCount { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.SubResource ProximityPlacementGroup { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource ProximityPlacementGroup { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.Sku Sku { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList Statuses { get { throw null; } } - public System.Collections.Generic.IList VirtualMachines { get { throw null; } } + public System.Collections.Generic.IList VirtualMachines { get { throw null; } } } public partial class AvailabilitySetUpdateOperation : Azure.Operation { @@ -2021,7 +2017,7 @@ public partial class CloudServiceNetworkProfile { public CloudServiceNetworkProfile() { } public System.Collections.Generic.IList LoadBalancerConfigurations { get { throw null; } } - public Azure.ResourceManager.Compute.Models.SubResource SwappableCloudService { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource SwappableCloudService { get { throw null; } set { } } } public partial class CloudServiceOsProfile { @@ -2225,7 +2221,7 @@ public partial class CloudServiceVaultAndSecretReference { public CloudServiceVaultAndSecretReference() { } public string SecretUrl { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.SubResource SourceVault { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource SourceVault { get { throw null; } set { } } } public partial class CloudServiceVaultCertificate { @@ -2235,7 +2231,7 @@ public CloudServiceVaultCertificate() { } public partial class CloudServiceVaultSecretGroup { public CloudServiceVaultSecretGroup() { } - public Azure.ResourceManager.Compute.Models.SubResource SourceVault { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource SourceVault { get { throw null; } set { } } public System.Collections.Generic.IList VaultCertificates { get { throw null; } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] @@ -2365,7 +2361,7 @@ internal DedicatedHostGroupInstanceView() { } public partial class DedicatedHostGroupUpdate : Azure.ResourceManager.Compute.Models.UpdateResource { public DedicatedHostGroupUpdate() { } - public System.Collections.Generic.IReadOnlyList Hosts { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Hosts { get { throw null; } } public Azure.ResourceManager.Compute.Models.DedicatedHostGroupInstanceView InstanceView { get { throw null; } } public int? PlatformFaultDomainCount { get { throw null; } set { } } public bool? SupportAutomaticPlacement { get { throw null; } set { } } @@ -2412,7 +2408,7 @@ public DedicatedHostUpdate() { } public int? PlatformFaultDomain { get { throw null; } set { } } public string ProvisioningState { get { throw null; } } public System.DateTimeOffset? ProvisioningTime { get { throw null; } } - public System.Collections.Generic.IReadOnlyList VirtualMachines { get { throw null; } } + public System.Collections.Generic.IReadOnlyList VirtualMachines { get { throw null; } } } public partial class DedicatedHostUpdateOperation : Azure.Operation { @@ -2686,10 +2682,6 @@ protected DiskEncryptionSetDeleteOperation() { } public static bool operator !=(Azure.ResourceManager.Compute.Models.DiskEncryptionSetIdentityType left, Azure.ResourceManager.Compute.Models.DiskEncryptionSetIdentityType right) { throw null; } public override string ToString() { throw null; } } - public partial class DiskEncryptionSetParameters : Azure.ResourceManager.Resources.Models.WritableSubResource - { - public DiskEncryptionSetParameters() { } - } public partial class DiskEncryptionSettings { public DiskEncryptionSettings() { } @@ -3154,9 +3146,10 @@ public GalleryArtifactPublishingProfileBase() { } public Azure.ResourceManager.Compute.Models.StorageAccountType? StorageAccountType { get { throw null; } set { } } public System.Collections.Generic.IList TargetRegions { get { throw null; } } } - public partial class GalleryArtifactVersionSource : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class GalleryArtifactVersionSource { public GalleryArtifactVersionSource() { } + public string Id { get { throw null; } set { } } public string Uri { get { throw null; } set { } } } public partial class GalleryCreateOrUpdateOperation : Azure.Operation @@ -3551,15 +3544,16 @@ public partial class ImageDisk public ImageDisk() { } public string BlobUri { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.CachingTypes? Caching { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.DiskEncryptionSetParameters DiskEncryptionSet { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource DiskEncryptionSet { get { throw null; } set { } } public int? DiskSizeGB { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.SubResource ManagedDisk { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.SubResource Snapshot { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource ManagedDisk { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource Snapshot { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.StorageAccountTypes? StorageAccountType { get { throw null; } set { } } } - public partial class ImageDiskReference : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ImageDiskReference { - public ImageDiskReference() { } + public ImageDiskReference(string id) { } + public string Id { get { throw null; } set { } } public int? Lun { get { throw null; } set { } } } public partial class ImageOSDisk : Azure.ResourceManager.Compute.Models.ImageDisk @@ -3575,7 +3569,7 @@ public ImagePurchasePlan() { } public string Product { get { throw null; } set { } } public string Publisher { get { throw null; } set { } } } - public partial class ImageReference : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ImageReference : Azure.ResourceManager.Compute.Models.SubResource { public ImageReference() { } public string ExactVersion { get { throw null; } } @@ -3596,7 +3590,7 @@ public partial class ImageUpdate : Azure.ResourceManager.Compute.Models.UpdateRe public ImageUpdate() { } public Azure.ResourceManager.Compute.Models.HyperVGenerationTypes? HyperVGeneration { get { throw null; } set { } } public string ProvisioningState { get { throw null; } } - public Azure.ResourceManager.Compute.Models.SubResource SourceVirtualMachine { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource SourceVirtualMachine { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.ImageStorageProfile StorageProfile { get { throw null; } set { } } } public partial class ImageUpdateOperation : Azure.Operation @@ -3690,31 +3684,31 @@ public partial class KeyForDiskEncryptionSet { public KeyForDiskEncryptionSet(string keyUrl) { } public string KeyUrl { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.SourceVault SourceVault { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource SourceVault { get { throw null; } set { } } } public partial class KeyVaultAndKeyReference { - public KeyVaultAndKeyReference(Azure.ResourceManager.Compute.Models.SourceVault sourceVault, string keyUrl) { } + public KeyVaultAndKeyReference(Azure.ResourceManager.Resources.Models.WritableSubResource sourceVault, string keyUrl) { } public string KeyUrl { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.SourceVault SourceVault { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource SourceVault { get { throw null; } set { } } } public partial class KeyVaultAndSecretReference { - public KeyVaultAndSecretReference(Azure.ResourceManager.Compute.Models.SourceVault sourceVault, string secretUrl) { } + public KeyVaultAndSecretReference(Azure.ResourceManager.Resources.Models.WritableSubResource sourceVault, string secretUrl) { } public string SecretUrl { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.SourceVault SourceVault { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource SourceVault { get { throw null; } set { } } } public partial class KeyVaultKeyReference { - public KeyVaultKeyReference(string keyUrl, Azure.ResourceManager.Compute.Models.SubResource sourceVault) { } + public KeyVaultKeyReference(string keyUrl, Azure.ResourceManager.Resources.Models.WritableSubResource sourceVault) { } public string KeyUrl { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.SubResource SourceVault { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource SourceVault { get { throw null; } set { } } } public partial class KeyVaultSecretReference { - public KeyVaultSecretReference(string secretUrl, Azure.ResourceManager.Compute.Models.SubResource sourceVault) { } + public KeyVaultSecretReference(string secretUrl, Azure.ResourceManager.Resources.Models.WritableSubResource sourceVault) { } public string SecretUrl { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.SubResource SourceVault { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource SourceVault { get { throw null; } set { } } } public partial class LastPatchInstallationSummary { @@ -3789,9 +3783,10 @@ public LinuxPatchSettings() { } public static bool operator !=(Azure.ResourceManager.Compute.Models.LinuxVMGuestPatchMode left, Azure.ResourceManager.Compute.Models.LinuxVMGuestPatchMode right) { throw null; } public override string ToString() { throw null; } } - public partial class LoadBalancerConfiguration : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class LoadBalancerConfiguration { public LoadBalancerConfiguration(string name, Azure.ResourceManager.Compute.Models.LoadBalancerConfigurationProperties properties) { } + public string Id { get { throw null; } set { } } public string Name { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.LoadBalancerConfigurationProperties Properties { get { throw null; } set { } } } @@ -3810,8 +3805,8 @@ public partial class LoadBalancerFrontendIPConfigurationProperties { public LoadBalancerFrontendIPConfigurationProperties() { } public string PrivateIPAddress { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.SubResource PublicIPAddress { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.SubResource Subnet { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource PublicIPAddress { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource Subnet { get { throw null; } set { } } } public partial class LogAnalyticExportRequestRateByIntervalOperation : Azure.Operation { @@ -3879,10 +3874,10 @@ internal MaintenanceRedeployStatus() { } public System.DateTimeOffset? PreMaintenanceWindowEndTime { get { throw null; } } public System.DateTimeOffset? PreMaintenanceWindowStartTime { get { throw null; } } } - public partial class ManagedDiskParameters : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ManagedDiskParameters : Azure.ResourceManager.Compute.Models.SubResource { public ManagedDiskParameters() { } - public Azure.ResourceManager.Compute.Models.DiskEncryptionSetParameters DiskEncryptionSet { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource DiskEncryptionSet { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.StorageAccountTypes? StorageAccountType { get { throw null; } set { } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] @@ -3921,7 +3916,7 @@ public ManagedDiskParameters() { } public static bool operator !=(Azure.ResourceManager.Compute.Models.NetworkApiVersion left, Azure.ResourceManager.Compute.Models.NetworkApiVersion right) { throw null; } public override string ToString() { throw null; } } - public partial class NetworkInterfaceReference : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class NetworkInterfaceReference : Azure.ResourceManager.Compute.Models.SubResource { public NetworkInterfaceReference() { } public Azure.ResourceManager.Compute.Models.DeleteOptions? DeleteOption { get { throw null; } set { } } @@ -4218,11 +4213,6 @@ public Plan() { } public string PromotionCode { get { throw null; } set { } } public string Publisher { get { throw null; } set { } } } - public partial class PrivateEndpoint - { - internal PrivateEndpoint() { } - public string Id { get { throw null; } } - } public partial class PrivateEndpointConnectionCreateOrUpdateOperation : Azure.Operation { protected PrivateEndpointConnectionCreateOrUpdateOperation() { } @@ -4661,9 +4651,10 @@ protected RestorePointCollectionDeleteOperation() { } public static bool operator !=(Azure.ResourceManager.Compute.Models.RestorePointCollectionExpandOptions left, Azure.ResourceManager.Compute.Models.RestorePointCollectionExpandOptions right) { throw null; } public override string ToString() { throw null; } } - public partial class RestorePointCollectionSourceProperties : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class RestorePointCollectionSourceProperties { public RestorePointCollectionSourceProperties() { } + public string Id { get { throw null; } set { } } public string Location { get { throw null; } } } public partial class RestorePointCollectionUpdate : Azure.ResourceManager.Compute.Models.UpdateResource @@ -4735,7 +4726,7 @@ public partial class RestorePointSourceVMDataDisk { internal RestorePointSourceVMDataDisk() { } public Azure.ResourceManager.Compute.Models.CachingTypes? Caching { get { throw null; } } - public Azure.ResourceManager.Compute.Models.ApiEntityReference DiskRestorePoint { get { throw null; } } + public Azure.ResourceManager.Resources.Models.WritableSubResource DiskRestorePoint { get { throw null; } } public int? DiskSizeGB { get { throw null; } } public int? Lun { get { throw null; } } public Azure.ResourceManager.Compute.Models.ManagedDiskParameters ManagedDisk { get { throw null; } } @@ -4745,7 +4736,7 @@ public partial class RestorePointSourceVmosDisk { internal RestorePointSourceVmosDisk() { } public Azure.ResourceManager.Compute.Models.CachingTypes? Caching { get { throw null; } } - public Azure.ResourceManager.Compute.Models.ApiEntityReference DiskRestorePoint { get { throw null; } } + public Azure.ResourceManager.Resources.Models.WritableSubResource DiskRestorePoint { get { throw null; } } public int? DiskSizeGB { get { throw null; } } public Azure.ResourceManager.Compute.Models.DiskEncryptionSettings EncryptionSettings { get { throw null; } } public Azure.ResourceManager.Compute.Models.ManagedDiskParameters ManagedDisk { get { throw null; } } @@ -4775,7 +4766,7 @@ internal RoleInstance() { } public partial class RoleInstanceNetworkProfile { internal RoleInstanceNetworkProfile() { } - public System.Collections.Generic.IReadOnlyList NetworkInterfaces { get { throw null; } } + public System.Collections.Generic.IReadOnlyList NetworkInterfaces { get { throw null; } } } public partial class RoleInstanceProperties { @@ -4847,10 +4838,11 @@ internal RunCommandDocument() { } public System.Collections.Generic.IReadOnlyList Parameters { get { throw null; } } public System.Collections.Generic.IReadOnlyList Script { get { throw null; } } } - public partial class RunCommandDocumentBase : Azure.ResourceManager.Resources.Models.SubResource + public partial class RunCommandDocumentBase { internal RunCommandDocumentBase() { } public string Description { get { throw null; } } + public string Id { get { throw null; } } public string Label { get { throw null; } } public Azure.ResourceManager.Compute.Models.OperatingSystemTypes OsType { get { throw null; } } public string Schema { get { throw null; } } @@ -5143,11 +5135,6 @@ protected SnapshotUpdateOperation() { } public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class SourceVault - { - public SourceVault() { } - public string Id { get { throw null; } set { } } - } public partial class SshConfiguration { public SshConfiguration() { } @@ -5177,9 +5164,10 @@ protected SshPublicKeyDeleteOperation() { } public override System.Threading.Tasks.ValueTask WaitForCompletionResponseAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public override System.Threading.Tasks.ValueTask WaitForCompletionResponseAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class SshPublicKeyGenerateKeyPairResult : Azure.ResourceManager.Resources.Models.SubResource + public partial class SshPublicKeyGenerateKeyPairResult { internal SshPublicKeyGenerateKeyPairResult() { } + public string Id { get { throw null; } } public string PrivateKey { get { throw null; } } public string PublicKey { get { throw null; } } } @@ -5277,7 +5265,7 @@ public partial class SubResourceReadOnly public SubResourceReadOnly() { } public string Id { get { throw null; } } } - public partial class SubResourceWithColocationStatus : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class SubResourceWithColocationStatus : Azure.ResourceManager.Compute.Models.SubResource { public SubResourceWithColocationStatus() { } public Azure.ResourceManager.Compute.Models.InstanceViewStatus ColocationStatus { get { throw null; } set { } } @@ -5402,7 +5390,7 @@ public VaultCertificate() { } public partial class VaultSecretGroup { public VaultSecretGroup() { } - public Azure.ResourceManager.Compute.Models.SubResource SourceVault { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource SourceVault { get { throw null; } set { } } public System.Collections.Generic.IList VaultCertificates { get { throw null; } } } public partial class VirtualHardDisk @@ -5462,7 +5450,7 @@ public VirtualMachineCaptureParameters(string vhdPrefix, string destinationConta public bool OverwriteVhds { get { throw null; } } public string VhdPrefix { get { throw null; } } } - public partial class VirtualMachineCaptureResult : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class VirtualMachineCaptureResult : Azure.ResourceManager.Compute.Models.SubResource { public VirtualMachineCaptureResult() { } public string ContentVersion { get { throw null; } } @@ -5635,7 +5623,7 @@ public VirtualMachineImageFeature() { } public string Name { get { throw null; } set { } } public string Value { get { throw null; } set { } } } - public partial class VirtualMachineImageResource : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class VirtualMachineImageResource : Azure.ResourceManager.Compute.Models.SubResource { public VirtualMachineImageResource(string name, string location) { } public Azure.ResourceManager.Compute.Models.ExtendedLocation ExtendedLocation { get { throw null; } set { } } @@ -5711,13 +5699,13 @@ public partial class VirtualMachineNetworkInterfaceConfiguration public VirtualMachineNetworkInterfaceConfiguration(string name) { } public Azure.ResourceManager.Compute.Models.DeleteOptions? DeleteOption { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.VirtualMachineNetworkInterfaceDnsSettingsConfiguration DnsSettings { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.SubResource DscpConfiguration { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource DscpConfiguration { get { throw null; } set { } } public bool? EnableAcceleratedNetworking { get { throw null; } set { } } public bool? EnableFpga { get { throw null; } set { } } public bool? EnableIPForwarding { get { throw null; } set { } } public System.Collections.Generic.IList IpConfigurations { get { throw null; } } public string Name { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.SubResource NetworkSecurityGroup { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource NetworkSecurityGroup { get { throw null; } set { } } public bool? Primary { get { throw null; } set { } } } public partial class VirtualMachineNetworkInterfaceDnsSettingsConfiguration @@ -5728,14 +5716,14 @@ public VirtualMachineNetworkInterfaceDnsSettingsConfiguration() { } public partial class VirtualMachineNetworkInterfaceIPConfiguration { public VirtualMachineNetworkInterfaceIPConfiguration(string name) { } - public System.Collections.Generic.IList ApplicationGatewayBackendAddressPools { get { throw null; } } - public System.Collections.Generic.IList ApplicationSecurityGroups { get { throw null; } } - public System.Collections.Generic.IList LoadBalancerBackendAddressPools { get { throw null; } } + public System.Collections.Generic.IList ApplicationGatewayBackendAddressPools { get { throw null; } } + public System.Collections.Generic.IList ApplicationSecurityGroups { get { throw null; } } + public System.Collections.Generic.IList LoadBalancerBackendAddressPools { get { throw null; } } public string Name { get { throw null; } set { } } public bool? Primary { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.IPVersions? PrivateIPAddressVersion { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.VirtualMachinePublicIPAddressConfiguration PublicIPAddressConfiguration { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.SubResource Subnet { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource Subnet { get { throw null; } set { } } } public partial class VirtualMachinePatchStatus { @@ -5806,7 +5794,7 @@ public VirtualMachinePublicIPAddressConfiguration(string name) { } public string Name { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.IPVersions? PublicIPAddressVersion { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.PublicIPAllocationMethod? PublicIPAllocationMethod { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.SubResource PublicIPPrefix { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource PublicIPPrefix { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.PublicIPAddressSku Sku { get { throw null; } set { } } } public partial class VirtualMachinePublicIPAddressDnsSettingsConfiguration @@ -6036,7 +6024,7 @@ public VirtualMachineScaleSetExtensionProfile() { } public System.Collections.Generic.IList Extensions { get { throw null; } } public string ExtensionsTimeBudget { get { throw null; } set { } } } - public partial class VirtualMachineScaleSetExtensionUpdate : Azure.ResourceManager.Resources.Models.SubResource + public partial class VirtualMachineScaleSetExtensionUpdate : Azure.ResourceManager.Compute.Models.SubResourceReadOnly { public VirtualMachineScaleSetExtensionUpdate() { } public bool? AutoUpgradeMinorVersion { get { throw null; } set { } } @@ -6078,18 +6066,18 @@ public partial class VirtualMachineScaleSetInstanceViewStatusesSummary internal VirtualMachineScaleSetInstanceViewStatusesSummary() { } public System.Collections.Generic.IReadOnlyList StatusesSummary { get { throw null; } } } - public partial class VirtualMachineScaleSetIPConfiguration : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class VirtualMachineScaleSetIPConfiguration : Azure.ResourceManager.Compute.Models.SubResource { public VirtualMachineScaleSetIPConfiguration(string name) { } - public System.Collections.Generic.IList ApplicationGatewayBackendAddressPools { get { throw null; } } - public System.Collections.Generic.IList ApplicationSecurityGroups { get { throw null; } } - public System.Collections.Generic.IList LoadBalancerBackendAddressPools { get { throw null; } } - public System.Collections.Generic.IList LoadBalancerInboundNatPools { get { throw null; } } + public System.Collections.Generic.IList ApplicationGatewayBackendAddressPools { get { throw null; } } + public System.Collections.Generic.IList ApplicationSecurityGroups { get { throw null; } } + public System.Collections.Generic.IList LoadBalancerBackendAddressPools { get { throw null; } } + public System.Collections.Generic.IList LoadBalancerInboundNatPools { get { throw null; } } public string Name { get { throw null; } set { } } public bool? Primary { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.IPVersion? PrivateIPAddressVersion { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.VirtualMachineScaleSetPublicIPAddressConfiguration PublicIPAddressConfiguration { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.ApiEntityReference Subnet { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource Subnet { get { throw null; } set { } } } public partial class VirtualMachineScaleSetIpTag { @@ -6100,10 +6088,10 @@ public VirtualMachineScaleSetIpTag() { } public partial class VirtualMachineScaleSetManagedDiskParameters { public VirtualMachineScaleSetManagedDiskParameters() { } - public Azure.ResourceManager.Compute.Models.DiskEncryptionSetParameters DiskEncryptionSet { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource DiskEncryptionSet { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.StorageAccountTypes? StorageAccountType { get { throw null; } set { } } } - public partial class VirtualMachineScaleSetNetworkConfiguration : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class VirtualMachineScaleSetNetworkConfiguration : Azure.ResourceManager.Compute.Models.SubResource { public VirtualMachineScaleSetNetworkConfiguration(string name) { } public Azure.ResourceManager.Compute.Models.DeleteOptions? DeleteOption { get { throw null; } set { } } @@ -6113,7 +6101,7 @@ public VirtualMachineScaleSetNetworkConfiguration(string name) { } public bool? EnableIPForwarding { get { throw null; } set { } } public System.Collections.Generic.IList IpConfigurations { get { throw null; } } public string Name { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.SubResource NetworkSecurityGroup { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource NetworkSecurityGroup { get { throw null; } set { } } public bool? Primary { get { throw null; } set { } } } public partial class VirtualMachineScaleSetNetworkConfigurationDnsSettings @@ -6124,7 +6112,7 @@ public VirtualMachineScaleSetNetworkConfigurationDnsSettings() { } public partial class VirtualMachineScaleSetNetworkProfile { public VirtualMachineScaleSetNetworkProfile() { } - public Azure.ResourceManager.Compute.Models.ApiEntityReference HealthProbe { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource HealthProbe { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.NetworkApiVersion? NetworkApiVersion { get { throw null; } set { } } public System.Collections.Generic.IList NetworkInterfaceConfigurations { get { throw null; } } } @@ -6195,7 +6183,7 @@ public VirtualMachineScaleSetPublicIPAddressConfiguration(string name) { } public System.Collections.Generic.IList IpTags { get { throw null; } } public string Name { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.IPVersion? PublicIPAddressVersion { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.SubResource PublicIPPrefix { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource PublicIPPrefix { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.PublicIPAddressSku Sku { get { throw null; } set { } } } public partial class VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings @@ -6351,7 +6339,7 @@ public VirtualMachineScaleSetUpdate() { } public Azure.ResourceManager.Resources.Models.ResourceIdentity Identity { get { throw null; } set { } } public bool? Overprovision { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.Plan Plan { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.SubResource ProximityPlacementGroup { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource ProximityPlacementGroup { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.ScaleInPolicy ScaleInPolicy { get { throw null; } set { } } public bool? SinglePlacementGroup { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.Sku Sku { get { throw null; } set { } } @@ -6369,20 +6357,20 @@ protected VirtualMachineScaleSetUpdateInstancesOperation() { } public override System.Threading.Tasks.ValueTask WaitForCompletionResponseAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public override System.Threading.Tasks.ValueTask WaitForCompletionResponseAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class VirtualMachineScaleSetUpdateIPConfiguration : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class VirtualMachineScaleSetUpdateIPConfiguration : Azure.ResourceManager.Compute.Models.SubResource { public VirtualMachineScaleSetUpdateIPConfiguration() { } - public System.Collections.Generic.IList ApplicationGatewayBackendAddressPools { get { throw null; } } - public System.Collections.Generic.IList ApplicationSecurityGroups { get { throw null; } } - public System.Collections.Generic.IList LoadBalancerBackendAddressPools { get { throw null; } } - public System.Collections.Generic.IList LoadBalancerInboundNatPools { get { throw null; } } + public System.Collections.Generic.IList ApplicationGatewayBackendAddressPools { get { throw null; } } + public System.Collections.Generic.IList ApplicationSecurityGroups { get { throw null; } } + public System.Collections.Generic.IList LoadBalancerBackendAddressPools { get { throw null; } } + public System.Collections.Generic.IList LoadBalancerInboundNatPools { get { throw null; } } public string Name { get { throw null; } set { } } public bool? Primary { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.IPVersion? PrivateIPAddressVersion { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.VirtualMachineScaleSetUpdatePublicIPAddressConfiguration PublicIPAddressConfiguration { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.ApiEntityReference Subnet { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource Subnet { get { throw null; } set { } } } - public partial class VirtualMachineScaleSetUpdateNetworkConfiguration : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class VirtualMachineScaleSetUpdateNetworkConfiguration : Azure.ResourceManager.Compute.Models.SubResource { public VirtualMachineScaleSetUpdateNetworkConfiguration() { } public Azure.ResourceManager.Compute.Models.DeleteOptions? DeleteOption { get { throw null; } set { } } @@ -6392,13 +6380,13 @@ public VirtualMachineScaleSetUpdateNetworkConfiguration() { } public bool? EnableIPForwarding { get { throw null; } set { } } public System.Collections.Generic.IList IpConfigurations { get { throw null; } } public string Name { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.SubResource NetworkSecurityGroup { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource NetworkSecurityGroup { get { throw null; } set { } } public bool? Primary { get { throw null; } set { } } } public partial class VirtualMachineScaleSetUpdateNetworkProfile { public VirtualMachineScaleSetUpdateNetworkProfile() { } - public Azure.ResourceManager.Compute.Models.ApiEntityReference HealthProbe { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource HealthProbe { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.NetworkApiVersion? NetworkApiVersion { get { throw null; } set { } } public System.Collections.Generic.IList NetworkInterfaceConfigurations { get { throw null; } } } @@ -6519,7 +6507,7 @@ internal VirtualMachineScaleSetVMExtensionsSummary() { } public string Name { get { throw null; } } public System.Collections.Generic.IReadOnlyList StatusesSummary { get { throw null; } } } - public partial class VirtualMachineScaleSetVMExtensionUpdate : Azure.ResourceManager.Resources.Models.SubResource + public partial class VirtualMachineScaleSetVMExtensionUpdate : Azure.ResourceManager.Compute.Models.SubResourceReadOnly { public VirtualMachineScaleSetVMExtensionUpdate() { } public bool? AutoUpgradeMinorVersion { get { throw null; } set { } } @@ -6959,14 +6947,14 @@ public partial class VirtualMachineUpdate : Azure.ResourceManager.Compute.Models { public VirtualMachineUpdate() { } public Azure.ResourceManager.Compute.Models.AdditionalCapabilities AdditionalCapabilities { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.SubResource AvailabilitySet { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource AvailabilitySet { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.BillingProfile BillingProfile { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.DiagnosticsProfile DiagnosticsProfile { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.VirtualMachineEvictionPolicyTypes? EvictionPolicy { get { throw null; } set { } } public string ExtensionsTimeBudget { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.HardwareProfile HardwareProfile { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.SubResource Host { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.SubResource HostGroup { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource Host { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource HostGroup { get { throw null; } set { } } public Azure.ResourceManager.Resources.Models.ResourceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.VirtualMachineInstanceView InstanceView { get { throw null; } } public string LicenseType { get { throw null; } set { } } @@ -6976,12 +6964,12 @@ public VirtualMachineUpdate() { } public int? PlatformFaultDomain { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.VirtualMachinePriorityTypes? Priority { get { throw null; } set { } } public string ProvisioningState { get { throw null; } } - public Azure.ResourceManager.Compute.Models.SubResource ProximityPlacementGroup { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource ProximityPlacementGroup { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.ScheduledEventsProfile ScheduledEventsProfile { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.SecurityProfile SecurityProfile { get { throw null; } set { } } public Azure.ResourceManager.Compute.Models.StorageProfile StorageProfile { get { throw null; } set { } } public string UserData { get { throw null; } set { } } - public Azure.ResourceManager.Compute.Models.SubResource VirtualMachineScaleSet { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource VirtualMachineScaleSet { get { throw null; } set { } } public string VmId { get { throw null; } } public System.Collections.Generic.IList Zones { get { throw null; } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/AvailabilitySetData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/AvailabilitySetData.cs index 8990e1c521314..0289b0aa3cf53 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/AvailabilitySetData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/AvailabilitySetData.cs @@ -21,7 +21,7 @@ public partial class AvailabilitySetData : TrackedResource /// The location. public AvailabilitySetData(Location location) : base(location) { - VirtualMachines = new ChangeTrackingList(); + VirtualMachines = new ChangeTrackingList(); Statuses = new ChangeTrackingList(); } @@ -37,7 +37,7 @@ public AvailabilitySetData(Location location) : base(location) /// A list of references to all virtual machines in the availability set. /// Specifies information about the proximity placement group that the availability set should be assigned to. <br><br>Minimum api-version: 2018-04-01. /// The resource status information. - internal AvailabilitySetData(ResourceIdentifier id, string name, ResourceType type, IDictionary tags, Location location, Models.Sku sku, int? platformUpdateDomainCount, int? platformFaultDomainCount, IList virtualMachines, Models.SubResource proximityPlacementGroup, IReadOnlyList statuses) : base(id, name, type, tags, location) + internal AvailabilitySetData(ResourceIdentifier id, string name, ResourceType type, IDictionary tags, Location location, Models.Sku sku, int? platformUpdateDomainCount, int? platformFaultDomainCount, IList virtualMachines, WritableSubResource proximityPlacementGroup, IReadOnlyList statuses) : base(id, name, type, tags, location) { Sku = sku; PlatformUpdateDomainCount = platformUpdateDomainCount; @@ -54,9 +54,9 @@ internal AvailabilitySetData(ResourceIdentifier id, string name, ResourceType ty /// Fault Domain count. public int? PlatformFaultDomainCount { get; set; } /// A list of references to all virtual machines in the availability set. - public IList VirtualMachines { get; } + public IList VirtualMachines { get; } /// Specifies information about the proximity placement group that the availability set should be assigned to. <br><br>Minimum api-version: 2018-04-01. - public Models.SubResource ProximityPlacementGroup { get; set; } + public WritableSubResource ProximityPlacementGroup { get; set; } /// The resource status information. public IReadOnlyList Statuses { get; } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostData.cs index 7d4467818d3f9..f15238d02abf5 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostData.cs @@ -30,7 +30,7 @@ public DedicatedHostData(Location location, Models.Sku sku) : base(location) } Sku = sku; - VirtualMachines = new ChangeTrackingList(); + VirtualMachines = new ChangeTrackingList(); } /// Initializes a new instance of DedicatedHostData. @@ -48,7 +48,7 @@ public DedicatedHostData(Location location, Models.Sku sku) : base(location) /// The date when the host was first provisioned. /// The provisioning state, which only appears in the response. /// The dedicated host instance view. - internal DedicatedHostData(ResourceIdentifier id, string name, ResourceType type, IDictionary tags, Location location, Models.Sku sku, int? platformFaultDomain, bool? autoReplaceOnFailure, string hostId, IReadOnlyList virtualMachines, DedicatedHostLicenseTypes? licenseType, DateTimeOffset? provisioningTime, string provisioningState, DedicatedHostInstanceView instanceView) : base(id, name, type, tags, location) + internal DedicatedHostData(ResourceIdentifier id, string name, ResourceType type, IDictionary tags, Location location, Models.Sku sku, int? platformFaultDomain, bool? autoReplaceOnFailure, string hostId, IReadOnlyList virtualMachines, DedicatedHostLicenseTypes? licenseType, DateTimeOffset? provisioningTime, string provisioningState, DedicatedHostInstanceView instanceView) : base(id, name, type, tags, location) { Sku = sku; PlatformFaultDomain = platformFaultDomain; @@ -70,7 +70,7 @@ internal DedicatedHostData(ResourceIdentifier id, string name, ResourceType type /// A unique id generated and assigned to the dedicated host by the platform. <br><br> Does not change throughout the lifetime of the host. public string HostId { get; } /// A list of references to all virtual machines in the Dedicated Host. - public IReadOnlyList VirtualMachines { get; } + public IReadOnlyList VirtualMachines { get; } /// Specifies the software license type that will be applied to the VMs deployed on the dedicated host. <br><br> Possible values are: <br><br> **None** <br><br> **Windows_Server_Hybrid** <br><br> **Windows_Server_Perpetual** <br><br> Default: **None**. public DedicatedHostLicenseTypes? LicenseType { get; set; } /// The date when the host was first provisioned. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostGroupData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostGroupData.cs index e7ac2b1080cad..b283709e7575b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostGroupData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/DedicatedHostGroupData.cs @@ -22,7 +22,7 @@ public partial class DedicatedHostGroupData : TrackedResource public DedicatedHostGroupData(Location location) : base(location) { Zones = new ChangeTrackingList(); - Hosts = new ChangeTrackingList(); + Hosts = new ChangeTrackingList(); } /// Initializes a new instance of DedicatedHostGroupData. @@ -36,7 +36,7 @@ public DedicatedHostGroupData(Location location) : base(location) /// A list of references to all dedicated hosts in the dedicated host group. /// The dedicated host group instance view, which has the list of instance view of the dedicated hosts under the dedicated host group. /// Specifies whether virtual machines or virtual machine scale sets can be placed automatically on the dedicated host group. Automatic placement means resources are allocated on dedicated hosts, that are chosen by Azure, under the dedicated host group. The value is defaulted to 'false' when not provided. <br><br>Minimum api-version: 2020-06-01. - internal DedicatedHostGroupData(ResourceIdentifier id, string name, ResourceType type, IDictionary tags, Location location, IList zones, int? platformFaultDomainCount, IReadOnlyList hosts, DedicatedHostGroupInstanceView instanceView, bool? supportAutomaticPlacement) : base(id, name, type, tags, location) + internal DedicatedHostGroupData(ResourceIdentifier id, string name, ResourceType type, IDictionary tags, Location location, IList zones, int? platformFaultDomainCount, IReadOnlyList hosts, DedicatedHostGroupInstanceView instanceView, bool? supportAutomaticPlacement) : base(id, name, type, tags, location) { Zones = zones; PlatformFaultDomainCount = platformFaultDomainCount; @@ -50,7 +50,7 @@ internal DedicatedHostGroupData(ResourceIdentifier id, string name, ResourceType /// Number of fault domains that the host group can span. public int? PlatformFaultDomainCount { get; set; } /// A list of references to all dedicated hosts in the dedicated host group. - public IReadOnlyList Hosts { get; } + public IReadOnlyList Hosts { get; } /// The dedicated host group instance view, which has the list of instance view of the dedicated hosts under the dedicated host group. public DedicatedHostGroupInstanceView InstanceView { get; } /// Specifies whether virtual machines or virtual machine scale sets can be placed automatically on the dedicated host group. Automatic placement means resources are allocated on dedicated hosts, that are chosen by Azure, under the dedicated host group. The value is defaulted to 'false' when not provided. <br><br>Minimum api-version: 2020-06-01. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ImageData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ImageData.cs index f5fb78b0cacf3..28306e5e7dfa6 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ImageData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/ImageData.cs @@ -33,7 +33,7 @@ public ImageData(Location location) : base(location) /// Specifies the storage settings for the virtual machine disks. /// The provisioning state. /// Specifies the HyperVGenerationType of the VirtualMachine created from the image. From API Version 2019-03-01 if the image source is a blob, then we need the user to specify the value, if the source is managed resource like disk or snapshot, we may require the user to specify the property if we cannot deduce it from the source managed resource. - internal ImageData(ResourceIdentifier id, string name, ResourceType type, IDictionary tags, Location location, ExtendedLocation extendedLocation, Models.SubResource sourceVirtualMachine, ImageStorageProfile storageProfile, string provisioningState, HyperVGenerationTypes? hyperVGeneration) : base(id, name, type, tags, location) + internal ImageData(ResourceIdentifier id, string name, ResourceType type, IDictionary tags, Location location, ExtendedLocation extendedLocation, WritableSubResource sourceVirtualMachine, ImageStorageProfile storageProfile, string provisioningState, HyperVGenerationTypes? hyperVGeneration) : base(id, name, type, tags, location) { ExtendedLocation = extendedLocation; SourceVirtualMachine = sourceVirtualMachine; @@ -45,7 +45,7 @@ internal ImageData(ResourceIdentifier id, string name, ResourceType type, IDicti /// The extended location of the Image. public ExtendedLocation ExtendedLocation { get; set; } /// The source virtual machine from which Image is created. - public Models.SubResource SourceVirtualMachine { get; set; } + public WritableSubResource SourceVirtualMachine { get; set; } /// Specifies the storage settings for the virtual machine disks. public ImageStorageProfile StorageProfile { get; set; } /// The provisioning state. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ApiEntityReference.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ApiEntityReference.Serialization.cs deleted file mode 100644 index 1e3d295dfe167..0000000000000 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ApiEntityReference.Serialization.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Compute.Models -{ - public partial class ApiEntityReference : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(Id)) - { - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); - } - writer.WriteEndObject(); - } - - internal static ApiEntityReference DeserializeApiEntityReference(JsonElement element) - { - Optional id = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - } - return new ApiEntityReference(id.Value); - } - } -} diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ApiEntityReference.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ApiEntityReference.cs deleted file mode 100644 index fcdf9de275420..0000000000000 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ApiEntityReference.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Compute.Models -{ - /// The API entity reference. - public partial class ApiEntityReference - { - /// Initializes a new instance of ApiEntityReference. - public ApiEntityReference() - { - } - - /// Initializes a new instance of ApiEntityReference. - /// The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... - internal ApiEntityReference(string id) - { - Id = id; - } - - /// The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/... - public string Id { get; set; } - } -} diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailabilitySetData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailabilitySetData.Serialization.cs index 6fdb969715ebf..c9949084b2e9d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailabilitySetData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailabilitySetData.Serialization.cs @@ -52,14 +52,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in VirtualMachines) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } if (Optional.IsDefined(ProximityPlacementGroup)) { writer.WritePropertyName("proximityPlacementGroup"); - writer.WriteObjectValue(ProximityPlacementGroup); + JsonSerializer.Serialize(writer, ProximityPlacementGroup); } writer.WriteEndObject(); writer.WriteEndObject(); @@ -75,8 +75,8 @@ internal static AvailabilitySetData DeserializeAvailabilitySetData(JsonElement e ResourceType type = default; Optional platformUpdateDomainCount = default; Optional platformFaultDomainCount = default; - Optional> virtualMachines = default; - Optional proximityPlacementGroup = default; + Optional> virtualMachines = default; + Optional proximityPlacementGroup = default; Optional> statuses = default; foreach (var property in element.EnumerateObject()) { @@ -156,10 +156,10 @@ internal static AvailabilitySetData DeserializeAvailabilitySetData(JsonElement e property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(Models.SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } virtualMachines = array; continue; @@ -171,7 +171,7 @@ internal static AvailabilitySetData DeserializeAvailabilitySetData(JsonElement e property0.ThrowNonNullablePropertyIsNull(); continue; } - proximityPlacementGroup = Models.SubResource.DeserializeSubResource(property0.Value); + proximityPlacementGroup = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("statuses")) @@ -193,7 +193,7 @@ internal static AvailabilitySetData DeserializeAvailabilitySetData(JsonElement e continue; } } - return new AvailabilitySetData(id, name, type, tags, location, sku.Value, Optional.ToNullable(platformUpdateDomainCount), Optional.ToNullable(platformFaultDomainCount), Optional.ToList(virtualMachines), proximityPlacementGroup.Value, Optional.ToList(statuses)); + return new AvailabilitySetData(id, name, type, tags, location, sku.Value, Optional.ToNullable(platformUpdateDomainCount), Optional.ToNullable(platformFaultDomainCount), Optional.ToList(virtualMachines), proximityPlacementGroup, Optional.ToList(statuses)); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailabilitySetUpdate.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailabilitySetUpdate.Serialization.cs index e44fa917de704..a4853d3675147 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailabilitySetUpdate.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailabilitySetUpdate.Serialization.cs @@ -49,14 +49,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in VirtualMachines) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } if (Optional.IsDefined(ProximityPlacementGroup)) { writer.WritePropertyName("proximityPlacementGroup"); - writer.WriteObjectValue(ProximityPlacementGroup); + JsonSerializer.Serialize(writer, ProximityPlacementGroup); } writer.WriteEndObject(); writer.WriteEndObject(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailabilitySetUpdate.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailabilitySetUpdate.cs index ec7995194732c..b707aa81d1431 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailabilitySetUpdate.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/AvailabilitySetUpdate.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -16,7 +17,7 @@ public partial class AvailabilitySetUpdate : UpdateResource /// Initializes a new instance of AvailabilitySetUpdate. public AvailabilitySetUpdate() { - VirtualMachines = new ChangeTrackingList(); + VirtualMachines = new ChangeTrackingList(); Statuses = new ChangeTrackingList(); } @@ -27,9 +28,9 @@ public AvailabilitySetUpdate() /// Fault Domain count. public int? PlatformFaultDomainCount { get; set; } /// A list of references to all virtual machines in the availability set. - public IList VirtualMachines { get; } + public IList VirtualMachines { get; } /// Specifies information about the proximity placement group that the availability set should be assigned to. <br><br>Minimum api-version: 2018-04-01. - public SubResource ProximityPlacementGroup { get; set; } + public WritableSubResource ProximityPlacementGroup { get; set; } /// The resource status information. public IReadOnlyList Statuses { get; } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceNetworkProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceNetworkProfile.Serialization.cs index a9b5ea0b8c90f..adacd58258969 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceNetworkProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceNetworkProfile.Serialization.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -29,7 +30,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(SwappableCloudService)) { writer.WritePropertyName("swappableCloudService"); - writer.WriteObjectValue(SwappableCloudService); + JsonSerializer.Serialize(writer, SwappableCloudService); } writer.WriteEndObject(); } @@ -37,7 +38,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static CloudServiceNetworkProfile DeserializeCloudServiceNetworkProfile(JsonElement element) { Optional> loadBalancerConfigurations = default; - Optional swappableCloudService = default; + Optional swappableCloudService = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("loadBalancerConfigurations")) @@ -62,11 +63,11 @@ internal static CloudServiceNetworkProfile DeserializeCloudServiceNetworkProfile property.ThrowNonNullablePropertyIsNull(); continue; } - swappableCloudService = SubResource.DeserializeSubResource(property.Value); + swappableCloudService = JsonSerializer.Deserialize(property.Value.ToString()); continue; } } - return new CloudServiceNetworkProfile(Optional.ToList(loadBalancerConfigurations), swappableCloudService.Value); + return new CloudServiceNetworkProfile(Optional.ToList(loadBalancerConfigurations), swappableCloudService); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceNetworkProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceNetworkProfile.cs index 4b7fc5d7ea3f5..32b453b6838bb 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceNetworkProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceNetworkProfile.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -22,7 +23,7 @@ public CloudServiceNetworkProfile() /// Initializes a new instance of CloudServiceNetworkProfile. /// List of Load balancer configurations. Cloud service can have up to two load balancer configurations, corresponding to a Public Load Balancer and an Internal Load Balancer. /// The id reference of the cloud service containing the target IP with which the subject cloud service can perform a swap. This property cannot be updated once it is set. The swappable cloud service referred by this id must be present otherwise an error will be thrown. - internal CloudServiceNetworkProfile(IList loadBalancerConfigurations, SubResource swappableCloudService) + internal CloudServiceNetworkProfile(IList loadBalancerConfigurations, WritableSubResource swappableCloudService) { LoadBalancerConfigurations = loadBalancerConfigurations; SwappableCloudService = swappableCloudService; @@ -31,6 +32,6 @@ internal CloudServiceNetworkProfile(IList loadBalance /// List of Load balancer configurations. Cloud service can have up to two load balancer configurations, corresponding to a Public Load Balancer and an Internal Load Balancer. public IList LoadBalancerConfigurations { get; } /// The id reference of the cloud service containing the target IP with which the subject cloud service can perform a swap. This property cannot be updated once it is set. The swappable cloud service referred by this id must be present otherwise an error will be thrown. - public SubResource SwappableCloudService { get; set; } + public WritableSubResource SwappableCloudService { get; set; } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultAndSecretReference.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultAndSecretReference.Serialization.cs index 545e69f547aff..e5bbf4dec5ee0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultAndSecretReference.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultAndSecretReference.Serialization.cs @@ -7,6 +7,7 @@ using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -18,7 +19,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(SourceVault)) { writer.WritePropertyName("sourceVault"); - writer.WriteObjectValue(SourceVault); + JsonSerializer.Serialize(writer, SourceVault); } if (Optional.IsDefined(SecretUrl)) { @@ -30,7 +31,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static CloudServiceVaultAndSecretReference DeserializeCloudServiceVaultAndSecretReference(JsonElement element) { - Optional sourceVault = default; + Optional sourceVault = default; Optional secretUrl = default; foreach (var property in element.EnumerateObject()) { @@ -41,7 +42,7 @@ internal static CloudServiceVaultAndSecretReference DeserializeCloudServiceVault property.ThrowNonNullablePropertyIsNull(); continue; } - sourceVault = SubResource.DeserializeSubResource(property.Value); + sourceVault = JsonSerializer.Deserialize(property.Value.ToString()); continue; } if (property.NameEquals("secretUrl")) @@ -50,7 +51,7 @@ internal static CloudServiceVaultAndSecretReference DeserializeCloudServiceVault continue; } } - return new CloudServiceVaultAndSecretReference(sourceVault.Value, secretUrl.Value); + return new CloudServiceVaultAndSecretReference(sourceVault, secretUrl.Value); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultAndSecretReference.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultAndSecretReference.cs index d9cf5a31deed8..65314e0fca709 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultAndSecretReference.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultAndSecretReference.cs @@ -5,6 +5,8 @@ #nullable disable +using Azure.ResourceManager.Resources.Models; + namespace Azure.ResourceManager.Compute.Models { /// The CloudServiceVaultAndSecretReference. @@ -18,14 +20,14 @@ public CloudServiceVaultAndSecretReference() /// Initializes a new instance of CloudServiceVaultAndSecretReference. /// /// - internal CloudServiceVaultAndSecretReference(SubResource sourceVault, string secretUrl) + internal CloudServiceVaultAndSecretReference(WritableSubResource sourceVault, string secretUrl) { SourceVault = sourceVault; SecretUrl = secretUrl; } /// Gets or sets the source vault. - public SubResource SourceVault { get; set; } + public WritableSubResource SourceVault { get; set; } /// Gets or sets the secret url. public string SecretUrl { get; set; } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultSecretGroup.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultSecretGroup.Serialization.cs index 055c7f18febb6..207ba9dad59ff 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultSecretGroup.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultSecretGroup.Serialization.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -19,7 +20,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(SourceVault)) { writer.WritePropertyName("sourceVault"); - writer.WriteObjectValue(SourceVault); + JsonSerializer.Serialize(writer, SourceVault); } if (Optional.IsCollectionDefined(VaultCertificates)) { @@ -36,7 +37,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static CloudServiceVaultSecretGroup DeserializeCloudServiceVaultSecretGroup(JsonElement element) { - Optional sourceVault = default; + Optional sourceVault = default; Optional> vaultCertificates = default; foreach (var property in element.EnumerateObject()) { @@ -47,7 +48,7 @@ internal static CloudServiceVaultSecretGroup DeserializeCloudServiceVaultSecretG property.ThrowNonNullablePropertyIsNull(); continue; } - sourceVault = SubResource.DeserializeSubResource(property.Value); + sourceVault = JsonSerializer.Deserialize(property.Value.ToString()); continue; } if (property.NameEquals("vaultCertificates")) @@ -66,7 +67,7 @@ internal static CloudServiceVaultSecretGroup DeserializeCloudServiceVaultSecretG continue; } } - return new CloudServiceVaultSecretGroup(sourceVault.Value, Optional.ToList(vaultCertificates)); + return new CloudServiceVaultSecretGroup(sourceVault, Optional.ToList(vaultCertificates)); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultSecretGroup.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultSecretGroup.cs index 4921ad5676b7a..907c2483ffcbd 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultSecretGroup.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/CloudServiceVaultSecretGroup.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -22,14 +23,14 @@ public CloudServiceVaultSecretGroup() /// Initializes a new instance of CloudServiceVaultSecretGroup. /// The relative URL of the Key Vault containing all of the certificates in VaultCertificates. /// The list of key vault references in SourceVault which contain certificates. - internal CloudServiceVaultSecretGroup(SubResource sourceVault, IList vaultCertificates) + internal CloudServiceVaultSecretGroup(WritableSubResource sourceVault, IList vaultCertificates) { SourceVault = sourceVault; VaultCertificates = vaultCertificates; } /// The relative URL of the Key Vault containing all of the certificates in VaultCertificates. - public SubResource SourceVault { get; set; } + public WritableSubResource SourceVault { get; set; } /// The list of key vault references in SourceVault which contain certificates. public IList VaultCertificates { get; } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostData.Serialization.cs index 8599c339c97e0..e324f0aa54508 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostData.Serialization.cs @@ -64,7 +64,7 @@ internal static DedicatedHostData DeserializeDedicatedHostData(JsonElement eleme Optional platformFaultDomain = default; Optional autoReplaceOnFailure = default; Optional hostId = default; - Optional> virtualMachines = default; + Optional> virtualMachines = default; Optional licenseType = default; Optional provisioningTime = default; Optional provisioningState = default; @@ -147,10 +147,10 @@ internal static DedicatedHostData DeserializeDedicatedHostData(JsonElement eleme property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResourceReadOnly.DeserializeSubResourceReadOnly(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } virtualMachines = array; continue; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupData.Serialization.cs index 1b62376e39220..9ad8ffbcef553 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupData.Serialization.cs @@ -64,7 +64,7 @@ internal static DedicatedHostGroupData DeserializeDedicatedHostGroupData(JsonEle string name = default; ResourceType type = default; Optional platformFaultDomainCount = default; - Optional> hosts = default; + Optional> hosts = default; Optional instanceView = default; Optional supportAutomaticPlacement = default; foreach (var property in element.EnumerateObject()) @@ -140,10 +140,10 @@ internal static DedicatedHostGroupData DeserializeDedicatedHostGroupData(JsonEle property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResourceReadOnly.DeserializeSubResourceReadOnly(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } hosts = array; continue; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupUpdate.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupUpdate.cs index 0dbacf237df57..94a3ed28040d1 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupUpdate.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostGroupUpdate.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -17,7 +18,7 @@ public partial class DedicatedHostGroupUpdate : UpdateResource public DedicatedHostGroupUpdate() { Zones = new ChangeTrackingList(); - Hosts = new ChangeTrackingList(); + Hosts = new ChangeTrackingList(); } /// Availability Zone to use for this host group. Only single zone is supported. The zone can be assigned only during creation. If not provided, the group supports all zones in the region. If provided, enforces each host in the group to be in the same zone. @@ -25,7 +26,7 @@ public DedicatedHostGroupUpdate() /// Number of fault domains that the host group can span. public int? PlatformFaultDomainCount { get; set; } /// A list of references to all dedicated hosts in the dedicated host group. - public IReadOnlyList Hosts { get; } + public IReadOnlyList Hosts { get; } /// The dedicated host group instance view, which has the list of instance view of the dedicated hosts under the dedicated host group. public DedicatedHostGroupInstanceView InstanceView { get; } /// Specifies whether virtual machines or virtual machine scale sets can be placed automatically on the dedicated host group. Automatic placement means resources are allocated on dedicated hosts, that are chosen by Azure, under the dedicated host group. The value is defaulted to 'false' when not provided. <br><br>Minimum api-version: 2020-06-01. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostUpdate.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostUpdate.cs index 9527541c49130..0c898cc0f2637 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostUpdate.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DedicatedHostUpdate.cs @@ -8,6 +8,7 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -17,7 +18,7 @@ public partial class DedicatedHostUpdate : UpdateResource /// Initializes a new instance of DedicatedHostUpdate. public DedicatedHostUpdate() { - VirtualMachines = new ChangeTrackingList(); + VirtualMachines = new ChangeTrackingList(); } /// Fault domain of the dedicated host within a dedicated host group. @@ -27,7 +28,7 @@ public DedicatedHostUpdate() /// A unique id generated and assigned to the dedicated host by the platform. <br><br> Does not change throughout the lifetime of the host. public string HostId { get; } /// A list of references to all virtual machines in the Dedicated Host. - public IReadOnlyList VirtualMachines { get; } + public IReadOnlyList VirtualMachines { get; } /// Specifies the software license type that will be applied to the VMs deployed on the dedicated host. <br><br> Possible values are: <br><br> **None** <br><br> **Windows_Server_Hybrid** <br><br> **Windows_Server_Perpetual** <br><br> Default: **None**. public DedicatedHostLicenseTypes? LicenseType { get; set; } /// The date when the host was first provisioned. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSetParameters.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSetParameters.Serialization.cs deleted file mode 100644 index ba69cacfd1f01..0000000000000 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSetParameters.Serialization.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Compute.Models -{ - public partial class DiskEncryptionSetParameters : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); - writer.WriteEndObject(); - } - - internal static DiskEncryptionSetParameters DeserializeDiskEncryptionSetParameters(JsonElement element) - { - ResourceIdentifier id = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - } - return new DiskEncryptionSetParameters(id); - } - } -} diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSetParameters.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSetParameters.cs deleted file mode 100644 index 86e86e34305ee..0000000000000 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/DiskEncryptionSetParameters.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.ResourceManager.Resources.Models; - -namespace Azure.ResourceManager.Compute.Models -{ - /// Describes the parameter of customer managed disk encryption set resource id that can be specified for disk. <br><br> NOTE: The disk encryption set resource id can only be specified for managed disk. Please refer https://aka.ms/mdssewithcmkoverview for more details. - public partial class DiskEncryptionSetParameters : WritableSubResource - { - /// Initializes a new instance of DiskEncryptionSetParameters. - public DiskEncryptionSetParameters() - { - } - - /// Initializes a new instance of DiskEncryptionSetParameters. - /// The id. - internal DiskEncryptionSetParameters(string id) : base(id) - { - } - } -} diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactSource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactSource.cs index dfdc4057b9d38..f2408d99ef13c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactSource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactSource.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -15,7 +16,7 @@ internal partial class GalleryArtifactSource /// Initializes a new instance of GalleryArtifactSource. /// The managed artifact. /// is null. - internal GalleryArtifactSource(ManagedArtifact managedImage) + internal GalleryArtifactSource(Resources.Models.SubResource managedImage) { if (managedImage == null) { @@ -26,6 +27,6 @@ internal GalleryArtifactSource(ManagedArtifact managedImage) } /// The managed artifact. - public ManagedArtifact ManagedImage { get; } + public Resources.Models.SubResource ManagedImage { get; } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactVersionSource.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactVersionSource.Serialization.cs index 7bbdf66781360..6f2c75ad69a09 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactVersionSource.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactVersionSource.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Compute.Models { @@ -16,34 +15,37 @@ public partial class GalleryArtifactVersionSource : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Uri)) { writer.WritePropertyName("uri"); writer.WriteStringValue(Uri); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WriteEndObject(); } internal static GalleryArtifactVersionSource DeserializeGalleryArtifactVersionSource(JsonElement element) { + Optional id = default; Optional uri = default; - ResourceIdentifier id = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("uri")) + if (property.NameEquals("id")) { - uri = property.Value.GetString(); + id = property.Value.GetString(); continue; } - if (property.NameEquals("id")) + if (property.NameEquals("uri")) { - id = property.Value.GetString(); + uri = property.Value.GetString(); continue; } } - return new GalleryArtifactVersionSource(id, uri.Value); + return new GalleryArtifactVersionSource(id.Value, uri.Value); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactVersionSource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactVersionSource.cs index 565f60c134d3c..64e506c1db574 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactVersionSource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/GalleryArtifactVersionSource.cs @@ -5,12 +5,10 @@ #nullable disable -using Azure.ResourceManager.Resources.Models; - namespace Azure.ResourceManager.Compute.Models { /// The gallery artifact version source. - public partial class GalleryArtifactVersionSource : WritableSubResource + public partial class GalleryArtifactVersionSource { /// Initializes a new instance of GalleryArtifactVersionSource. public GalleryArtifactVersionSource() @@ -18,13 +16,16 @@ public GalleryArtifactVersionSource() } /// Initializes a new instance of GalleryArtifactVersionSource. - /// The id. + /// The id of the gallery artifact version source. Can specify a disk uri, snapshot uri, user image or storage account resource. /// The uri of the gallery artifact version source. Currently used to specify vhd/blob source. - internal GalleryArtifactVersionSource(string id, string uri) : base(id) + internal GalleryArtifactVersionSource(string id, string uri) { + Id = id; Uri = uri; } + /// The id of the gallery artifact version source. Can specify a disk uri, snapshot uri, user image or storage account resource. + public string Id { get; set; } /// The uri of the gallery artifact version source. Currently used to specify vhd/blob source. public string Uri { get; set; } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageData.Serialization.cs index 75b728644a8fb..430f7f10ab7ed 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageData.Serialization.cs @@ -39,7 +39,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(SourceVirtualMachine)) { writer.WritePropertyName("sourceVirtualMachine"); - writer.WriteObjectValue(SourceVirtualMachine); + JsonSerializer.Serialize(writer, SourceVirtualMachine); } if (Optional.IsDefined(StorageProfile)) { @@ -63,7 +63,7 @@ internal static ImageData DeserializeImageData(JsonElement element) ResourceIdentifier id = default; string name = default; ResourceType type = default; - Optional sourceVirtualMachine = default; + Optional sourceVirtualMachine = default; Optional storageProfile = default; Optional provisioningState = default; Optional hyperVGeneration = default; @@ -125,7 +125,7 @@ internal static ImageData DeserializeImageData(JsonElement element) property0.ThrowNonNullablePropertyIsNull(); continue; } - sourceVirtualMachine = Models.SubResource.DeserializeSubResource(property0.Value); + sourceVirtualMachine = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("storageProfile")) @@ -157,7 +157,7 @@ internal static ImageData DeserializeImageData(JsonElement element) continue; } } - return new ImageData(id, name, type, tags, location, extendedLocation.Value, sourceVirtualMachine.Value, storageProfile.Value, provisioningState.Value, Optional.ToNullable(hyperVGeneration)); + return new ImageData(id, name, type, tags, location, extendedLocation.Value, sourceVirtualMachine, storageProfile.Value, provisioningState.Value, Optional.ToNullable(hyperVGeneration)); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDataDisk.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDataDisk.Serialization.cs index 488c25d69b729..77d1a47ba53ed 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDataDisk.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDataDisk.Serialization.cs @@ -7,6 +7,7 @@ using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -20,12 +21,12 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Snapshot)) { writer.WritePropertyName("snapshot"); - writer.WriteObjectValue(Snapshot); + JsonSerializer.Serialize(writer, Snapshot); } if (Optional.IsDefined(ManagedDisk)) { writer.WritePropertyName("managedDisk"); - writer.WriteObjectValue(ManagedDisk); + JsonSerializer.Serialize(writer, ManagedDisk); } if (Optional.IsDefined(BlobUri)) { @@ -50,7 +51,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DiskEncryptionSet)) { writer.WritePropertyName("diskEncryptionSet"); - writer.WriteObjectValue(DiskEncryptionSet); + JsonSerializer.Serialize(writer, DiskEncryptionSet); } writer.WriteEndObject(); } @@ -58,13 +59,13 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static ImageDataDisk DeserializeImageDataDisk(JsonElement element) { int lun = default; - Optional snapshot = default; - Optional managedDisk = default; + Optional snapshot = default; + Optional managedDisk = default; Optional blobUri = default; Optional caching = default; Optional diskSizeGB = default; Optional storageAccountType = default; - Optional diskEncryptionSet = default; + Optional diskEncryptionSet = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("lun")) @@ -79,7 +80,7 @@ internal static ImageDataDisk DeserializeImageDataDisk(JsonElement element) property.ThrowNonNullablePropertyIsNull(); continue; } - snapshot = SubResource.DeserializeSubResource(property.Value); + snapshot = JsonSerializer.Deserialize(property.Value.ToString()); continue; } if (property.NameEquals("managedDisk")) @@ -89,7 +90,7 @@ internal static ImageDataDisk DeserializeImageDataDisk(JsonElement element) property.ThrowNonNullablePropertyIsNull(); continue; } - managedDisk = SubResource.DeserializeSubResource(property.Value); + managedDisk = JsonSerializer.Deserialize(property.Value.ToString()); continue; } if (property.NameEquals("blobUri")) @@ -134,11 +135,11 @@ internal static ImageDataDisk DeserializeImageDataDisk(JsonElement element) property.ThrowNonNullablePropertyIsNull(); continue; } - diskEncryptionSet = DiskEncryptionSetParameters.DeserializeDiskEncryptionSetParameters(property.Value); + diskEncryptionSet = JsonSerializer.Deserialize(property.Value.ToString()); continue; } } - return new ImageDataDisk(snapshot.Value, managedDisk.Value, blobUri.Value, Optional.ToNullable(caching), Optional.ToNullable(diskSizeGB), Optional.ToNullable(storageAccountType), diskEncryptionSet.Value, lun); + return new ImageDataDisk(snapshot, managedDisk, blobUri.Value, Optional.ToNullable(caching), Optional.ToNullable(diskSizeGB), Optional.ToNullable(storageAccountType), diskEncryptionSet, lun); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDataDisk.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDataDisk.cs index 0a02695e47be5..e62faa02ea11c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDataDisk.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDataDisk.cs @@ -5,6 +5,8 @@ #nullable disable +using Azure.ResourceManager.Resources.Models; + namespace Azure.ResourceManager.Compute.Models { /// Describes a data disk. @@ -26,7 +28,7 @@ public ImageDataDisk(int lun) /// Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. /// Specifies the customer managed disk encryption set resource id for the managed image disk. /// Specifies the logical unit number of the data disk. This value is used to identify data disks within the VM and therefore must be unique for each data disk attached to a VM. - internal ImageDataDisk(SubResource snapshot, SubResource managedDisk, string blobUri, CachingTypes? caching, int? diskSizeGB, StorageAccountTypes? storageAccountType, DiskEncryptionSetParameters diskEncryptionSet, int lun) : base(snapshot, managedDisk, blobUri, caching, diskSizeGB, storageAccountType, diskEncryptionSet) + internal ImageDataDisk(WritableSubResource snapshot, WritableSubResource managedDisk, string blobUri, CachingTypes? caching, int? diskSizeGB, StorageAccountTypes? storageAccountType, WritableSubResource diskEncryptionSet, int lun) : base(snapshot, managedDisk, blobUri, caching, diskSizeGB, storageAccountType, diskEncryptionSet) { Lun = lun; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDisk.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDisk.Serialization.cs index 6c322d7f52290..3370363210ee3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDisk.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDisk.Serialization.cs @@ -7,6 +7,7 @@ using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -18,12 +19,12 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Snapshot)) { writer.WritePropertyName("snapshot"); - writer.WriteObjectValue(Snapshot); + JsonSerializer.Serialize(writer, Snapshot); } if (Optional.IsDefined(ManagedDisk)) { writer.WritePropertyName("managedDisk"); - writer.WriteObjectValue(ManagedDisk); + JsonSerializer.Serialize(writer, ManagedDisk); } if (Optional.IsDefined(BlobUri)) { @@ -48,20 +49,20 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DiskEncryptionSet)) { writer.WritePropertyName("diskEncryptionSet"); - writer.WriteObjectValue(DiskEncryptionSet); + JsonSerializer.Serialize(writer, DiskEncryptionSet); } writer.WriteEndObject(); } internal static ImageDisk DeserializeImageDisk(JsonElement element) { - Optional snapshot = default; - Optional managedDisk = default; + Optional snapshot = default; + Optional managedDisk = default; Optional blobUri = default; Optional caching = default; Optional diskSizeGB = default; Optional storageAccountType = default; - Optional diskEncryptionSet = default; + Optional diskEncryptionSet = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("snapshot")) @@ -71,7 +72,7 @@ internal static ImageDisk DeserializeImageDisk(JsonElement element) property.ThrowNonNullablePropertyIsNull(); continue; } - snapshot = SubResource.DeserializeSubResource(property.Value); + snapshot = JsonSerializer.Deserialize(property.Value.ToString()); continue; } if (property.NameEquals("managedDisk")) @@ -81,7 +82,7 @@ internal static ImageDisk DeserializeImageDisk(JsonElement element) property.ThrowNonNullablePropertyIsNull(); continue; } - managedDisk = SubResource.DeserializeSubResource(property.Value); + managedDisk = JsonSerializer.Deserialize(property.Value.ToString()); continue; } if (property.NameEquals("blobUri")) @@ -126,11 +127,11 @@ internal static ImageDisk DeserializeImageDisk(JsonElement element) property.ThrowNonNullablePropertyIsNull(); continue; } - diskEncryptionSet = DiskEncryptionSetParameters.DeserializeDiskEncryptionSetParameters(property.Value); + diskEncryptionSet = JsonSerializer.Deserialize(property.Value.ToString()); continue; } } - return new ImageDisk(snapshot.Value, managedDisk.Value, blobUri.Value, Optional.ToNullable(caching), Optional.ToNullable(diskSizeGB), Optional.ToNullable(storageAccountType), diskEncryptionSet.Value); + return new ImageDisk(snapshot, managedDisk, blobUri.Value, Optional.ToNullable(caching), Optional.ToNullable(diskSizeGB), Optional.ToNullable(storageAccountType), diskEncryptionSet); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDisk.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDisk.cs index f405befb0794e..0122bcf0a7096 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDisk.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDisk.cs @@ -5,6 +5,8 @@ #nullable disable +using Azure.ResourceManager.Resources.Models; + namespace Azure.ResourceManager.Compute.Models { /// Describes a image disk. @@ -23,7 +25,7 @@ public ImageDisk() /// Specifies the size of empty data disks in gigabytes. This element can be used to overwrite the name of the disk in a virtual machine image. <br><br> This value cannot be larger than 1023 GB. /// Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. /// Specifies the customer managed disk encryption set resource id for the managed image disk. - internal ImageDisk(SubResource snapshot, SubResource managedDisk, string blobUri, CachingTypes? caching, int? diskSizeGB, StorageAccountTypes? storageAccountType, DiskEncryptionSetParameters diskEncryptionSet) + internal ImageDisk(WritableSubResource snapshot, WritableSubResource managedDisk, string blobUri, CachingTypes? caching, int? diskSizeGB, StorageAccountTypes? storageAccountType, WritableSubResource diskEncryptionSet) { Snapshot = snapshot; ManagedDisk = managedDisk; @@ -35,9 +37,9 @@ internal ImageDisk(SubResource snapshot, SubResource managedDisk, string blobUri } /// The snapshot. - public SubResource Snapshot { get; set; } + public WritableSubResource Snapshot { get; set; } /// The managedDisk. - public SubResource ManagedDisk { get; set; } + public WritableSubResource ManagedDisk { get; set; } /// The Virtual Hard Disk. public string BlobUri { get; set; } /// Specifies the caching requirements. <br><br> Possible values are: <br><br> **None** <br><br> **ReadOnly** <br><br> **ReadWrite** <br><br> Default: **None for Standard storage. ReadOnly for Premium storage**. @@ -47,6 +49,6 @@ internal ImageDisk(SubResource snapshot, SubResource managedDisk, string blobUri /// Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. public StorageAccountTypes? StorageAccountType { get; set; } /// Specifies the customer managed disk encryption set resource id for the managed image disk. - public DiskEncryptionSetParameters DiskEncryptionSet { get; set; } + public WritableSubResource DiskEncryptionSet { get; set; } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDiskReference.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDiskReference.Serialization.cs index d9e24da196fd9..698a036e9c3a4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDiskReference.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDiskReference.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Compute.Models { @@ -16,22 +15,27 @@ public partial class ImageDiskReference : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); if (Optional.IsDefined(Lun)) { writer.WritePropertyName("lun"); writer.WriteNumberValue(Lun.Value); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WriteEndObject(); } internal static ImageDiskReference DeserializeImageDiskReference(JsonElement element) { + string id = default; Optional lun = default; - ResourceIdentifier id = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("lun")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -42,11 +46,6 @@ internal static ImageDiskReference DeserializeImageDiskReference(JsonElement ele lun = property.Value.GetInt32(); continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } } return new ImageDiskReference(id, Optional.ToNullable(lun)); } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDiskReference.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDiskReference.cs index 3aaf622bf8c87..14ed4a011c53e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDiskReference.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageDiskReference.cs @@ -5,26 +5,37 @@ #nullable disable -using Azure.ResourceManager.Resources.Models; +using System; namespace Azure.ResourceManager.Compute.Models { /// The source image used for creating the disk. - public partial class ImageDiskReference : WritableSubResource + public partial class ImageDiskReference { /// Initializes a new instance of ImageDiskReference. - public ImageDiskReference() + /// A relative uri containing either a Platform Image Repository or user image reference. + /// is null. + public ImageDiskReference(string id) { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + Id = id; } /// Initializes a new instance of ImageDiskReference. - /// The id. + /// A relative uri containing either a Platform Image Repository or user image reference. /// If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null. - internal ImageDiskReference(string id, int? lun) : base(id) + internal ImageDiskReference(string id, int? lun) { + Id = id; Lun = lun; } + /// A relative uri containing either a Platform Image Repository or user image reference. + public string Id { get; set; } /// If the disk is created from an image's data disk, this is an index that indicates which of the data disks in the image to use. For OS disks, this field is null. public int? Lun { get; set; } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageOSDisk.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageOSDisk.Serialization.cs index 1bca84ab99244..3d78d3aee749a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageOSDisk.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageOSDisk.Serialization.cs @@ -7,6 +7,7 @@ using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -22,12 +23,12 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Snapshot)) { writer.WritePropertyName("snapshot"); - writer.WriteObjectValue(Snapshot); + JsonSerializer.Serialize(writer, Snapshot); } if (Optional.IsDefined(ManagedDisk)) { writer.WritePropertyName("managedDisk"); - writer.WriteObjectValue(ManagedDisk); + JsonSerializer.Serialize(writer, ManagedDisk); } if (Optional.IsDefined(BlobUri)) { @@ -52,7 +53,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DiskEncryptionSet)) { writer.WritePropertyName("diskEncryptionSet"); - writer.WriteObjectValue(DiskEncryptionSet); + JsonSerializer.Serialize(writer, DiskEncryptionSet); } writer.WriteEndObject(); } @@ -61,13 +62,13 @@ internal static ImageOSDisk DeserializeImageOSDisk(JsonElement element) { OperatingSystemTypes osType = default; OperatingSystemStateTypes osState = default; - Optional snapshot = default; - Optional managedDisk = default; + Optional snapshot = default; + Optional managedDisk = default; Optional blobUri = default; Optional caching = default; Optional diskSizeGB = default; Optional storageAccountType = default; - Optional diskEncryptionSet = default; + Optional diskEncryptionSet = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("osType")) @@ -87,7 +88,7 @@ internal static ImageOSDisk DeserializeImageOSDisk(JsonElement element) property.ThrowNonNullablePropertyIsNull(); continue; } - snapshot = SubResource.DeserializeSubResource(property.Value); + snapshot = JsonSerializer.Deserialize(property.Value.ToString()); continue; } if (property.NameEquals("managedDisk")) @@ -97,7 +98,7 @@ internal static ImageOSDisk DeserializeImageOSDisk(JsonElement element) property.ThrowNonNullablePropertyIsNull(); continue; } - managedDisk = SubResource.DeserializeSubResource(property.Value); + managedDisk = JsonSerializer.Deserialize(property.Value.ToString()); continue; } if (property.NameEquals("blobUri")) @@ -142,11 +143,11 @@ internal static ImageOSDisk DeserializeImageOSDisk(JsonElement element) property.ThrowNonNullablePropertyIsNull(); continue; } - diskEncryptionSet = DiskEncryptionSetParameters.DeserializeDiskEncryptionSetParameters(property.Value); + diskEncryptionSet = JsonSerializer.Deserialize(property.Value.ToString()); continue; } } - return new ImageOSDisk(snapshot.Value, managedDisk.Value, blobUri.Value, Optional.ToNullable(caching), Optional.ToNullable(diskSizeGB), Optional.ToNullable(storageAccountType), diskEncryptionSet.Value, osType, osState); + return new ImageOSDisk(snapshot, managedDisk, blobUri.Value, Optional.ToNullable(caching), Optional.ToNullable(diskSizeGB), Optional.ToNullable(storageAccountType), diskEncryptionSet, osType, osState); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageOSDisk.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageOSDisk.cs index 33495f60cccdb..3d1777d1259f8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageOSDisk.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageOSDisk.cs @@ -5,6 +5,8 @@ #nullable disable +using Azure.ResourceManager.Resources.Models; + namespace Azure.ResourceManager.Compute.Models { /// Describes an Operating System disk. @@ -29,7 +31,7 @@ public ImageOSDisk(OperatingSystemTypes osType, OperatingSystemStateTypes osStat /// Specifies the customer managed disk encryption set resource id for the managed image disk. /// This property allows you to specify the type of the OS that is included in the disk if creating a VM from a custom image. <br><br> Possible values are: <br><br> **Windows** <br><br> **Linux**. /// The OS State. - internal ImageOSDisk(SubResource snapshot, SubResource managedDisk, string blobUri, CachingTypes? caching, int? diskSizeGB, StorageAccountTypes? storageAccountType, DiskEncryptionSetParameters diskEncryptionSet, OperatingSystemTypes osType, OperatingSystemStateTypes osState) : base(snapshot, managedDisk, blobUri, caching, diskSizeGB, storageAccountType, diskEncryptionSet) + internal ImageOSDisk(WritableSubResource snapshot, WritableSubResource managedDisk, string blobUri, CachingTypes? caching, int? diskSizeGB, StorageAccountTypes? storageAccountType, WritableSubResource diskEncryptionSet, OperatingSystemTypes osType, OperatingSystemStateTypes osState) : base(snapshot, managedDisk, blobUri, caching, diskSizeGB, storageAccountType, diskEncryptionSet) { OsType = osType; OsState = osState; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageReference.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageReference.Serialization.cs index 0cddf4b571852..2e74262fdef21 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageReference.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageReference.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Compute.Models { @@ -36,8 +35,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("version"); writer.WriteStringValue(Version); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WriteEndObject(); } @@ -48,7 +50,7 @@ internal static ImageReference DeserializeImageReference(JsonElement element) Optional sku = default; Optional version = default; Optional exactVersion = default; - ResourceIdentifier id = default; + Optional id = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("publisher")) @@ -82,7 +84,7 @@ internal static ImageReference DeserializeImageReference(JsonElement element) continue; } } - return new ImageReference(id, publisher.Value, offer.Value, sku.Value, version.Value, exactVersion.Value); + return new ImageReference(id.Value, publisher.Value, offer.Value, sku.Value, version.Value, exactVersion.Value); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageReference.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageReference.cs index 1717e633953fa..aacdfae69d385 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageReference.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageReference.cs @@ -5,12 +5,10 @@ #nullable disable -using Azure.ResourceManager.Resources.Models; - namespace Azure.ResourceManager.Compute.Models { /// Specifies information about the image to use. You can specify information about platform images, marketplace images, or virtual machine images. This element is required when you want to use a platform image, marketplace image, or virtual machine image, but is not used in other creation operations. NOTE: Image reference publisher and offer can only be set when you create the scale set. - public partial class ImageReference : WritableSubResource + public partial class ImageReference : SubResource { /// Initializes a new instance of ImageReference. public ImageReference() @@ -18,7 +16,7 @@ public ImageReference() } /// Initializes a new instance of ImageReference. - /// The id. + /// Resource Id. /// The image publisher. /// Specifies the offer of the platform image or marketplace image used to create the virtual machine. /// The image SKU. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageUpdate.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageUpdate.Serialization.cs index 404c9146423ce..f5822e6136e18 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageUpdate.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageUpdate.Serialization.cs @@ -31,7 +31,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(SourceVirtualMachine)) { writer.WritePropertyName("sourceVirtualMachine"); - writer.WriteObjectValue(SourceVirtualMachine); + JsonSerializer.Serialize(writer, SourceVirtualMachine); } if (Optional.IsDefined(StorageProfile)) { diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageUpdate.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageUpdate.cs index 854ade31e6f5b..a3de4fe9d7f80 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageUpdate.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ImageUpdate.cs @@ -5,6 +5,8 @@ #nullable disable +using Azure.ResourceManager.Resources.Models; + namespace Azure.ResourceManager.Compute.Models { /// The source user image virtual hard disk. Only tags may be updated. @@ -16,7 +18,7 @@ public ImageUpdate() } /// The source virtual machine from which Image is created. - public SubResource SourceVirtualMachine { get; set; } + public WritableSubResource SourceVirtualMachine { get; set; } /// Specifies the storage settings for the virtual machine disks. public ImageStorageProfile StorageProfile { get; set; } /// The provisioning state. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyForDiskEncryptionSet.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyForDiskEncryptionSet.Serialization.cs index 661a03f0b1b7a..dc15512b7f70d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyForDiskEncryptionSet.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyForDiskEncryptionSet.Serialization.cs @@ -7,6 +7,7 @@ using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -18,7 +19,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(SourceVault)) { writer.WritePropertyName("sourceVault"); - writer.WriteObjectValue(SourceVault); + JsonSerializer.Serialize(writer, SourceVault); } writer.WritePropertyName("keyUrl"); writer.WriteStringValue(KeyUrl); @@ -27,7 +28,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static KeyForDiskEncryptionSet DeserializeKeyForDiskEncryptionSet(JsonElement element) { - Optional sourceVault = default; + Optional sourceVault = default; string keyUrl = default; foreach (var property in element.EnumerateObject()) { @@ -38,7 +39,7 @@ internal static KeyForDiskEncryptionSet DeserializeKeyForDiskEncryptionSet(JsonE property.ThrowNonNullablePropertyIsNull(); continue; } - sourceVault = SourceVault.DeserializeSourceVault(property.Value); + sourceVault = JsonSerializer.Deserialize(property.Value.ToString()); continue; } if (property.NameEquals("keyUrl")) @@ -47,7 +48,7 @@ internal static KeyForDiskEncryptionSet DeserializeKeyForDiskEncryptionSet(JsonE continue; } } - return new KeyForDiskEncryptionSet(sourceVault.Value, keyUrl); + return new KeyForDiskEncryptionSet(sourceVault, keyUrl); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyForDiskEncryptionSet.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyForDiskEncryptionSet.cs index 002acec3e0398..86197e6b01c6b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyForDiskEncryptionSet.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyForDiskEncryptionSet.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -28,14 +29,14 @@ public KeyForDiskEncryptionSet(string keyUrl) /// Initializes a new instance of KeyForDiskEncryptionSet. /// Resource id of the KeyVault containing the key or secret. This property is optional and cannot be used if the KeyVault subscription is not the same as the Disk Encryption Set subscription. /// Fully versioned Key Url pointing to a key in KeyVault. Version segment of the Url is required regardless of rotationToLatestKeyVersionEnabled value. - internal KeyForDiskEncryptionSet(SourceVault sourceVault, string keyUrl) + internal KeyForDiskEncryptionSet(WritableSubResource sourceVault, string keyUrl) { SourceVault = sourceVault; KeyUrl = keyUrl; } /// Resource id of the KeyVault containing the key or secret. This property is optional and cannot be used if the KeyVault subscription is not the same as the Disk Encryption Set subscription. - public SourceVault SourceVault { get; set; } + public WritableSubResource SourceVault { get; set; } /// Fully versioned Key Url pointing to a key in KeyVault. Version segment of the Url is required regardless of rotationToLatestKeyVersionEnabled value. public string KeyUrl { get; set; } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultAndKeyReference.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultAndKeyReference.Serialization.cs index 5f5eca412d2f8..08401d2190167 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultAndKeyReference.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultAndKeyReference.Serialization.cs @@ -7,6 +7,7 @@ using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -16,21 +17,20 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("sourceVault"); - writer.WriteObjectValue(SourceVault); - writer.WritePropertyName("keyUrl"); + JsonSerializer.Serialize(writer, SourceVault); writer.WritePropertyName("keyUrl"); writer.WriteStringValue(KeyUrl); writer.WriteEndObject(); } internal static KeyVaultAndKeyReference DeserializeKeyVaultAndKeyReference(JsonElement element) { - SourceVault sourceVault = default; + WritableSubResource sourceVault = default; string keyUrl = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sourceVault")) { - sourceVault = SourceVault.DeserializeSourceVault(property.Value); + sourceVault = JsonSerializer.Deserialize(property.Value.ToString()); continue; } if (property.NameEquals("keyUrl")) diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultAndKeyReference.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultAndKeyReference.cs index 4e0f706dcd308..60ce7d29c46cd 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultAndKeyReference.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultAndKeyReference.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -16,7 +17,7 @@ public partial class KeyVaultAndKeyReference /// Resource id of the KeyVault containing the key or secret. /// Url pointing to a key or secret in KeyVault. /// or is null. - public KeyVaultAndKeyReference(SourceVault sourceVault, string keyUrl) + public KeyVaultAndKeyReference(WritableSubResource sourceVault, string keyUrl) { if (sourceVault == null) { @@ -32,7 +33,7 @@ public KeyVaultAndKeyReference(SourceVault sourceVault, string keyUrl) } /// Resource id of the KeyVault containing the key or secret. - public SourceVault SourceVault { get; set; } + public WritableSubResource SourceVault { get; set; } /// Url pointing to a key or secret in KeyVault. public string KeyUrl { get; set; } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultAndSecretReference.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultAndSecretReference.Serialization.cs index dd9a70b0b75b5..6748fdfcc914d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultAndSecretReference.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultAndSecretReference.Serialization.cs @@ -7,6 +7,7 @@ using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -16,21 +17,20 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); writer.WritePropertyName("sourceVault"); - writer.WriteObjectValue(SourceVault); - writer.WritePropertyName("secretUrl"); + JsonSerializer.Serialize(writer, SourceVault); writer.WritePropertyName("secretUrl"); writer.WriteStringValue(SecretUrl); writer.WriteEndObject(); } internal static KeyVaultAndSecretReference DeserializeKeyVaultAndSecretReference(JsonElement element) { - SourceVault sourceVault = default; + WritableSubResource sourceVault = default; string secretUrl = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("sourceVault")) { - sourceVault = SourceVault.DeserializeSourceVault(property.Value); + sourceVault = JsonSerializer.Deserialize(property.Value.ToString()); continue; } if (property.NameEquals("secretUrl")) diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultAndSecretReference.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultAndSecretReference.cs index e5c6cf36f2a23..bc2bfffdd5e78 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultAndSecretReference.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultAndSecretReference.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -16,7 +17,7 @@ public partial class KeyVaultAndSecretReference /// Resource id of the KeyVault containing the key or secret. /// Url pointing to a key or secret in KeyVault. /// or is null. - public KeyVaultAndSecretReference(SourceVault sourceVault, string secretUrl) + public KeyVaultAndSecretReference(WritableSubResource sourceVault, string secretUrl) { if (sourceVault == null) { @@ -32,7 +33,7 @@ public KeyVaultAndSecretReference(SourceVault sourceVault, string secretUrl) } /// Resource id of the KeyVault containing the key or secret. - public SourceVault SourceVault { get; set; } + public WritableSubResource SourceVault { get; set; } /// Url pointing to a key or secret in KeyVault. public string SecretUrl { get; set; } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultKeyReference.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultKeyReference.Serialization.cs index 03d57587fc350..8d83d2420a38e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultKeyReference.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultKeyReference.Serialization.cs @@ -7,6 +7,7 @@ using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -18,14 +19,13 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("keyUrl"); writer.WriteStringValue(KeyUrl); writer.WritePropertyName("sourceVault"); - writer.WriteObjectValue(SourceVault); - writer.WriteEndObject(); + JsonSerializer.Serialize(writer, SourceVault); writer.WriteEndObject(); } internal static KeyVaultKeyReference DeserializeKeyVaultKeyReference(JsonElement element) { string keyUrl = default; - SubResource sourceVault = default; + WritableSubResource sourceVault = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("keyUrl")) @@ -35,7 +35,7 @@ internal static KeyVaultKeyReference DeserializeKeyVaultKeyReference(JsonElement } if (property.NameEquals("sourceVault")) { - sourceVault = SubResource.DeserializeSubResource(property.Value); + sourceVault = JsonSerializer.Deserialize(property.Value.ToString()); continue; } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultKeyReference.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultKeyReference.cs index 11465cdf6a9e0..6cbb22be82416 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultKeyReference.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultKeyReference.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -16,7 +17,7 @@ public partial class KeyVaultKeyReference /// The URL referencing a key encryption key in Key Vault. /// The relative URL of the Key Vault containing the key. /// or is null. - public KeyVaultKeyReference(string keyUrl, SubResource sourceVault) + public KeyVaultKeyReference(string keyUrl, WritableSubResource sourceVault) { if (keyUrl == null) { @@ -34,6 +35,6 @@ public KeyVaultKeyReference(string keyUrl, SubResource sourceVault) /// The URL referencing a key encryption key in Key Vault. public string KeyUrl { get; set; } /// The relative URL of the Key Vault containing the key. - public SubResource SourceVault { get; set; } + public WritableSubResource SourceVault { get; set; } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultSecretReference.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultSecretReference.Serialization.cs index 2c023e4cf4d45..6814065e5b543 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultSecretReference.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultSecretReference.Serialization.cs @@ -7,6 +7,7 @@ using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -18,14 +19,13 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("secretUrl"); writer.WriteStringValue(SecretUrl); writer.WritePropertyName("sourceVault"); - writer.WriteObjectValue(SourceVault); - writer.WriteEndObject(); + JsonSerializer.Serialize(writer, SourceVault); writer.WriteEndObject(); } internal static KeyVaultSecretReference DeserializeKeyVaultSecretReference(JsonElement element) { string secretUrl = default; - SubResource sourceVault = default; + WritableSubResource sourceVault = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("secretUrl")) @@ -35,7 +35,7 @@ internal static KeyVaultSecretReference DeserializeKeyVaultSecretReference(JsonE } if (property.NameEquals("sourceVault")) { - sourceVault = SubResource.DeserializeSubResource(property.Value); + sourceVault = JsonSerializer.Deserialize(property.Value.ToString()); continue; } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultSecretReference.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultSecretReference.cs index 1e3c6b669f30a..b121456848984 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultSecretReference.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/KeyVaultSecretReference.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -16,7 +17,7 @@ public partial class KeyVaultSecretReference /// The URL referencing a secret in a Key Vault. /// The relative URL of the Key Vault containing the secret. /// or is null. - public KeyVaultSecretReference(string secretUrl, SubResource sourceVault) + public KeyVaultSecretReference(string secretUrl, WritableSubResource sourceVault) { if (secretUrl == null) { @@ -34,6 +35,6 @@ public KeyVaultSecretReference(string secretUrl, SubResource sourceVault) /// The URL referencing a secret in a Key Vault. public string SecretUrl { get; set; } /// The relative URL of the Key Vault containing the secret. - public SubResource SourceVault { get; set; } + public WritableSubResource SourceVault { get; set; } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LoadBalancerConfiguration.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LoadBalancerConfiguration.Serialization.cs index 314b0728b0567..3ff42f61df8e7 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LoadBalancerConfiguration.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LoadBalancerConfiguration.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Compute.Models { @@ -16,22 +15,30 @@ public partial class LoadBalancerConfiguration : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("name"); writer.WriteStringValue(Name); writer.WritePropertyName("properties"); writer.WriteObjectValue(Properties); - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WriteEndObject(); } internal static LoadBalancerConfiguration DeserializeLoadBalancerConfiguration(JsonElement element) { + Optional id = default; string name = default; LoadBalancerConfigurationProperties properties = default; - ResourceIdentifier id = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -42,13 +49,8 @@ internal static LoadBalancerConfiguration DeserializeLoadBalancerConfiguration(J properties = LoadBalancerConfigurationProperties.DeserializeLoadBalancerConfigurationProperties(property.Value); continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } } - return new LoadBalancerConfiguration(id, name, properties); + return new LoadBalancerConfiguration(id.Value, name, properties); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LoadBalancerConfiguration.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LoadBalancerConfiguration.cs index 9c00605e93bee..b3d79b7b5e293 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LoadBalancerConfiguration.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LoadBalancerConfiguration.cs @@ -6,12 +6,11 @@ #nullable disable using System; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { /// Describes the load balancer configuration. - public partial class LoadBalancerConfiguration : WritableSubResource + public partial class LoadBalancerConfiguration { /// Initializes a new instance of LoadBalancerConfiguration. /// The name of the Load balancer. @@ -33,15 +32,18 @@ public LoadBalancerConfiguration(string name, LoadBalancerConfigurationPropertie } /// Initializes a new instance of LoadBalancerConfiguration. - /// The id. + /// Resource Id. /// The name of the Load balancer. /// Properties of the load balancer configuration. - internal LoadBalancerConfiguration(string id, string name, LoadBalancerConfigurationProperties properties) : base(id) + internal LoadBalancerConfiguration(string id, string name, LoadBalancerConfigurationProperties properties) { + Id = id; Name = name; Properties = properties; } + /// Resource Id. + public string Id { get; set; } /// The name of the Load balancer. public string Name { get; set; } /// Properties of the load balancer configuration. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LoadBalancerFrontendIPConfigurationProperties.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LoadBalancerFrontendIPConfigurationProperties.Serialization.cs index 0aab1a4f40c06..3aa43f3867a52 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LoadBalancerFrontendIPConfigurationProperties.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LoadBalancerFrontendIPConfigurationProperties.Serialization.cs @@ -7,6 +7,7 @@ using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -18,12 +19,12 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PublicIPAddress)) { writer.WritePropertyName("publicIPAddress"); - writer.WriteObjectValue(PublicIPAddress); + JsonSerializer.Serialize(writer, PublicIPAddress); } if (Optional.IsDefined(Subnet)) { writer.WritePropertyName("subnet"); - writer.WriteObjectValue(Subnet); + JsonSerializer.Serialize(writer, Subnet); } if (Optional.IsDefined(PrivateIPAddress)) { @@ -35,8 +36,8 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static LoadBalancerFrontendIPConfigurationProperties DeserializeLoadBalancerFrontendIPConfigurationProperties(JsonElement element) { - Optional publicIPAddress = default; - Optional subnet = default; + Optional publicIPAddress = default; + Optional subnet = default; Optional privateIPAddress = default; foreach (var property in element.EnumerateObject()) { @@ -47,7 +48,7 @@ internal static LoadBalancerFrontendIPConfigurationProperties DeserializeLoadBal property.ThrowNonNullablePropertyIsNull(); continue; } - publicIPAddress = SubResource.DeserializeSubResource(property.Value); + publicIPAddress = JsonSerializer.Deserialize(property.Value.ToString()); continue; } if (property.NameEquals("subnet")) @@ -57,7 +58,7 @@ internal static LoadBalancerFrontendIPConfigurationProperties DeserializeLoadBal property.ThrowNonNullablePropertyIsNull(); continue; } - subnet = SubResource.DeserializeSubResource(property.Value); + subnet = JsonSerializer.Deserialize(property.Value.ToString()); continue; } if (property.NameEquals("privateIPAddress")) @@ -66,7 +67,7 @@ internal static LoadBalancerFrontendIPConfigurationProperties DeserializeLoadBal continue; } } - return new LoadBalancerFrontendIPConfigurationProperties(publicIPAddress.Value, subnet.Value, privateIPAddress.Value); + return new LoadBalancerFrontendIPConfigurationProperties(publicIPAddress, subnet, privateIPAddress.Value); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LoadBalancerFrontendIPConfigurationProperties.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LoadBalancerFrontendIPConfigurationProperties.cs index a6175b73c7c53..9ee3ea97c5452 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LoadBalancerFrontendIPConfigurationProperties.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/LoadBalancerFrontendIPConfigurationProperties.cs @@ -5,6 +5,8 @@ #nullable disable +using Azure.ResourceManager.Resources.Models; + namespace Azure.ResourceManager.Compute.Models { /// Describes a cloud service IP Configuration. @@ -19,7 +21,7 @@ public LoadBalancerFrontendIPConfigurationProperties() /// The reference to the public ip address resource. /// The reference to the virtual network subnet resource. /// The virtual network private IP address of the IP configuration. - internal LoadBalancerFrontendIPConfigurationProperties(SubResource publicIPAddress, SubResource subnet, string privateIPAddress) + internal LoadBalancerFrontendIPConfigurationProperties(WritableSubResource publicIPAddress, WritableSubResource subnet, string privateIPAddress) { PublicIPAddress = publicIPAddress; Subnet = subnet; @@ -27,9 +29,9 @@ internal LoadBalancerFrontendIPConfigurationProperties(SubResource publicIPAddre } /// The reference to the public ip address resource. - public SubResource PublicIPAddress { get; set; } + public WritableSubResource PublicIPAddress { get; set; } /// The reference to the virtual network subnet resource. - public SubResource Subnet { get; set; } + public WritableSubResource Subnet { get; set; } /// The virtual network private IP address of the IP configuration. public string PrivateIPAddress { get; set; } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ManagedArtifact.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ManagedArtifact.cs deleted file mode 100644 index 31ed56cc07097..0000000000000 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ManagedArtifact.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Compute.Models -{ - /// The managed artifact. - internal partial class ManagedArtifact - { - /// Initializes a new instance of ManagedArtifact. - /// The managed artifact id. - /// is null. - internal ManagedArtifact(string id) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - - Id = id; - } - - /// The managed artifact id. - public string Id { get; } - } -} diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ManagedDiskParameters.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ManagedDiskParameters.Serialization.cs index 1c5bdf8878814..0c0b32d741c54 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ManagedDiskParameters.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ManagedDiskParameters.Serialization.cs @@ -7,7 +7,7 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -24,18 +24,21 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DiskEncryptionSet)) { writer.WritePropertyName("diskEncryptionSet"); - writer.WriteObjectValue(DiskEncryptionSet); + JsonSerializer.Serialize(writer, DiskEncryptionSet); + } + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WriteEndObject(); } internal static ManagedDiskParameters DeserializeManagedDiskParameters(JsonElement element) { Optional storageAccountType = default; - Optional diskEncryptionSet = default; - ResourceIdentifier id = default; + Optional diskEncryptionSet = default; + Optional id = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("storageAccountType")) @@ -55,7 +58,7 @@ internal static ManagedDiskParameters DeserializeManagedDiskParameters(JsonEleme property.ThrowNonNullablePropertyIsNull(); continue; } - diskEncryptionSet = DiskEncryptionSetParameters.DeserializeDiskEncryptionSetParameters(property.Value); + diskEncryptionSet = JsonSerializer.Deserialize(property.Value.ToString()); continue; } if (property.NameEquals("id")) @@ -64,7 +67,7 @@ internal static ManagedDiskParameters DeserializeManagedDiskParameters(JsonEleme continue; } } - return new ManagedDiskParameters(id, Optional.ToNullable(storageAccountType), diskEncryptionSet.Value); + return new ManagedDiskParameters(id.Value, Optional.ToNullable(storageAccountType), diskEncryptionSet); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ManagedDiskParameters.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ManagedDiskParameters.cs index b937634782ff9..106395c7923a6 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ManagedDiskParameters.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/ManagedDiskParameters.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.Compute.Models { /// The parameters of a managed disk. - public partial class ManagedDiskParameters : WritableSubResource + public partial class ManagedDiskParameters : SubResource { /// Initializes a new instance of ManagedDiskParameters. public ManagedDiskParameters() @@ -18,10 +18,10 @@ public ManagedDiskParameters() } /// Initializes a new instance of ManagedDiskParameters. - /// The id. + /// Resource Id. /// Specifies the storage account type for the managed disk. Managed OS disk storage account type can only be set when you create the scale set. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. /// Specifies the customer managed disk encryption set resource id for the managed disk. - internal ManagedDiskParameters(string id, StorageAccountTypes? storageAccountType, DiskEncryptionSetParameters diskEncryptionSet) : base(id) + internal ManagedDiskParameters(string id, StorageAccountTypes? storageAccountType, WritableSubResource diskEncryptionSet) : base(id) { StorageAccountType = storageAccountType; DiskEncryptionSet = diskEncryptionSet; @@ -30,6 +30,6 @@ internal ManagedDiskParameters(string id, StorageAccountTypes? storageAccountTyp /// Specifies the storage account type for the managed disk. Managed OS disk storage account type can only be set when you create the scale set. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. public StorageAccountTypes? StorageAccountType { get; set; } /// Specifies the customer managed disk encryption set resource id for the managed disk. - public DiskEncryptionSetParameters DiskEncryptionSet { get; set; } + public WritableSubResource DiskEncryptionSet { get; set; } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/NetworkInterfaceReference.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/NetworkInterfaceReference.Serialization.cs index 7305f1d579f7c..39d93d3935ae7 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/NetworkInterfaceReference.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/NetworkInterfaceReference.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Compute.Models { @@ -16,8 +15,11 @@ public partial class NetworkInterfaceReference : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Primary)) @@ -36,7 +38,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static NetworkInterfaceReference DeserializeNetworkInterfaceReference(JsonElement element) { - ResourceIdentifier id = default; + Optional id = default; Optional primary = default; Optional deleteOption = default; foreach (var property in element.EnumerateObject()) @@ -79,7 +81,7 @@ internal static NetworkInterfaceReference DeserializeNetworkInterfaceReference(J continue; } } - return new NetworkInterfaceReference(id, Optional.ToNullable(primary), Optional.ToNullable(deleteOption)); + return new NetworkInterfaceReference(id.Value, Optional.ToNullable(primary), Optional.ToNullable(deleteOption)); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/NetworkInterfaceReference.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/NetworkInterfaceReference.cs index 0376796f9d7cc..2afc02d8e7e37 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/NetworkInterfaceReference.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/NetworkInterfaceReference.cs @@ -5,12 +5,10 @@ #nullable disable -using Azure.ResourceManager.Resources.Models; - namespace Azure.ResourceManager.Compute.Models { /// Describes a network interface reference. - public partial class NetworkInterfaceReference : WritableSubResource + public partial class NetworkInterfaceReference : SubResource { /// Initializes a new instance of NetworkInterfaceReference. public NetworkInterfaceReference() @@ -18,7 +16,7 @@ public NetworkInterfaceReference() } /// Initializes a new instance of NetworkInterfaceReference. - /// The id. + /// Resource Id. /// Specifies the primary network interface in case the virtual machine has more than 1 network interface. /// Specify what happens to the network interface when the VM is deleted. internal NetworkInterfaceReference(string id, bool? primary, DeleteOptions? deleteOption) : base(id) diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PrivateEndpoint.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PrivateEndpoint.Serialization.cs deleted file mode 100644 index 9b61fc5bf90b3..0000000000000 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PrivateEndpoint.Serialization.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Compute.Models -{ - public partial class PrivateEndpoint - { - internal static PrivateEndpoint DeserializePrivateEndpoint(JsonElement element) - { - Optional id = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - } - return new PrivateEndpoint(id.Value); - } - } -} diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PrivateEndpoint.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PrivateEndpoint.cs deleted file mode 100644 index 3c36524b4871e..0000000000000 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PrivateEndpoint.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Compute.Models -{ - /// The Private Endpoint resource. - public partial class PrivateEndpoint - { - /// Initializes a new instance of PrivateEndpoint. - internal PrivateEndpoint() - { - } - - /// Initializes a new instance of PrivateEndpoint. - /// The ARM identifier for Private Endpoint. - internal PrivateEndpoint(string id) - { - Id = id; - } - - /// The ARM identifier for Private Endpoint. - public string Id { get; } - } -} diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PrivateEndpointConnectionData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PrivateEndpointConnectionData.Serialization.cs index 9f999a0f288d3..991f44bd92d10 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PrivateEndpointConnectionData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/PrivateEndpointConnectionData.Serialization.cs @@ -9,6 +9,7 @@ using Azure.Core; using Azure.ResourceManager; using Azure.ResourceManager.Compute.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute { @@ -33,7 +34,7 @@ internal static PrivateEndpointConnectionData DeserializePrivateEndpointConnecti ResourceIdentifier id = default; string name = default; ResourceType type = default; - Optional privateEndpoint = default; + Optional privateEndpoint = default; Optional privateLinkServiceConnectionState = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) @@ -69,7 +70,7 @@ internal static PrivateEndpointConnectionData DeserializePrivateEndpointConnecti property0.ThrowNonNullablePropertyIsNull(); continue; } - privateEndpoint = PrivateEndpoint.DeserializePrivateEndpoint(property0.Value); + privateEndpoint = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("privateLinkServiceConnectionState")) @@ -96,7 +97,7 @@ internal static PrivateEndpointConnectionData DeserializePrivateEndpointConnecti continue; } } - return new PrivateEndpointConnectionData(id, name, type, privateEndpoint.Value, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState)); + return new PrivateEndpointConnectionData(id, name, type, privateEndpoint, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointCollectionSourceProperties.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointCollectionSourceProperties.Serialization.cs index 36636772bdacd..bfcf6feb73503 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointCollectionSourceProperties.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointCollectionSourceProperties.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Compute.Models { @@ -16,15 +15,18 @@ public partial class RestorePointCollectionSourceProperties : IUtf8JsonSerializa void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WriteEndObject(); } internal static RestorePointCollectionSourceProperties DeserializeRestorePointCollectionSourceProperties(JsonElement element) { Optional location = default; - ResourceIdentifier id = default; + Optional id = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("location")) @@ -38,7 +40,7 @@ internal static RestorePointCollectionSourceProperties DeserializeRestorePointCo continue; } } - return new RestorePointCollectionSourceProperties(id, location.Value); + return new RestorePointCollectionSourceProperties(location.Value, id.Value); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointCollectionSourceProperties.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointCollectionSourceProperties.cs index 465a53ddf3c44..5ae359f88578d 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointCollectionSourceProperties.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointCollectionSourceProperties.cs @@ -5,12 +5,10 @@ #nullable disable -using Azure.ResourceManager.Resources.Models; - namespace Azure.ResourceManager.Compute.Models { /// The properties of the source resource that this restore point collection is created from. - public partial class RestorePointCollectionSourceProperties : WritableSubResource + public partial class RestorePointCollectionSourceProperties { /// Initializes a new instance of RestorePointCollectionSourceProperties. public RestorePointCollectionSourceProperties() @@ -18,14 +16,17 @@ public RestorePointCollectionSourceProperties() } /// Initializes a new instance of RestorePointCollectionSourceProperties. - /// The id. /// Location of the source resource used to create this restore point collection. - internal RestorePointCollectionSourceProperties(string id, string location) : base(id) + /// Resource Id of the source resource used to create this restore point collection. + internal RestorePointCollectionSourceProperties(string location, string id) { Location = location; + Id = id; } /// Location of the source resource used to create this restore point collection. public string Location { get; } + /// Resource Id of the source resource used to create this restore point collection. + public string Id { get; set; } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointData.Serialization.cs index 139779bfbafc0..a3fdc8190f54e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointData.Serialization.cs @@ -10,6 +10,7 @@ using Azure.Core; using Azure.ResourceManager; using Azure.ResourceManager.Compute.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute { @@ -26,7 +27,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ExcludeDisks) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } @@ -39,7 +40,7 @@ internal static RestorePointData DeserializeRestorePointData(JsonElement element ResourceIdentifier id = default; string name = default; ResourceType type = default; - Optional> excludeDisks = default; + Optional> excludeDisks = default; Optional sourceMetadata = default; Optional provisioningState = default; Optional consistencyMode = default; @@ -77,10 +78,10 @@ internal static RestorePointData DeserializeRestorePointData(JsonElement element property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(ApiEntityReference.DeserializeApiEntityReference(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } excludeDisks = array; continue; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVMDataDisk.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVMDataDisk.Serialization.cs index b37a8875a680b..127f845a4c692 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVMDataDisk.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVMDataDisk.Serialization.cs @@ -7,6 +7,7 @@ using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -19,7 +20,7 @@ internal static RestorePointSourceVMDataDisk DeserializeRestorePointSourceVMData Optional caching = default; Optional diskSizeGB = default; Optional managedDisk = default; - Optional diskRestorePoint = default; + Optional diskRestorePoint = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("lun")) @@ -74,11 +75,11 @@ internal static RestorePointSourceVMDataDisk DeserializeRestorePointSourceVMData property.ThrowNonNullablePropertyIsNull(); continue; } - diskRestorePoint = ApiEntityReference.DeserializeApiEntityReference(property.Value); + diskRestorePoint = JsonSerializer.Deserialize(property.Value.ToString()); continue; } } - return new RestorePointSourceVMDataDisk(Optional.ToNullable(lun), name.Value, Optional.ToNullable(caching), Optional.ToNullable(diskSizeGB), managedDisk.Value, diskRestorePoint.Value); + return new RestorePointSourceVMDataDisk(Optional.ToNullable(lun), name.Value, Optional.ToNullable(caching), Optional.ToNullable(diskSizeGB), managedDisk.Value, diskRestorePoint); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVMDataDisk.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVMDataDisk.cs index eaedc641e4820..415533be3f4fb 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVMDataDisk.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVMDataDisk.cs @@ -5,6 +5,8 @@ #nullable disable +using Azure.ResourceManager.Resources.Models; + namespace Azure.ResourceManager.Compute.Models { /// Describes a data disk. @@ -22,7 +24,7 @@ internal RestorePointSourceVMDataDisk() /// Gets the initial disk size in GB for blank data disks, and the new desired size for existing OS and Data disks. /// Gets the managed disk details. /// Gets the disk restore point Id. - internal RestorePointSourceVMDataDisk(int? lun, string name, CachingTypes? caching, int? diskSizeGB, ManagedDiskParameters managedDisk, ApiEntityReference diskRestorePoint) + internal RestorePointSourceVMDataDisk(int? lun, string name, CachingTypes? caching, int? diskSizeGB, ManagedDiskParameters managedDisk, WritableSubResource diskRestorePoint) { Lun = lun; Name = name; @@ -43,6 +45,6 @@ internal RestorePointSourceVMDataDisk(int? lun, string name, CachingTypes? cachi /// Gets the managed disk details. public ManagedDiskParameters ManagedDisk { get; } /// Gets the disk restore point Id. - public ApiEntityReference DiskRestorePoint { get; } + public WritableSubResource DiskRestorePoint { get; } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVmosDisk.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVmosDisk.Serialization.cs index 187b7c641b799..ae1c6acd6801b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVmosDisk.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVmosDisk.Serialization.cs @@ -7,6 +7,7 @@ using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -20,7 +21,7 @@ internal static RestorePointSourceVmosDisk DeserializeRestorePointSourceVmosDisk Optional caching = default; Optional diskSizeGB = default; Optional managedDisk = default; - Optional diskRestorePoint = default; + Optional diskRestorePoint = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("osType")) @@ -85,11 +86,11 @@ internal static RestorePointSourceVmosDisk DeserializeRestorePointSourceVmosDisk property.ThrowNonNullablePropertyIsNull(); continue; } - diskRestorePoint = ApiEntityReference.DeserializeApiEntityReference(property.Value); + diskRestorePoint = JsonSerializer.Deserialize(property.Value.ToString()); continue; } } - return new RestorePointSourceVmosDisk(Optional.ToNullable(osType), encryptionSettings.Value, name.Value, Optional.ToNullable(caching), Optional.ToNullable(diskSizeGB), managedDisk.Value, diskRestorePoint.Value); + return new RestorePointSourceVmosDisk(Optional.ToNullable(osType), encryptionSettings.Value, name.Value, Optional.ToNullable(caching), Optional.ToNullable(diskSizeGB), managedDisk.Value, diskRestorePoint); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVmosDisk.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVmosDisk.cs index 886e6714939e1..7690fbad9912e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVmosDisk.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RestorePointSourceVmosDisk.cs @@ -5,6 +5,8 @@ #nullable disable +using Azure.ResourceManager.Resources.Models; + namespace Azure.ResourceManager.Compute.Models { /// Describes an Operating System disk. @@ -23,7 +25,7 @@ internal RestorePointSourceVmosDisk() /// Gets the disk size in GB. /// Gets the managed disk details. /// Gets the disk restore point Id. - internal RestorePointSourceVmosDisk(OperatingSystemType? osType, DiskEncryptionSettings encryptionSettings, string name, CachingTypes? caching, int? diskSizeGB, ManagedDiskParameters managedDisk, ApiEntityReference diskRestorePoint) + internal RestorePointSourceVmosDisk(OperatingSystemType? osType, DiskEncryptionSettings encryptionSettings, string name, CachingTypes? caching, int? diskSizeGB, ManagedDiskParameters managedDisk, WritableSubResource diskRestorePoint) { OsType = osType; EncryptionSettings = encryptionSettings; @@ -47,6 +49,6 @@ internal RestorePointSourceVmosDisk(OperatingSystemType? osType, DiskEncryptionS /// Gets the managed disk details. public ManagedDiskParameters ManagedDisk { get; } /// Gets the disk restore point Id. - public ApiEntityReference DiskRestorePoint { get; } + public WritableSubResource DiskRestorePoint { get; } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstanceNetworkProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstanceNetworkProfile.Serialization.cs index 07967addadd38..5c3a86f8bca70 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstanceNetworkProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstanceNetworkProfile.Serialization.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -15,7 +16,7 @@ public partial class RoleInstanceNetworkProfile { internal static RoleInstanceNetworkProfile DeserializeRoleInstanceNetworkProfile(JsonElement element) { - Optional> networkInterfaces = default; + Optional> networkInterfaces = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("networkInterfaces")) @@ -25,10 +26,10 @@ internal static RoleInstanceNetworkProfile DeserializeRoleInstanceNetworkProfile property.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } networkInterfaces = array; continue; diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstanceNetworkProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstanceNetworkProfile.cs index 9cf372caede49..c15f7e02b0a4c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstanceNetworkProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RoleInstanceNetworkProfile.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -16,17 +17,17 @@ public partial class RoleInstanceNetworkProfile /// Initializes a new instance of RoleInstanceNetworkProfile. internal RoleInstanceNetworkProfile() { - NetworkInterfaces = new ChangeTrackingList(); + NetworkInterfaces = new ChangeTrackingList(); } /// Initializes a new instance of RoleInstanceNetworkProfile. /// Specifies the list of resource Ids for the network interfaces associated with the role instance. - internal RoleInstanceNetworkProfile(IReadOnlyList networkInterfaces) + internal RoleInstanceNetworkProfile(IReadOnlyList networkInterfaces) { NetworkInterfaces = networkInterfaces; } /// Specifies the list of resource Ids for the network interfaces associated with the role instance. - public IReadOnlyList NetworkInterfaces { get; } + public IReadOnlyList NetworkInterfaces { get; } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandDocument.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandDocument.Serialization.cs index 6523794bf49ff..51bab718e751b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandDocument.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandDocument.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Compute.Models { @@ -19,10 +18,10 @@ internal static RunCommandDocument DeserializeRunCommandDocument(JsonElement ele IReadOnlyList script = default; Optional> parameters = default; string schema = default; + string id = default; OperatingSystemTypes osType = default; string label = default; string description = default; - ResourceIdentifier id = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("script")) @@ -55,6 +54,11 @@ internal static RunCommandDocument DeserializeRunCommandDocument(JsonElement ele schema = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("osType")) { osType = property.Value.GetString().ToOperatingSystemTypes(); @@ -70,13 +74,8 @@ internal static RunCommandDocument DeserializeRunCommandDocument(JsonElement ele description = property.Value.GetString(); continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } } - return new RunCommandDocument(id, schema, osType, label, description, script, Optional.ToList(parameters)); + return new RunCommandDocument(schema, id, osType, label, description, script, Optional.ToList(parameters)); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandDocument.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandDocument.cs index d366ae88941af..13e9a88048ff1 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandDocument.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandDocument.cs @@ -17,17 +17,22 @@ public partial class RunCommandDocument : RunCommandDocumentBase { /// Initializes a new instance of RunCommandDocument. /// The VM run command schema. + /// The VM run command id. /// The Operating System type. /// The VM run command label. /// The VM run command description. /// The script to be executed. - /// , , , or is null. - internal RunCommandDocument(string schema, OperatingSystemTypes osType, string label, string description, IEnumerable script) : base(schema, osType, label, description) + /// , , , , or is null. + internal RunCommandDocument(string schema, string id, OperatingSystemTypes osType, string label, string description, IEnumerable script) : base(schema, id, osType, label, description) { if (schema == null) { throw new ArgumentNullException(nameof(schema)); } + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } if (label == null) { throw new ArgumentNullException(nameof(label)); @@ -46,15 +51,33 @@ internal RunCommandDocument(string schema, OperatingSystemTypes osType, string l } /// Initializes a new instance of RunCommandDocument. - /// The id. /// The VM run command schema. + /// The VM run command id. /// The Operating System type. /// The VM run command label. /// The VM run command description. /// The script to be executed. /// The parameters used by the script. - internal RunCommandDocument(string id, string schema, OperatingSystemTypes osType, string label, string description, IReadOnlyList script, IReadOnlyList parameters) : base(id, schema, osType, label, description) + /// , , , or is null. + internal RunCommandDocument(string schema, string id, OperatingSystemTypes osType, string label, string description, IReadOnlyList script, IReadOnlyList parameters) : base(schema, id, osType, label, description) { + if (schema == null) + { + throw new ArgumentNullException(nameof(schema)); + } + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + if (label == null) + { + throw new ArgumentNullException(nameof(label)); + } + if (description == null) + { + throw new ArgumentNullException(nameof(description)); + } + Script = script; Parameters = parameters; } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandDocumentBase.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandDocumentBase.Serialization.cs index 6b2931c354a40..1dab1b450634a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandDocumentBase.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandDocumentBase.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Compute.Models { @@ -16,10 +15,10 @@ public partial class RunCommandDocumentBase internal static RunCommandDocumentBase DeserializeRunCommandDocumentBase(JsonElement element) { string schema = default; + string id = default; OperatingSystemTypes osType = default; string label = default; string description = default; - ResourceIdentifier id = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("$schema")) @@ -27,6 +26,11 @@ internal static RunCommandDocumentBase DeserializeRunCommandDocumentBase(JsonEle schema = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("osType")) { osType = property.Value.GetString().ToOperatingSystemTypes(); @@ -42,13 +46,8 @@ internal static RunCommandDocumentBase DeserializeRunCommandDocumentBase(JsonEle description = property.Value.GetString(); continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } } - return new RunCommandDocumentBase(id, schema, osType, label, description); + return new RunCommandDocumentBase(schema, id, osType, label, description); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandDocumentBase.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandDocumentBase.cs index 2b985dee9da94..d26df35cbb4cf 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandDocumentBase.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/RunCommandDocumentBase.cs @@ -6,25 +6,29 @@ #nullable disable using System; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { /// Describes the properties of a Run Command metadata. - public partial class RunCommandDocumentBase : Resources.Models.SubResource + public partial class RunCommandDocumentBase { /// Initializes a new instance of RunCommandDocumentBase. /// The VM run command schema. + /// The VM run command id. /// The Operating System type. /// The VM run command label. /// The VM run command description. - /// , , or is null. - internal RunCommandDocumentBase(string schema, OperatingSystemTypes osType, string label, string description) + /// , , , or is null. + internal RunCommandDocumentBase(string schema, string id, OperatingSystemTypes osType, string label, string description) { if (schema == null) { throw new ArgumentNullException(nameof(schema)); } + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } if (label == null) { throw new ArgumentNullException(nameof(label)); @@ -35,20 +39,7 @@ internal RunCommandDocumentBase(string schema, OperatingSystemTypes osType, stri } Schema = schema; - OsType = osType; - Label = label; - Description = description; - } - - /// Initializes a new instance of RunCommandDocumentBase. - /// The id. - /// The VM run command schema. - /// The Operating System type. - /// The VM run command label. - /// The VM run command description. - internal RunCommandDocumentBase(string id, string schema, OperatingSystemTypes osType, string label, string description) : base(id) - { - Schema = schema; + Id = id; OsType = osType; Label = label; Description = description; @@ -56,6 +47,8 @@ internal RunCommandDocumentBase(string id, string schema, OperatingSystemTypes o /// The VM run command schema. public string Schema { get; } + /// The VM run command id. + public string Id { get; } /// The Operating System type. public OperatingSystemTypes OsType { get; } /// The VM run command label. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SourceVault.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SourceVault.Serialization.cs deleted file mode 100644 index 49656476cb67b..0000000000000 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SourceVault.Serialization.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Compute.Models -{ - public partial class SourceVault : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(Id)) - { - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); - } - writer.WriteEndObject(); - } - - internal static SourceVault DeserializeSourceVault(JsonElement element) - { - Optional id = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - } - return new SourceVault(id.Value); - } - } -} diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SourceVault.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SourceVault.cs deleted file mode 100644 index 011d2f0323a10..0000000000000 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SourceVault.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Compute.Models -{ - /// The vault id is an Azure Resource Manager Resource id in the form /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.KeyVault/vaults/{vaultName}. - public partial class SourceVault - { - /// Initializes a new instance of SourceVault. - public SourceVault() - { - } - - /// Initializes a new instance of SourceVault. - /// Resource Id. - internal SourceVault(string id) - { - Id = id; - } - - /// Resource Id. - public string Id { get; set; } - } -} diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyGenerateKeyPairResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyGenerateKeyPairResult.Serialization.cs index 2f70825089c8e..65d6587ef37e4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyGenerateKeyPairResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyGenerateKeyPairResult.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Compute.Models { @@ -17,7 +16,7 @@ internal static SshPublicKeyGenerateKeyPairResult DeserializeSshPublicKeyGenerat { string privateKey = default; string publicKey = default; - ResourceIdentifier id = default; + string id = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("privateKey")) @@ -36,7 +35,7 @@ internal static SshPublicKeyGenerateKeyPairResult DeserializeSshPublicKeyGenerat continue; } } - return new SshPublicKeyGenerateKeyPairResult(id, privateKey, publicKey); + return new SshPublicKeyGenerateKeyPairResult(privateKey, publicKey, id); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyGenerateKeyPairResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyGenerateKeyPairResult.cs index c4a6544147760..f5746afe1bd09 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyGenerateKeyPairResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SshPublicKeyGenerateKeyPairResult.cs @@ -6,18 +6,18 @@ #nullable disable using System; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { /// Response from generation of an SSH key pair. - public partial class SshPublicKeyGenerateKeyPairResult : Resources.Models.SubResource + public partial class SshPublicKeyGenerateKeyPairResult { /// Initializes a new instance of SshPublicKeyGenerateKeyPairResult. /// Private key portion of the key pair used to authenticate to a virtual machine through ssh. The private key is returned in RFC3447 format and should be treated as a secret. /// Public key portion of the key pair used to authenticate to a virtual machine through ssh. The public key is in ssh-rsa format. - /// or is null. - internal SshPublicKeyGenerateKeyPairResult(string privateKey, string publicKey) + /// The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. + /// , , or is null. + internal SshPublicKeyGenerateKeyPairResult(string privateKey, string publicKey, string id) { if (privateKey == null) { @@ -27,24 +27,21 @@ internal SshPublicKeyGenerateKeyPairResult(string privateKey, string publicKey) { throw new ArgumentNullException(nameof(publicKey)); } + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } PrivateKey = privateKey; PublicKey = publicKey; - } - - /// Initializes a new instance of SshPublicKeyGenerateKeyPairResult. - /// The id. - /// Private key portion of the key pair used to authenticate to a virtual machine through ssh. The private key is returned in RFC3447 format and should be treated as a secret. - /// Public key portion of the key pair used to authenticate to a virtual machine through ssh. The public key is in ssh-rsa format. - internal SshPublicKeyGenerateKeyPairResult(string id, string privateKey, string publicKey) : base(id) - { - PrivateKey = privateKey; - PublicKey = publicKey; + Id = id; } /// Private key portion of the key pair used to authenticate to a virtual machine through ssh. The private key is returned in RFC3447 format and should be treated as a secret. public string PrivateKey { get; } /// Public key portion of the key pair used to authenticate to a virtual machine through ssh. The public key is in ssh-rsa format. public string PublicKey { get; } + /// The ARM resource id in the form of /subscriptions/{SubscriptionId}/resourceGroups/{ResourceGroupName}/providers/Microsoft.Compute/sshPublicKeys/{SshPublicKeyName}. + public string Id { get; } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SubResourceWithColocationStatus.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SubResourceWithColocationStatus.Serialization.cs index 9e85af3166721..47d7359c88a62 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SubResourceWithColocationStatus.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SubResourceWithColocationStatus.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Compute.Models { @@ -21,15 +20,18 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("colocationStatus"); writer.WriteObjectValue(ColocationStatus); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WriteEndObject(); } internal static SubResourceWithColocationStatus DeserializeSubResourceWithColocationStatus(JsonElement element) { Optional colocationStatus = default; - ResourceIdentifier id = default; + Optional id = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("colocationStatus")) @@ -48,7 +50,7 @@ internal static SubResourceWithColocationStatus DeserializeSubResourceWithColoca continue; } } - return new SubResourceWithColocationStatus(id, colocationStatus.Value); + return new SubResourceWithColocationStatus(id.Value, colocationStatus.Value); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SubResourceWithColocationStatus.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SubResourceWithColocationStatus.cs index ad9275c9e0070..19aae34c862dc 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SubResourceWithColocationStatus.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/SubResourceWithColocationStatus.cs @@ -5,12 +5,10 @@ #nullable disable -using Azure.ResourceManager.Resources.Models; - namespace Azure.ResourceManager.Compute.Models { /// The SubResourceWithColocationStatus. - public partial class SubResourceWithColocationStatus : WritableSubResource + public partial class SubResourceWithColocationStatus : SubResource { /// Initializes a new instance of SubResourceWithColocationStatus. public SubResourceWithColocationStatus() @@ -18,7 +16,7 @@ public SubResourceWithColocationStatus() } /// Initializes a new instance of SubResourceWithColocationStatus. - /// The id. + /// Resource Id. /// Describes colocation status of a resource in the Proximity Placement Group. internal SubResourceWithColocationStatus(string id, InstanceViewStatus colocationStatus) : base(id) { diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpdateDomainData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpdateDomainData.Serialization.cs index 10144f511238a..55a1cf0632752 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpdateDomainData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/UpdateDomainData.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Compute { @@ -21,22 +20,22 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static UpdateDomainData DeserializeUpdateDomainData(JsonElement element) { + Optional id = default; Optional name = default; - ResourceIdentifier id = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("name")) + if (property.NameEquals("id")) { - name = property.Value.GetString(); + id = property.Value.GetString(); continue; } - if (property.NameEquals("id")) + if (property.NameEquals("name")) { - id = property.Value.GetString(); + name = property.Value.GetString(); continue; } } - return new UpdateDomainData(id, name.Value); + return new UpdateDomainData(id.Value, name.Value); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VaultSecretGroup.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VaultSecretGroup.Serialization.cs index fa178c09647a8..fb0af38f7b3b0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VaultSecretGroup.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VaultSecretGroup.Serialization.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -19,7 +20,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(SourceVault)) { writer.WritePropertyName("sourceVault"); - writer.WriteObjectValue(SourceVault); + JsonSerializer.Serialize(writer, SourceVault); } if (Optional.IsCollectionDefined(VaultCertificates)) { @@ -36,7 +37,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static VaultSecretGroup DeserializeVaultSecretGroup(JsonElement element) { - Optional sourceVault = default; + Optional sourceVault = default; Optional> vaultCertificates = default; foreach (var property in element.EnumerateObject()) { @@ -47,7 +48,7 @@ internal static VaultSecretGroup DeserializeVaultSecretGroup(JsonElement element property.ThrowNonNullablePropertyIsNull(); continue; } - sourceVault = SubResource.DeserializeSubResource(property.Value); + sourceVault = JsonSerializer.Deserialize(property.Value.ToString()); continue; } if (property.NameEquals("vaultCertificates")) @@ -66,7 +67,7 @@ internal static VaultSecretGroup DeserializeVaultSecretGroup(JsonElement element continue; } } - return new VaultSecretGroup(sourceVault.Value, Optional.ToList(vaultCertificates)); + return new VaultSecretGroup(sourceVault, Optional.ToList(vaultCertificates)); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VaultSecretGroup.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VaultSecretGroup.cs index 05fef634d5999..f175e580f062c 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VaultSecretGroup.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VaultSecretGroup.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -22,14 +23,14 @@ public VaultSecretGroup() /// Initializes a new instance of VaultSecretGroup. /// The relative URL of the Key Vault containing all of the certificates in VaultCertificates. /// The list of key vault references in SourceVault which contain certificates. - internal VaultSecretGroup(SubResource sourceVault, IList vaultCertificates) + internal VaultSecretGroup(WritableSubResource sourceVault, IList vaultCertificates) { SourceVault = sourceVault; VaultCertificates = vaultCertificates; } /// The relative URL of the Key Vault containing all of the certificates in VaultCertificates. - public SubResource SourceVault { get; set; } + public WritableSubResource SourceVault { get; set; } /// The list of key vault references in SourceVault which contain certificates. public IList VaultCertificates { get; } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineCaptureResult.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineCaptureResult.Serialization.cs index fbb8cd5496a1e..bb9c27c4c1147 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineCaptureResult.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineCaptureResult.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Compute.Models { @@ -17,8 +16,11 @@ public partial class VirtualMachineCaptureResult : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WriteEndObject(); } @@ -28,7 +30,7 @@ internal static VirtualMachineCaptureResult DeserializeVirtualMachineCaptureResu Optional contentVersion = default; Optional parameters = default; Optional> resources = default; - ResourceIdentifier id = default; + Optional id = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("$schema")) @@ -72,7 +74,7 @@ internal static VirtualMachineCaptureResult DeserializeVirtualMachineCaptureResu continue; } } - return new VirtualMachineCaptureResult(id, schema.Value, contentVersion.Value, parameters.Value, Optional.ToList(resources)); + return new VirtualMachineCaptureResult(id.Value, schema.Value, contentVersion.Value, parameters.Value, Optional.ToList(resources)); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineCaptureResult.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineCaptureResult.cs index ae1f7340a4025..5e73c0d2e3069 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineCaptureResult.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineCaptureResult.cs @@ -7,12 +7,11 @@ using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { /// Output of virtual machine capture operation. - public partial class VirtualMachineCaptureResult : WritableSubResource + public partial class VirtualMachineCaptureResult : SubResource { /// Initializes a new instance of VirtualMachineCaptureResult. public VirtualMachineCaptureResult() @@ -21,7 +20,7 @@ public VirtualMachineCaptureResult() } /// Initializes a new instance of VirtualMachineCaptureResult. - /// The id. + /// Resource Id. /// the schema of the captured virtual machine. /// the version of the content. /// parameters of the captured virtual machine. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineData.Serialization.cs index 45f1974c3b1fe..8307d2e3cb344 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineData.Serialization.cs @@ -94,17 +94,17 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AvailabilitySet)) { writer.WritePropertyName("availabilitySet"); - writer.WriteObjectValue(AvailabilitySet); + JsonSerializer.Serialize(writer, AvailabilitySet); } if (Optional.IsDefined(VirtualMachineScaleSet)) { writer.WritePropertyName("virtualMachineScaleSet"); - writer.WriteObjectValue(VirtualMachineScaleSet); + JsonSerializer.Serialize(writer, VirtualMachineScaleSet); } if (Optional.IsDefined(ProximityPlacementGroup)) { writer.WritePropertyName("proximityPlacementGroup"); - writer.WriteObjectValue(ProximityPlacementGroup); + JsonSerializer.Serialize(writer, ProximityPlacementGroup); } if (Optional.IsDefined(Priority)) { @@ -124,12 +124,12 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Host)) { writer.WritePropertyName("host"); - writer.WriteObjectValue(Host); + JsonSerializer.Serialize(writer, Host); } if (Optional.IsDefined(HostGroup)) { writer.WritePropertyName("hostGroup"); - writer.WriteObjectValue(HostGroup); + JsonSerializer.Serialize(writer, HostGroup); } if (Optional.IsDefined(LicenseType)) { @@ -179,14 +179,14 @@ internal static VirtualMachineData DeserializeVirtualMachineData(JsonElement ele Optional networkProfile = default; Optional securityProfile = default; Optional diagnosticsProfile = default; - Optional availabilitySet = default; - Optional virtualMachineScaleSet = default; - Optional proximityPlacementGroup = default; + Optional availabilitySet = default; + Optional virtualMachineScaleSet = default; + Optional proximityPlacementGroup = default; Optional priority = default; Optional evictionPolicy = default; Optional billingProfile = default; - Optional host = default; - Optional hostGroup = default; + Optional host = default; + Optional hostGroup = default; Optional provisioningState = default; Optional instanceView = default; Optional licenseType = default; @@ -373,7 +373,7 @@ internal static VirtualMachineData DeserializeVirtualMachineData(JsonElement ele property0.ThrowNonNullablePropertyIsNull(); continue; } - availabilitySet = Models.SubResource.DeserializeSubResource(property0.Value); + availabilitySet = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("virtualMachineScaleSet")) @@ -383,7 +383,7 @@ internal static VirtualMachineData DeserializeVirtualMachineData(JsonElement ele property0.ThrowNonNullablePropertyIsNull(); continue; } - virtualMachineScaleSet = Models.SubResource.DeserializeSubResource(property0.Value); + virtualMachineScaleSet = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("proximityPlacementGroup")) @@ -393,7 +393,7 @@ internal static VirtualMachineData DeserializeVirtualMachineData(JsonElement ele property0.ThrowNonNullablePropertyIsNull(); continue; } - proximityPlacementGroup = Models.SubResource.DeserializeSubResource(property0.Value); + proximityPlacementGroup = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("priority")) @@ -433,7 +433,7 @@ internal static VirtualMachineData DeserializeVirtualMachineData(JsonElement ele property0.ThrowNonNullablePropertyIsNull(); continue; } - host = Models.SubResource.DeserializeSubResource(property0.Value); + host = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("hostGroup")) @@ -443,7 +443,7 @@ internal static VirtualMachineData DeserializeVirtualMachineData(JsonElement ele property0.ThrowNonNullablePropertyIsNull(); continue; } - hostGroup = Models.SubResource.DeserializeSubResource(property0.Value); + hostGroup = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("provisioningState")) @@ -505,7 +505,7 @@ internal static VirtualMachineData DeserializeVirtualMachineData(JsonElement ele continue; } } - return new VirtualMachineData(id, name, type, tags, location, plan.Value, Optional.ToList(resources), identity, Optional.ToList(zones), extendedLocation.Value, hardwareProfile.Value, storageProfile.Value, additionalCapabilities.Value, osProfile.Value, networkProfile.Value, securityProfile.Value, diagnosticsProfile.Value, availabilitySet.Value, virtualMachineScaleSet.Value, proximityPlacementGroup.Value, Optional.ToNullable(priority), Optional.ToNullable(evictionPolicy), billingProfile.Value, host.Value, hostGroup.Value, provisioningState.Value, instanceView.Value, licenseType.Value, vmId.Value, extensionsTimeBudget.Value, Optional.ToNullable(platformFaultDomain), scheduledEventsProfile.Value, userData.Value); + return new VirtualMachineData(id, name, type, tags, location, plan.Value, Optional.ToList(resources), identity, Optional.ToList(zones), extendedLocation.Value, hardwareProfile.Value, storageProfile.Value, additionalCapabilities.Value, osProfile.Value, networkProfile.Value, securityProfile.Value, diagnosticsProfile.Value, availabilitySet, virtualMachineScaleSet, proximityPlacementGroup, Optional.ToNullable(priority), Optional.ToNullable(evictionPolicy), billingProfile.Value, host, hostGroup, provisioningState.Value, instanceView.Value, licenseType.Value, vmId.Value, extensionsTimeBudget.Value, Optional.ToNullable(platformFaultDomain), scheduledEventsProfile.Value, userData.Value); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImage.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImage.Serialization.cs index d56f9e53fdb83..3da55151fee34 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImage.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImage.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Compute.Models { @@ -37,8 +36,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("extendedLocation"); writer.WriteObjectValue(ExtendedLocation); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Plan)) @@ -96,7 +98,7 @@ internal static VirtualMachineImage DeserializeVirtualMachineImage(JsonElement e string location = default; Optional> tags = default; Optional extendedLocation = default; - ResourceIdentifier id = default; + Optional id = default; Optional plan = default; Optional osDiskImage = default; Optional> dataDiskImages = default; @@ -239,7 +241,7 @@ internal static VirtualMachineImage DeserializeVirtualMachineImage(JsonElement e continue; } } - return new VirtualMachineImage(id, name, location, Optional.ToDictionary(tags), extendedLocation.Value, plan.Value, osDiskImage.Value, Optional.ToList(dataDiskImages), automaticOSUpgradeProperties.Value, Optional.ToNullable(hyperVGeneration), disallowed.Value, Optional.ToList(features)); + return new VirtualMachineImage(id.Value, name, location, Optional.ToDictionary(tags), extendedLocation.Value, plan.Value, osDiskImage.Value, Optional.ToList(dataDiskImages), automaticOSUpgradeProperties.Value, Optional.ToNullable(hyperVGeneration), disallowed.Value, Optional.ToList(features)); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImage.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImage.cs index d077788e1c3d4..abb30e1b12201 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImage.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImage.cs @@ -34,7 +34,7 @@ public VirtualMachineImage(string name, string location) : base(name, location) } /// Initializes a new instance of VirtualMachineImage. - /// The id. + /// Resource Id. /// The name of the resource. /// The supported Azure location of the resource. /// Specifies the tags that are assigned to the virtual machine. For more information about using tags, see [Using tags to organize your Azure resources](https://docs.microsoft.com/azure/azure-resource-manager/resource-group-using-tags.md). diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImageResource.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImageResource.Serialization.cs index c6c697d7d2275..29d3dbb2be0a9 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImageResource.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImageResource.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Compute.Models { @@ -37,8 +36,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("extendedLocation"); writer.WriteObjectValue(ExtendedLocation); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WriteEndObject(); } @@ -48,7 +50,7 @@ internal static VirtualMachineImageResource DeserializeVirtualMachineImageResour string location = default; Optional> tags = default; Optional extendedLocation = default; - ResourceIdentifier id = default; + Optional id = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) @@ -92,7 +94,7 @@ internal static VirtualMachineImageResource DeserializeVirtualMachineImageResour continue; } } - return new VirtualMachineImageResource(id, name, location, Optional.ToDictionary(tags), extendedLocation.Value); + return new VirtualMachineImageResource(id.Value, name, location, Optional.ToDictionary(tags), extendedLocation.Value); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImageResource.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImageResource.cs index 653315036804f..15af0247bc3f2 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImageResource.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineImageResource.cs @@ -8,12 +8,11 @@ using System; using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { /// Virtual machine image resource information. - public partial class VirtualMachineImageResource : WritableSubResource + public partial class VirtualMachineImageResource : SubResource { /// Initializes a new instance of VirtualMachineImageResource. /// The name of the resource. @@ -36,7 +35,7 @@ public VirtualMachineImageResource(string name, string location) } /// Initializes a new instance of VirtualMachineImageResource. - /// The id. + /// Resource Id. /// The name of the resource. /// The supported Azure location of the resource. /// Specifies the tags that are assigned to the virtual machine. For more information about using tags, see [Using tags to organize your Azure resources](https://docs.microsoft.com/azure/azure-resource-manager/resource-group-using-tags.md). diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceConfiguration.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceConfiguration.Serialization.cs index 6acaace79b34c..b0a2cd29827e8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceConfiguration.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceConfiguration.Serialization.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -48,7 +49,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(NetworkSecurityGroup)) { writer.WritePropertyName("networkSecurityGroup"); - writer.WriteObjectValue(NetworkSecurityGroup); + JsonSerializer.Serialize(writer, NetworkSecurityGroup); } if (Optional.IsDefined(DnsSettings)) { @@ -68,7 +69,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DscpConfiguration)) { writer.WritePropertyName("dscpConfiguration"); - writer.WriteObjectValue(DscpConfiguration); + JsonSerializer.Serialize(writer, DscpConfiguration); } writer.WriteEndObject(); writer.WriteEndObject(); @@ -82,10 +83,10 @@ internal static VirtualMachineNetworkInterfaceConfiguration DeserializeVirtualMa Optional enableAcceleratedNetworking = default; Optional enableFpga = default; Optional enableIPForwarding = default; - Optional networkSecurityGroup = default; + Optional networkSecurityGroup = default; Optional dnsSettings = default; Optional> ipConfigurations = default; - Optional dscpConfiguration = default; + Optional dscpConfiguration = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) @@ -159,7 +160,7 @@ internal static VirtualMachineNetworkInterfaceConfiguration DeserializeVirtualMa property0.ThrowNonNullablePropertyIsNull(); continue; } - networkSecurityGroup = SubResource.DeserializeSubResource(property0.Value); + networkSecurityGroup = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("dnsSettings")) @@ -194,14 +195,14 @@ internal static VirtualMachineNetworkInterfaceConfiguration DeserializeVirtualMa property0.ThrowNonNullablePropertyIsNull(); continue; } - dscpConfiguration = SubResource.DeserializeSubResource(property0.Value); + dscpConfiguration = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } } continue; } } - return new VirtualMachineNetworkInterfaceConfiguration(name, Optional.ToNullable(primary), Optional.ToNullable(deleteOption), Optional.ToNullable(enableAcceleratedNetworking), Optional.ToNullable(enableFpga), Optional.ToNullable(enableIPForwarding), networkSecurityGroup.Value, dnsSettings.Value, Optional.ToList(ipConfigurations), dscpConfiguration.Value); + return new VirtualMachineNetworkInterfaceConfiguration(name, Optional.ToNullable(primary), Optional.ToNullable(deleteOption), Optional.ToNullable(enableAcceleratedNetworking), Optional.ToNullable(enableFpga), Optional.ToNullable(enableIPForwarding), networkSecurityGroup, dnsSettings.Value, Optional.ToList(ipConfigurations), dscpConfiguration); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceConfiguration.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceConfiguration.cs index c7a2fbcb69b29..c9f5db3e920d2 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceConfiguration.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceConfiguration.cs @@ -8,6 +8,7 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -39,7 +40,7 @@ public VirtualMachineNetworkInterfaceConfiguration(string name) /// The dns settings to be applied on the network interfaces. /// Specifies the IP configurations of the network interface. /// - internal VirtualMachineNetworkInterfaceConfiguration(string name, bool? primary, DeleteOptions? deleteOption, bool? enableAcceleratedNetworking, bool? enableFpga, bool? enableIPForwarding, SubResource networkSecurityGroup, VirtualMachineNetworkInterfaceDnsSettingsConfiguration dnsSettings, IList ipConfigurations, SubResource dscpConfiguration) + internal VirtualMachineNetworkInterfaceConfiguration(string name, bool? primary, DeleteOptions? deleteOption, bool? enableAcceleratedNetworking, bool? enableFpga, bool? enableIPForwarding, WritableSubResource networkSecurityGroup, VirtualMachineNetworkInterfaceDnsSettingsConfiguration dnsSettings, IList ipConfigurations, WritableSubResource dscpConfiguration) { Name = name; Primary = primary; @@ -66,12 +67,12 @@ internal VirtualMachineNetworkInterfaceConfiguration(string name, bool? primary, /// Whether IP forwarding enabled on this NIC. public bool? EnableIPForwarding { get; set; } /// The network security group. - public SubResource NetworkSecurityGroup { get; set; } + public WritableSubResource NetworkSecurityGroup { get; set; } /// The dns settings to be applied on the network interfaces. public VirtualMachineNetworkInterfaceDnsSettingsConfiguration DnsSettings { get; set; } /// Specifies the IP configurations of the network interface. public IList IpConfigurations { get; } /// Gets or sets the dscp configuration. - public SubResource DscpConfiguration { get; set; } + public WritableSubResource DscpConfiguration { get; set; } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceIPConfiguration.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceIPConfiguration.Serialization.cs index f1a4e0391dbd4..1b1002caeb660 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceIPConfiguration.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceIPConfiguration.Serialization.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -23,7 +24,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Subnet)) { writer.WritePropertyName("subnet"); - writer.WriteObjectValue(Subnet); + JsonSerializer.Serialize(writer, Subnet); } if (Optional.IsDefined(Primary)) { @@ -46,7 +47,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ApplicationSecurityGroups) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } @@ -56,7 +57,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ApplicationGatewayBackendAddressPools) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } @@ -66,7 +67,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in LoadBalancerBackendAddressPools) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } @@ -77,13 +78,13 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static VirtualMachineNetworkInterfaceIPConfiguration DeserializeVirtualMachineNetworkInterfaceIPConfiguration(JsonElement element) { string name = default; - Optional subnet = default; + Optional subnet = default; Optional primary = default; Optional publicIPAddressConfiguration = default; Optional privateIPAddressVersion = default; - Optional> applicationSecurityGroups = default; - Optional> applicationGatewayBackendAddressPools = default; - Optional> loadBalancerBackendAddressPools = default; + Optional> applicationSecurityGroups = default; + Optional> applicationGatewayBackendAddressPools = default; + Optional> loadBalancerBackendAddressPools = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) @@ -107,7 +108,7 @@ internal static VirtualMachineNetworkInterfaceIPConfiguration DeserializeVirtual property0.ThrowNonNullablePropertyIsNull(); continue; } - subnet = SubResource.DeserializeSubResource(property0.Value); + subnet = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("primary")) @@ -147,10 +148,10 @@ internal static VirtualMachineNetworkInterfaceIPConfiguration DeserializeVirtual property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } applicationSecurityGroups = array; continue; @@ -162,10 +163,10 @@ internal static VirtualMachineNetworkInterfaceIPConfiguration DeserializeVirtual property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } applicationGatewayBackendAddressPools = array; continue; @@ -177,10 +178,10 @@ internal static VirtualMachineNetworkInterfaceIPConfiguration DeserializeVirtual property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } loadBalancerBackendAddressPools = array; continue; @@ -189,7 +190,7 @@ internal static VirtualMachineNetworkInterfaceIPConfiguration DeserializeVirtual continue; } } - return new VirtualMachineNetworkInterfaceIPConfiguration(name, subnet.Value, Optional.ToNullable(primary), publicIPAddressConfiguration.Value, Optional.ToNullable(privateIPAddressVersion), Optional.ToList(applicationSecurityGroups), Optional.ToList(applicationGatewayBackendAddressPools), Optional.ToList(loadBalancerBackendAddressPools)); + return new VirtualMachineNetworkInterfaceIPConfiguration(name, subnet, Optional.ToNullable(primary), publicIPAddressConfiguration.Value, Optional.ToNullable(privateIPAddressVersion), Optional.ToList(applicationSecurityGroups), Optional.ToList(applicationGatewayBackendAddressPools), Optional.ToList(loadBalancerBackendAddressPools)); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceIPConfiguration.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceIPConfiguration.cs index 22dbd9e6935e0..7d60560a3af77 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceIPConfiguration.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineNetworkInterfaceIPConfiguration.cs @@ -8,6 +8,7 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -25,9 +26,9 @@ public VirtualMachineNetworkInterfaceIPConfiguration(string name) } Name = name; - ApplicationSecurityGroups = new ChangeTrackingList(); - ApplicationGatewayBackendAddressPools = new ChangeTrackingList(); - LoadBalancerBackendAddressPools = new ChangeTrackingList(); + ApplicationSecurityGroups = new ChangeTrackingList(); + ApplicationGatewayBackendAddressPools = new ChangeTrackingList(); + LoadBalancerBackendAddressPools = new ChangeTrackingList(); } /// Initializes a new instance of VirtualMachineNetworkInterfaceIPConfiguration. @@ -39,7 +40,7 @@ public VirtualMachineNetworkInterfaceIPConfiguration(string name) /// Specifies an array of references to application security group. /// Specifies an array of references to backend address pools of application gateways. A virtual machine can reference backend address pools of multiple application gateways. Multiple virtual machines cannot use the same application gateway. /// Specifies an array of references to backend address pools of load balancers. A virtual machine can reference backend address pools of one public and one internal load balancer. [Multiple virtual machines cannot use the same basic sku load balancer]. - internal VirtualMachineNetworkInterfaceIPConfiguration(string name, SubResource subnet, bool? primary, VirtualMachinePublicIPAddressConfiguration publicIPAddressConfiguration, IPVersions? privateIPAddressVersion, IList applicationSecurityGroups, IList applicationGatewayBackendAddressPools, IList loadBalancerBackendAddressPools) + internal VirtualMachineNetworkInterfaceIPConfiguration(string name, WritableSubResource subnet, bool? primary, VirtualMachinePublicIPAddressConfiguration publicIPAddressConfiguration, IPVersions? privateIPAddressVersion, IList applicationSecurityGroups, IList applicationGatewayBackendAddressPools, IList loadBalancerBackendAddressPools) { Name = name; Subnet = subnet; @@ -54,7 +55,7 @@ internal VirtualMachineNetworkInterfaceIPConfiguration(string name, SubResource /// The IP configuration name. public string Name { get; set; } /// Specifies the identifier of the subnet. - public SubResource Subnet { get; set; } + public WritableSubResource Subnet { get; set; } /// Specifies the primary network interface in case the virtual machine has more than 1 network interface. public bool? Primary { get; set; } /// The publicIPAddressConfiguration. @@ -62,10 +63,10 @@ internal VirtualMachineNetworkInterfaceIPConfiguration(string name, SubResource /// Available from Api-Version 2017-03-30 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. public IPVersions? PrivateIPAddressVersion { get; set; } /// Specifies an array of references to application security group. - public IList ApplicationSecurityGroups { get; } + public IList ApplicationSecurityGroups { get; } /// Specifies an array of references to backend address pools of application gateways. A virtual machine can reference backend address pools of multiple application gateways. Multiple virtual machines cannot use the same application gateway. - public IList ApplicationGatewayBackendAddressPools { get; } + public IList ApplicationGatewayBackendAddressPools { get; } /// Specifies an array of references to backend address pools of load balancers. A virtual machine can reference backend address pools of one public and one internal load balancer. [Multiple virtual machines cannot use the same basic sku load balancer]. - public IList LoadBalancerBackendAddressPools { get; } + public IList LoadBalancerBackendAddressPools { get; } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePublicIPAddressConfiguration.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePublicIPAddressConfiguration.Serialization.cs index 1fd2570449f53..fc404e8289a1f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePublicIPAddressConfiguration.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePublicIPAddressConfiguration.Serialization.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -53,7 +54,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PublicIPPrefix)) { writer.WritePropertyName("publicIPPrefix"); - writer.WriteObjectValue(PublicIPPrefix); + JsonSerializer.Serialize(writer, PublicIPPrefix); } if (Optional.IsDefined(PublicIPAddressVersion)) { @@ -77,7 +78,7 @@ internal static VirtualMachinePublicIPAddressConfiguration DeserializeVirtualMac Optional deleteOption = default; Optional dnsSettings = default; Optional> ipTags = default; - Optional publicIPPrefix = default; + Optional publicIPPrefix = default; Optional publicIPAddressVersion = default; Optional publicIPAllocationMethod = default; foreach (var property in element.EnumerateObject()) @@ -158,7 +159,7 @@ internal static VirtualMachinePublicIPAddressConfiguration DeserializeVirtualMac property0.ThrowNonNullablePropertyIsNull(); continue; } - publicIPPrefix = SubResource.DeserializeSubResource(property0.Value); + publicIPPrefix = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("publicIPAddressVersion")) @@ -185,7 +186,7 @@ internal static VirtualMachinePublicIPAddressConfiguration DeserializeVirtualMac continue; } } - return new VirtualMachinePublicIPAddressConfiguration(name, sku.Value, Optional.ToNullable(idleTimeoutInMinutes), Optional.ToNullable(deleteOption), dnsSettings.Value, Optional.ToList(ipTags), publicIPPrefix.Value, Optional.ToNullable(publicIPAddressVersion), Optional.ToNullable(publicIPAllocationMethod)); + return new VirtualMachinePublicIPAddressConfiguration(name, sku.Value, Optional.ToNullable(idleTimeoutInMinutes), Optional.ToNullable(deleteOption), dnsSettings.Value, Optional.ToList(ipTags), publicIPPrefix, Optional.ToNullable(publicIPAddressVersion), Optional.ToNullable(publicIPAllocationMethod)); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePublicIPAddressConfiguration.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePublicIPAddressConfiguration.cs index 3495c0a41e219..17755fa32ce3a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePublicIPAddressConfiguration.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachinePublicIPAddressConfiguration.cs @@ -8,6 +8,7 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -38,7 +39,7 @@ public VirtualMachinePublicIPAddressConfiguration(string name) /// The PublicIPPrefix from which to allocate publicIP addresses. /// Available from Api-Version 2019-07-01 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. /// Specify the public IP allocation type. - internal VirtualMachinePublicIPAddressConfiguration(string name, PublicIPAddressSku sku, int? idleTimeoutInMinutes, DeleteOptions? deleteOption, VirtualMachinePublicIPAddressDnsSettingsConfiguration dnsSettings, IList ipTags, SubResource publicIPPrefix, IPVersions? publicIPAddressVersion, PublicIPAllocationMethod? publicIPAllocationMethod) + internal VirtualMachinePublicIPAddressConfiguration(string name, PublicIPAddressSku sku, int? idleTimeoutInMinutes, DeleteOptions? deleteOption, VirtualMachinePublicIPAddressDnsSettingsConfiguration dnsSettings, IList ipTags, WritableSubResource publicIPPrefix, IPVersions? publicIPAddressVersion, PublicIPAllocationMethod? publicIPAllocationMethod) { Name = name; Sku = sku; @@ -64,7 +65,7 @@ internal VirtualMachinePublicIPAddressConfiguration(string name, PublicIPAddress /// The list of IP tags associated with the public IP address. public IList IpTags { get; } /// The PublicIPPrefix from which to allocate publicIP addresses. - public SubResource PublicIPPrefix { get; set; } + public WritableSubResource PublicIPPrefix { get; set; } /// Available from Api-Version 2019-07-01 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. public IPVersions? PublicIPAddressVersion { get; set; } /// Specify the public IP allocation type. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetData.Serialization.cs index 6985e2816437c..5bf17c742dd88 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetData.Serialization.cs @@ -104,12 +104,12 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ProximityPlacementGroup)) { writer.WritePropertyName("proximityPlacementGroup"); - writer.WriteObjectValue(ProximityPlacementGroup); + JsonSerializer.Serialize(writer, ProximityPlacementGroup); } if (Optional.IsDefined(HostGroup)) { writer.WritePropertyName("hostGroup"); - writer.WriteObjectValue(HostGroup); + JsonSerializer.Serialize(writer, HostGroup); } if (Optional.IsDefined(AdditionalCapabilities)) { @@ -152,8 +152,8 @@ internal static VirtualMachineScaleSetData DeserializeVirtualMachineScaleSetData Optional singlePlacementGroup = default; Optional zoneBalance = default; Optional platformFaultDomainCount = default; - Optional proximityPlacementGroup = default; - Optional hostGroup = default; + Optional proximityPlacementGroup = default; + Optional hostGroup = default; Optional additionalCapabilities = default; Optional scaleInPolicy = default; Optional orchestrationMode = default; @@ -350,7 +350,7 @@ internal static VirtualMachineScaleSetData DeserializeVirtualMachineScaleSetData property0.ThrowNonNullablePropertyIsNull(); continue; } - proximityPlacementGroup = Models.SubResource.DeserializeSubResource(property0.Value); + proximityPlacementGroup = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("hostGroup")) @@ -360,7 +360,7 @@ internal static VirtualMachineScaleSetData DeserializeVirtualMachineScaleSetData property0.ThrowNonNullablePropertyIsNull(); continue; } - hostGroup = Models.SubResource.DeserializeSubResource(property0.Value); + hostGroup = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("additionalCapabilities")) @@ -397,7 +397,7 @@ internal static VirtualMachineScaleSetData DeserializeVirtualMachineScaleSetData continue; } } - return new VirtualMachineScaleSetData(id, name, type, tags, location, sku.Value, plan.Value, identity, Optional.ToList(zones), extendedLocation.Value, upgradePolicy.Value, automaticRepairsPolicy.Value, virtualMachineProfile.Value, provisioningState.Value, Optional.ToNullable(overprovision), Optional.ToNullable(doNotRunExtensionsOnOverprovisionedVMs), uniqueId.Value, Optional.ToNullable(singlePlacementGroup), Optional.ToNullable(zoneBalance), Optional.ToNullable(platformFaultDomainCount), proximityPlacementGroup.Value, hostGroup.Value, additionalCapabilities.Value, scaleInPolicy.Value, Optional.ToNullable(orchestrationMode)); + return new VirtualMachineScaleSetData(id, name, type, tags, location, sku.Value, plan.Value, identity, Optional.ToList(zones), extendedLocation.Value, upgradePolicy.Value, automaticRepairsPolicy.Value, virtualMachineProfile.Value, provisioningState.Value, Optional.ToNullable(overprovision), Optional.ToNullable(doNotRunExtensionsOnOverprovisionedVMs), uniqueId.Value, Optional.ToNullable(singlePlacementGroup), Optional.ToNullable(zoneBalance), Optional.ToNullable(platformFaultDomainCount), proximityPlacementGroup, hostGroup, additionalCapabilities.Value, scaleInPolicy.Value, Optional.ToNullable(orchestrationMode)); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionData.Serialization.cs index adfd1ca2f1618..09b5ec1bbc31a 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionData.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Compute { @@ -82,7 +81,7 @@ internal static VirtualMachineScaleSetExtensionData DeserializeVirtualMachineSca { Optional name = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional forceUpdateTag = default; Optional publisher = default; Optional type0 = default; @@ -203,7 +202,7 @@ internal static VirtualMachineScaleSetExtensionData DeserializeVirtualMachineSca continue; } } - return new VirtualMachineScaleSetExtensionData(id, name.Value, type.Value, forceUpdateTag.Value, publisher.Value, type0.Value, typeHandlerVersion.Value, Optional.ToNullable(autoUpgradeMinorVersion), Optional.ToNullable(enableAutomaticUpgrade), settings.Value, protectedSettings.Value, provisioningState.Value, Optional.ToList(provisionAfterExtensions)); + return new VirtualMachineScaleSetExtensionData(id.Value, name.Value, type.Value, forceUpdateTag.Value, publisher.Value, type0.Value, typeHandlerVersion.Value, Optional.ToNullable(autoUpgradeMinorVersion), Optional.ToNullable(enableAutomaticUpgrade), settings.Value, protectedSettings.Value, provisioningState.Value, Optional.ToList(provisionAfterExtensions)); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionUpdate.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionUpdate.Serialization.cs index 706a1cfee3ca6..4eed54fc2e925 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionUpdate.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionUpdate.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Compute.Models { @@ -77,7 +76,7 @@ internal static VirtualMachineScaleSetExtensionUpdate DeserializeVirtualMachineS { Optional name = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional forceUpdateTag = default; Optional publisher = default; Optional type0 = default; @@ -198,7 +197,7 @@ internal static VirtualMachineScaleSetExtensionUpdate DeserializeVirtualMachineS continue; } } - return new VirtualMachineScaleSetExtensionUpdate(id, name.Value, type.Value, forceUpdateTag.Value, publisher.Value, type0.Value, typeHandlerVersion.Value, Optional.ToNullable(autoUpgradeMinorVersion), Optional.ToNullable(enableAutomaticUpgrade), settings.Value, protectedSettings.Value, provisioningState.Value, Optional.ToList(provisionAfterExtensions)); + return new VirtualMachineScaleSetExtensionUpdate(id.Value, name.Value, type.Value, forceUpdateTag.Value, publisher.Value, type0.Value, typeHandlerVersion.Value, Optional.ToNullable(autoUpgradeMinorVersion), Optional.ToNullable(enableAutomaticUpgrade), settings.Value, protectedSettings.Value, provisioningState.Value, Optional.ToList(provisionAfterExtensions)); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionUpdate.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionUpdate.cs index 37be74f900ff6..55af6e56b8c49 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionUpdate.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetExtensionUpdate.cs @@ -7,12 +7,11 @@ using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { /// Describes a Virtual Machine Scale Set Extension. - public partial class VirtualMachineScaleSetExtensionUpdate : Resources.Models.SubResource + public partial class VirtualMachineScaleSetExtensionUpdate : SubResourceReadOnly { /// Initializes a new instance of VirtualMachineScaleSetExtensionUpdate. public VirtualMachineScaleSetExtensionUpdate() @@ -21,7 +20,7 @@ public VirtualMachineScaleSetExtensionUpdate() } /// Initializes a new instance of VirtualMachineScaleSetExtensionUpdate. - /// The id. + /// Resource Id. /// The name of the extension. /// Resource type. /// If a value is provided and is different from the previous value, the extension handler will be forced to update even if the extension configuration has not changed. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetIPConfiguration.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetIPConfiguration.Serialization.cs index 88bbbdb93b01c..9701bddeba49f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetIPConfiguration.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetIPConfiguration.Serialization.cs @@ -8,7 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -19,14 +19,17 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartObject(); writer.WritePropertyName("name"); writer.WriteStringValue(Name); - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Subnet)) { writer.WritePropertyName("subnet"); - writer.WriteObjectValue(Subnet); + JsonSerializer.Serialize(writer, Subnet); } if (Optional.IsDefined(Primary)) { @@ -49,7 +52,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ApplicationGatewayBackendAddressPools) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } @@ -59,7 +62,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ApplicationSecurityGroups) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } @@ -69,7 +72,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in LoadBalancerBackendAddressPools) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } @@ -79,7 +82,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in LoadBalancerInboundNatPools) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } @@ -90,15 +93,15 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static VirtualMachineScaleSetIPConfiguration DeserializeVirtualMachineScaleSetIPConfiguration(JsonElement element) { string name = default; - ResourceIdentifier id = default; - Optional subnet = default; + Optional id = default; + Optional subnet = default; Optional primary = default; Optional publicIPAddressConfiguration = default; Optional privateIPAddressVersion = default; - Optional> applicationGatewayBackendAddressPools = default; - Optional> applicationSecurityGroups = default; - Optional> loadBalancerBackendAddressPools = default; - Optional> loadBalancerInboundNatPools = default; + Optional> applicationGatewayBackendAddressPools = default; + Optional> applicationSecurityGroups = default; + Optional> loadBalancerBackendAddressPools = default; + Optional> loadBalancerInboundNatPools = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) @@ -127,7 +130,7 @@ internal static VirtualMachineScaleSetIPConfiguration DeserializeVirtualMachineS property0.ThrowNonNullablePropertyIsNull(); continue; } - subnet = ApiEntityReference.DeserializeApiEntityReference(property0.Value); + subnet = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("primary")) @@ -167,10 +170,10 @@ internal static VirtualMachineScaleSetIPConfiguration DeserializeVirtualMachineS property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } applicationGatewayBackendAddressPools = array; continue; @@ -182,10 +185,10 @@ internal static VirtualMachineScaleSetIPConfiguration DeserializeVirtualMachineS property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } applicationSecurityGroups = array; continue; @@ -197,10 +200,10 @@ internal static VirtualMachineScaleSetIPConfiguration DeserializeVirtualMachineS property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } loadBalancerBackendAddressPools = array; continue; @@ -212,10 +215,10 @@ internal static VirtualMachineScaleSetIPConfiguration DeserializeVirtualMachineS property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } loadBalancerInboundNatPools = array; continue; @@ -224,7 +227,7 @@ internal static VirtualMachineScaleSetIPConfiguration DeserializeVirtualMachineS continue; } } - return new VirtualMachineScaleSetIPConfiguration(id, name, subnet.Value, Optional.ToNullable(primary), publicIPAddressConfiguration.Value, Optional.ToNullable(privateIPAddressVersion), Optional.ToList(applicationGatewayBackendAddressPools), Optional.ToList(applicationSecurityGroups), Optional.ToList(loadBalancerBackendAddressPools), Optional.ToList(loadBalancerInboundNatPools)); + return new VirtualMachineScaleSetIPConfiguration(id.Value, name, subnet, Optional.ToNullable(primary), publicIPAddressConfiguration.Value, Optional.ToNullable(privateIPAddressVersion), Optional.ToList(applicationGatewayBackendAddressPools), Optional.ToList(applicationSecurityGroups), Optional.ToList(loadBalancerBackendAddressPools), Optional.ToList(loadBalancerInboundNatPools)); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetIPConfiguration.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetIPConfiguration.cs index f8f0c414ad59c..4bf2ebc75f55b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetIPConfiguration.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetIPConfiguration.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.Compute.Models { /// Describes a virtual machine scale set network profile's IP configuration. - public partial class VirtualMachineScaleSetIPConfiguration : WritableSubResource + public partial class VirtualMachineScaleSetIPConfiguration : SubResource { /// Initializes a new instance of VirtualMachineScaleSetIPConfiguration. /// The IP configuration name. @@ -26,14 +26,14 @@ public VirtualMachineScaleSetIPConfiguration(string name) } Name = name; - ApplicationGatewayBackendAddressPools = new ChangeTrackingList(); - ApplicationSecurityGroups = new ChangeTrackingList(); - LoadBalancerBackendAddressPools = new ChangeTrackingList(); - LoadBalancerInboundNatPools = new ChangeTrackingList(); + ApplicationGatewayBackendAddressPools = new ChangeTrackingList(); + ApplicationSecurityGroups = new ChangeTrackingList(); + LoadBalancerBackendAddressPools = new ChangeTrackingList(); + LoadBalancerInboundNatPools = new ChangeTrackingList(); } /// Initializes a new instance of VirtualMachineScaleSetIPConfiguration. - /// The id. + /// Resource Id. /// The IP configuration name. /// Specifies the identifier of the subnet. /// Specifies the primary network interface in case the virtual machine has more than 1 network interface. @@ -43,7 +43,7 @@ public VirtualMachineScaleSetIPConfiguration(string name) /// Specifies an array of references to application security group. /// Specifies an array of references to backend address pools of load balancers. A scale set can reference backend address pools of one public and one internal load balancer. Multiple scale sets cannot use the same basic sku load balancer. /// Specifies an array of references to inbound Nat pools of the load balancers. A scale set can reference inbound nat pools of one public and one internal load balancer. Multiple scale sets cannot use the same basic sku load balancer. - internal VirtualMachineScaleSetIPConfiguration(string id, string name, ApiEntityReference subnet, bool? primary, VirtualMachineScaleSetPublicIPAddressConfiguration publicIPAddressConfiguration, IPVersion? privateIPAddressVersion, IList applicationGatewayBackendAddressPools, IList applicationSecurityGroups, IList loadBalancerBackendAddressPools, IList loadBalancerInboundNatPools) : base(id) + internal VirtualMachineScaleSetIPConfiguration(string id, string name, WritableSubResource subnet, bool? primary, VirtualMachineScaleSetPublicIPAddressConfiguration publicIPAddressConfiguration, IPVersion? privateIPAddressVersion, IList applicationGatewayBackendAddressPools, IList applicationSecurityGroups, IList loadBalancerBackendAddressPools, IList loadBalancerInboundNatPools) : base(id) { Name = name; Subnet = subnet; @@ -59,7 +59,7 @@ internal VirtualMachineScaleSetIPConfiguration(string id, string name, ApiEntity /// The IP configuration name. public string Name { get; set; } /// Specifies the identifier of the subnet. - public ApiEntityReference Subnet { get; set; } + public WritableSubResource Subnet { get; set; } /// Specifies the primary network interface in case the virtual machine has more than 1 network interface. public bool? Primary { get; set; } /// The publicIPAddressConfiguration. @@ -67,12 +67,12 @@ internal VirtualMachineScaleSetIPConfiguration(string id, string name, ApiEntity /// Available from Api-Version 2017-03-30 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. public IPVersion? PrivateIPAddressVersion { get; set; } /// Specifies an array of references to backend address pools of application gateways. A scale set can reference backend address pools of multiple application gateways. Multiple scale sets cannot use the same application gateway. - public IList ApplicationGatewayBackendAddressPools { get; } + public IList ApplicationGatewayBackendAddressPools { get; } /// Specifies an array of references to application security group. - public IList ApplicationSecurityGroups { get; } + public IList ApplicationSecurityGroups { get; } /// Specifies an array of references to backend address pools of load balancers. A scale set can reference backend address pools of one public and one internal load balancer. Multiple scale sets cannot use the same basic sku load balancer. - public IList LoadBalancerBackendAddressPools { get; } + public IList LoadBalancerBackendAddressPools { get; } /// Specifies an array of references to inbound Nat pools of the load balancers. A scale set can reference inbound nat pools of one public and one internal load balancer. Multiple scale sets cannot use the same basic sku load balancer. - public IList LoadBalancerInboundNatPools { get; } + public IList LoadBalancerInboundNatPools { get; } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetManagedDiskParameters.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetManagedDiskParameters.Serialization.cs index ecee43d3dec65..430b203464ce8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetManagedDiskParameters.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetManagedDiskParameters.Serialization.cs @@ -7,6 +7,7 @@ using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -23,7 +24,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DiskEncryptionSet)) { writer.WritePropertyName("diskEncryptionSet"); - writer.WriteObjectValue(DiskEncryptionSet); + JsonSerializer.Serialize(writer, DiskEncryptionSet); } writer.WriteEndObject(); } @@ -31,7 +32,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static VirtualMachineScaleSetManagedDiskParameters DeserializeVirtualMachineScaleSetManagedDiskParameters(JsonElement element) { Optional storageAccountType = default; - Optional diskEncryptionSet = default; + Optional diskEncryptionSet = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("storageAccountType")) @@ -51,11 +52,11 @@ internal static VirtualMachineScaleSetManagedDiskParameters DeserializeVirtualMa property.ThrowNonNullablePropertyIsNull(); continue; } - diskEncryptionSet = DiskEncryptionSetParameters.DeserializeDiskEncryptionSetParameters(property.Value); + diskEncryptionSet = JsonSerializer.Deserialize(property.Value.ToString()); continue; } } - return new VirtualMachineScaleSetManagedDiskParameters(Optional.ToNullable(storageAccountType), diskEncryptionSet.Value); + return new VirtualMachineScaleSetManagedDiskParameters(Optional.ToNullable(storageAccountType), diskEncryptionSet); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetManagedDiskParameters.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetManagedDiskParameters.cs index a34ec7343d7dd..98c17bec658c7 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetManagedDiskParameters.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetManagedDiskParameters.cs @@ -5,6 +5,8 @@ #nullable disable +using Azure.ResourceManager.Resources.Models; + namespace Azure.ResourceManager.Compute.Models { /// Describes the parameters of a ScaleSet managed disk. @@ -18,7 +20,7 @@ public VirtualMachineScaleSetManagedDiskParameters() /// Initializes a new instance of VirtualMachineScaleSetManagedDiskParameters. /// Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. /// Specifies the customer managed disk encryption set resource id for the managed disk. - internal VirtualMachineScaleSetManagedDiskParameters(StorageAccountTypes? storageAccountType, DiskEncryptionSetParameters diskEncryptionSet) + internal VirtualMachineScaleSetManagedDiskParameters(StorageAccountTypes? storageAccountType, WritableSubResource diskEncryptionSet) { StorageAccountType = storageAccountType; DiskEncryptionSet = diskEncryptionSet; @@ -27,6 +29,6 @@ internal VirtualMachineScaleSetManagedDiskParameters(StorageAccountTypes? storag /// Specifies the storage account type for the managed disk. NOTE: UltraSSD_LRS can only be used with data disks, it cannot be used with OS Disk. public StorageAccountTypes? StorageAccountType { get; set; } /// Specifies the customer managed disk encryption set resource id for the managed disk. - public DiskEncryptionSetParameters DiskEncryptionSet { get; set; } + public WritableSubResource DiskEncryptionSet { get; set; } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkConfiguration.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkConfiguration.Serialization.cs index 891392a604b02..b8ccebde91c5b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkConfiguration.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkConfiguration.Serialization.cs @@ -8,7 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -19,8 +19,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartObject(); writer.WritePropertyName("name"); writer.WriteStringValue(Name); - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Primary)) @@ -41,7 +44,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(NetworkSecurityGroup)) { writer.WritePropertyName("networkSecurityGroup"); - writer.WriteObjectValue(NetworkSecurityGroup); + JsonSerializer.Serialize(writer, NetworkSecurityGroup); } if (Optional.IsDefined(DnsSettings)) { @@ -75,11 +78,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static VirtualMachineScaleSetNetworkConfiguration DeserializeVirtualMachineScaleSetNetworkConfiguration(JsonElement element) { string name = default; - ResourceIdentifier id = default; + Optional id = default; Optional primary = default; Optional enableAcceleratedNetworking = default; Optional enableFpga = default; - Optional networkSecurityGroup = default; + Optional networkSecurityGroup = default; Optional dnsSettings = default; Optional> ipConfigurations = default; Optional enableIPForwarding = default; @@ -142,7 +145,7 @@ internal static VirtualMachineScaleSetNetworkConfiguration DeserializeVirtualMac property0.ThrowNonNullablePropertyIsNull(); continue; } - networkSecurityGroup = SubResource.DeserializeSubResource(property0.Value); + networkSecurityGroup = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("dnsSettings")) @@ -194,7 +197,7 @@ internal static VirtualMachineScaleSetNetworkConfiguration DeserializeVirtualMac continue; } } - return new VirtualMachineScaleSetNetworkConfiguration(id, name, Optional.ToNullable(primary), Optional.ToNullable(enableAcceleratedNetworking), Optional.ToNullable(enableFpga), networkSecurityGroup.Value, dnsSettings.Value, Optional.ToList(ipConfigurations), Optional.ToNullable(enableIPForwarding), Optional.ToNullable(deleteOption)); + return new VirtualMachineScaleSetNetworkConfiguration(id.Value, name, Optional.ToNullable(primary), Optional.ToNullable(enableAcceleratedNetworking), Optional.ToNullable(enableFpga), networkSecurityGroup, dnsSettings.Value, Optional.ToList(ipConfigurations), Optional.ToNullable(enableIPForwarding), Optional.ToNullable(deleteOption)); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkConfiguration.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkConfiguration.cs index 1f65efc379f51..2d572bf8e2896 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkConfiguration.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkConfiguration.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.Compute.Models { /// Describes a virtual machine scale set network profile's network configurations. - public partial class VirtualMachineScaleSetNetworkConfiguration : WritableSubResource + public partial class VirtualMachineScaleSetNetworkConfiguration : SubResource { /// Initializes a new instance of VirtualMachineScaleSetNetworkConfiguration. /// The network configuration name. @@ -30,7 +30,7 @@ public VirtualMachineScaleSetNetworkConfiguration(string name) } /// Initializes a new instance of VirtualMachineScaleSetNetworkConfiguration. - /// The id. + /// Resource Id. /// The network configuration name. /// Specifies the primary network interface in case the virtual machine has more than 1 network interface. /// Specifies whether the network interface is accelerated networking-enabled. @@ -40,7 +40,7 @@ public VirtualMachineScaleSetNetworkConfiguration(string name) /// Specifies the IP configurations of the network interface. /// Whether IP forwarding enabled on this NIC. /// Specify what happens to the network interface when the VM is deleted. - internal VirtualMachineScaleSetNetworkConfiguration(string id, string name, bool? primary, bool? enableAcceleratedNetworking, bool? enableFpga, SubResource networkSecurityGroup, VirtualMachineScaleSetNetworkConfigurationDnsSettings dnsSettings, IList ipConfigurations, bool? enableIPForwarding, DeleteOptions? deleteOption) : base(id) + internal VirtualMachineScaleSetNetworkConfiguration(string id, string name, bool? primary, bool? enableAcceleratedNetworking, bool? enableFpga, WritableSubResource networkSecurityGroup, VirtualMachineScaleSetNetworkConfigurationDnsSettings dnsSettings, IList ipConfigurations, bool? enableIPForwarding, DeleteOptions? deleteOption) : base(id) { Name = name; Primary = primary; @@ -62,7 +62,7 @@ internal VirtualMachineScaleSetNetworkConfiguration(string id, string name, bool /// Specifies whether the network interface is FPGA networking-enabled. public bool? EnableFpga { get; set; } /// The network security group. - public SubResource NetworkSecurityGroup { get; set; } + public WritableSubResource NetworkSecurityGroup { get; set; } /// The dns settings to be applied on the network interfaces. public VirtualMachineScaleSetNetworkConfigurationDnsSettings DnsSettings { get; set; } /// Specifies the IP configurations of the network interface. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkProfile.Serialization.cs index 0ae0b597a4a9c..78b5035c006e7 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkProfile.Serialization.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -19,7 +20,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(HealthProbe)) { writer.WritePropertyName("healthProbe"); - writer.WriteObjectValue(HealthProbe); + JsonSerializer.Serialize(writer, HealthProbe); } if (Optional.IsCollectionDefined(NetworkInterfaceConfigurations)) { @@ -41,7 +42,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static VirtualMachineScaleSetNetworkProfile DeserializeVirtualMachineScaleSetNetworkProfile(JsonElement element) { - Optional healthProbe = default; + Optional healthProbe = default; Optional> networkInterfaceConfigurations = default; Optional networkApiVersion = default; foreach (var property in element.EnumerateObject()) @@ -53,7 +54,7 @@ internal static VirtualMachineScaleSetNetworkProfile DeserializeVirtualMachineSc property.ThrowNonNullablePropertyIsNull(); continue; } - healthProbe = ApiEntityReference.DeserializeApiEntityReference(property.Value); + healthProbe = JsonSerializer.Deserialize(property.Value.ToString()); continue; } if (property.NameEquals("networkInterfaceConfigurations")) @@ -82,7 +83,7 @@ internal static VirtualMachineScaleSetNetworkProfile DeserializeVirtualMachineSc continue; } } - return new VirtualMachineScaleSetNetworkProfile(healthProbe.Value, Optional.ToList(networkInterfaceConfigurations), Optional.ToNullable(networkApiVersion)); + return new VirtualMachineScaleSetNetworkProfile(healthProbe, Optional.ToList(networkInterfaceConfigurations), Optional.ToNullable(networkApiVersion)); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkProfile.cs index 94b501ac803f2..08dafa8504cd6 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetNetworkProfile.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -23,7 +24,7 @@ public VirtualMachineScaleSetNetworkProfile() /// A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. /// The list of network configurations. /// specifies the Microsoft.Network API version used when creating networking resources in the Network Interface Configurations for Virtual Machine Scale Set with orchestration mode 'Flexible'. - internal VirtualMachineScaleSetNetworkProfile(ApiEntityReference healthProbe, IList networkInterfaceConfigurations, NetworkApiVersion? networkApiVersion) + internal VirtualMachineScaleSetNetworkProfile(WritableSubResource healthProbe, IList networkInterfaceConfigurations, NetworkApiVersion? networkApiVersion) { HealthProbe = healthProbe; NetworkInterfaceConfigurations = networkInterfaceConfigurations; @@ -31,7 +32,7 @@ internal VirtualMachineScaleSetNetworkProfile(ApiEntityReference healthProbe, IL } /// A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. - public ApiEntityReference HealthProbe { get; set; } + public WritableSubResource HealthProbe { get; set; } /// The list of network configurations. public IList NetworkInterfaceConfigurations { get; } /// specifies the Microsoft.Network API version used when creating networking resources in the Network Interface Configurations for Virtual Machine Scale Set with orchestration mode 'Flexible'. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfiguration.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfiguration.Serialization.cs index e2883271ebd89..7561ef3d5e3d3 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfiguration.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfiguration.Serialization.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -48,7 +49,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PublicIPPrefix)) { writer.WritePropertyName("publicIPPrefix"); - writer.WriteObjectValue(PublicIPPrefix); + JsonSerializer.Serialize(writer, PublicIPPrefix); } if (Optional.IsDefined(PublicIPAddressVersion)) { @@ -71,7 +72,7 @@ internal static VirtualMachineScaleSetPublicIPAddressConfiguration DeserializeVi Optional idleTimeoutInMinutes = default; Optional dnsSettings = default; Optional> ipTags = default; - Optional publicIPPrefix = default; + Optional publicIPPrefix = default; Optional publicIPAddressVersion = default; Optional deleteOption = default; foreach (var property in element.EnumerateObject()) @@ -142,7 +143,7 @@ internal static VirtualMachineScaleSetPublicIPAddressConfiguration DeserializeVi property0.ThrowNonNullablePropertyIsNull(); continue; } - publicIPPrefix = SubResource.DeserializeSubResource(property0.Value); + publicIPPrefix = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("publicIPAddressVersion")) @@ -169,7 +170,7 @@ internal static VirtualMachineScaleSetPublicIPAddressConfiguration DeserializeVi continue; } } - return new VirtualMachineScaleSetPublicIPAddressConfiguration(name, sku.Value, Optional.ToNullable(idleTimeoutInMinutes), dnsSettings.Value, Optional.ToList(ipTags), publicIPPrefix.Value, Optional.ToNullable(publicIPAddressVersion), Optional.ToNullable(deleteOption)); + return new VirtualMachineScaleSetPublicIPAddressConfiguration(name, sku.Value, Optional.ToNullable(idleTimeoutInMinutes), dnsSettings.Value, Optional.ToList(ipTags), publicIPPrefix, Optional.ToNullable(publicIPAddressVersion), Optional.ToNullable(deleteOption)); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfiguration.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfiguration.cs index 87871fa560142..a08a4d5a692a4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfiguration.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetPublicIPAddressConfiguration.cs @@ -8,6 +8,7 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -37,7 +38,7 @@ public VirtualMachineScaleSetPublicIPAddressConfiguration(string name) /// The PublicIPPrefix from which to allocate publicIP addresses. /// Available from Api-Version 2019-07-01 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. /// Specify what happens to the public IP when the VM is deleted. - internal VirtualMachineScaleSetPublicIPAddressConfiguration(string name, PublicIPAddressSku sku, int? idleTimeoutInMinutes, VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings dnsSettings, IList ipTags, SubResource publicIPPrefix, IPVersion? publicIPAddressVersion, DeleteOptions? deleteOption) + internal VirtualMachineScaleSetPublicIPAddressConfiguration(string name, PublicIPAddressSku sku, int? idleTimeoutInMinutes, VirtualMachineScaleSetPublicIPAddressConfigurationDnsSettings dnsSettings, IList ipTags, WritableSubResource publicIPPrefix, IPVersion? publicIPAddressVersion, DeleteOptions? deleteOption) { Name = name; Sku = sku; @@ -60,7 +61,7 @@ internal VirtualMachineScaleSetPublicIPAddressConfiguration(string name, PublicI /// The list of IP tags associated with the public IP address. public IList IpTags { get; } /// The PublicIPPrefix from which to allocate publicIP addresses. - public SubResource PublicIPPrefix { get; set; } + public WritableSubResource PublicIPPrefix { get; set; } /// Available from Api-Version 2019-07-01 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. public IPVersion? PublicIPAddressVersion { get; set; } /// Specify what happens to the public IP when the VM is deleted. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdate.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdate.Serialization.cs index f766b907b595b..e6de6dc2b0558 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdate.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdate.Serialization.cs @@ -86,7 +86,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ProximityPlacementGroup)) { writer.WritePropertyName("proximityPlacementGroup"); - writer.WriteObjectValue(ProximityPlacementGroup); + JsonSerializer.Serialize(writer, ProximityPlacementGroup); } writer.WriteEndObject(); writer.WriteEndObject(); diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdate.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdate.cs index d70b76f8855e1..6b1805b15c421 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdate.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdate.cs @@ -40,6 +40,6 @@ public VirtualMachineScaleSetUpdate() /// Specifies the scale-in policy that decides which virtual machines are chosen for removal when a Virtual Machine Scale Set is scaled-in. public ScaleInPolicy ScaleInPolicy { get; set; } /// Specifies information about the proximity placement group that the virtual machine scale set should be assigned to. <br><br>Minimum api-version: 2018-04-01. - public SubResource ProximityPlacementGroup { get; set; } + public WritableSubResource ProximityPlacementGroup { get; set; } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateIPConfiguration.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateIPConfiguration.Serialization.cs index 8da824a8a6f90..ebf765b505ccd 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateIPConfiguration.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateIPConfiguration.Serialization.cs @@ -8,7 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -22,14 +22,17 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Subnet)) { writer.WritePropertyName("subnet"); - writer.WriteObjectValue(Subnet); + JsonSerializer.Serialize(writer, Subnet); } if (Optional.IsDefined(Primary)) { @@ -52,7 +55,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ApplicationGatewayBackendAddressPools) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } @@ -62,7 +65,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ApplicationSecurityGroups) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } @@ -72,7 +75,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in LoadBalancerBackendAddressPools) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } @@ -82,7 +85,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in LoadBalancerInboundNatPools) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } @@ -93,15 +96,15 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static VirtualMachineScaleSetUpdateIPConfiguration DeserializeVirtualMachineScaleSetUpdateIPConfiguration(JsonElement element) { Optional name = default; - ResourceIdentifier id = default; - Optional subnet = default; + Optional id = default; + Optional subnet = default; Optional primary = default; Optional publicIPAddressConfiguration = default; Optional privateIPAddressVersion = default; - Optional> applicationGatewayBackendAddressPools = default; - Optional> applicationSecurityGroups = default; - Optional> loadBalancerBackendAddressPools = default; - Optional> loadBalancerInboundNatPools = default; + Optional> applicationGatewayBackendAddressPools = default; + Optional> applicationSecurityGroups = default; + Optional> loadBalancerBackendAddressPools = default; + Optional> loadBalancerInboundNatPools = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) @@ -130,7 +133,7 @@ internal static VirtualMachineScaleSetUpdateIPConfiguration DeserializeVirtualMa property0.ThrowNonNullablePropertyIsNull(); continue; } - subnet = ApiEntityReference.DeserializeApiEntityReference(property0.Value); + subnet = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("primary")) @@ -170,10 +173,10 @@ internal static VirtualMachineScaleSetUpdateIPConfiguration DeserializeVirtualMa property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } applicationGatewayBackendAddressPools = array; continue; @@ -185,10 +188,10 @@ internal static VirtualMachineScaleSetUpdateIPConfiguration DeserializeVirtualMa property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } applicationSecurityGroups = array; continue; @@ -200,10 +203,10 @@ internal static VirtualMachineScaleSetUpdateIPConfiguration DeserializeVirtualMa property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } loadBalancerBackendAddressPools = array; continue; @@ -215,10 +218,10 @@ internal static VirtualMachineScaleSetUpdateIPConfiguration DeserializeVirtualMa property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } loadBalancerInboundNatPools = array; continue; @@ -227,7 +230,7 @@ internal static VirtualMachineScaleSetUpdateIPConfiguration DeserializeVirtualMa continue; } } - return new VirtualMachineScaleSetUpdateIPConfiguration(id, name.Value, subnet.Value, Optional.ToNullable(primary), publicIPAddressConfiguration.Value, Optional.ToNullable(privateIPAddressVersion), Optional.ToList(applicationGatewayBackendAddressPools), Optional.ToList(applicationSecurityGroups), Optional.ToList(loadBalancerBackendAddressPools), Optional.ToList(loadBalancerInboundNatPools)); + return new VirtualMachineScaleSetUpdateIPConfiguration(id.Value, name.Value, subnet, Optional.ToNullable(primary), publicIPAddressConfiguration.Value, Optional.ToNullable(privateIPAddressVersion), Optional.ToList(applicationGatewayBackendAddressPools), Optional.ToList(applicationSecurityGroups), Optional.ToList(loadBalancerBackendAddressPools), Optional.ToList(loadBalancerInboundNatPools)); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateIPConfiguration.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateIPConfiguration.cs index 3e493340a0fdc..e0bc51239fb12 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateIPConfiguration.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateIPConfiguration.cs @@ -12,19 +12,19 @@ namespace Azure.ResourceManager.Compute.Models { /// Describes a virtual machine scale set network profile's IP configuration. NOTE: The subnet of a scale set may be modified as long as the original subnet and the new subnet are in the same virtual network. - public partial class VirtualMachineScaleSetUpdateIPConfiguration : WritableSubResource + public partial class VirtualMachineScaleSetUpdateIPConfiguration : SubResource { /// Initializes a new instance of VirtualMachineScaleSetUpdateIPConfiguration. public VirtualMachineScaleSetUpdateIPConfiguration() { - ApplicationGatewayBackendAddressPools = new ChangeTrackingList(); - ApplicationSecurityGroups = new ChangeTrackingList(); - LoadBalancerBackendAddressPools = new ChangeTrackingList(); - LoadBalancerInboundNatPools = new ChangeTrackingList(); + ApplicationGatewayBackendAddressPools = new ChangeTrackingList(); + ApplicationSecurityGroups = new ChangeTrackingList(); + LoadBalancerBackendAddressPools = new ChangeTrackingList(); + LoadBalancerInboundNatPools = new ChangeTrackingList(); } /// Initializes a new instance of VirtualMachineScaleSetUpdateIPConfiguration. - /// The id. + /// Resource Id. /// The IP configuration name. /// The subnet. /// Specifies the primary IP Configuration in case the network interface has more than one IP Configuration. @@ -34,7 +34,7 @@ public VirtualMachineScaleSetUpdateIPConfiguration() /// Specifies an array of references to application security group. /// The load balancer backend address pools. /// The load balancer inbound nat pools. - internal VirtualMachineScaleSetUpdateIPConfiguration(string id, string name, ApiEntityReference subnet, bool? primary, VirtualMachineScaleSetUpdatePublicIPAddressConfiguration publicIPAddressConfiguration, IPVersion? privateIPAddressVersion, IList applicationGatewayBackendAddressPools, IList applicationSecurityGroups, IList loadBalancerBackendAddressPools, IList loadBalancerInboundNatPools) : base(id) + internal VirtualMachineScaleSetUpdateIPConfiguration(string id, string name, WritableSubResource subnet, bool? primary, VirtualMachineScaleSetUpdatePublicIPAddressConfiguration publicIPAddressConfiguration, IPVersion? privateIPAddressVersion, IList applicationGatewayBackendAddressPools, IList applicationSecurityGroups, IList loadBalancerBackendAddressPools, IList loadBalancerInboundNatPools) : base(id) { Name = name; Subnet = subnet; @@ -50,7 +50,7 @@ internal VirtualMachineScaleSetUpdateIPConfiguration(string id, string name, Api /// The IP configuration name. public string Name { get; set; } /// The subnet. - public ApiEntityReference Subnet { get; set; } + public WritableSubResource Subnet { get; set; } /// Specifies the primary IP Configuration in case the network interface has more than one IP Configuration. public bool? Primary { get; set; } /// The publicIPAddressConfiguration. @@ -58,12 +58,12 @@ internal VirtualMachineScaleSetUpdateIPConfiguration(string id, string name, Api /// Available from Api-Version 2017-03-30 onwards, it represents whether the specific ipconfiguration is IPv4 or IPv6. Default is taken as IPv4. Possible values are: 'IPv4' and 'IPv6'. public IPVersion? PrivateIPAddressVersion { get; set; } /// The application gateway backend address pools. - public IList ApplicationGatewayBackendAddressPools { get; } + public IList ApplicationGatewayBackendAddressPools { get; } /// Specifies an array of references to application security group. - public IList ApplicationSecurityGroups { get; } + public IList ApplicationSecurityGroups { get; } /// The load balancer backend address pools. - public IList LoadBalancerBackendAddressPools { get; } + public IList LoadBalancerBackendAddressPools { get; } /// The load balancer inbound nat pools. - public IList LoadBalancerInboundNatPools { get; } + public IList LoadBalancerInboundNatPools { get; } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkConfiguration.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkConfiguration.Serialization.cs index 903044ca5bb64..de4e8421f2ed0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkConfiguration.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkConfiguration.Serialization.cs @@ -8,7 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -22,8 +22,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Primary)) @@ -44,7 +47,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(NetworkSecurityGroup)) { writer.WritePropertyName("networkSecurityGroup"); - writer.WriteObjectValue(NetworkSecurityGroup); + JsonSerializer.Serialize(writer, NetworkSecurityGroup); } if (Optional.IsDefined(DnsSettings)) { @@ -78,11 +81,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static VirtualMachineScaleSetUpdateNetworkConfiguration DeserializeVirtualMachineScaleSetUpdateNetworkConfiguration(JsonElement element) { Optional name = default; - ResourceIdentifier id = default; + Optional id = default; Optional primary = default; Optional enableAcceleratedNetworking = default; Optional enableFpga = default; - Optional networkSecurityGroup = default; + Optional networkSecurityGroup = default; Optional dnsSettings = default; Optional> ipConfigurations = default; Optional enableIPForwarding = default; @@ -145,7 +148,7 @@ internal static VirtualMachineScaleSetUpdateNetworkConfiguration DeserializeVirt property0.ThrowNonNullablePropertyIsNull(); continue; } - networkSecurityGroup = SubResource.DeserializeSubResource(property0.Value); + networkSecurityGroup = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("dnsSettings")) @@ -197,7 +200,7 @@ internal static VirtualMachineScaleSetUpdateNetworkConfiguration DeserializeVirt continue; } } - return new VirtualMachineScaleSetUpdateNetworkConfiguration(id, name.Value, Optional.ToNullable(primary), Optional.ToNullable(enableAcceleratedNetworking), Optional.ToNullable(enableFpga), networkSecurityGroup.Value, dnsSettings.Value, Optional.ToList(ipConfigurations), Optional.ToNullable(enableIPForwarding), Optional.ToNullable(deleteOption)); + return new VirtualMachineScaleSetUpdateNetworkConfiguration(id.Value, name.Value, Optional.ToNullable(primary), Optional.ToNullable(enableAcceleratedNetworking), Optional.ToNullable(enableFpga), networkSecurityGroup, dnsSettings.Value, Optional.ToList(ipConfigurations), Optional.ToNullable(enableIPForwarding), Optional.ToNullable(deleteOption)); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkConfiguration.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkConfiguration.cs index 13cabc86ba31d..eb5a3798a2844 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkConfiguration.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkConfiguration.cs @@ -12,7 +12,7 @@ namespace Azure.ResourceManager.Compute.Models { /// Describes a virtual machine scale set network profile's network configurations. - public partial class VirtualMachineScaleSetUpdateNetworkConfiguration : WritableSubResource + public partial class VirtualMachineScaleSetUpdateNetworkConfiguration : SubResource { /// Initializes a new instance of VirtualMachineScaleSetUpdateNetworkConfiguration. public VirtualMachineScaleSetUpdateNetworkConfiguration() @@ -21,7 +21,7 @@ public VirtualMachineScaleSetUpdateNetworkConfiguration() } /// Initializes a new instance of VirtualMachineScaleSetUpdateNetworkConfiguration. - /// The id. + /// Resource Id. /// The network configuration name. /// Whether this is a primary NIC on a virtual machine. /// Specifies whether the network interface is accelerated networking-enabled. @@ -31,7 +31,7 @@ public VirtualMachineScaleSetUpdateNetworkConfiguration() /// The virtual machine scale set IP Configuration. /// Whether IP forwarding enabled on this NIC. /// Specify what happens to the network interface when the VM is deleted. - internal VirtualMachineScaleSetUpdateNetworkConfiguration(string id, string name, bool? primary, bool? enableAcceleratedNetworking, bool? enableFpga, SubResource networkSecurityGroup, VirtualMachineScaleSetNetworkConfigurationDnsSettings dnsSettings, IList ipConfigurations, bool? enableIPForwarding, DeleteOptions? deleteOption) : base(id) + internal VirtualMachineScaleSetUpdateNetworkConfiguration(string id, string name, bool? primary, bool? enableAcceleratedNetworking, bool? enableFpga, WritableSubResource networkSecurityGroup, VirtualMachineScaleSetNetworkConfigurationDnsSettings dnsSettings, IList ipConfigurations, bool? enableIPForwarding, DeleteOptions? deleteOption) : base(id) { Name = name; Primary = primary; @@ -53,7 +53,7 @@ internal VirtualMachineScaleSetUpdateNetworkConfiguration(string id, string name /// Specifies whether the network interface is FPGA networking-enabled. public bool? EnableFpga { get; set; } /// The network security group. - public SubResource NetworkSecurityGroup { get; set; } + public WritableSubResource NetworkSecurityGroup { get; set; } /// The dns settings to be applied on the network interfaces. public VirtualMachineScaleSetNetworkConfigurationDnsSettings DnsSettings { get; set; } /// The virtual machine scale set IP Configuration. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkProfile.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkProfile.Serialization.cs index 937138ccba21c..ab95e203f58e4 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkProfile.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkProfile.Serialization.cs @@ -18,7 +18,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(HealthProbe)) { writer.WritePropertyName("healthProbe"); - writer.WriteObjectValue(HealthProbe); + JsonSerializer.Serialize(writer, HealthProbe); } if (Optional.IsCollectionDefined(NetworkInterfaceConfigurations)) { diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkProfile.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkProfile.cs index 33e7b5ce7b1ea..7276ed1d749e8 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkProfile.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetUpdateNetworkProfile.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute.Models { @@ -20,7 +21,7 @@ public VirtualMachineScaleSetUpdateNetworkProfile() } /// A reference to a load balancer probe used to determine the health of an instance in the virtual machine scale set. The reference will be in the form: '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/probes/{probeName}'. - public ApiEntityReference HealthProbe { get; set; } + public WritableSubResource HealthProbe { get; set; } /// The list of network configurations. public IList NetworkInterfaceConfigurations { get; } /// specifies the Microsoft.Network API version used when creating networking resources in the Network Interface Configurations for Virtual Machine Scale Set with orchestration mode 'Flexible'. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVMData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVMData.Serialization.cs index 7482d4326adaf..faba3e17dfc75 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVMData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVMData.Serialization.cs @@ -79,7 +79,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AvailabilitySet)) { writer.WritePropertyName("availabilitySet"); - writer.WriteObjectValue(AvailabilitySet); + JsonSerializer.Serialize(writer, AvailabilitySet); } if (Optional.IsDefined(LicenseType)) { @@ -123,7 +123,7 @@ internal static VirtualMachineScaleSetVMData DeserializeVirtualMachineScaleSetVM Optional networkProfile = default; Optional networkProfileConfiguration = default; Optional diagnosticsProfile = default; - Optional availabilitySet = default; + Optional availabilitySet = default; Optional provisioningState = default; Optional licenseType = default; Optional modelDefinitionApplied = default; @@ -337,7 +337,7 @@ internal static VirtualMachineScaleSetVMData DeserializeVirtualMachineScaleSetVM property0.ThrowNonNullablePropertyIsNull(); continue; } - availabilitySet = Models.SubResource.DeserializeSubResource(property0.Value); + availabilitySet = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("provisioningState")) @@ -374,7 +374,7 @@ internal static VirtualMachineScaleSetVMData DeserializeVirtualMachineScaleSetVM continue; } } - return new VirtualMachineScaleSetVMData(id, name, type, tags, location, instanceId.Value, sku.Value, plan.Value, Optional.ToList(resources), Optional.ToList(zones), Optional.ToNullable(latestModelApplied), vmId.Value, instanceView.Value, hardwareProfile.Value, storageProfile.Value, additionalCapabilities.Value, osProfile.Value, securityProfile.Value, networkProfile.Value, networkProfileConfiguration.Value, diagnosticsProfile.Value, availabilitySet.Value, provisioningState.Value, licenseType.Value, modelDefinitionApplied.Value, protectionPolicy.Value, userData.Value); + return new VirtualMachineScaleSetVMData(id, name, type, tags, location, instanceId.Value, sku.Value, plan.Value, Optional.ToList(resources), Optional.ToList(zones), Optional.ToNullable(latestModelApplied), vmId.Value, instanceView.Value, hardwareProfile.Value, storageProfile.Value, additionalCapabilities.Value, osProfile.Value, securityProfile.Value, networkProfile.Value, networkProfileConfiguration.Value, diagnosticsProfile.Value, availabilitySet, provisioningState.Value, licenseType.Value, modelDefinitionApplied.Value, protectionPolicy.Value, userData.Value); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVMExtensionData.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVMExtensionData.Serialization.cs index 00727369f1d98..f805b0a7753a6 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVMExtensionData.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVMExtensionData.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Compute.Models; namespace Azure.ResourceManager.Compute @@ -72,7 +71,7 @@ internal static VirtualMachineScaleSetVMExtensionData DeserializeVirtualMachineS { Optional name = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional forceUpdateTag = default; Optional publisher = default; Optional type0 = default; @@ -188,7 +187,7 @@ internal static VirtualMachineScaleSetVMExtensionData DeserializeVirtualMachineS continue; } } - return new VirtualMachineScaleSetVMExtensionData(id, name.Value, type.Value, forceUpdateTag.Value, publisher.Value, type0.Value, typeHandlerVersion.Value, Optional.ToNullable(autoUpgradeMinorVersion), Optional.ToNullable(enableAutomaticUpgrade), settings.Value, protectedSettings.Value, provisioningState.Value, instanceView.Value); + return new VirtualMachineScaleSetVMExtensionData(id.Value, name.Value, type.Value, forceUpdateTag.Value, publisher.Value, type0.Value, typeHandlerVersion.Value, Optional.ToNullable(autoUpgradeMinorVersion), Optional.ToNullable(enableAutomaticUpgrade), settings.Value, protectedSettings.Value, provisioningState.Value, instanceView.Value); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVMExtensionUpdate.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVMExtensionUpdate.Serialization.cs index 712e0d3a6dd22..d3c284a7a6252 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVMExtensionUpdate.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVMExtensionUpdate.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Compute.Models { @@ -66,7 +65,7 @@ internal static VirtualMachineScaleSetVMExtensionUpdate DeserializeVirtualMachin { Optional name = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional forceUpdateTag = default; Optional publisher = default; Optional type0 = default; @@ -165,7 +164,7 @@ internal static VirtualMachineScaleSetVMExtensionUpdate DeserializeVirtualMachin continue; } } - return new VirtualMachineScaleSetVMExtensionUpdate(id, name.Value, type.Value, forceUpdateTag.Value, publisher.Value, type0.Value, typeHandlerVersion.Value, Optional.ToNullable(autoUpgradeMinorVersion), Optional.ToNullable(enableAutomaticUpgrade), settings.Value, protectedSettings.Value); + return new VirtualMachineScaleSetVMExtensionUpdate(id.Value, name.Value, type.Value, forceUpdateTag.Value, publisher.Value, type0.Value, typeHandlerVersion.Value, Optional.ToNullable(autoUpgradeMinorVersion), Optional.ToNullable(enableAutomaticUpgrade), settings.Value, protectedSettings.Value); } } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVMExtensionUpdate.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVMExtensionUpdate.cs index 0c7dbc5c42f4f..a285a83298517 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVMExtensionUpdate.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineScaleSetVMExtensionUpdate.cs @@ -5,12 +5,10 @@ #nullable disable -using Azure.ResourceManager.Resources.Models; - namespace Azure.ResourceManager.Compute.Models { /// Describes a VMSS VM Extension. - public partial class VirtualMachineScaleSetVMExtensionUpdate : Resources.Models.SubResource + public partial class VirtualMachineScaleSetVMExtensionUpdate : SubResourceReadOnly { /// Initializes a new instance of VirtualMachineScaleSetVMExtensionUpdate. public VirtualMachineScaleSetVMExtensionUpdate() @@ -18,7 +16,7 @@ public VirtualMachineScaleSetVMExtensionUpdate() } /// Initializes a new instance of VirtualMachineScaleSetVMExtensionUpdate. - /// The id. + /// Resource Id. /// The name of the extension. /// Resource type. /// How the extension handler should be forced to update even if the extension configuration has not changed. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineUpdate.Serialization.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineUpdate.Serialization.cs index 53562fc014073..8ea7a4482fde7 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineUpdate.Serialization.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineUpdate.Serialization.cs @@ -86,17 +86,17 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AvailabilitySet)) { writer.WritePropertyName("availabilitySet"); - writer.WriteObjectValue(AvailabilitySet); + JsonSerializer.Serialize(writer, AvailabilitySet); } if (Optional.IsDefined(VirtualMachineScaleSet)) { writer.WritePropertyName("virtualMachineScaleSet"); - writer.WriteObjectValue(VirtualMachineScaleSet); + JsonSerializer.Serialize(writer, VirtualMachineScaleSet); } if (Optional.IsDefined(ProximityPlacementGroup)) { writer.WritePropertyName("proximityPlacementGroup"); - writer.WriteObjectValue(ProximityPlacementGroup); + JsonSerializer.Serialize(writer, ProximityPlacementGroup); } if (Optional.IsDefined(Priority)) { @@ -116,12 +116,12 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Host)) { writer.WritePropertyName("host"); - writer.WriteObjectValue(Host); + JsonSerializer.Serialize(writer, Host); } if (Optional.IsDefined(HostGroup)) { writer.WritePropertyName("hostGroup"); - writer.WriteObjectValue(HostGroup); + JsonSerializer.Serialize(writer, HostGroup); } if (Optional.IsDefined(LicenseType)) { diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineUpdate.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineUpdate.cs index beb15707ab822..b1e4c1444e9c1 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineUpdate.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/Models/VirtualMachineUpdate.cs @@ -41,11 +41,11 @@ public VirtualMachineUpdate() /// Specifies the boot diagnostic settings state. <br><br>Minimum api-version: 2015-06-15. public DiagnosticsProfile DiagnosticsProfile { get; set; } /// Specifies information about the availability set that the virtual machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see [Availability sets overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). <br><br> For more information on Azure planned maintenance, see [Maintenance and updates for Virtual Machines in Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates) <br><br> Currently, a VM can only be added to availability set at creation time. The availability set to which the VM is being added should be under the same resource group as the availability set resource. An existing VM cannot be added to an availability set. <br><br>This property cannot exist along with a non-null properties.virtualMachineScaleSet reference. - public SubResource AvailabilitySet { get; set; } + public WritableSubResource AvailabilitySet { get; set; } /// Specifies information about the virtual machine scale set that the virtual machine should be assigned to. Virtual machines specified in the same virtual machine scale set are allocated to different nodes to maximize availability. Currently, a VM can only be added to virtual machine scale set at creation time. An existing VM cannot be added to a virtual machine scale set. <br><br>This property cannot exist along with a non-null properties.availabilitySet reference. <br><br>Minimum api‐version: 2019‐03‐01. - public SubResource VirtualMachineScaleSet { get; set; } + public WritableSubResource VirtualMachineScaleSet { get; set; } /// Specifies information about the proximity placement group that the virtual machine should be assigned to. <br><br>Minimum api-version: 2018-04-01. - public SubResource ProximityPlacementGroup { get; set; } + public WritableSubResource ProximityPlacementGroup { get; set; } /// Specifies the priority for the virtual machine. <br><br>Minimum api-version: 2019-03-01. public VirtualMachinePriorityTypes? Priority { get; set; } /// Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot scale set. <br><br>For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2019-03-01. <br><br>For Azure Spot scale sets, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2017-10-30-preview. @@ -53,9 +53,9 @@ public VirtualMachineUpdate() /// Specifies the billing related details of a Azure Spot virtual machine. <br><br>Minimum api-version: 2019-03-01. public BillingProfile BillingProfile { get; set; } /// Specifies information about the dedicated host that the virtual machine resides in. <br><br>Minimum api-version: 2018-10-01. - public SubResource Host { get; set; } + public WritableSubResource Host { get; set; } /// Specifies information about the dedicated host group that the virtual machine resides in. <br><br>Minimum api-version: 2020-06-01. <br><br>NOTE: User cannot specify both host and hostGroup properties. - public SubResource HostGroup { get; set; } + public WritableSubResource HostGroup { get; set; } /// The provisioning state, which only appears in the response. public string ProvisioningState { get; } /// The virtual machine instance view. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/PrivateEndpointConnectionData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/PrivateEndpointConnectionData.cs index da35b30c70048..9112c9d6aa273 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/PrivateEndpointConnectionData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/PrivateEndpointConnectionData.cs @@ -8,6 +8,7 @@ using Azure.ResourceManager; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute { @@ -26,7 +27,7 @@ public PrivateEndpointConnectionData() /// The resource of private end point. /// A collection of information about the state of the connection between DiskAccess and Virtual Network. /// The provisioning state of the private endpoint connection resource. - internal PrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType type, PrivateEndpoint privateEndpoint, PrivateLinkServiceConnectionState privateLinkServiceConnectionState, PrivateEndpointConnectionProvisioningState? provisioningState) : base(id, name, type) + internal PrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType type, Resources.Models.SubResource privateEndpoint, PrivateLinkServiceConnectionState privateLinkServiceConnectionState, PrivateEndpointConnectionProvisioningState? provisioningState) : base(id, name, type) { PrivateEndpoint = privateEndpoint; PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; @@ -34,7 +35,7 @@ internal PrivateEndpointConnectionData(ResourceIdentifier id, string name, Resou } /// The resource of private end point. - public PrivateEndpoint PrivateEndpoint { get; } + public Resources.Models.SubResource PrivateEndpoint { get; } /// A collection of information about the state of the connection between DiskAccess and Virtual Network. public PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get; set; } /// The provisioning state of the private endpoint connection resource. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointData.cs index e49ed9b9feed1..55a649956dc0f 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/RestorePointData.cs @@ -10,6 +10,7 @@ using Azure.ResourceManager; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute { @@ -19,7 +20,7 @@ public partial class RestorePointData : Resource /// Initializes a new instance of RestorePointData. public RestorePointData() { - ExcludeDisks = new ChangeTrackingList(); + ExcludeDisks = new ChangeTrackingList(); } /// Initializes a new instance of RestorePointData. @@ -31,7 +32,7 @@ public RestorePointData() /// Gets the provisioning state of the restore point. /// Gets the consistency mode for the restore point. Please refer to https://aka.ms/RestorePoints for more details. /// Gets the provisioning details set by the server during Create restore point operation. - internal RestorePointData(ResourceIdentifier id, string name, ResourceType type, IList excludeDisks, RestorePointSourceMetadata sourceMetadata, string provisioningState, ConsistencyModeTypes? consistencyMode, RestorePointProvisioningDetails provisioningDetails) : base(id, name, type) + internal RestorePointData(ResourceIdentifier id, string name, ResourceType type, IList excludeDisks, RestorePointSourceMetadata sourceMetadata, string provisioningState, ConsistencyModeTypes? consistencyMode, RestorePointProvisioningDetails provisioningDetails) : base(id, name, type) { ExcludeDisks = excludeDisks; SourceMetadata = sourceMetadata; @@ -41,7 +42,7 @@ internal RestorePointData(ResourceIdentifier id, string name, ResourceType type, } /// List of disk resource ids that the customer wishes to exclude from the restore point. If no disks are specified, all disks will be included. - public IList ExcludeDisks { get; } + public IList ExcludeDisks { get; } /// Gets the details of the VM captured at the time of the restore point creation. public RestorePointSourceMetadata SourceMetadata { get; } /// Gets the provisioning state of the restore point. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/UpdateDomainData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/UpdateDomainData.cs index bdffba6cbd39e..53d80a30b8e3e 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/UpdateDomainData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/UpdateDomainData.cs @@ -5,12 +5,10 @@ #nullable disable -using Azure.ResourceManager.Resources.Models; - namespace Azure.ResourceManager.Compute { /// A class representing the UpdateDomain data model. - public partial class UpdateDomainData : SubResource + public partial class UpdateDomainData { /// Initializes a new instance of UpdateDomainData. public UpdateDomainData() @@ -18,13 +16,16 @@ public UpdateDomainData() } /// Initializes a new instance of UpdateDomainData. - /// The id. + /// Resource Id. /// Resource Name. - internal UpdateDomainData(string id, string name) : base(id) + internal UpdateDomainData(string id, string name) { + Id = id; Name = name; } + /// Resource Id. + public string Id { get; } /// Resource Name. public string Name { get; } } diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineData.cs index d5aeb7f305c58..e323e1cee7ff6 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineData.cs @@ -59,7 +59,7 @@ public VirtualMachineData(Location location) : base(location) /// Specifies the scale set logical fault domain into which the Virtual Machine will be created. By default, the Virtual Machine will by automatically assigned to a fault domain that best maintains balance across available fault domains.<br><li>This is applicable only if the 'virtualMachineScaleSet' property of this Virtual Machine is set.<li>The Virtual Machine Scale Set that is referenced, must have 'platformFaultDomainCount' &gt; 1.<li>This property cannot be updated once the Virtual Machine is created.<li>Fault domain assignment can be viewed in the Virtual Machine Instance View.<br><br>Minimum api‐version: 2020‐12‐01. /// Specifies Scheduled Event related configurations. /// UserData for the VM, which must be base-64 encoded. Customer should not pass any secrets in here. <br><br>Minimum api-version: 2021-03-01. - internal VirtualMachineData(ResourceIdentifier id, string name, ResourceType type, IDictionary tags, Location location, Models.Plan plan, IReadOnlyList resources, ResourceIdentity identity, IList zones, ExtendedLocation extendedLocation, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, NetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, Models.SubResource availabilitySet, Models.SubResource virtualMachineScaleSet, Models.SubResource proximityPlacementGroup, VirtualMachinePriorityTypes? priority, VirtualMachineEvictionPolicyTypes? evictionPolicy, BillingProfile billingProfile, Models.SubResource host, Models.SubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget, int? platformFaultDomain, ScheduledEventsProfile scheduledEventsProfile, string userData) : base(id, name, type, tags, location) + internal VirtualMachineData(ResourceIdentifier id, string name, ResourceType type, IDictionary tags, Location location, Models.Plan plan, IReadOnlyList resources, ResourceIdentity identity, IList zones, ExtendedLocation extendedLocation, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, NetworkProfile networkProfile, SecurityProfile securityProfile, DiagnosticsProfile diagnosticsProfile, WritableSubResource availabilitySet, WritableSubResource virtualMachineScaleSet, WritableSubResource proximityPlacementGroup, VirtualMachinePriorityTypes? priority, VirtualMachineEvictionPolicyTypes? evictionPolicy, BillingProfile billingProfile, WritableSubResource host, WritableSubResource hostGroup, string provisioningState, VirtualMachineInstanceView instanceView, string licenseType, string vmId, string extensionsTimeBudget, int? platformFaultDomain, ScheduledEventsProfile scheduledEventsProfile, string userData) : base(id, name, type, tags, location) { Plan = plan; Resources = resources; @@ -116,11 +116,11 @@ internal VirtualMachineData(ResourceIdentifier id, string name, ResourceType typ /// Specifies the boot diagnostic settings state. <br><br>Minimum api-version: 2015-06-15. public DiagnosticsProfile DiagnosticsProfile { get; set; } /// Specifies information about the availability set that the virtual machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see [Availability sets overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). <br><br> For more information on Azure planned maintenance, see [Maintenance and updates for Virtual Machines in Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates) <br><br> Currently, a VM can only be added to availability set at creation time. The availability set to which the VM is being added should be under the same resource group as the availability set resource. An existing VM cannot be added to an availability set. <br><br>This property cannot exist along with a non-null properties.virtualMachineScaleSet reference. - public Models.SubResource AvailabilitySet { get; set; } + public WritableSubResource AvailabilitySet { get; set; } /// Specifies information about the virtual machine scale set that the virtual machine should be assigned to. Virtual machines specified in the same virtual machine scale set are allocated to different nodes to maximize availability. Currently, a VM can only be added to virtual machine scale set at creation time. An existing VM cannot be added to a virtual machine scale set. <br><br>This property cannot exist along with a non-null properties.availabilitySet reference. <br><br>Minimum api‐version: 2019‐03‐01. - public Models.SubResource VirtualMachineScaleSet { get; set; } + public WritableSubResource VirtualMachineScaleSet { get; set; } /// Specifies information about the proximity placement group that the virtual machine should be assigned to. <br><br>Minimum api-version: 2018-04-01. - public Models.SubResource ProximityPlacementGroup { get; set; } + public WritableSubResource ProximityPlacementGroup { get; set; } /// Specifies the priority for the virtual machine. <br><br>Minimum api-version: 2019-03-01. public VirtualMachinePriorityTypes? Priority { get; set; } /// Specifies the eviction policy for the Azure Spot virtual machine and Azure Spot scale set. <br><br>For Azure Spot virtual machines, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2019-03-01. <br><br>For Azure Spot scale sets, both 'Deallocate' and 'Delete' are supported and the minimum api-version is 2017-10-30-preview. @@ -128,9 +128,9 @@ internal VirtualMachineData(ResourceIdentifier id, string name, ResourceType typ /// Specifies the billing related details of a Azure Spot virtual machine. <br><br>Minimum api-version: 2019-03-01. public BillingProfile BillingProfile { get; set; } /// Specifies information about the dedicated host that the virtual machine resides in. <br><br>Minimum api-version: 2018-10-01. - public Models.SubResource Host { get; set; } + public WritableSubResource Host { get; set; } /// Specifies information about the dedicated host group that the virtual machine resides in. <br><br>Minimum api-version: 2020-06-01. <br><br>NOTE: User cannot specify both host and hostGroup properties. - public Models.SubResource HostGroup { get; set; } + public WritableSubResource HostGroup { get; set; } /// The provisioning state, which only appears in the response. public string ProvisioningState { get; } /// The virtual machine instance view. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetData.cs index 27670e2c59e4a..4873e84feae17 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetData.cs @@ -50,7 +50,7 @@ public VirtualMachineScaleSetData(Location location) : base(location) /// Specifies additional capabilities enabled or disabled on the Virtual Machines in the Virtual Machine Scale Set. For instance: whether the Virtual Machines have the capability to support attaching managed data disks with UltraSSD_LRS storage account type. /// Specifies the scale-in policy that decides which virtual machines are chosen for removal when a Virtual Machine Scale Set is scaled-in. /// Specifies the orchestration mode for the virtual machine scale set. - internal VirtualMachineScaleSetData(ResourceIdentifier id, string name, ResourceType type, IDictionary tags, Location location, Models.Sku sku, Models.Plan plan, ResourceIdentity identity, IList zones, ExtendedLocation extendedLocation, UpgradePolicy upgradePolicy, AutomaticRepairsPolicy automaticRepairsPolicy, VirtualMachineScaleSetVMProfile virtualMachineProfile, string provisioningState, bool? overprovision, bool? doNotRunExtensionsOnOverprovisionedVMs, string uniqueId, bool? singlePlacementGroup, bool? zoneBalance, int? platformFaultDomainCount, Models.SubResource proximityPlacementGroup, Models.SubResource hostGroup, AdditionalCapabilities additionalCapabilities, ScaleInPolicy scaleInPolicy, OrchestrationMode? orchestrationMode) : base(id, name, type, tags, location) + internal VirtualMachineScaleSetData(ResourceIdentifier id, string name, ResourceType type, IDictionary tags, Location location, Models.Sku sku, Models.Plan plan, ResourceIdentity identity, IList zones, ExtendedLocation extendedLocation, UpgradePolicy upgradePolicy, AutomaticRepairsPolicy automaticRepairsPolicy, VirtualMachineScaleSetVMProfile virtualMachineProfile, string provisioningState, bool? overprovision, bool? doNotRunExtensionsOnOverprovisionedVMs, string uniqueId, bool? singlePlacementGroup, bool? zoneBalance, int? platformFaultDomainCount, WritableSubResource proximityPlacementGroup, WritableSubResource hostGroup, AdditionalCapabilities additionalCapabilities, ScaleInPolicy scaleInPolicy, OrchestrationMode? orchestrationMode) : base(id, name, type, tags, location) { Sku = sku; Plan = plan; @@ -105,9 +105,9 @@ internal VirtualMachineScaleSetData(ResourceIdentifier id, string name, Resource /// Fault Domain count for each placement group. public int? PlatformFaultDomainCount { get; set; } /// Specifies information about the proximity placement group that the virtual machine scale set should be assigned to. <br><br>Minimum api-version: 2018-04-01. - public Models.SubResource ProximityPlacementGroup { get; set; } + public WritableSubResource ProximityPlacementGroup { get; set; } /// Specifies information about the dedicated host group that the virtual machine scale set resides in. <br><br>Minimum api-version: 2020-06-01. - public Models.SubResource HostGroup { get; set; } + public WritableSubResource HostGroup { get; set; } /// Specifies additional capabilities enabled or disabled on the Virtual Machines in the Virtual Machine Scale Set. For instance: whether the Virtual Machines have the capability to support attaching managed data disks with UltraSSD_LRS storage account type. public AdditionalCapabilities AdditionalCapabilities { get; set; } /// Specifies the scale-in policy that decides which virtual machines are chosen for removal when a Virtual Machine Scale Set is scaled-in. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetExtensionData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetExtensionData.cs index 9a195e26f97c9..6a26f4cca3902 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetExtensionData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetExtensionData.cs @@ -7,12 +7,12 @@ using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.Resources.Models; +using Azure.ResourceManager.Compute.Models; namespace Azure.ResourceManager.Compute { /// A class representing the VirtualMachineScaleSetExtension data model. - public partial class VirtualMachineScaleSetExtensionData : SubResource + public partial class VirtualMachineScaleSetExtensionData : SubResourceReadOnly { /// Initializes a new instance of VirtualMachineScaleSetExtensionData. public VirtualMachineScaleSetExtensionData() @@ -21,7 +21,7 @@ public VirtualMachineScaleSetExtensionData() } /// Initializes a new instance of VirtualMachineScaleSetExtensionData. - /// The id. + /// Resource Id. /// The name of the extension. /// Resource type. /// If a value is provided and is different from the previous value, the extension handler will be forced to update even if the extension configuration has not changed. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVMData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVMData.cs index aa18ba0f9eedc..c915b9fb1f7f9 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVMData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVMData.cs @@ -53,7 +53,7 @@ public VirtualMachineScaleSetVMData(Location location) : base(location) /// Specifies whether the model applied to the virtual machine is the model of the virtual machine scale set or the customized model for the virtual machine. /// Specifies the protection policy of the virtual machine. /// UserData for the VM, which must be base-64 encoded. Customer should not pass any secrets in here. <br><br>Minimum api-version: 2021-03-01. - internal VirtualMachineScaleSetVMData(ResourceIdentifier id, string name, ResourceType type, IDictionary tags, Location location, string instanceId, Models.Sku sku, Models.Plan plan, IReadOnlyList resources, IReadOnlyList zones, bool? latestModelApplied, string vmId, VirtualMachineScaleSetVMInstanceView instanceView, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, SecurityProfile securityProfile, NetworkProfile networkProfile, VirtualMachineScaleSetVMNetworkProfileConfiguration networkProfileConfiguration, DiagnosticsProfile diagnosticsProfile, Models.SubResource availabilitySet, string provisioningState, string licenseType, string modelDefinitionApplied, VirtualMachineScaleSetVMProtectionPolicy protectionPolicy, string userData) : base(id, name, type, tags, location) + internal VirtualMachineScaleSetVMData(ResourceIdentifier id, string name, ResourceType type, IDictionary tags, Location location, string instanceId, Models.Sku sku, Models.Plan plan, IReadOnlyList resources, IReadOnlyList zones, bool? latestModelApplied, string vmId, VirtualMachineScaleSetVMInstanceView instanceView, HardwareProfile hardwareProfile, StorageProfile storageProfile, AdditionalCapabilities additionalCapabilities, OSProfile osProfile, SecurityProfile securityProfile, NetworkProfile networkProfile, VirtualMachineScaleSetVMNetworkProfileConfiguration networkProfileConfiguration, DiagnosticsProfile diagnosticsProfile, WritableSubResource availabilitySet, string provisioningState, string licenseType, string modelDefinitionApplied, VirtualMachineScaleSetVMProtectionPolicy protectionPolicy, string userData) : base(id, name, type, tags, location) { InstanceId = instanceId; Sku = sku; @@ -112,7 +112,7 @@ internal VirtualMachineScaleSetVMData(ResourceIdentifier id, string name, Resour /// Specifies the boot diagnostic settings state. <br><br>Minimum api-version: 2015-06-15. public DiagnosticsProfile DiagnosticsProfile { get; set; } /// Specifies information about the availability set that the virtual machine should be assigned to. Virtual machines specified in the same availability set are allocated to different nodes to maximize availability. For more information about availability sets, see [Availability sets overview](https://docs.microsoft.com/azure/virtual-machines/availability-set-overview). <br><br> For more information on Azure planned maintenance, see [Maintenance and updates for Virtual Machines in Azure](https://docs.microsoft.com/azure/virtual-machines/maintenance-and-updates) <br><br> Currently, a VM can only be added to availability set at creation time. An existing VM cannot be added to an availability set. - public Models.SubResource AvailabilitySet { get; set; } + public WritableSubResource AvailabilitySet { get; set; } /// The provisioning state, which only appears in the response. public string ProvisioningState { get; } /// Specifies that the image or disk that is being used was licensed on-premises. <br><br> Possible values for Windows Server operating system are: <br><br> Windows_Client <br><br> Windows_Server <br><br> Possible values for Linux Server operating system are: <br><br> RHEL_BYOS (for RHEL) <br><br> SLES_BYOS (for SUSE) <br><br> For more information, see [Azure Hybrid Use Benefit for Windows Server](https://docs.microsoft.com/azure/virtual-machines/windows/hybrid-use-benefit-licensing) <br><br> [Azure Hybrid Use Benefit for Linux Server](https://docs.microsoft.com/azure/virtual-machines/linux/azure-hybrid-benefit-linux) <br><br> Minimum api-version: 2015-06-15. diff --git a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVMExtensionData.cs b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVMExtensionData.cs index b1bb1eac241ef..821d3ab4b363b 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVMExtensionData.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/src/Generated/VirtualMachineScaleSetVMExtensionData.cs @@ -6,12 +6,11 @@ #nullable disable using Azure.ResourceManager.Compute.Models; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Compute { /// A class representing the VirtualMachineScaleSetVMExtension data model. - public partial class VirtualMachineScaleSetVMExtensionData : Resources.Models.SubResource + public partial class VirtualMachineScaleSetVMExtensionData : SubResourceReadOnly { /// Initializes a new instance of VirtualMachineScaleSetVMExtensionData. public VirtualMachineScaleSetVMExtensionData() @@ -19,7 +18,7 @@ public VirtualMachineScaleSetVMExtensionData() } /// Initializes a new instance of VirtualMachineScaleSetVMExtensionData. - /// The id. + /// Resource Id. /// The name of the extension. /// Resource type. /// How the extension handler should be forced to update even if the extension configuration has not changed. diff --git a/sdk/compute/Azure.ResourceManager.Compute/tests/Helpers/ResourceDataHelper.cs b/sdk/compute/Azure.ResourceManager.Compute/tests/Helpers/ResourceDataHelper.cs index 5c40e08477bd0..5c7701ba427fb 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/tests/Helpers/ResourceDataHelper.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/tests/Helpers/ResourceDataHelper.cs @@ -327,7 +327,7 @@ public static VirtualMachineScaleSetData GetBasicLinuxVirtualMachineScaleSetData new VirtualMachineScaleSetIPConfiguration("internal") { Primary = true, - Subnet = new ApiEntityReference() + Subnet = new WritableSubResource() { Id = subnetId } diff --git a/sdk/compute/Azure.ResourceManager.Compute/tests/Scenario/VirtualMachineContainerTests.cs b/sdk/compute/Azure.ResourceManager.Compute/tests/Scenario/VirtualMachineContainerTests.cs index 7964da4ef3de0..11641e4a58963 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/tests/Scenario/VirtualMachineContainerTests.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/tests/Scenario/VirtualMachineContainerTests.cs @@ -9,6 +9,7 @@ namespace Azure.ResourceManager.Compute.Tests { + [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/24576")] public class VirtualMachineContainerTests : VirtualMachineTestBase { public VirtualMachineContainerTests(bool async) diff --git a/sdk/compute/Azure.ResourceManager.Compute/tests/Scenario/VirtualMachineOperationsTests.cs b/sdk/compute/Azure.ResourceManager.Compute/tests/Scenario/VirtualMachineOperationsTests.cs index aaebf9ecbd9d6..09a948e0304fd 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/tests/Scenario/VirtualMachineOperationsTests.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/tests/Scenario/VirtualMachineOperationsTests.cs @@ -5,10 +5,12 @@ using Azure.Core.TestFramework; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Compute.Tests.Helpers; +using Azure.ResourceManager.Resources.Models; using NUnit.Framework; namespace Azure.ResourceManager.Compute.Tests { + [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/24576")] public class VirtualMachineOperationsTests : VirtualMachineTestBase { public VirtualMachineOperationsTests(bool isAsync) @@ -60,7 +62,7 @@ public async Task Update() await vm.DeallocateAsync(); var update = new VirtualMachineUpdate() { - ProximityPlacementGroup = new SubResource() + ProximityPlacementGroup = new WritableSubResource() { Id = ppg.Id } diff --git a/sdk/compute/Azure.ResourceManager.Compute/tests/Scenario/VirtualMachineScaleSetContainerTests.cs b/sdk/compute/Azure.ResourceManager.Compute/tests/Scenario/VirtualMachineScaleSetContainerTests.cs index d698484f157ed..174c80b3e01c0 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/tests/Scenario/VirtualMachineScaleSetContainerTests.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/tests/Scenario/VirtualMachineScaleSetContainerTests.cs @@ -9,6 +9,7 @@ namespace Azure.ResourceManager.Compute.Tests { + [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/24576")] public class VirtualMachineScaleSetContainerTests : VirtualMachineScaleSetTestBase { public VirtualMachineScaleSetContainerTests(bool isAsync) diff --git a/sdk/compute/Azure.ResourceManager.Compute/tests/Scenario/VirtualMachineScaleSetOperationsTests.cs b/sdk/compute/Azure.ResourceManager.Compute/tests/Scenario/VirtualMachineScaleSetOperationsTests.cs index 383eb7ca383d2..e5e6ba1326452 100644 --- a/sdk/compute/Azure.ResourceManager.Compute/tests/Scenario/VirtualMachineScaleSetOperationsTests.cs +++ b/sdk/compute/Azure.ResourceManager.Compute/tests/Scenario/VirtualMachineScaleSetOperationsTests.cs @@ -5,10 +5,12 @@ using Azure.Core.TestFramework; using Azure.ResourceManager.Compute.Models; using Azure.ResourceManager.Compute.Tests.Helpers; +using Azure.ResourceManager.Resources.Models; using NUnit.Framework; namespace Azure.ResourceManager.Compute.Tests { + [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/24576")] public class VirtualMachineScaleSetOperationsTests : VirtualMachineScaleSetTestBase { public VirtualMachineScaleSetOperationsTests(bool isAsync) @@ -60,7 +62,7 @@ public async Task Update() await vmss.DeallocateAsync(); var update = new VirtualMachineScaleSetUpdate() { - ProximityPlacementGroup = new SubResource() + ProximityPlacementGroup = new WritableSubResource() { Id = ppg.Id } diff --git a/sdk/confidentialledger/Azure.Security.ConfidentialLedger/README.md b/sdk/confidentialledger/Azure.Security.ConfidentialLedger/README.md index 5d2133908cb6f..2ae8f63ad127d 100644 --- a/sdk/confidentialledger/Azure.Security.ConfidentialLedger/README.md +++ b/sdk/confidentialledger/Azure.Security.ConfidentialLedger/README.md @@ -53,7 +53,7 @@ var identityClient = new ConfidentialLedgerIdentityServiceClient(identityService // Get the ledger's TLS certificate for our ledger. string ledgerId = ""; // ex. "my-ledger" from "https://my-ledger.eastus.cloudapp.azure.com" -Response response = identityClient.GetLedgerIdentity(ledgerId); +Response response = identityClient.GetLedgerIdentity(ledgerId, new()); X509Certificate2 ledgerTlsCert = ConfidentialLedgerIdentityServiceClient.ParseCertificate(response); ``` @@ -109,7 +109,7 @@ Console.WriteLine($"Appended transaction with Id: {transactionId}"); Since Confidential Ledger is a distributed system, rare transient failures may cause writes to be lost. For entries that must be preserved, it is advisable to verify that the write became durable. Note: It may be necessary to call `GetTransactionStatus` multiple times until it returns a "Committed" status. ```C# Snippet:GetStatus -Response statusResponse = ledgerClient.GetTransactionStatus(transactionId); +Response statusResponse = ledgerClient.GetTransactionStatus(transactionId, new()); string status = JsonDocument.Parse(statusResponse.Content) .RootElement @@ -121,7 +121,7 @@ Console.WriteLine($"Transaction status: {status}"); // Wait for the entry to be committed while (status == "Pending") { - statusResponse = ledgerClient.GetTransactionStatus(transactionId); + statusResponse = ledgerClient.GetTransactionStatus(transactionId, new()); status = JsonDocument.Parse(statusResponse.Content) .RootElement .GetProperty("state") @@ -136,7 +136,7 @@ Console.WriteLine($"Transaction status: {status}"); State changes to the Confidential Ledger are saved in a data structure called a Merkle tree. To cryptographically verify that writes were correctly saved, a Merkle proof, or receipt, can be retrieved for any transaction id. ```C# Snippet:GetReceipt -Response receiptResponse = ledgerClient.GetReceipt(transactionId); +Response receiptResponse = ledgerClient.GetReceipt(transactionId, new()); string receiptJson = new StreamReader(receiptResponse.ContentStream).ReadToEnd(); Console.WriteLine(receiptJson); @@ -172,7 +172,7 @@ string subLedgerId = JsonDocument.Parse(postResponse.Content) status = "Pending"; while (status == "Pending") { - statusResponse = ledgerClient.GetTransactionStatus(transactionId); + statusResponse = ledgerClient.GetTransactionStatus(transactionId, new()); status = JsonDocument.Parse(statusResponse.Content) .RootElement .GetProperty("state") @@ -182,7 +182,7 @@ while (status == "Pending") Console.WriteLine($"Transaction status: {status}"); // Provide both the transactionId and subLedgerId. -Response getBySubledgerResponse = ledgerClient.GetLedgerEntry(transactionId, subLedgerId); +Response getBySubledgerResponse = ledgerClient.GetLedgerEntry(transactionId, new(), subLedgerId); // Try until the entry is available. bool loaded = false; @@ -199,14 +199,14 @@ while (!loaded) } else { - getBySubledgerResponse = ledgerClient.GetLedgerEntry(transactionId, subLedgerId); + getBySubledgerResponse = ledgerClient.GetLedgerEntry(transactionId, new(), subLedgerId); } } Console.WriteLine(contents); // "Hello world!" // Now just provide the transactionId. -getBySubledgerResponse = ledgerClient.GetLedgerEntry(transactionId); +getBySubledgerResponse = ledgerClient.GetLedgerEntry(transactionId, new()); string subLedgerId2 = JsonDocument.Parse(getBySubledgerResponse.Content) .RootElement @@ -237,7 +237,7 @@ firstPostResponse.Headers.TryGetValue(ConfidentialLedgerConstants.Headers.Transa status = "Pending"; while (status == "Pending") { - statusResponse = ledgerClient.GetTransactionStatus(transactionId); + statusResponse = ledgerClient.GetTransactionStatus(transactionId, new()); status = JsonDocument.Parse(statusResponse.Content) .RootElement .GetProperty("state") @@ -245,7 +245,7 @@ while (status == "Pending") } // The ledger entry written at the transactionId in firstResponse is retrieved from the default sub-ledger. -Response getResponse = ledgerClient.GetLedgerEntry(transactionId); +Response getResponse = ledgerClient.GetLedgerEntry(transactionId, new()); // Try until the entry is available. loaded = false; @@ -262,7 +262,7 @@ while (!loaded) } else { - getResponse = ledgerClient.GetLedgerEntry(transactionId, subLedgerId); + getResponse = ledgerClient.GetLedgerEntry(transactionId, new(), subLedgerId); } } @@ -275,7 +275,7 @@ string firstEntryContents = JsonDocument.Parse(getResponse.Content) Console.WriteLine(firstEntryContents); // "Hello world 0" // This will return the latest entry available in the default sub-ledger. -getResponse = ledgerClient.GetCurrentLedgerEntry(); +getResponse = ledgerClient.GetCurrentLedgerEntry(new()); // Try until the entry is available. loaded = false; @@ -292,7 +292,7 @@ while (!loaded) } else { - getResponse = ledgerClient.GetCurrentLedgerEntry(); + getResponse = ledgerClient.GetCurrentLedgerEntry(new()); } } @@ -305,14 +305,14 @@ subLedgerPostResponse.Headers.TryGetValue(ConfidentialLedgerConstants.Transactio status = "Pending"; while (status == "Pending") { - statusResponse = ledgerClient.GetTransactionStatus(subLedgerTransactionId); + statusResponse = ledgerClient.GetTransactionStatus(subLedgerTransactionId, new()); status = JsonDocument.Parse(statusResponse.Content) .RootElement .GetProperty("state") .GetString(); } -getResponse = ledgerClient.GetLedgerEntry(subLedgerTransactionId, "my sub-ledger"); +getResponse = ledgerClient.GetLedgerEntry(subLedgerTransactionId, new(), "my sub-ledger"); // Try until the entry is available. loaded = false; element = default; @@ -328,14 +328,14 @@ while (!loaded) } else { - getResponse = ledgerClient.GetLedgerEntry(subLedgerTransactionId, "my sub-ledger"); + getResponse = ledgerClient.GetLedgerEntry(subLedgerTransactionId, new(), "my sub-ledger"); } } Console.WriteLine(subLedgerEntry); // "Hello world sub-ledger 0" // This will return the latest entry available in the sub-ledger. -getResponse = ledgerClient.GetCurrentLedgerEntry("my sub-ledger"); +getResponse = ledgerClient.GetCurrentLedgerEntry(new(), "my sub-ledger"); string latestSubLedger = JsonDocument.Parse(getResponse.Content) .RootElement .GetProperty("contents") @@ -350,7 +350,7 @@ Ledger entries in a sub-ledger may be retrieved over a range of transaction ids. Note: Both ranges are optional; they can be provided individually or not at all. ```C# Snippet:RangedQuery -ledgerClient.GetLedgerEntries(fromTransactionId: "2.1", toTransactionId: subLedgerTransactionId); +ledgerClient.GetLedgerEntries(new(), fromTransactionId: "2.1", toTransactionId: subLedgerTransactionId); ``` ### User management @@ -370,7 +370,7 @@ ledgerClient.CreateOrUpdateUser( One may want to validate details about the Confidential Ledger for a variety of reasons. For example, you may want to view details about how Microsoft may manage your Confidential Ledger as part of [Confidential Consortium Framework governance](https://microsoft.github.io/CCF/main/governance/index.html), or verify that your Confidential Ledger is indeed running in SGX enclaves. A number of client methods are provided for these use cases. ```C# Snippet:Consortium -Response consortiumResponse = ledgerClient.GetConsortiumMembers(); +Response consortiumResponse = ledgerClient.GetConsortiumMembers(new()); string membersJson = new StreamReader(consortiumResponse.ContentStream).ReadToEnd(); // Consortium members can manage and alter the Confidential Ledger, such as by replacing unhealthy nodes. @@ -378,13 +378,13 @@ Console.WriteLine(membersJson); // The constitution is a collection of JavaScript code that defines actions available to members, // and vets proposals by members to execute those actions. -Response constitutionResponse = ledgerClient.GetConstitution(); +Response constitutionResponse = ledgerClient.GetConstitution(new()); string constitutionJson = new StreamReader(constitutionResponse.ContentStream).ReadToEnd(); Console.WriteLine(constitutionJson); // Enclave quotes contain material that can be used to cryptographically verify the validity and contents of an enclave. -Response enclavesResponse = ledgerClient.GetEnclaveQuotes(); +Response enclavesResponse = ledgerClient.GetEnclaveQuotes(new()); string enclavesJson = new StreamReader(enclavesResponse.ContentStream).ReadToEnd(); Console.WriteLine(enclavesJson); diff --git a/sdk/confidentialledger/Azure.Security.ConfidentialLedger/api/Azure.Security.ConfidentialLedger.netstandard2.0.cs b/sdk/confidentialledger/Azure.Security.ConfidentialLedger/api/Azure.Security.ConfidentialLedger.netstandard2.0.cs index f05d1fda9b4ab..f482911b1f592 100644 --- a/sdk/confidentialledger/Azure.Security.ConfidentialLedger/api/Azure.Security.ConfidentialLedger.netstandard2.0.cs +++ b/sdk/confidentialledger/Azure.Security.ConfidentialLedger/api/Azure.Security.ConfidentialLedger.netstandard2.0.cs @@ -9,24 +9,24 @@ public ConfidentialLedgerClient(System.Uri ledgerUri, Azure.Core.TokenCredential public virtual System.Threading.Tasks.Task CreateOrUpdateUserAsync(string userId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual Azure.Response DeleteUser(string userId, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task DeleteUserAsync(string userId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetConsortiumMembers(Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetConsortiumMembersAsync(Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetConstitution(Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetConstitutionAsync(Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetCurrentLedgerEntry(string subLedgerId = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetCurrentLedgerEntryAsync(string subLedgerId = null, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetEnclaveQuotes(Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetEnclaveQuotesAsync(Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetLedgerEntries(string subLedgerId = null, string fromTransactionId = null, string toTransactionId = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetLedgerEntriesAsync(string subLedgerId = null, string fromTransactionId = null, string toTransactionId = null, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetLedgerEntry(string transactionId, string subLedgerId = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetLedgerEntryAsync(string transactionId, string subLedgerId = null, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetReceipt(string transactionId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetReceiptAsync(string transactionId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetTransactionStatus(string transactionId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetTransactionStatusAsync(string transactionId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetUser(string userId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetUserAsync(string userId, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response GetConsortiumMembers(Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetConsortiumMembersAsync(Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetConstitution(Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetConstitutionAsync(Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetCurrentLedgerEntry(Azure.RequestOptions options, string subLedgerId = null) { throw null; } + public virtual System.Threading.Tasks.Task GetCurrentLedgerEntryAsync(Azure.RequestOptions options, string subLedgerId = null) { throw null; } + public virtual Azure.Response GetEnclaveQuotes(Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetEnclaveQuotesAsync(Azure.RequestOptions options) { throw null; } + public virtual Azure.Pageable GetLedgerEntries(Azure.RequestOptions options, string subLedgerId = null, string fromTransactionId = null, string toTransactionId = null) { throw null; } + public virtual Azure.AsyncPageable GetLedgerEntriesAsync(Azure.RequestOptions options, string subLedgerId = null, string fromTransactionId = null, string toTransactionId = null) { throw null; } + public virtual Azure.Response GetLedgerEntry(string transactionId, Azure.RequestOptions options, string subLedgerId = null) { throw null; } + public virtual System.Threading.Tasks.Task GetLedgerEntryAsync(string transactionId, Azure.RequestOptions options, string subLedgerId = null) { throw null; } + public virtual Azure.Response GetReceipt(string transactionId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetReceiptAsync(string transactionId, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetTransactionStatus(string transactionId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetTransactionStatusAsync(string transactionId, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetUser(string userId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetUserAsync(string userId, Azure.RequestOptions options) { throw null; } public virtual Azure.Response PostLedgerEntry(Azure.Core.RequestContent content, string subLedgerId = null, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task PostLedgerEntryAsync(Azure.Core.RequestContent content, string subLedgerId = null, Azure.RequestOptions options = null) { throw null; } } @@ -47,8 +47,8 @@ public partial class ConfidentialLedgerIdentityServiceClient protected ConfidentialLedgerIdentityServiceClient() { } public ConfidentialLedgerIdentityServiceClient(System.Uri identityServiceUri, Azure.Security.ConfidentialLedger.ConfidentialLedgerClientOptions options = null) { } public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } - public virtual Azure.Response GetLedgerIdentity(string ledgerId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetLedgerIdentityAsync(string ledgerId, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response GetLedgerIdentity(string ledgerId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetLedgerIdentityAsync(string ledgerId, Azure.RequestOptions options) { throw null; } public static System.Security.Cryptography.X509Certificates.X509Certificate2 ParseCertificate(Azure.Response getIdentityResponse) { throw null; } } } diff --git a/sdk/confidentialledger/Azure.Security.ConfidentialLedger/src/Azure.Security.ConfidentialLedger.csproj b/sdk/confidentialledger/Azure.Security.ConfidentialLedger/src/Azure.Security.ConfidentialLedger.csproj index 27632fa71df78..c635e8d6e7be4 100644 --- a/sdk/confidentialledger/Azure.Security.ConfidentialLedger/src/Azure.Security.ConfidentialLedger.csproj +++ b/sdk/confidentialledger/Azure.Security.ConfidentialLedger/src/Azure.Security.ConfidentialLedger.csproj @@ -5,6 +5,7 @@ 1.0.0-beta.3 Azure ConfidentialLedger $(RequiredTargetFrameworks) + $(DefineConstants);EXPERIMENTAL @@ -15,7 +16,6 @@ - diff --git a/sdk/confidentialledger/Azure.Security.ConfidentialLedger/src/ConfidentialLedgerIdentityServiceClient.cs b/sdk/confidentialledger/Azure.Security.ConfidentialLedger/src/ConfidentialLedgerIdentityServiceClient.cs index 53557da3839b8..bbbab9100a455 100644 --- a/sdk/confidentialledger/Azure.Security.ConfidentialLedger/src/ConfidentialLedgerIdentityServiceClient.cs +++ b/sdk/confidentialledger/Azure.Security.ConfidentialLedger/src/ConfidentialLedgerIdentityServiceClient.cs @@ -33,8 +33,8 @@ public ConfidentialLedgerIdentityServiceClient(Uri identityServiceUri, Confident options ??= new ConfidentialLedgerClientOptions(); _clientDiagnostics = new ClientDiagnostics(options); _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, Array.Empty(), new ResponseClassifier()); - this.identityServiceUri = identityServiceUri; - apiVersion = options.Version; + _identityServiceUri = identityServiceUri; + _apiVersion = options.Version; } /// diff --git a/sdk/confidentialledger/Azure.Security.ConfidentialLedger/src/Generated/ConfidentialLedgerClient.cs b/sdk/confidentialledger/Azure.Security.ConfidentialLedger/src/Generated/ConfidentialLedgerClient.cs index ef28507be37b6..2c9f0f7c736e0 100644 --- a/sdk/confidentialledger/Azure.Security.ConfidentialLedger/src/Generated/ConfidentialLedgerClient.cs +++ b/sdk/confidentialledger/Azure.Security.ConfidentialLedger/src/Generated/ConfidentialLedgerClient.cs @@ -6,6 +6,9 @@ #nullable disable using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; @@ -16,14 +19,16 @@ namespace Azure.Security.ConfidentialLedger /// The ConfidentialLedger service client. public partial class ConfidentialLedgerClient { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://confidential-ledger.azure.com/.default" }; + private static readonly string[] AuthorizationScopes = { "https://confidential-ledger.azure.com/.default" }; private readonly TokenCredential _tokenCredential; - private Uri ledgerUri; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _ledgerUri; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of ConfidentialLedgerClient for mocking. protected ConfidentialLedgerClient() @@ -34,6 +39,7 @@ protected ConfidentialLedgerClient() /// The Confidential Ledger URL, for example https://contoso.confidentialledger.azure.com. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. + /// or is null. public ConfidentialLedgerClient(Uri ledgerUri, TokenCredential credential, ConfidentialLedgerClientOptions options = null) { if (ledgerUri == null) @@ -46,15 +52,16 @@ public ConfidentialLedgerClient(Uri ledgerUri, TokenCredential credential, Confi } options ??= new ConfidentialLedgerClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); _tokenCredential = credential; - var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); - _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { authPolicy }, new ResponseClassifier()); - this.ledgerUri = ledgerUri; - apiVersion = options.Version; + _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _ledgerUri = ledgerUri; + _apiVersion = options.Version; } /// The constitution is a script that assesses and applies proposals from consortium members. + /// The request options. /// /// Schema for Response Body: /// { @@ -62,7 +69,6 @@ public ConfidentialLedgerClient(Uri ledgerUri, TokenCredential credential, Confi /// script: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -74,33 +80,16 @@ public ConfidentialLedgerClient(Uri ledgerUri, TokenCredential credential, Confi /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetConstitutionAsync(RequestOptions options = null) + public virtual async Task GetConstitutionAsync(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetConstitutionRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("ConfidentialLedgerClient.GetConstitution"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetConstitutionRequest(); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -110,6 +99,7 @@ public virtual async Task GetConstitutionAsync(RequestOptions options } /// The constitution is a script that assesses and applies proposals from consortium members. + /// The request options. /// /// Schema for Response Body: /// { @@ -117,7 +107,6 @@ public virtual async Task GetConstitutionAsync(RequestOptions options /// script: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -129,33 +118,16 @@ public virtual async Task GetConstitutionAsync(RequestOptions options /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetConstitution(RequestOptions options = null) + public virtual Response GetConstitution(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetConstitutionRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("ConfidentialLedgerClient.GetConstitution"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetConstitutionRequest(); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -164,21 +136,8 @@ public virtual Response GetConstitution(RequestOptions options = null) } } - private HttpMessage CreateGetConstitutionRequest() - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(ledgerUri); - uri.AppendPath("/app/governance/constitution", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Consortium members can manage the Confidential Ledger. + /// The request options. /// /// Schema for Response Body: /// { @@ -190,7 +149,6 @@ private HttpMessage CreateGetConstitutionRequest() /// ] /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -202,33 +160,16 @@ private HttpMessage CreateGetConstitutionRequest() /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetConsortiumMembersAsync(RequestOptions options = null) + public virtual async Task GetConsortiumMembersAsync(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetConsortiumMembersRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("ConfidentialLedgerClient.GetConsortiumMembers"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetConsortiumMembersRequest(); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -238,6 +179,7 @@ public virtual async Task GetConsortiumMembersAsync(RequestOptions opt } /// Consortium members can manage the Confidential Ledger. + /// The request options. /// /// Schema for Response Body: /// { @@ -249,7 +191,6 @@ public virtual async Task GetConsortiumMembersAsync(RequestOptions opt /// ] /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -261,33 +202,16 @@ public virtual async Task GetConsortiumMembersAsync(RequestOptions opt /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetConsortiumMembers(RequestOptions options = null) + public virtual Response GetConsortiumMembers(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetConsortiumMembersRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("ConfidentialLedgerClient.GetConsortiumMembers"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetConsortiumMembersRequest(); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -296,21 +220,8 @@ public virtual Response GetConsortiumMembers(RequestOptions options = null) } } - private HttpMessage CreateGetConsortiumMembersRequest() - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(ledgerUri); - uri.AppendPath("/app/governance/members", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// A quote is an SGX enclave measurement that can be used to verify the validity of a node and its enclave. + /// The request options. /// /// Schema for Response Body: /// { @@ -318,7 +229,6 @@ private HttpMessage CreateGetConsortiumMembersRequest() /// enclaveQuotes: Dictionary<string, EnclaveQuote> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -330,33 +240,16 @@ private HttpMessage CreateGetConsortiumMembersRequest() /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetEnclaveQuotesAsync(RequestOptions options = null) + public virtual async Task GetEnclaveQuotesAsync(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetEnclaveQuotesRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("ConfidentialLedgerClient.GetEnclaveQuotes"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetEnclaveQuotesRequest(); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -366,6 +259,7 @@ public virtual async Task GetEnclaveQuotesAsync(RequestOptions options } /// A quote is an SGX enclave measurement that can be used to verify the validity of a node and its enclave. + /// The request options. /// /// Schema for Response Body: /// { @@ -373,7 +267,6 @@ public virtual async Task GetEnclaveQuotesAsync(RequestOptions options /// enclaveQuotes: Dictionary<string, EnclaveQuote> /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -385,112 +278,16 @@ public virtual async Task GetEnclaveQuotesAsync(RequestOptions options /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetEnclaveQuotes(RequestOptions options = null) + public virtual Response GetEnclaveQuotes(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetEnclaveQuotesRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("ConfidentialLedgerClient.GetEnclaveQuotes"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - private HttpMessage CreateGetEnclaveQuotesRequest() - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(ledgerUri); - uri.AppendPath("/app/enclaveQuotes", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// A sub-ledger id may optionally be specified. Only entries in the specified (or default) sub-ledger will be returned. - /// - /// Schema for Response Body: - /// { - /// state: "Loading" | "Ready", - /// @nextLink: string, - /// entries: [ - /// { - /// contents: string, - /// subLedgerId: string, - /// transactionId: string - /// } - /// ] - /// } - /// - /// - /// Schema for Response Error: - /// { - /// error: { - /// code: string, - /// message: string, - /// innererror: ConfidentialLedgerErrorBody - /// } - /// } - /// - /// - /// - /// The sub-ledger id. - /// Specify the first transaction ID in a range. - /// Specify the last transaction ID in a range. - /// The request options. -#pragma warning disable AZC0002 - public virtual async Task GetLedgerEntriesAsync(string subLedgerId = null, string fromTransactionId = null, string toTransactionId = null, RequestOptions options = null) -#pragma warning restore AZC0002 - { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetLedgerEntriesRequest(subLedgerId, fromTransactionId, toTransactionId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("ConfidentialLedgerClient.GetLedgerEntries"); - scope.Start(); - try - { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetEnclaveQuotesRequest(); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -499,98 +296,10 @@ public virtual async Task GetLedgerEntriesAsync(string subLedgerId = n } } - /// A sub-ledger id may optionally be specified. Only entries in the specified (or default) sub-ledger will be returned. - /// - /// Schema for Response Body: - /// { - /// state: "Loading" | "Ready", - /// @nextLink: string, - /// entries: [ - /// { - /// contents: string, - /// subLedgerId: string, - /// transactionId: string - /// } - /// ] - /// } - /// - /// - /// Schema for Response Error: - /// { - /// error: { - /// code: string, - /// message: string, - /// innererror: ConfidentialLedgerErrorBody - /// } - /// } - /// - /// - /// + /// A sub-ledger id may optionally be specified. + /// The content to send as the body of the request. /// The sub-ledger id. - /// Specify the first transaction ID in a range. - /// Specify the last transaction ID in a range. /// The request options. -#pragma warning disable AZC0002 - public virtual Response GetLedgerEntries(string subLedgerId = null, string fromTransactionId = null, string toTransactionId = null, RequestOptions options = null) -#pragma warning restore AZC0002 - { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetLedgerEntriesRequest(subLedgerId, fromTransactionId, toTransactionId); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("ConfidentialLedgerClient.GetLedgerEntries"); - scope.Start(); - try - { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - private HttpMessage CreateGetLedgerEntriesRequest(string subLedgerId, string fromTransactionId, string toTransactionId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(ledgerUri); - uri.AppendPath("/app/transactions", false); - uri.AppendQuery("api-version", apiVersion, true); - if (subLedgerId != null) - { - uri.AppendQuery("subLedgerId", subLedgerId, true); - } - if (fromTransactionId != null) - { - uri.AppendQuery("fromTransactionId", fromTransactionId, true); - } - if (toTransactionId != null) - { - uri.AppendQuery("toTransactionId", toTransactionId, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// A sub-ledger id may optionally be specified. /// /// Schema for Request Body: /// { @@ -599,13 +308,11 @@ private HttpMessage CreateGetLedgerEntriesRequest(string subLedgerId, string fro /// transactionId: string /// } /// - /// /// Schema for Response Body: /// { /// subLedgerId: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -617,35 +324,16 @@ private HttpMessage CreateGetLedgerEntriesRequest(string subLedgerId, string fro /// /// /// - /// The content to send as the body of the request. - /// The sub-ledger id. - /// The request options. #pragma warning disable AZC0002 public virtual async Task PostLedgerEntryAsync(RequestContent content, string subLedgerId = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreatePostLedgerEntryRequest(content, subLedgerId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("ConfidentialLedgerClient.PostLedgerEntry"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreatePostLedgerEntryRequest(content, subLedgerId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -655,6 +343,9 @@ public virtual async Task PostLedgerEntryAsync(RequestContent content, } /// A sub-ledger id may optionally be specified. + /// The content to send as the body of the request. + /// The sub-ledger id. + /// The request options. /// /// Schema for Request Body: /// { @@ -663,13 +354,11 @@ public virtual async Task PostLedgerEntryAsync(RequestContent content, /// transactionId: string /// } /// - /// /// Schema for Response Body: /// { /// subLedgerId: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -681,35 +370,16 @@ public virtual async Task PostLedgerEntryAsync(RequestContent content, /// /// /// - /// The content to send as the body of the request. - /// The sub-ledger id. - /// The request options. #pragma warning disable AZC0002 public virtual Response PostLedgerEntry(RequestContent content, string subLedgerId = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreatePostLedgerEntryRequest(content, subLedgerId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("ConfidentialLedgerClient.PostLedgerEntry"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreatePostLedgerEntryRequest(content, subLedgerId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -718,27 +388,11 @@ public virtual Response PostLedgerEntry(RequestContent content, string subLedger } } - private HttpMessage CreatePostLedgerEntryRequest(RequestContent content, string subLedgerId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(ledgerUri); - uri.AppendPath("/app/transactions", false); - uri.AppendQuery("api-version", apiVersion, true); - if (subLedgerId != null) - { - uri.AppendQuery("subLedgerId", subLedgerId, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - /// To return older ledger entries, the relevant sections of the ledger must be read from disk and validated. To prevent blocking within the enclave, the response will indicate whether the entry is ready and part of the response, or if the loading is still ongoing. + /// Identifies a write transaction. + /// The request options. + /// The sub-ledger id. + /// is null. /// /// Schema for Response Body: /// { @@ -750,7 +404,6 @@ private HttpMessage CreatePostLedgerEntryRequest(RequestContent content, string /// } /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -762,35 +415,16 @@ private HttpMessage CreatePostLedgerEntryRequest(RequestContent content, string /// /// /// - /// Identifies a write transaction. - /// The sub-ledger id. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetLedgerEntryAsync(string transactionId, string subLedgerId = null, RequestOptions options = null) + public virtual async Task GetLedgerEntryAsync(string transactionId, RequestOptions options, string subLedgerId = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetLedgerEntryRequest(transactionId, subLedgerId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("ConfidentialLedgerClient.GetLedgerEntry"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetLedgerEntryRequest(transactionId, subLedgerId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -800,6 +434,10 @@ public virtual async Task GetLedgerEntryAsync(string transactionId, st } /// To return older ledger entries, the relevant sections of the ledger must be read from disk and validated. To prevent blocking within the enclave, the response will indicate whether the entry is ready and part of the response, or if the loading is still ongoing. + /// Identifies a write transaction. + /// The request options. + /// The sub-ledger id. + /// is null. /// /// Schema for Response Body: /// { @@ -811,7 +449,6 @@ public virtual async Task GetLedgerEntryAsync(string transactionId, st /// } /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -823,35 +460,16 @@ public virtual async Task GetLedgerEntryAsync(string transactionId, st /// /// /// - /// Identifies a write transaction. - /// The sub-ledger id. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetLedgerEntry(string transactionId, string subLedgerId = null, RequestOptions options = null) + public virtual Response GetLedgerEntry(string transactionId, RequestOptions options, string subLedgerId = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetLedgerEntryRequest(transactionId, subLedgerId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("ConfidentialLedgerClient.GetLedgerEntry"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetLedgerEntryRequest(transactionId, subLedgerId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -860,26 +478,10 @@ public virtual Response GetLedgerEntry(string transactionId, string subLedgerId } } - private HttpMessage CreateGetLedgerEntryRequest(string transactionId, string subLedgerId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(ledgerUri); - uri.AppendPath("/app/transactions/", false); - uri.AppendPath(transactionId, true); - uri.AppendQuery("api-version", apiVersion, true); - if (subLedgerId != null) - { - uri.AppendQuery("subLedgerId", subLedgerId, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Gets a receipt certifying ledger contents at a particular transaction id. + /// Identifies a write transaction. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -899,7 +501,6 @@ private HttpMessage CreateGetLedgerEntryRequest(string transactionId, string sub /// transactionId: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -911,34 +512,16 @@ private HttpMessage CreateGetLedgerEntryRequest(string transactionId, string sub /// /// /// - /// Identifies a write transaction. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetReceiptAsync(string transactionId, RequestOptions options = null) + public virtual async Task GetReceiptAsync(string transactionId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetReceiptRequest(transactionId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("ConfidentialLedgerClient.GetReceipt"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetReceiptRequest(transactionId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -948,6 +531,9 @@ public virtual async Task GetReceiptAsync(string transactionId, Reques } /// Gets a receipt certifying ledger contents at a particular transaction id. + /// Identifies a write transaction. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -967,7 +553,6 @@ public virtual async Task GetReceiptAsync(string transactionId, Reques /// transactionId: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -979,34 +564,16 @@ public virtual async Task GetReceiptAsync(string transactionId, Reques /// /// /// - /// Identifies a write transaction. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetReceipt(string transactionId, RequestOptions options = null) + public virtual Response GetReceipt(string transactionId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetReceiptRequest(transactionId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("ConfidentialLedgerClient.GetReceipt"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetReceiptRequest(transactionId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1015,23 +582,10 @@ public virtual Response GetReceipt(string transactionId, RequestOptions options } } - private HttpMessage CreateGetReceiptRequest(string transactionId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(ledgerUri); - uri.AppendPath("/app/transactions/", false); - uri.AppendPath(transactionId, true); - uri.AppendPath("/receipt", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Gets the status of an entry identified by a transaction id. + /// Identifies a write transaction. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -1039,7 +593,6 @@ private HttpMessage CreateGetReceiptRequest(string transactionId) /// transactionId: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1051,34 +604,16 @@ private HttpMessage CreateGetReceiptRequest(string transactionId) /// /// /// - /// Identifies a write transaction. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetTransactionStatusAsync(string transactionId, RequestOptions options = null) + public virtual async Task GetTransactionStatusAsync(string transactionId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetTransactionStatusRequest(transactionId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("ConfidentialLedgerClient.GetTransactionStatus"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetTransactionStatusRequest(transactionId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1088,6 +623,9 @@ public virtual async Task GetTransactionStatusAsync(string transaction } /// Gets the status of an entry identified by a transaction id. + /// Identifies a write transaction. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -1095,7 +633,6 @@ public virtual async Task GetTransactionStatusAsync(string transaction /// transactionId: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1107,34 +644,16 @@ public virtual async Task GetTransactionStatusAsync(string transaction /// /// /// - /// Identifies a write transaction. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetTransactionStatus(string transactionId, RequestOptions options = null) + public virtual Response GetTransactionStatus(string transactionId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetTransactionStatusRequest(transactionId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("ConfidentialLedgerClient.GetTransactionStatus"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetTransactionStatusRequest(transactionId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1143,23 +662,9 @@ public virtual Response GetTransactionStatus(string transactionId, RequestOption } } - private HttpMessage CreateGetTransactionStatusRequest(string transactionId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(ledgerUri); - uri.AppendPath("/app/transactions/", false); - uri.AppendPath(transactionId, true); - uri.AppendPath("/status", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// A sub-ledger id may optionally be specified. + /// The request options. + /// The sub-ledger id. /// /// Schema for Response Body: /// { @@ -1168,7 +673,6 @@ private HttpMessage CreateGetTransactionStatusRequest(string transactionId) /// transactionId: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1180,34 +684,16 @@ private HttpMessage CreateGetTransactionStatusRequest(string transactionId) /// /// /// - /// The sub-ledger id. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetCurrentLedgerEntryAsync(string subLedgerId = null, RequestOptions options = null) + public virtual async Task GetCurrentLedgerEntryAsync(RequestOptions options, string subLedgerId = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetCurrentLedgerEntryRequest(subLedgerId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("ConfidentialLedgerClient.GetCurrentLedgerEntry"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetCurrentLedgerEntryRequest(subLedgerId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1217,6 +703,8 @@ public virtual async Task GetCurrentLedgerEntryAsync(string subLedgerI } /// A sub-ledger id may optionally be specified. + /// The request options. + /// The sub-ledger id. /// /// Schema for Response Body: /// { @@ -1225,7 +713,6 @@ public virtual async Task GetCurrentLedgerEntryAsync(string subLedgerI /// transactionId: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1237,34 +724,16 @@ public virtual async Task GetCurrentLedgerEntryAsync(string subLedgerI /// /// /// - /// The sub-ledger id. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetCurrentLedgerEntry(string subLedgerId = null, RequestOptions options = null) + public virtual Response GetCurrentLedgerEntry(RequestOptions options, string subLedgerId = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetCurrentLedgerEntryRequest(subLedgerId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("ConfidentialLedgerClient.GetCurrentLedgerEntry"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetCurrentLedgerEntryRequest(subLedgerId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1273,25 +742,10 @@ public virtual Response GetCurrentLedgerEntry(string subLedgerId = null, Request } } - private HttpMessage CreateGetCurrentLedgerEntryRequest(string subLedgerId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(ledgerUri); - uri.AppendPath("/app/transactions/current", false); - uri.AppendQuery("api-version", apiVersion, true); - if (subLedgerId != null) - { - uri.AppendQuery("subLedgerId", subLedgerId, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Deletes a user from the Confidential Ledger. + /// The user id, either an AAD object ID or certificate fingerprint. + /// The request options. + /// is null. /// /// Schema for Response Error: /// { @@ -1304,34 +758,16 @@ private HttpMessage CreateGetCurrentLedgerEntryRequest(string subLedgerId) /// /// /// - /// The user id, either an AAD object ID or certificate fingerprint. - /// The request options. #pragma warning disable AZC0002 public virtual async Task DeleteUserAsync(string userId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteUserRequest(userId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("ConfidentialLedgerClient.DeleteUser"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteUserRequest(userId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1341,6 +777,9 @@ public virtual async Task DeleteUserAsync(string userId, RequestOption } /// Deletes a user from the Confidential Ledger. + /// The user id, either an AAD object ID or certificate fingerprint. + /// The request options. + /// is null. /// /// Schema for Response Error: /// { @@ -1353,34 +792,16 @@ public virtual async Task DeleteUserAsync(string userId, RequestOption /// /// /// - /// The user id, either an AAD object ID or certificate fingerprint. - /// The request options. #pragma warning disable AZC0002 public virtual Response DeleteUser(string userId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteUserRequest(userId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("ConfidentialLedgerClient.DeleteUser"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteUserRequest(userId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1389,22 +810,10 @@ public virtual Response DeleteUser(string userId, RequestOptions options = null) } } - private HttpMessage CreateDeleteUserRequest(string userId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(ledgerUri); - uri.AppendPath("/app/users/", false); - uri.AppendPath(userId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Gets a user. + /// The user id, either an AAD object ID or certificate fingerprint. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -1412,7 +821,6 @@ private HttpMessage CreateDeleteUserRequest(string userId) /// userId: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1424,34 +832,16 @@ private HttpMessage CreateDeleteUserRequest(string userId) /// /// /// - /// The user id, either an AAD object ID or certificate fingerprint. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetUserAsync(string userId, RequestOptions options = null) + public virtual async Task GetUserAsync(string userId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetUserRequest(userId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("ConfidentialLedgerClient.GetUser"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetUserRequest(userId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1461,6 +851,9 @@ public virtual async Task GetUserAsync(string userId, RequestOptions o } /// Gets a user. + /// The user id, either an AAD object ID or certificate fingerprint. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -1468,7 +861,6 @@ public virtual async Task GetUserAsync(string userId, RequestOptions o /// userId: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1480,34 +872,16 @@ public virtual async Task GetUserAsync(string userId, RequestOptions o /// /// /// - /// The user id, either an AAD object ID or certificate fingerprint. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetUser(string userId, RequestOptions options = null) + public virtual Response GetUser(string userId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetUserRequest(userId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("ConfidentialLedgerClient.GetUser"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetUserRequest(userId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1516,22 +890,11 @@ public virtual Response GetUser(string userId, RequestOptions options = null) } } - private HttpMessage CreateGetUserRequest(string userId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(ledgerUri); - uri.AppendPath("/app/users/", false); - uri.AppendPath(userId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// A JSON merge patch is applied for existing users. + /// The user id, either an AAD object ID or certificate fingerprint. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// /// Schema for Request Body: /// { @@ -1539,14 +902,12 @@ private HttpMessage CreateGetUserRequest(string userId) /// userId: string /// } /// - /// /// Schema for Response Body: /// { /// assignedRole: "Administrator" | "Contributor" | "Reader", /// userId: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1558,35 +919,16 @@ private HttpMessage CreateGetUserRequest(string userId) /// /// /// - /// The user id, either an AAD object ID or certificate fingerprint. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task CreateOrUpdateUserAsync(string userId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateUserRequest(userId, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("ConfidentialLedgerClient.CreateOrUpdateUser"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateUserRequest(userId, content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1596,6 +938,10 @@ public virtual async Task CreateOrUpdateUserAsync(string userId, Reque } /// A JSON merge patch is applied for existing users. + /// The user id, either an AAD object ID or certificate fingerprint. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// /// Schema for Request Body: /// { @@ -1603,14 +949,12 @@ public virtual async Task CreateOrUpdateUserAsync(string userId, Reque /// userId: string /// } /// - /// /// Schema for Response Body: /// { /// assignedRole: "Administrator" | "Contributor" | "Reader", /// userId: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1622,35 +966,16 @@ public virtual async Task CreateOrUpdateUserAsync(string userId, Reque /// /// /// - /// The user id, either an AAD object ID or certificate fingerprint. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response CreateOrUpdateUser(string userId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateUserRequest(userId, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("ConfidentialLedgerClient.CreateOrUpdateUser"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateUserRequest(userId, content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1659,21 +984,359 @@ public virtual Response CreateOrUpdateUser(string userId, RequestContent content } } - private HttpMessage CreateCreateOrUpdateUserRequest(string userId, RequestContent content) + /// A sub-ledger id may optionally be specified. Only entries in the specified (or default) sub-ledger will be returned. + /// The request options. + /// The sub-ledger id. + /// Specify the first transaction ID in a range. + /// Specify the last transaction ID in a range. + /// + /// Schema for Response Body: + /// { + /// state: "Loading" | "Ready", + /// @nextLink: string, + /// entries: [ + /// { + /// contents: string, + /// subLedgerId: string, + /// transactionId: string + /// } + /// ] + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// message: string, + /// innererror: ConfidentialLedgerErrorBody + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual AsyncPageable GetLedgerEntriesAsync(RequestOptions options, string subLedgerId = null, string fromTransactionId = null, string toTransactionId = null) +#pragma warning restore AZC0002 + { + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "ConfidentialLedgerClient.GetLedgerEntries"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetLedgerEntriesRequest(subLedgerId, fromTransactionId, toTransactionId) + : CreateGetLedgerEntriesNextPageRequest(nextLink, subLedgerId, fromTransactionId, toTransactionId); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "entries", "@nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + /// A sub-ledger id may optionally be specified. Only entries in the specified (or default) sub-ledger will be returned. + /// The request options. + /// The sub-ledger id. + /// Specify the first transaction ID in a range. + /// Specify the last transaction ID in a range. + /// + /// Schema for Response Body: + /// { + /// state: "Loading" | "Ready", + /// @nextLink: string, + /// entries: [ + /// { + /// contents: string, + /// subLedgerId: string, + /// transactionId: string + /// } + /// ] + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// message: string, + /// innererror: ConfidentialLedgerErrorBody + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual Pageable GetLedgerEntries(RequestOptions options, string subLedgerId = null, string fromTransactionId = null, string toTransactionId = null) +#pragma warning restore AZC0002 + { + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "ConfidentialLedgerClient.GetLedgerEntries"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetLedgerEntriesRequest(subLedgerId, fromTransactionId, toTransactionId) + : CreateGetLedgerEntriesNextPageRequest(nextLink, subLedgerId, fromTransactionId, toTransactionId); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "entries", "@nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + internal HttpMessage CreateGetConstitutionRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_ledgerUri); + uri.AppendPath("/app/governance/constitution", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetConsortiumMembersRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_ledgerUri); + uri.AppendPath("/app/governance/members", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetEnclaveQuotesRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_ledgerUri); + uri.AppendPath("/app/enclaveQuotes", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetLedgerEntriesRequest(string subLedgerId, string fromTransactionId, string toTransactionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_ledgerUri); + uri.AppendPath("/app/transactions", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (subLedgerId != null) + { + uri.AppendQuery("subLedgerId", subLedgerId, true); + } + if (fromTransactionId != null) + { + uri.AppendQuery("fromTransactionId", fromTransactionId, true); + } + if (toTransactionId != null) + { + uri.AppendQuery("toTransactionId", toTransactionId, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreatePostLedgerEntryRequest(RequestContent content, string subLedgerId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_ledgerUri); + uri.AppendPath("/app/transactions", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (subLedgerId != null) + { + uri.AppendQuery("subLedgerId", subLedgerId, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetLedgerEntryRequest(string transactionId, string subLedgerId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_ledgerUri); + uri.AppendPath("/app/transactions/", false); + uri.AppendPath(transactionId, true); + uri.AppendQuery("api-version", _apiVersion, true); + if (subLedgerId != null) + { + uri.AppendQuery("subLedgerId", subLedgerId, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetReceiptRequest(string transactionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_ledgerUri); + uri.AppendPath("/app/transactions/", false); + uri.AppendPath(transactionId, true); + uri.AppendPath("/receipt", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetTransactionStatusRequest(string transactionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_ledgerUri); + uri.AppendPath("/app/transactions/", false); + uri.AppendPath(transactionId, true); + uri.AppendPath("/status", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetCurrentLedgerEntryRequest(string subLedgerId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_ledgerUri); + uri.AppendPath("/app/transactions/current", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (subLedgerId != null) + { + uri.AppendQuery("subLedgerId", subLedgerId, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateDeleteUserRequest(string userId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_ledgerUri); + uri.AppendPath("/app/users/", false); + uri.AppendPath(userId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier204.Instance; + return message; + } + + internal HttpMessage CreateGetUserRequest(string userId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_ledgerUri); + uri.AppendPath("/app/users/", false); + uri.AppendPath(userId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateOrUpdateUserRequest(string userId, RequestContent content) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Patch; var uri = new RawRequestUriBuilder(); - uri.Reset(ledgerUri); + uri.Reset(_ledgerUri); uri.AppendPath("/app/users/", false); uri.AppendPath(userId, true); - uri.AppendQuery("api-version", apiVersion, 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; + message.ResponseClassifier = ResponseClassifier200.Instance; return message; } + + internal HttpMessage CreateGetLedgerEntriesNextPageRequest(string nextLink, string subLedgerId, string fromTransactionId, string toTransactionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_ledgerUri); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier204 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier204(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 204 => false, + _ => true + }; + } + } } } diff --git a/sdk/confidentialledger/Azure.Security.ConfidentialLedger/src/Generated/ConfidentialLedgerIdentityServiceClient.cs b/sdk/confidentialledger/Azure.Security.ConfidentialLedger/src/Generated/ConfidentialLedgerIdentityServiceClient.cs index bce291bad3a8c..2a533e3f02edf 100644 --- a/sdk/confidentialledger/Azure.Security.ConfidentialLedger/src/Generated/ConfidentialLedgerIdentityServiceClient.cs +++ b/sdk/confidentialledger/Azure.Security.ConfidentialLedger/src/Generated/ConfidentialLedgerIdentityServiceClient.cs @@ -16,14 +16,16 @@ namespace Azure.Security.ConfidentialLedger /// The ConfidentialLedgerIdentityService service client. public partial class ConfidentialLedgerIdentityServiceClient { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://confidential-ledger.azure.com/.default" }; + private static readonly string[] AuthorizationScopes = { "https://confidential-ledger.azure.com/.default" }; private readonly TokenCredential _tokenCredential; - private Uri identityServiceUri; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _identityServiceUri; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of ConfidentialLedgerIdentityServiceClient for mocking. protected ConfidentialLedgerIdentityServiceClient() @@ -31,6 +33,9 @@ protected ConfidentialLedgerIdentityServiceClient() } /// Gets identity information for a Confidential Ledger instance. + /// Id of the Confidential Ledger instance to get information for. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -38,7 +43,6 @@ protected ConfidentialLedgerIdentityServiceClient() /// ledgerTlsCertificate: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -50,34 +54,16 @@ protected ConfidentialLedgerIdentityServiceClient() /// /// /// - /// Id of the Confidential Ledger instance to get information for. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetLedgerIdentityAsync(string ledgerId, RequestOptions options = null) + public virtual async Task GetLedgerIdentityAsync(string ledgerId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetLedgerIdentityRequest(ledgerId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("ConfidentialLedgerIdentityServiceClient.GetLedgerIdentity"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetLedgerIdentityRequest(ledgerId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -87,6 +73,9 @@ public virtual async Task GetLedgerIdentityAsync(string ledgerId, Requ } /// Gets identity information for a Confidential Ledger instance. + /// Id of the Confidential Ledger instance to get information for. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -94,7 +83,6 @@ public virtual async Task GetLedgerIdentityAsync(string ledgerId, Requ /// ledgerTlsCertificate: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -106,34 +94,16 @@ public virtual async Task GetLedgerIdentityAsync(string ledgerId, Requ /// /// /// - /// Id of the Confidential Ledger instance to get information for. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetLedgerIdentity(string ledgerId, RequestOptions options = null) + public virtual Response GetLedgerIdentity(string ledgerId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetLedgerIdentityRequest(ledgerId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("ConfidentialLedgerIdentityServiceClient.GetLedgerIdentity"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetLedgerIdentityRequest(ledgerId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -142,19 +112,34 @@ public virtual Response GetLedgerIdentity(string ledgerId, RequestOptions option } } - private HttpMessage CreateGetLedgerIdentityRequest(string ledgerId) + internal HttpMessage CreateGetLedgerIdentityRequest(string ledgerId) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); - uri.Reset(identityServiceUri); + uri.Reset(_identityServiceUri); uri.AppendPath("/ledgerIdentity/", false); uri.AppendPath(ledgerId, true); - uri.AppendQuery("api-version", apiVersion, true); + uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; return message; } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } } } diff --git a/sdk/confidentialledger/Azure.Security.ConfidentialLedger/tests/ConfidentialLedgerClientLiveTests.cs b/sdk/confidentialledger/Azure.Security.ConfidentialLedger/tests/ConfidentialLedgerClientLiveTests.cs index 5b7c26f767bfb..b0519b6fbebce 100644 --- a/sdk/confidentialledger/Azure.Security.ConfidentialLedger/tests/ConfidentialLedgerClientLiveTests.cs +++ b/sdk/confidentialledger/Azure.Security.ConfidentialLedger/tests/ConfidentialLedgerClientLiveTests.cs @@ -51,95 +51,95 @@ public void Setup() public async Task GetUser(string objId) { - var result = await Client.GetUserAsync(objId); + var result = await Client.GetUserAsync(objId, new()); var stringResult = new StreamReader(result.ContentStream).ReadToEnd(); Assert.AreEqual((int)HttpStatusCode.OK, result.Status); Assert.That(stringResult, Does.Contain(objId)); } - [RecordedTest] - public async Task GetLedgerEntries() - { - await PostLedgerEntry(); - - var result = await Client.GetLedgerEntriesAsync(); - - var nextLinkDetails = GetNextLinkDetails(result); - while (nextLinkDetails != null) - { - var fromId = nextLinkDetails["fromTransactionId"]; - var subId = nextLinkDetails["subLedgerId"]; - result = await Client.GetLedgerEntriesAsync(subId, fromId).ConfigureAwait(false); - Assert.AreEqual((int)HttpStatusCode.OK, result.Status); - nextLinkDetails = GetNextLinkDetails(result); - } - } - - [RecordedTest] - public async Task GetLedgerEntry() - { - await PostLedgerEntry(); - - var result = await Client.GetLedgerEntriesAsync(); - var stringResult = new StreamReader(result.ContentStream).ReadToEnd(); - - while (stringResult.Contains("Loading")) - { - result = await Client.GetLedgerEntriesAsync().ConfigureAwait(false); - stringResult = new StreamReader(result.ContentStream).ReadToEnd(); - } - var transactionId = GetFirstTransactionId(result); - result = await Client.GetLedgerEntryAsync(transactionId).ConfigureAwait(false); - - Assert.AreEqual((int)HttpStatusCode.OK, result.Status); - Assert.That(stringResult, Does.Contain(transactionId)); - } - - [RecordedTest] - public async Task GetReceipt() - { - await PostLedgerEntry(); - - var result = await Client.GetLedgerEntriesAsync(); - var stringResult = new StreamReader(result.ContentStream).ReadToEnd(); - - while (stringResult.Contains("Loading")) - { - result = await Client.GetLedgerEntriesAsync().ConfigureAwait(false); - stringResult = new StreamReader(result.ContentStream).ReadToEnd(); - } - var transactionId = GetFirstTransactionId(result); - result = await Client.GetReceiptAsync(transactionId).ConfigureAwait(false); - - Assert.AreEqual((int)HttpStatusCode.OK, result.Status); - Assert.That(stringResult, Does.Contain(transactionId)); - } - - [RecordedTest] - public async Task GetTransactionStatus() - { - await PostLedgerEntry(); - - var result = await Client.GetLedgerEntriesAsync(); - var stringResult = new StreamReader(result.ContentStream).ReadToEnd(); - - while (stringResult.Contains("Loading")) - { - result = await Client.GetLedgerEntriesAsync().ConfigureAwait(false); - stringResult = new StreamReader(result.ContentStream).ReadToEnd(); - } - var transactionId = GetFirstTransactionId(result); - result = await Client.GetTransactionStatusAsync(transactionId).ConfigureAwait(false); - - Assert.AreEqual((int)HttpStatusCode.OK, result.Status); - Assert.That(stringResult, Does.Contain(transactionId)); - } + //[RecordedTest] + //public async Task GetLedgerEntries() + //{ + // await PostLedgerEntry(); + + // var result = await Client.GetLedgerEntriesAsync(); + + // var nextLinkDetails = GetNextLinkDetails(result); + // while (nextLinkDetails != null) + // { + // var fromId = nextLinkDetails["fromTransactionId"]; + // var subId = nextLinkDetails["subLedgerId"]; + // result = await Client.GetLedgerEntriesAsync(subId, fromId).ConfigureAwait(false); + // Assert.AreEqual((int)HttpStatusCode.OK, result.Status); + // nextLinkDetails = GetNextLinkDetails(result); + // } + //} + + //[RecordedTest] + //public async Task GetLedgerEntry() + //{ + // await PostLedgerEntry(); + + // var result = await Client.GetLedgerEntriesAsync(); + // var stringResult = new StreamReader(result.ContentStream).ReadToEnd(); + + // while (stringResult.Contains("Loading")) + // { + // result = await Client.GetLedgerEntriesAsync().ConfigureAwait(false); + // stringResult = new StreamReader(result.ContentStream).ReadToEnd(); + // } + // var transactionId = GetFirstTransactionId(result); + // result = await Client.GetLedgerEntryAsync(transactionId).ConfigureAwait(false); + + // Assert.AreEqual((int)HttpStatusCode.OK, result.Status); + // Assert.That(stringResult, Does.Contain(transactionId)); + //} + + //[RecordedTest] + //public async Task GetReceipt() + //{ + // await PostLedgerEntry(); + + // var result = await Client.GetLedgerEntriesAsync(); + // var stringResult = new StreamReader(result.ContentStream).ReadToEnd(); + + // while (stringResult.Contains("Loading")) + // { + // result = await Client.GetLedgerEntriesAsync().ConfigureAwait(false); + // stringResult = new StreamReader(result.ContentStream).ReadToEnd(); + // } + // var transactionId = GetFirstTransactionId(result); + // result = await Client.GetReceiptAsync(transactionId).ConfigureAwait(false); + + // Assert.AreEqual((int)HttpStatusCode.OK, result.Status); + // Assert.That(stringResult, Does.Contain(transactionId)); + //} + + //[RecordedTest] + //public async Task GetTransactionStatus() + //{ + // await PostLedgerEntry(); + + // var result = await Client.GetLedgerEntriesAsync(); + // var stringResult = new StreamReader(result.ContentStream).ReadToEnd(); + + // while (stringResult.Contains("Loading")) + // { + // result = await Client.GetLedgerEntriesAsync().ConfigureAwait(false); + // stringResult = new StreamReader(result.ContentStream).ReadToEnd(); + // } + // var transactionId = GetFirstTransactionId(result); + // result = await Client.GetTransactionStatusAsync(transactionId).ConfigureAwait(false); + + // Assert.AreEqual((int)HttpStatusCode.OK, result.Status); + // Assert.That(stringResult, Does.Contain(transactionId)); + //} [RecordedTest] public async Task GetConstitution() { - var result = await Client.GetConstitutionAsync(); + var result = await Client.GetConstitutionAsync(new()); var stringResult = new StreamReader(result.ContentStream).ReadToEnd(); Assert.AreEqual((int)HttpStatusCode.OK, result.Status); @@ -149,7 +149,7 @@ public async Task GetConstitution() [RecordedTest] public async Task GetConsortiumMembers() { - var result = await Client.GetConsortiumMembersAsync(); + var result = await Client.GetConsortiumMembersAsync(new()); var stringResult = new StreamReader(result.ContentStream).ReadToEnd(); Assert.AreEqual((int)HttpStatusCode.OK, result.Status); @@ -159,7 +159,7 @@ public async Task GetConsortiumMembers() [RecordedTest] public async Task GetEnclaveQuotes() { - var result = await Client.GetEnclaveQuotesAsync(); + var result = await Client.GetEnclaveQuotesAsync(new()); var stringResult = new StreamReader(result.ContentStream).ReadToEnd(); Assert.AreEqual((int)HttpStatusCode.OK, result.Status); @@ -183,7 +183,7 @@ public async Task GetCurrentLedgerEntry() { await PostLedgerEntry(); - var result = await Client.GetCurrentLedgerEntryAsync(); + var result = await Client.GetCurrentLedgerEntryAsync(new()); var stringResult = new StreamReader(result.ContentStream).ReadToEnd(); Assert.AreEqual((int)HttpStatusCode.OK, result.Status); @@ -214,7 +214,7 @@ public async Task GetLedgerIdentity() { var ledgerId = TestEnvironment.ConfidentialLedgerUrl.Host; ledgerId = ledgerId.Substring(0, ledgerId.IndexOf('.')); - var result = await IdentityClient.GetLedgerIdentityAsync(ledgerId).ConfigureAwait(false); + var result = await IdentityClient.GetLedgerIdentityAsync(ledgerId, new()).ConfigureAwait(false); Assert.AreEqual((int)HttpStatusCode.OK, result.Status); } diff --git a/sdk/confidentialledger/Azure.Security.ConfidentialLedger/tests/samples/HelloWorldSamples.cs b/sdk/confidentialledger/Azure.Security.ConfidentialLedger/tests/samples/HelloWorldSamples.cs index b45cc06be3e5f..96cc35bc96c03 100644 --- a/sdk/confidentialledger/Azure.Security.ConfidentialLedger/tests/samples/HelloWorldSamples.cs +++ b/sdk/confidentialledger/Azure.Security.ConfidentialLedger/tests/samples/HelloWorldSamples.cs @@ -37,7 +37,7 @@ public void HelloWorld() var ledgerId = TestEnvironment.ConfidentialLedgerUrl.Host; ledgerId = ledgerId.Substring(0, ledgerId.IndexOf('.')); #endif - Response response = identityClient.GetLedgerIdentity(ledgerId); + Response response = identityClient.GetLedgerIdentity(ledgerId, new()); X509Certificate2 ledgerTlsCert = ConfidentialLedgerIdentityServiceClient.ParseCertificate(response); #endregion @@ -92,7 +92,7 @@ bool CertValidationCheck(HttpRequestMessage httpRequestMessage, X509Certificate2 #region Snippet:GetStatus - Response statusResponse = ledgerClient.GetTransactionStatus(transactionId); + Response statusResponse = ledgerClient.GetTransactionStatus(transactionId, new()); string status = JsonDocument.Parse(statusResponse.Content) .RootElement @@ -104,7 +104,7 @@ bool CertValidationCheck(HttpRequestMessage httpRequestMessage, X509Certificate2 // Wait for the entry to be committed while (status == "Pending") { - statusResponse = ledgerClient.GetTransactionStatus(transactionId); + statusResponse = ledgerClient.GetTransactionStatus(transactionId, new()); status = JsonDocument.Parse(statusResponse.Content) .RootElement .GetProperty("state") @@ -117,7 +117,7 @@ bool CertValidationCheck(HttpRequestMessage httpRequestMessage, X509Certificate2 #region Snippet:GetReceipt - Response receiptResponse = ledgerClient.GetReceipt(transactionId); + Response receiptResponse = ledgerClient.GetReceipt(transactionId, new()); string receiptJson = new StreamReader(receiptResponse.ContentStream).ReadToEnd(); Console.WriteLine(receiptJson); @@ -159,7 +159,7 @@ bool CertValidationCheck(HttpRequestMessage httpRequestMessage, X509Certificate2 status = "Pending"; while (status == "Pending") { - statusResponse = ledgerClient.GetTransactionStatus(transactionId); + statusResponse = ledgerClient.GetTransactionStatus(transactionId, new()); status = JsonDocument.Parse(statusResponse.Content) .RootElement .GetProperty("state") @@ -169,7 +169,7 @@ bool CertValidationCheck(HttpRequestMessage httpRequestMessage, X509Certificate2 Console.WriteLine($"Transaction status: {status}"); // Provide both the transactionId and subLedgerId. - Response getBySubledgerResponse = ledgerClient.GetLedgerEntry(transactionId, subLedgerId); + Response getBySubledgerResponse = ledgerClient.GetLedgerEntry(transactionId, new(), subLedgerId); // Try until the entry is available. bool loaded = false; @@ -186,14 +186,14 @@ bool CertValidationCheck(HttpRequestMessage httpRequestMessage, X509Certificate2 } else { - getBySubledgerResponse = ledgerClient.GetLedgerEntry(transactionId, subLedgerId); + getBySubledgerResponse = ledgerClient.GetLedgerEntry(transactionId, new(), subLedgerId); } } Console.WriteLine(contents); // "Hello world!" // Now just provide the transactionId. - getBySubledgerResponse = ledgerClient.GetLedgerEntry(transactionId); + getBySubledgerResponse = ledgerClient.GetLedgerEntry(transactionId, new()); string subLedgerId2 = JsonDocument.Parse(getBySubledgerResponse.Content) .RootElement @@ -228,7 +228,7 @@ bool CertValidationCheck(HttpRequestMessage httpRequestMessage, X509Certificate2 status = "Pending"; while (status == "Pending") { - statusResponse = ledgerClient.GetTransactionStatus(transactionId); + statusResponse = ledgerClient.GetTransactionStatus(transactionId, new()); status = JsonDocument.Parse(statusResponse.Content) .RootElement .GetProperty("state") @@ -236,7 +236,7 @@ bool CertValidationCheck(HttpRequestMessage httpRequestMessage, X509Certificate2 } // The ledger entry written at the transactionId in firstResponse is retrieved from the default sub-ledger. - Response getResponse = ledgerClient.GetLedgerEntry(transactionId); + Response getResponse = ledgerClient.GetLedgerEntry(transactionId, new()); // Try until the entry is available. loaded = false; @@ -253,7 +253,7 @@ bool CertValidationCheck(HttpRequestMessage httpRequestMessage, X509Certificate2 } else { - getResponse = ledgerClient.GetLedgerEntry(transactionId, subLedgerId); + getResponse = ledgerClient.GetLedgerEntry(transactionId, new(), subLedgerId); } } @@ -266,7 +266,7 @@ bool CertValidationCheck(HttpRequestMessage httpRequestMessage, X509Certificate2 Console.WriteLine(firstEntryContents); // "Hello world 0" // This will return the latest entry available in the default sub-ledger. - getResponse = ledgerClient.GetCurrentLedgerEntry(); + getResponse = ledgerClient.GetCurrentLedgerEntry(new()); // Try until the entry is available. loaded = false; @@ -283,7 +283,7 @@ bool CertValidationCheck(HttpRequestMessage httpRequestMessage, X509Certificate2 } else { - getResponse = ledgerClient.GetCurrentLedgerEntry(); + getResponse = ledgerClient.GetCurrentLedgerEntry(new()); } } @@ -296,14 +296,14 @@ bool CertValidationCheck(HttpRequestMessage httpRequestMessage, X509Certificate2 status = "Pending"; while (status == "Pending") { - statusResponse = ledgerClient.GetTransactionStatus(subLedgerTransactionId); + statusResponse = ledgerClient.GetTransactionStatus(subLedgerTransactionId, new()); status = JsonDocument.Parse(statusResponse.Content) .RootElement .GetProperty("state") .GetString(); } - getResponse = ledgerClient.GetLedgerEntry(subLedgerTransactionId, "my sub-ledger"); + getResponse = ledgerClient.GetLedgerEntry(subLedgerTransactionId, new(), "my sub-ledger"); // Try until the entry is available. loaded = false; element = default; @@ -319,14 +319,14 @@ bool CertValidationCheck(HttpRequestMessage httpRequestMessage, X509Certificate2 } else { - getResponse = ledgerClient.GetLedgerEntry(subLedgerTransactionId, "my sub-ledger"); + getResponse = ledgerClient.GetLedgerEntry(subLedgerTransactionId, new(), "my sub-ledger"); } } Console.WriteLine(subLedgerEntry); // "Hello world sub-ledger 0" // This will return the latest entry available in the sub-ledger. - getResponse = ledgerClient.GetCurrentLedgerEntry("my sub-ledger"); + getResponse = ledgerClient.GetCurrentLedgerEntry(new(), "my sub-ledger"); string latestSubLedger = JsonDocument.Parse(getResponse.Content) .RootElement .GetProperty("contents") @@ -338,7 +338,7 @@ bool CertValidationCheck(HttpRequestMessage httpRequestMessage, X509Certificate2 #region Snippet:RangedQuery - ledgerClient.GetLedgerEntries(fromTransactionId: "2.1", toTransactionId: subLedgerTransactionId); + ledgerClient.GetLedgerEntries(new(), fromTransactionId: "2.1", toTransactionId: subLedgerTransactionId); #endregion @@ -356,7 +356,7 @@ bool CertValidationCheck(HttpRequestMessage httpRequestMessage, X509Certificate2 #region Snippet:Consortium - Response consortiumResponse = ledgerClient.GetConsortiumMembers(); + Response consortiumResponse = ledgerClient.GetConsortiumMembers(new()); string membersJson = new StreamReader(consortiumResponse.ContentStream).ReadToEnd(); // Consortium members can manage and alter the Confidential Ledger, such as by replacing unhealthy nodes. @@ -364,13 +364,13 @@ bool CertValidationCheck(HttpRequestMessage httpRequestMessage, X509Certificate2 // The constitution is a collection of JavaScript code that defines actions available to members, // and vets proposals by members to execute those actions. - Response constitutionResponse = ledgerClient.GetConstitution(); + Response constitutionResponse = ledgerClient.GetConstitution(new()); string constitutionJson = new StreamReader(constitutionResponse.ContentStream).ReadToEnd(); Console.WriteLine(constitutionJson); // Enclave quotes contain material that can be used to cryptographically verify the validity and contents of an enclave. - Response enclavesResponse = ledgerClient.GetEnclaveQuotes(); + Response enclavesResponse = ledgerClient.GetEnclaveQuotes(new()); string enclavesJson = new StreamReader(enclavesResponse.ContentStream).ReadToEnd(); Console.WriteLine(enclavesJson); diff --git a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/autorest.md b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/autorest.md index 0a11ad9bdbd1b..540188737dbe3 100644 --- a/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/autorest.md +++ b/sdk/containerregistry/Azure.Containers.ContainerRegistry/src/autorest.md @@ -8,4 +8,6 @@ input-file: - https://github.com/Azure/azure-rest-api-specs/blob/2c33d5572dab4c6f52faf31004f0561205737107/specification/containerregistry/data-plane/Azure.ContainerRegistry/stable/2021-07-01/containerregistry.json model-namespace: false +modelerfour: + seal-single-value-enum-by-default: true ``` diff --git a/sdk/digitaltwins/Azure.DigitalTwins.Core/src/Generated/DigitalTwinModelsRestClient.cs b/sdk/digitaltwins/Azure.DigitalTwins.Core/src/Generated/DigitalTwinModelsRestClient.cs index fd6f753fc8955..1f8910724ec57 100644 --- a/sdk/digitaltwins/Azure.DigitalTwins.Core/src/Generated/DigitalTwinModelsRestClient.cs +++ b/sdk/digitaltwins/Azure.DigitalTwins.Core/src/Generated/DigitalTwinModelsRestClient.cs @@ -149,7 +149,10 @@ internal HttpMessage CreateListRequest(IEnumerable dependenciesFor, bool uri.AppendPath("/models", false); if (dependenciesFor != null) { - uri.AppendQueryDelimited("dependenciesFor", dependenciesFor, ",", true); + foreach (var param in dependenciesFor) + { + uri.AppendQuery("dependenciesFor", param, true); + } } if (includeModelDefinition != null) { diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/EventGridModelFactory.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/EventGridModelFactory.cs index 2017b54fbccd5..0787bda195a3f 100644 --- a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/EventGridModelFactory.cs +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/EventGridModelFactory.cs @@ -1246,14 +1246,24 @@ public static MicrosoftTeamsUserIdentifierModel MicrosoftTeamsUserIdentifierMode return new MicrosoftTeamsUserIdentifierModel(userId, isAnonymous, cloud); } - /// Initializes a new instance of AcsChatEventBaseProperties. + /// Initializes a new instance of AcsChatMessageReceivedEventData. /// The communication identifier of the target user. /// The transaction id will be used as co-relation vector. /// The chat thread id. - /// A new instance for mocking. - public static AcsChatEventBaseProperties AcsChatEventBaseProperties(CommunicationIdentifierModel recipientCommunicationIdentifier = null, string transactionId = null, string threadId = null) + /// The chat message id. + /// The communication identifier of the sender. + /// The display name of the sender. + /// The original compose time of the message. + /// The type of the message. + /// The version of the message. + /// The body of the chat message. + /// The chat message metadata. + /// A new instance for mocking. + public static AcsChatMessageReceivedEventData AcsChatMessageReceivedEventData(CommunicationIdentifierModel recipientCommunicationIdentifier = null, string transactionId = null, string threadId = null, string messageId = null, CommunicationIdentifierModel senderCommunicationIdentifier = null, string senderDisplayName = null, DateTimeOffset? composeTime = null, string type = null, long? version = null, string messageBody = null, IReadOnlyDictionary metadata = null) { - return new AcsChatEventBaseProperties(recipientCommunicationIdentifier, transactionId, threadId); + metadata ??= new Dictionary(); + + return new AcsChatMessageReceivedEventData(recipientCommunicationIdentifier, transactionId, threadId, messageId, senderCommunicationIdentifier, senderDisplayName, composeTime, type, version, messageBody, metadata); } /// Initializes a new instance of AcsChatMessageEventBaseProperties. @@ -1272,10 +1282,19 @@ public static AcsChatMessageEventBaseProperties AcsChatMessageEventBasePropertie return new AcsChatMessageEventBaseProperties(recipientCommunicationIdentifier, transactionId, threadId, messageId, senderCommunicationIdentifier, senderDisplayName, composeTime, type, version); } - /// Initializes a new instance of AcsChatMessageReceivedEventData. + /// Initializes a new instance of AcsChatEventBaseProperties. /// The communication identifier of the target user. /// The transaction id will be used as co-relation vector. /// The chat thread id. + /// A new instance for mocking. + public static AcsChatEventBaseProperties AcsChatEventBaseProperties(CommunicationIdentifierModel recipientCommunicationIdentifier = null, string transactionId = null, string threadId = null) + { + return new AcsChatEventBaseProperties(recipientCommunicationIdentifier, transactionId, threadId); + } + + /// Initializes a new instance of AcsChatMessageReceivedInThreadEventData. + /// The transaction id will be used as co-relation vector. + /// The chat thread id. /// The chat message id. /// The communication identifier of the sender. /// The display name of the sender. @@ -1284,21 +1303,12 @@ public static AcsChatMessageEventBaseProperties AcsChatMessageEventBasePropertie /// The version of the message. /// The body of the chat message. /// The chat message metadata. - /// A new instance for mocking. - public static AcsChatMessageReceivedEventData AcsChatMessageReceivedEventData(CommunicationIdentifierModel recipientCommunicationIdentifier = null, string transactionId = null, string threadId = null, string messageId = null, CommunicationIdentifierModel senderCommunicationIdentifier = null, string senderDisplayName = null, DateTimeOffset? composeTime = null, string type = null, long? version = null, string messageBody = null, IReadOnlyDictionary metadata = null) + /// A new instance for mocking. + public static AcsChatMessageReceivedInThreadEventData AcsChatMessageReceivedInThreadEventData(string transactionId = null, string threadId = null, string messageId = null, CommunicationIdentifierModel senderCommunicationIdentifier = null, string senderDisplayName = null, DateTimeOffset? composeTime = null, string type = null, long? version = null, string messageBody = null, IReadOnlyDictionary metadata = null) { metadata ??= new Dictionary(); - return new AcsChatMessageReceivedEventData(recipientCommunicationIdentifier, transactionId, threadId, messageId, senderCommunicationIdentifier, senderDisplayName, composeTime, type, version, messageBody, metadata); - } - - /// Initializes a new instance of AcsChatEventInThreadBaseProperties. - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// A new instance for mocking. - public static AcsChatEventInThreadBaseProperties AcsChatEventInThreadBaseProperties(string transactionId = null, string threadId = null) - { - return new AcsChatEventInThreadBaseProperties(transactionId, threadId); + return new AcsChatMessageReceivedInThreadEventData(transactionId, threadId, messageId, senderCommunicationIdentifier, senderDisplayName, composeTime, type, version, messageBody, metadata); } /// Initializes a new instance of AcsChatMessageEventInThreadBaseProperties. @@ -1316,23 +1326,13 @@ public static AcsChatMessageEventInThreadBaseProperties AcsChatMessageEventInThr return new AcsChatMessageEventInThreadBaseProperties(transactionId, threadId, messageId, senderCommunicationIdentifier, senderDisplayName, composeTime, type, version); } - /// Initializes a new instance of AcsChatMessageReceivedInThreadEventData. + /// Initializes a new instance of AcsChatEventInThreadBaseProperties. /// The transaction id will be used as co-relation vector. /// The chat thread id. - /// The chat message id. - /// The communication identifier of the sender. - /// The display name of the sender. - /// The original compose time of the message. - /// The type of the message. - /// The version of the message. - /// The body of the chat message. - /// The chat message metadata. - /// A new instance for mocking. - public static AcsChatMessageReceivedInThreadEventData AcsChatMessageReceivedInThreadEventData(string transactionId = null, string threadId = null, string messageId = null, CommunicationIdentifierModel senderCommunicationIdentifier = null, string senderDisplayName = null, DateTimeOffset? composeTime = null, string type = null, long? version = null, string messageBody = null, IReadOnlyDictionary metadata = null) + /// A new instance for mocking. + public static AcsChatEventInThreadBaseProperties AcsChatEventInThreadBaseProperties(string transactionId = null, string threadId = null) { - metadata ??= new Dictionary(); - - return new AcsChatMessageReceivedInThreadEventData(transactionId, threadId, messageId, senderCommunicationIdentifier, senderDisplayName, composeTime, type, version, messageBody, metadata); + return new AcsChatEventInThreadBaseProperties(transactionId, threadId); } /// Initializes a new instance of AcsChatMessageEditedEventData. @@ -1409,18 +1409,6 @@ public static AcsChatMessageDeletedInThreadEventData AcsChatMessageDeletedInThre return new AcsChatMessageDeletedInThreadEventData(transactionId, threadId, messageId, senderCommunicationIdentifier, senderDisplayName, composeTime, type, version, deleteTime); } - /// Initializes a new instance of AcsChatThreadEventBaseProperties. - /// The communication identifier of the target user. - /// The transaction id will be used as co-relation vector. - /// The chat thread id. - /// The original creation time of the thread. - /// The version of the thread. - /// A new instance for mocking. - public static AcsChatThreadEventBaseProperties AcsChatThreadEventBaseProperties(CommunicationIdentifierModel recipientCommunicationIdentifier = null, string transactionId = null, string threadId = null, DateTimeOffset? createTime = null, long? version = null) - { - return new AcsChatThreadEventBaseProperties(recipientCommunicationIdentifier, transactionId, threadId, createTime, version); - } - /// Initializes a new instance of AcsChatThreadCreatedWithUserEventData. /// The communication identifier of the target user. /// The transaction id will be used as co-relation vector. @@ -1448,15 +1436,16 @@ public static AcsChatThreadParticipantProperties AcsChatThreadParticipantPropert return new AcsChatThreadParticipantProperties(displayName, participantCommunicationIdentifier); } - /// Initializes a new instance of AcsChatThreadEventInThreadBaseProperties. + /// Initializes a new instance of AcsChatThreadEventBaseProperties. + /// The communication identifier of the target user. /// The transaction id will be used as co-relation vector. /// The chat thread id. /// The original creation time of the thread. /// The version of the thread. - /// A new instance for mocking. - public static AcsChatThreadEventInThreadBaseProperties AcsChatThreadEventInThreadBaseProperties(string transactionId = null, string threadId = null, DateTimeOffset? createTime = null, long? version = null) + /// A new instance for mocking. + public static AcsChatThreadEventBaseProperties AcsChatThreadEventBaseProperties(CommunicationIdentifierModel recipientCommunicationIdentifier = null, string transactionId = null, string threadId = null, DateTimeOffset? createTime = null, long? version = null) { - return new AcsChatThreadEventInThreadBaseProperties(transactionId, threadId, createTime, version); + return new AcsChatThreadEventBaseProperties(recipientCommunicationIdentifier, transactionId, threadId, createTime, version); } /// Initializes a new instance of AcsChatThreadCreatedEventData. @@ -1476,6 +1465,17 @@ public static AcsChatThreadCreatedEventData AcsChatThreadCreatedEventData(string return new AcsChatThreadCreatedEventData(transactionId, threadId, createTime, version, createdByCommunicationIdentifier, properties, participants?.ToList()); } + /// Initializes a new instance of AcsChatThreadEventInThreadBaseProperties. + /// The transaction id will be used as co-relation vector. + /// The chat thread id. + /// The original creation time of the thread. + /// The version of the thread. + /// A new instance for mocking. + public static AcsChatThreadEventInThreadBaseProperties AcsChatThreadEventInThreadBaseProperties(string transactionId = null, string threadId = null, DateTimeOffset? createTime = null, long? version = null) + { + return new AcsChatThreadEventInThreadBaseProperties(transactionId, threadId, createTime, version); + } + /// Initializes a new instance of AcsChatThreadWithUserDeletedEventData. /// The communication identifier of the target user. /// The transaction id will be used as co-relation vector. @@ -1592,16 +1592,6 @@ public static AcsChatParticipantRemovedFromThreadEventData AcsChatParticipantRem return new AcsChatParticipantRemovedFromThreadEventData(transactionId, threadId, time, removedByCommunicationIdentifier, participantRemoved, version); } - /// Initializes a new instance of AcsSmsEventBaseProperties. - /// The identity of the SMS message. - /// The identity of SMS message sender. - /// The identity of SMS message receiver. - /// A new instance for mocking. - public static AcsSmsEventBaseProperties AcsSmsEventBaseProperties(string messageId = null, string @from = null, string to = null) - { - return new AcsSmsEventBaseProperties(messageId, @from, to); - } - /// Initializes a new instance of AcsSmsDeliveryReportReceivedEventData. /// The identity of the SMS message. /// The identity of SMS message sender. @@ -1629,6 +1619,16 @@ public static AcsSmsDeliveryAttemptProperties AcsSmsDeliveryAttemptProperties(Da return new AcsSmsDeliveryAttemptProperties(timestamp, segmentsSucceeded, segmentsFailed); } + /// Initializes a new instance of AcsSmsEventBaseProperties. + /// The identity of the SMS message. + /// The identity of SMS message sender. + /// The identity of SMS message receiver. + /// A new instance for mocking. + public static AcsSmsEventBaseProperties AcsSmsEventBaseProperties(string messageId = null, string @from = null, string to = null) + { + return new AcsSmsEventBaseProperties(messageId, @from, to); + } + /// Initializes a new instance of AcsSmsReceivedEventData. /// The identity of the SMS message. /// The identity of SMS message sender. diff --git a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/autorest.md b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/autorest.md index a911e49c21b54..0e338430dfc1e 100644 --- a/sdk/formrecognizer/Azure.AI.FormRecognizer/src/autorest.md +++ b/sdk/formrecognizer/Azure.AI.FormRecognizer/src/autorest.md @@ -12,6 +12,8 @@ Run `dotnet build /t:GenerateCode` to generate code. Notice how there are two ma ``` yaml input-file: - https://github.com/Azure/azure-rest-api-specs/blob/7043b48f4be1fdd40757b9ef372b65f054daf48f/specification/cognitiveservices/data-plane/FormRecognizer/stable/v2.1/FormRecognizer.json +modelerfour: + seal-single-value-enum-by-default: true ``` ## Make the API version parameterized so we generate a multi-versioned API diff --git a/sdk/iot/Azure.IoT.Hub.Service/src/autorest.md b/sdk/iot/Azure.IoT.Hub.Service/src/autorest.md index eb4d448d0af7d..933efafc692a5 100644 --- a/sdk/iot/Azure.IoT.Hub.Service/src/autorest.md +++ b/sdk/iot/Azure.IoT.Hub.Service/src/autorest.md @@ -8,4 +8,6 @@ Run `./generateCode.ps1` in this directory to generate the code. ``` yaml input-file: - $(this-folder)/swagger/iothubservice.json +modelerfour: + seal-single-value-enum-by-default: true ``` diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/api/Azure.ResourceManager.KeyVault.netstandard2.0.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/api/Azure.ResourceManager.KeyVault.netstandard2.0.cs index 710f8505fe0c3..6d1d26a40f492 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/api/Azure.ResourceManager.KeyVault.netstandard2.0.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/api/Azure.ResourceManager.KeyVault.netstandard2.0.cs @@ -120,7 +120,7 @@ public partial class MhsmPrivateEndpointConnectionData : Azure.ResourceManager.K { public MhsmPrivateEndpointConnectionData(Azure.ResourceManager.Resources.Models.Location location) : base (default(Azure.ResourceManager.Resources.Models.Location)) { } public string Etag { get { throw null; } set { } } - public Azure.ResourceManager.KeyVault.Models.MhsmPrivateEndpoint PrivateEndpoint { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.SubResource PrivateEndpoint { get { throw null; } set { } } public Azure.ResourceManager.KeyVault.Models.MhsmPrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get { throw null; } set { } } public Azure.ResourceManager.KeyVault.Models.PrivateEndpointConnectionProvisioningState? ProvisioningState { get { throw null; } set { } } } @@ -157,7 +157,7 @@ public partial class PrivateEndpointConnectionData : Azure.ResourceManager.KeyVa { public PrivateEndpointConnectionData() { } public string Etag { get { throw null; } set { } } - public Azure.ResourceManager.KeyVault.Models.PrivateEndpoint PrivateEndpoint { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.SubResource PrivateEndpoint { get { throw null; } set { } } public Azure.ResourceManager.KeyVault.Models.PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get { throw null; } set { } } public Azure.ResourceManager.KeyVault.Models.PrivateEndpointConnectionProvisioningState? ProvisioningState { get { throw null; } set { } } } @@ -508,12 +508,7 @@ public MhsmNetworkRuleSet() { } public Azure.ResourceManager.KeyVault.Models.NetworkRuleBypassOptions? Bypass { get { throw null; } set { } } public Azure.ResourceManager.KeyVault.Models.NetworkRuleAction? DefaultAction { get { throw null; } set { } } public System.Collections.Generic.IList IpRules { get { throw null; } } - public System.Collections.Generic.IList VirtualNetworkRules { get { throw null; } } - } - public partial class MhsmPrivateEndpoint - { - public MhsmPrivateEndpoint() { } - public string Id { get { throw null; } } + public System.Collections.Generic.IList VirtualNetworkRules { get { throw null; } } } public partial class MhsmPrivateEndpointConnectionDeleteOperation : Azure.Operation { @@ -531,7 +526,7 @@ protected MhsmPrivateEndpointConnectionDeleteOperation() { } public partial class MhsmPrivateEndpointConnectionItem { internal MhsmPrivateEndpointConnectionItem() { } - public Azure.ResourceManager.KeyVault.Models.MhsmPrivateEndpoint PrivateEndpoint { get { throw null; } } + public Azure.ResourceManager.Resources.Models.SubResource PrivateEndpoint { get { throw null; } } public Azure.ResourceManager.KeyVault.Models.MhsmPrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get { throw null; } } public Azure.ResourceManager.KeyVault.Models.PrivateEndpointConnectionProvisioningState? ProvisioningState { get { throw null; } } } @@ -567,11 +562,6 @@ public MhsmPrivateLinkServiceConnectionState() { } public string Description { get { throw null; } set { } } public Azure.ResourceManager.KeyVault.Models.PrivateEndpointServiceConnectionStatus? Status { get { throw null; } set { } } } - public partial class MhsmVirtualNetworkRule - { - public MhsmVirtualNetworkRule(string id) { } - public string Id { get { throw null; } set { } } - } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct NetworkRuleAction : System.IEquatable { @@ -624,11 +614,6 @@ public Permissions() { } public System.Collections.Generic.IList Secrets { get { throw null; } } public System.Collections.Generic.IList Storage { get { throw null; } } } - public partial class PrivateEndpoint - { - public PrivateEndpoint() { } - public string Id { get { throw null; } } - } public partial class PrivateEndpointConnectionDeleteOperation : Azure.Operation { protected PrivateEndpointConnectionDeleteOperation() { } @@ -642,11 +627,12 @@ protected PrivateEndpointConnectionDeleteOperation() { } public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class PrivateEndpointConnectionItem : Azure.ResourceManager.Resources.Models.SubResource + public partial class PrivateEndpointConnectionItem { internal PrivateEndpointConnectionItem() { } public string Etag { get { throw null; } } - public Azure.ResourceManager.KeyVault.Models.PrivateEndpoint PrivateEndpoint { get { throw null; } } + public string Id { get { throw null; } } + public Azure.ResourceManager.Resources.Models.SubResource PrivateEndpoint { get { throw null; } } public Azure.ResourceManager.KeyVault.Models.PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get { throw null; } } public Azure.ResourceManager.KeyVault.Models.PrivateEndpointConnectionProvisioningState? ProvisioningState { get { throw null; } } } @@ -978,9 +964,10 @@ protected VaultUpdateOperation() { } public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class VirtualNetworkRule : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class VirtualNetworkRule { - public VirtualNetworkRule() { } + public VirtualNetworkRule(string id) { } + public string Id { get { throw null; } set { } } public bool? IgnoreMissingVnetServiceEndpoint { get { throw null; } set { } } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/MhsmPrivateEndpointConnectionData.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/MhsmPrivateEndpointConnectionData.cs index e12742c0ae53b..0053c76c41fac 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/MhsmPrivateEndpointConnectionData.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/MhsmPrivateEndpointConnectionData.cs @@ -33,7 +33,7 @@ public MhsmPrivateEndpointConnectionData(Location location) : base(location) /// Properties of the private endpoint object. /// Approval state of the private link connection. /// Provisioning state of the private endpoint connection. - internal MhsmPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType type, IDictionary tags, Location location, ManagedHsmSku sku, SystemData systemData, string etag, MhsmPrivateEndpoint privateEndpoint, MhsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState, PrivateEndpointConnectionProvisioningState? provisioningState) : base(id, name, type, tags, location, sku, systemData) + internal MhsmPrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType type, IDictionary tags, Location location, ManagedHsmSku sku, SystemData systemData, string etag, SubResource privateEndpoint, MhsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState, PrivateEndpointConnectionProvisioningState? provisioningState) : base(id, name, type, tags, location, sku, systemData) { Etag = etag; PrivateEndpoint = privateEndpoint; @@ -44,7 +44,7 @@ internal MhsmPrivateEndpointConnectionData(ResourceIdentifier id, string name, R /// Modified whenever there is a change in the state of private endpoint connection. public string Etag { get; set; } /// Properties of the private endpoint object. - public MhsmPrivateEndpoint PrivateEndpoint { get; set; } + public SubResource PrivateEndpoint { get; set; } /// Approval state of the private link connection. public MhsmPrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get; set; } /// Provisioning state of the private endpoint connection. diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmNetworkRuleSet.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmNetworkRuleSet.Serialization.cs index e8611fd67c304..64176417a09cc 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmNetworkRuleSet.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmNetworkRuleSet.Serialization.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.KeyVault.Models { @@ -42,7 +43,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in VirtualNetworkRules) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } @@ -54,7 +55,7 @@ internal static MhsmNetworkRuleSet DeserializeMhsmNetworkRuleSet(JsonElement ele Optional bypass = default; Optional defaultAction = default; Optional> ipRules = default; - Optional> virtualNetworkRules = default; + Optional> virtualNetworkRules = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("bypass")) @@ -99,10 +100,10 @@ internal static MhsmNetworkRuleSet DeserializeMhsmNetworkRuleSet(JsonElement ele property.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(MhsmVirtualNetworkRule.DeserializeMhsmVirtualNetworkRule(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } virtualNetworkRules = array; continue; diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmNetworkRuleSet.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmNetworkRuleSet.cs index 49488a44748f9..d24ed360e782e 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmNetworkRuleSet.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmNetworkRuleSet.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.KeyVault.Models { @@ -17,7 +18,7 @@ public partial class MhsmNetworkRuleSet public MhsmNetworkRuleSet() { IpRules = new ChangeTrackingList(); - VirtualNetworkRules = new ChangeTrackingList(); + VirtualNetworkRules = new ChangeTrackingList(); } /// Initializes a new instance of MhsmNetworkRuleSet. @@ -25,7 +26,7 @@ public MhsmNetworkRuleSet() /// The default action when no rule from ipRules and from virtualNetworkRules match. This is only used after the bypass property has been evaluated. /// The list of IP address rules. /// The list of virtual network rules. - internal MhsmNetworkRuleSet(NetworkRuleBypassOptions? bypass, NetworkRuleAction? defaultAction, IList ipRules, IList virtualNetworkRules) + internal MhsmNetworkRuleSet(NetworkRuleBypassOptions? bypass, NetworkRuleAction? defaultAction, IList ipRules, IList virtualNetworkRules) { Bypass = bypass; DefaultAction = defaultAction; @@ -40,6 +41,6 @@ internal MhsmNetworkRuleSet(NetworkRuleBypassOptions? bypass, NetworkRuleAction? /// The list of IP address rules. public IList IpRules { get; } /// The list of virtual network rules. - public IList VirtualNetworkRules { get; } + public IList VirtualNetworkRules { get; } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmPrivateEndpoint.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmPrivateEndpoint.Serialization.cs deleted file mode 100644 index bc996a2c9dbba..0000000000000 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmPrivateEndpoint.Serialization.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.KeyVault.Models -{ - public partial class MhsmPrivateEndpoint : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WriteEndObject(); - } - - internal static MhsmPrivateEndpoint DeserializeMhsmPrivateEndpoint(JsonElement element) - { - Optional id = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - } - return new MhsmPrivateEndpoint(id.Value); - } - } -} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmPrivateEndpoint.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmPrivateEndpoint.cs deleted file mode 100644 index 7dbf5fa97f06a..0000000000000 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmPrivateEndpoint.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.KeyVault.Models -{ - /// Private endpoint object properties. - public partial class MhsmPrivateEndpoint - { - /// Initializes a new instance of MhsmPrivateEndpoint. - public MhsmPrivateEndpoint() - { - } - - /// Initializes a new instance of MhsmPrivateEndpoint. - /// Full identifier of the private endpoint resource. - internal MhsmPrivateEndpoint(string id) - { - Id = id; - } - - /// Full identifier of the private endpoint resource. - public string Id { get; } - } -} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmPrivateEndpointConnectionData.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmPrivateEndpointConnectionData.Serialization.cs index 885fc34894a88..d8c82974f6e22 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmPrivateEndpointConnectionData.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmPrivateEndpointConnectionData.Serialization.cs @@ -44,7 +44,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PrivateEndpoint)) { writer.WritePropertyName("privateEndpoint"); - writer.WriteObjectValue(PrivateEndpoint); + JsonSerializer.Serialize(writer, PrivateEndpoint); } if (Optional.IsDefined(PrivateLinkServiceConnectionState)) { @@ -70,7 +70,7 @@ internal static MhsmPrivateEndpointConnectionData DeserializeMhsmPrivateEndpoint ResourceIdentifier id = default; string name = default; ResourceType type = default; - Optional privateEndpoint = default; + Optional privateEndpoint = default; Optional privateLinkServiceConnectionState = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) @@ -146,7 +146,7 @@ internal static MhsmPrivateEndpointConnectionData DeserializeMhsmPrivateEndpoint property0.ThrowNonNullablePropertyIsNull(); continue; } - privateEndpoint = MhsmPrivateEndpoint.DeserializeMhsmPrivateEndpoint(property0.Value); + privateEndpoint = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("privateLinkServiceConnectionState")) @@ -173,7 +173,7 @@ internal static MhsmPrivateEndpointConnectionData DeserializeMhsmPrivateEndpoint continue; } } - return new MhsmPrivateEndpointConnectionData(id, name, type, tags, location, sku.Value, systemData.Value, etag.Value, privateEndpoint.Value, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState)); + return new MhsmPrivateEndpointConnectionData(id, name, type, tags, location, sku.Value, systemData.Value, etag.Value, privateEndpoint, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmPrivateEndpointConnectionItem.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmPrivateEndpointConnectionItem.Serialization.cs index 3f21503a3ea69..7665c48c0d8ee 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmPrivateEndpointConnectionItem.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmPrivateEndpointConnectionItem.Serialization.cs @@ -7,6 +7,7 @@ using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.KeyVault.Models { @@ -14,7 +15,7 @@ public partial class MhsmPrivateEndpointConnectionItem { internal static MhsmPrivateEndpointConnectionItem DeserializeMhsmPrivateEndpointConnectionItem(JsonElement element) { - Optional privateEndpoint = default; + Optional privateEndpoint = default; Optional privateLinkServiceConnectionState = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) @@ -35,7 +36,7 @@ internal static MhsmPrivateEndpointConnectionItem DeserializeMhsmPrivateEndpoint property0.ThrowNonNullablePropertyIsNull(); continue; } - privateEndpoint = MhsmPrivateEndpoint.DeserializeMhsmPrivateEndpoint(property0.Value); + privateEndpoint = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("privateLinkServiceConnectionState")) @@ -62,7 +63,7 @@ internal static MhsmPrivateEndpointConnectionItem DeserializeMhsmPrivateEndpoint continue; } } - return new MhsmPrivateEndpointConnectionItem(privateEndpoint.Value, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState)); + return new MhsmPrivateEndpointConnectionItem(privateEndpoint, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmPrivateEndpointConnectionItem.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmPrivateEndpointConnectionItem.cs index 6e732cfe04ca2..218fe33eeb32c 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmPrivateEndpointConnectionItem.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmPrivateEndpointConnectionItem.cs @@ -5,6 +5,8 @@ #nullable disable +using Azure.ResourceManager.Resources.Models; + namespace Azure.ResourceManager.KeyVault.Models { /// Private endpoint connection item. @@ -19,7 +21,7 @@ internal MhsmPrivateEndpointConnectionItem() /// Properties of the private endpoint object. /// Approval state of the private link connection. /// Provisioning state of the private endpoint connection. - internal MhsmPrivateEndpointConnectionItem(MhsmPrivateEndpoint privateEndpoint, MhsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState, PrivateEndpointConnectionProvisioningState? provisioningState) + internal MhsmPrivateEndpointConnectionItem(SubResource privateEndpoint, MhsmPrivateLinkServiceConnectionState privateLinkServiceConnectionState, PrivateEndpointConnectionProvisioningState? provisioningState) { PrivateEndpoint = privateEndpoint; PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; @@ -27,7 +29,7 @@ internal MhsmPrivateEndpointConnectionItem(MhsmPrivateEndpoint privateEndpoint, } /// Properties of the private endpoint object. - public MhsmPrivateEndpoint PrivateEndpoint { get; } + public SubResource PrivateEndpoint { get; } /// Approval state of the private link connection. public MhsmPrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get; } /// Provisioning state of the private endpoint connection. diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmVirtualNetworkRule.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmVirtualNetworkRule.Serialization.cs deleted file mode 100644 index cc5cae19a0e0e..0000000000000 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmVirtualNetworkRule.Serialization.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.KeyVault.Models -{ - public partial class MhsmVirtualNetworkRule : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); - writer.WriteEndObject(); - } - - internal static MhsmVirtualNetworkRule DeserializeMhsmVirtualNetworkRule(JsonElement element) - { - string id = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - } - return new MhsmVirtualNetworkRule(id); - } - } -} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmVirtualNetworkRule.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmVirtualNetworkRule.cs deleted file mode 100644 index 8fb7a1f1455eb..0000000000000 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/MhsmVirtualNetworkRule.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.KeyVault.Models -{ - /// A rule governing the accessibility of a managed hsm pool from a specific virtual network. - public partial class MhsmVirtualNetworkRule - { - /// Initializes a new instance of MhsmVirtualNetworkRule. - /// Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. - /// is null. - public MhsmVirtualNetworkRule(string id) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - - Id = id; - } - - /// Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. - public string Id { get; set; } - } -} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/PrivateEndpoint.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/PrivateEndpoint.Serialization.cs deleted file mode 100644 index 378a1f2023bb5..0000000000000 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/PrivateEndpoint.Serialization.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.KeyVault.Models -{ - public partial class PrivateEndpoint : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WriteEndObject(); - } - - internal static PrivateEndpoint DeserializePrivateEndpoint(JsonElement element) - { - Optional id = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - } - return new PrivateEndpoint(id.Value); - } - } -} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/PrivateEndpoint.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/PrivateEndpoint.cs deleted file mode 100644 index c13156db60f6b..0000000000000 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/PrivateEndpoint.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.KeyVault.Models -{ - /// Private endpoint object properties. - public partial class PrivateEndpoint - { - /// Initializes a new instance of PrivateEndpoint. - public PrivateEndpoint() - { - } - - /// Initializes a new instance of PrivateEndpoint. - /// Full identifier of the private endpoint resource. - internal PrivateEndpoint(string id) - { - Id = id; - } - - /// Full identifier of the private endpoint resource. - public string Id { get; } - } -} diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/PrivateEndpointConnectionData.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/PrivateEndpointConnectionData.Serialization.cs index f3b4de32969f2..6b81d2fa3ca9d 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/PrivateEndpointConnectionData.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/PrivateEndpointConnectionData.Serialization.cs @@ -10,6 +10,7 @@ using Azure.Core; using Azure.ResourceManager; using Azure.ResourceManager.KeyVault.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.KeyVault { @@ -28,7 +29,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PrivateEndpoint)) { writer.WritePropertyName("privateEndpoint"); - writer.WriteObjectValue(PrivateEndpoint); + JsonSerializer.Serialize(writer, PrivateEndpoint); } if (Optional.IsDefined(PrivateLinkServiceConnectionState)) { @@ -52,7 +53,7 @@ internal static PrivateEndpointConnectionData DeserializePrivateEndpointConnecti ResourceIdentifier id = default; string name = default; ResourceType type = default; - Optional privateEndpoint = default; + Optional privateEndpoint = default; Optional privateLinkServiceConnectionState = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) @@ -113,7 +114,7 @@ internal static PrivateEndpointConnectionData DeserializePrivateEndpointConnecti property0.ThrowNonNullablePropertyIsNull(); continue; } - privateEndpoint = PrivateEndpoint.DeserializePrivateEndpoint(property0.Value); + privateEndpoint = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("privateLinkServiceConnectionState")) @@ -140,7 +141,7 @@ internal static PrivateEndpointConnectionData DeserializePrivateEndpointConnecti continue; } } - return new PrivateEndpointConnectionData(id, name, type, location.Value, Optional.ToDictionary(tags), etag.Value, privateEndpoint.Value, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState)); + return new PrivateEndpointConnectionData(id, name, type, location.Value, Optional.ToDictionary(tags), etag.Value, privateEndpoint, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/PrivateEndpointConnectionItem.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/PrivateEndpointConnectionItem.Serialization.cs index c7bdf6f6be7b9..817fb84b7cdd6 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/PrivateEndpointConnectionItem.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/PrivateEndpointConnectionItem.Serialization.cs @@ -7,7 +7,7 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.KeyVault.Models { @@ -15,21 +15,21 @@ public partial class PrivateEndpointConnectionItem { internal static PrivateEndpointConnectionItem DeserializePrivateEndpointConnectionItem(JsonElement element) { + Optional id = default; Optional etag = default; - ResourceIdentifier id = default; - Optional privateEndpoint = default; + Optional privateEndpoint = default; Optional privateLinkServiceConnectionState = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("etag")) + if (property.NameEquals("id")) { - etag = property.Value.GetString(); + id = property.Value.GetString(); continue; } - if (property.NameEquals("id")) + if (property.NameEquals("etag")) { - id = property.Value.GetString(); + etag = property.Value.GetString(); continue; } if (property.NameEquals("properties")) @@ -48,7 +48,7 @@ internal static PrivateEndpointConnectionItem DeserializePrivateEndpointConnecti property0.ThrowNonNullablePropertyIsNull(); continue; } - privateEndpoint = PrivateEndpoint.DeserializePrivateEndpoint(property0.Value); + privateEndpoint = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("privateLinkServiceConnectionState")) @@ -75,7 +75,7 @@ internal static PrivateEndpointConnectionItem DeserializePrivateEndpointConnecti continue; } } - return new PrivateEndpointConnectionItem(id, etag.Value, privateEndpoint.Value, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState)); + return new PrivateEndpointConnectionItem(id.Value, etag.Value, privateEndpoint, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/PrivateEndpointConnectionItem.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/PrivateEndpointConnectionItem.cs index aca3871bd09dc..15c8abb0e7c96 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/PrivateEndpointConnectionItem.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/PrivateEndpointConnectionItem.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.KeyVault.Models { /// Private endpoint connection item. - public partial class PrivateEndpointConnectionItem : SubResource + public partial class PrivateEndpointConnectionItem { /// Initializes a new instance of PrivateEndpointConnectionItem. internal PrivateEndpointConnectionItem() @@ -18,23 +18,26 @@ internal PrivateEndpointConnectionItem() } /// Initializes a new instance of PrivateEndpointConnectionItem. - /// The id. + /// Id of private endpoint connection. /// Modified whenever there is a change in the state of private endpoint connection. /// Properties of the private endpoint object. /// Approval state of the private link connection. /// Provisioning state of the private endpoint connection. - internal PrivateEndpointConnectionItem(string id, string etag, PrivateEndpoint privateEndpoint, PrivateLinkServiceConnectionState privateLinkServiceConnectionState, PrivateEndpointConnectionProvisioningState? provisioningState) : base(id) + internal PrivateEndpointConnectionItem(string id, string etag, SubResource privateEndpoint, PrivateLinkServiceConnectionState privateLinkServiceConnectionState, PrivateEndpointConnectionProvisioningState? provisioningState) { + Id = id; Etag = etag; PrivateEndpoint = privateEndpoint; PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; ProvisioningState = provisioningState; } + /// Id of private endpoint connection. + public string Id { get; } /// Modified whenever there is a change in the state of private endpoint connection. public string Etag { get; } /// Properties of the private endpoint object. - public PrivateEndpoint PrivateEndpoint { get; } + public SubResource PrivateEndpoint { get; } /// Approval state of the private link connection. public PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get; } /// Provisioning state of the private endpoint connection. diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/VirtualNetworkRule.Serialization.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/VirtualNetworkRule.Serialization.cs index fa6e9cfe1e1b7..1f058550f7289 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/VirtualNetworkRule.Serialization.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/VirtualNetworkRule.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.KeyVault.Models { @@ -16,22 +15,27 @@ public partial class VirtualNetworkRule : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); if (Optional.IsDefined(IgnoreMissingVnetServiceEndpoint)) { writer.WritePropertyName("ignoreMissingVnetServiceEndpoint"); writer.WriteBooleanValue(IgnoreMissingVnetServiceEndpoint.Value); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WriteEndObject(); } internal static VirtualNetworkRule DeserializeVirtualNetworkRule(JsonElement element) { + string id = default; Optional ignoreMissingVnetServiceEndpoint = default; - ResourceIdentifier id = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("ignoreMissingVnetServiceEndpoint")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -42,11 +46,6 @@ internal static VirtualNetworkRule DeserializeVirtualNetworkRule(JsonElement ele ignoreMissingVnetServiceEndpoint = property.Value.GetBoolean(); continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } } return new VirtualNetworkRule(id, Optional.ToNullable(ignoreMissingVnetServiceEndpoint)); } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/VirtualNetworkRule.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/VirtualNetworkRule.cs index d9b283bac8a06..0fa261d8b6f4e 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/VirtualNetworkRule.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/Models/VirtualNetworkRule.cs @@ -5,26 +5,37 @@ #nullable disable -using Azure.ResourceManager.Resources.Models; +using System; namespace Azure.ResourceManager.KeyVault.Models { /// A rule governing the accessibility of a vault from a specific virtual network. - public partial class VirtualNetworkRule : WritableSubResource + public partial class VirtualNetworkRule { /// Initializes a new instance of VirtualNetworkRule. - public VirtualNetworkRule() + /// Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + /// is null. + public VirtualNetworkRule(string id) { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + Id = id; } /// Initializes a new instance of VirtualNetworkRule. - /// The id. + /// Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. /// Property to specify whether NRP will ignore the check if parent subnet has serviceEndpoints configured. - internal VirtualNetworkRule(string id, bool? ignoreMissingVnetServiceEndpoint) : base(id) + internal VirtualNetworkRule(string id, bool? ignoreMissingVnetServiceEndpoint) { + Id = id; IgnoreMissingVnetServiceEndpoint = ignoreMissingVnetServiceEndpoint; } + /// Full resource id of a vnet subnet, such as '/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.Network/virtualNetworks/test-vnet/subnets/subnet1'. + public string Id { get; set; } /// Property to specify whether NRP will ignore the check if parent subnet has serviceEndpoints configured. public bool? IgnoreMissingVnetServiceEndpoint { get; set; } } diff --git a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/PrivateEndpointConnectionData.cs b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/PrivateEndpointConnectionData.cs index e01b0430d8ca6..ee15084816b34 100644 --- a/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/PrivateEndpointConnectionData.cs +++ b/sdk/keyvault/Azure.ResourceManager.KeyVault/src/Generated/PrivateEndpointConnectionData.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using Azure.ResourceManager; using Azure.ResourceManager.KeyVault.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.KeyVault { @@ -29,7 +30,7 @@ public PrivateEndpointConnectionData() /// Properties of the private endpoint object. /// Approval state of the private link connection. /// Provisioning state of the private endpoint connection. - internal PrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType type, string location, IReadOnlyDictionary tags, string etag, PrivateEndpoint privateEndpoint, PrivateLinkServiceConnectionState privateLinkServiceConnectionState, PrivateEndpointConnectionProvisioningState? provisioningState) : base(id, name, type, location, tags) + internal PrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType type, string location, IReadOnlyDictionary tags, string etag, SubResource privateEndpoint, PrivateLinkServiceConnectionState privateLinkServiceConnectionState, PrivateEndpointConnectionProvisioningState? provisioningState) : base(id, name, type, location, tags) { Etag = etag; PrivateEndpoint = privateEndpoint; @@ -40,7 +41,7 @@ internal PrivateEndpointConnectionData(ResourceIdentifier id, string name, Resou /// Modified whenever there is a change in the state of private endpoint connection. public string Etag { get; set; } /// Properties of the private endpoint object. - public PrivateEndpoint PrivateEndpoint { get; set; } + public SubResource PrivateEndpoint { get; set; } /// Approval state of the private link connection. public PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get; set; } /// Provisioning state of the private endpoint connection. diff --git a/sdk/monitor/Azure.Monitor.Query/src/autorest.md b/sdk/monitor/Azure.Monitor.Query/src/autorest.md index 4da44f0dcdd63..a45ecf055141c 100644 --- a/sdk/monitor/Azure.Monitor.Query/src/autorest.md +++ b/sdk/monitor/Azure.Monitor.Query/src/autorest.md @@ -11,6 +11,7 @@ input-file: - https://github.com/Azure/azure-rest-api-specs/blob/dba6ed1f03bda88ac6884c0a883246446cc72495/specification/monitor/resource-manager/Microsoft.Insights/preview/2017-12-01-preview/metricNamespaces_API.json modelerfour: lenient-model-deduplication: true + seal-single-value-enum-by-default: true ``` ### Remove metadata operations diff --git a/sdk/network/Azure.ResourceManager.Network/api/Azure.ResourceManager.Network.netstandard2.0.cs b/sdk/network/Azure.ResourceManager.Network/api/Azure.ResourceManager.Network.netstandard2.0.cs index 671c6719004cd..11c68e047ccb9 100644 --- a/sdk/network/Azure.ResourceManager.Network/api/Azure.ResourceManager.Network.netstandard2.0.cs +++ b/sdk/network/Azure.ResourceManager.Network/api/Azure.ResourceManager.Network.netstandard2.0.cs @@ -55,7 +55,7 @@ public ApplicationGatewayData() { } public bool? EnableFips { get { throw null; } set { } } public bool? EnableHttp2 { get { throw null; } set { } } public string Etag { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource FirewallPolicy { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource FirewallPolicy { get { throw null; } set { } } public bool? ForceFirewallPolicyAssociation { get { throw null; } set { } } public System.Collections.Generic.IList FrontendIPConfigurations { get { throw null; } } public System.Collections.Generic.IList FrontendPorts { get { throw null; } } @@ -110,7 +110,7 @@ protected ApplicationGatewayPrivateEndpointConnectionContainer() { } public virtual Azure.Response GetIfExists(string connectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string connectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class ApplicationGatewayPrivateEndpointConnectionData : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ApplicationGatewayPrivateEndpointConnectionData : Azure.ResourceManager.Network.Models.SubResource { public ApplicationGatewayPrivateEndpointConnectionData() { } public string Etag { get { throw null; } } @@ -276,7 +276,7 @@ public AzureFirewallData() { } public System.Collections.Generic.IDictionary AdditionalProperties { get { throw null; } } public System.Collections.Generic.IList ApplicationRuleCollections { get { throw null; } } public string Etag { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource FirewallPolicy { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource FirewallPolicy { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.HubIPAddresses HubIPAddresses { get { throw null; } set { } } public System.Collections.Generic.IList IpConfigurations { get { throw null; } } public System.Collections.Generic.IReadOnlyList IpGroups { get { throw null; } } @@ -286,7 +286,7 @@ public AzureFirewallData() { } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } public Azure.ResourceManager.Network.Models.AzureFirewallSku Sku { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.AzureFirewallThreatIntelMode? ThreatIntelMode { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource VirtualHub { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource VirtualHub { get { throw null; } set { } } public System.Collections.Generic.IList Zones { get { throw null; } } } public partial class BackendAddressPool : Azure.ResourceManager.Core.ArmResource @@ -318,17 +318,17 @@ protected BackendAddressPoolContainer() { } public virtual Azure.Response GetIfExists(string backendAddressPoolName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string backendAddressPoolName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class BackendAddressPoolData : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class BackendAddressPoolData : Azure.ResourceManager.Network.Models.SubResource { public BackendAddressPoolData() { } public System.Collections.Generic.IReadOnlyList BackendIPConfigurations { get { throw null; } } public string Etag { get { throw null; } } public System.Collections.Generic.IList LoadBalancerBackendAddresses { get { throw null; } } - public System.Collections.Generic.IReadOnlyList LoadBalancingRules { get { throw null; } } + public System.Collections.Generic.IReadOnlyList LoadBalancingRules { get { throw null; } } public string Location { get { throw null; } set { } } public string Name { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource OutboundRule { get { throw null; } } - public System.Collections.Generic.IReadOnlyList OutboundRules { get { throw null; } } + public Azure.ResourceManager.Resources.Models.WritableSubResource OutboundRule { get { throw null; } } + public System.Collections.Generic.IReadOnlyList OutboundRules { get { throw null; } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } public System.Collections.Generic.IList TunnelInterfaces { get { throw null; } } public string Type { get { throw null; } } @@ -406,7 +406,7 @@ protected BgpConnectionContainer() { } public virtual Azure.Response GetIfExists(string connectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string connectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class BgpConnectionData : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class BgpConnectionData : Azure.ResourceManager.Network.Models.SubResource { public BgpConnectionData() { } public Azure.ResourceManager.Network.Models.HubBgpConnectionStatus? ConnectionState { get { throw null; } } @@ -519,7 +519,7 @@ public CustomIpPrefixData() { } public Azure.ResourceManager.Network.Models.ExtendedLocation ExtendedLocation { get { throw null; } set { } } public string FailedReason { get { throw null; } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } - public System.Collections.Generic.IReadOnlyList PublicIpPrefixes { get { throw null; } } + public System.Collections.Generic.IReadOnlyList PublicIpPrefixes { get { throw null; } } public string ResourceGuid { get { throw null; } } public string SignedMessage { get { throw null; } set { } } public System.Collections.Generic.IList Zones { get { throw null; } } @@ -561,7 +561,7 @@ public DdosCustomPolicyData() { } public string Etag { get { throw null; } } public System.Collections.Generic.IList ProtocolCustomSettings { get { throw null; } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } - public System.Collections.Generic.IReadOnlyList PublicIPAddresses { get { throw null; } } + public System.Collections.Generic.IReadOnlyList PublicIPAddresses { get { throw null; } } public string ResourceGuid { get { throw null; } } } public partial class DdosProtectionPlan : Azure.ResourceManager.Core.ArmResource @@ -609,7 +609,7 @@ public DdosProtectionPlanData(Azure.ResourceManager.Resources.Models.Location lo public string Etag { get { throw null; } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } public string ResourceGuid { get { throw null; } } - public System.Collections.Generic.IReadOnlyList VirtualNetworks { get { throw null; } } + public System.Collections.Generic.IReadOnlyList VirtualNetworks { get { throw null; } } } public partial class DscpConfiguration : Azure.ResourceManager.Core.ArmResource { @@ -714,7 +714,7 @@ protected ExpressRouteCircuitAuthorizationContainer() { } public virtual Azure.Response GetIfExists(string authorizationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string authorizationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class ExpressRouteCircuitAuthorizationData : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ExpressRouteCircuitAuthorizationData : Azure.ResourceManager.Network.Models.SubResource { public ExpressRouteCircuitAuthorizationData() { } public string AuthorizationKey { get { throw null; } set { } } @@ -753,17 +753,17 @@ protected ExpressRouteCircuitConnectionContainer() { } public virtual Azure.Response GetIfExists(string connectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string connectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class ExpressRouteCircuitConnectionData : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ExpressRouteCircuitConnectionData : Azure.ResourceManager.Network.Models.SubResource { public ExpressRouteCircuitConnectionData() { } public string AddressPrefix { get { throw null; } set { } } public string AuthorizationKey { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.CircuitConnectionStatus? CircuitConnectionStatus { get { throw null; } } public string Etag { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource ExpressRouteCircuitPeering { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource ExpressRouteCircuitPeering { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.Ipv6CircuitConnectionConfig Ipv6CircuitConnectionConfig { get { throw null; } set { } } public string Name { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource PeerExpressRouteCircuitPeering { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource PeerExpressRouteCircuitPeering { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } public string Type { get { throw null; } } } @@ -792,7 +792,7 @@ public ExpressRouteCircuitData() { } public float? BandwidthInGbps { get { throw null; } set { } } public string CircuitProvisioningState { get { throw null; } set { } } public string Etag { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource ExpressRoutePort { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource ExpressRoutePort { get { throw null; } set { } } public string GatewayManagerEtag { get { throw null; } set { } } public bool? GlobalReachEnabled { get { throw null; } set { } } public System.Collections.Generic.IList Peerings { get { throw null; } } @@ -838,13 +838,13 @@ protected ExpressRouteCircuitPeeringContainer() { } public virtual Azure.Response GetIfExists(string peeringName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string peeringName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class ExpressRouteCircuitPeeringData : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ExpressRouteCircuitPeeringData : Azure.ResourceManager.Network.Models.SubResource { public ExpressRouteCircuitPeeringData() { } public int? AzureASN { get { throw null; } set { } } public System.Collections.Generic.IList Connections { get { throw null; } } public string Etag { get { throw null; } } - public Azure.ResourceManager.Network.Models.ExpressRouteConnectionId ExpressRouteConnection { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.SubResource ExpressRouteConnection { get { throw null; } set { } } public string GatewayManagerEtag { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.Ipv6ExpressRouteCircuitPeeringConfig Ipv6PeeringConfig { get { throw null; } set { } } public string LastModifiedBy { get { throw null; } } @@ -856,7 +856,7 @@ public ExpressRouteCircuitPeeringData() { } public string PrimaryAzurePort { get { throw null; } set { } } public string PrimaryPeerAddressPrefix { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource RouteFilter { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource RouteFilter { get { throw null; } set { } } public string SecondaryAzurePort { get { throw null; } set { } } public string SecondaryPeerAddressPrefix { get { throw null; } set { } } public string SharedKey { get { throw null; } set { } } @@ -894,12 +894,12 @@ protected ExpressRouteConnectionContainer() { } public virtual Azure.Response GetIfExists(string connectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string connectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class ExpressRouteConnectionData : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ExpressRouteConnectionData : Azure.ResourceManager.Network.Models.SubResource { public ExpressRouteConnectionData(string name) { } public string AuthorizationKey { get { throw null; } set { } } public bool? EnableInternetSecurity { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.ExpressRouteCircuitPeeringId ExpressRouteCircuitPeering { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource ExpressRouteCircuitPeering { get { throw null; } set { } } public bool? ExpressRouteGatewayBypass { get { throw null; } set { } } public string Name { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } @@ -949,7 +949,7 @@ public partial class ExpressRouteCrossConnectionData : Azure.ResourceManager.Net public ExpressRouteCrossConnectionData() { } public int? BandwidthInMbps { get { throw null; } } public string Etag { get { throw null; } } - public Azure.ResourceManager.Network.Models.ExpressRouteCircuitReference ExpressRouteCircuit { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource ExpressRouteCircuit { get { throw null; } set { } } public string PeeringLocation { get { throw null; } } public System.Collections.Generic.IList Peerings { get { throw null; } } public string PrimaryAzurePort { get { throw null; } } @@ -988,7 +988,7 @@ protected ExpressRouteCrossConnectionPeeringContainer() { } public virtual Azure.Response GetIfExists(string peeringName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string peeringName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class ExpressRouteCrossConnectionPeeringData : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ExpressRouteCrossConnectionPeeringData : Azure.ResourceManager.Network.Models.SubResource { public ExpressRouteCrossConnectionPeeringData() { } public int? AzureASN { get { throw null; } } @@ -1050,7 +1050,7 @@ public ExpressRouteGatewayData() { } public string Etag { get { throw null; } } public System.Collections.Generic.IReadOnlyList ExpressRouteConnections { get { throw null; } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } - public Azure.ResourceManager.Network.Models.VirtualHubId VirtualHub { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource VirtualHub { get { throw null; } set { } } } public partial class ExpressRoutePort : Azure.ResourceManager.Core.ArmResource { @@ -1096,7 +1096,7 @@ public partial class ExpressRoutePortData : Azure.ResourceManager.Network.Models public ExpressRoutePortData() { } public string AllocationDate { get { throw null; } } public int? BandwidthInGbps { get { throw null; } set { } } - public System.Collections.Generic.IReadOnlyList Circuits { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Circuits { get { throw null; } } public Azure.ResourceManager.Network.Models.ExpressRoutePortsEncapsulation? Encapsulation { get { throw null; } set { } } public string Etag { get { throw null; } } public string EtherType { get { throw null; } } @@ -1143,16 +1143,16 @@ protected FirewallPolicyContainer() { } public partial class FirewallPolicyData : Azure.ResourceManager.Network.Models.Resource { public FirewallPolicyData() { } - public Azure.ResourceManager.Network.Models.SubResource BasePolicy { get { throw null; } set { } } - public System.Collections.Generic.IReadOnlyList ChildPolicies { get { throw null; } } + public Azure.ResourceManager.Resources.Models.WritableSubResource BasePolicy { get { throw null; } set { } } + public System.Collections.Generic.IReadOnlyList ChildPolicies { get { throw null; } } public Azure.ResourceManager.Network.Models.DnsSettings DnsSettings { get { throw null; } set { } } public string Etag { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Firewalls { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Firewalls { get { throw null; } } public Azure.ResourceManager.Resources.Models.ResourceIdentity Identity { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.FirewallPolicyInsights Insights { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.FirewallPolicyIntrusionDetection IntrusionDetection { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } - public System.Collections.Generic.IReadOnlyList RuleCollectionGroups { get { throw null; } } + public System.Collections.Generic.IReadOnlyList RuleCollectionGroups { get { throw null; } } public Azure.ResourceManager.Network.Models.FirewallPolicySku Sku { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.FirewallPolicySnat Snat { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.AzureFirewallThreatIntelMode? ThreatIntelMode { get { throw null; } set { } } @@ -1188,7 +1188,7 @@ protected FirewallPolicyRuleCollectionGroupContainer() { } public virtual Azure.Response GetIfExists(string ruleCollectionGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string ruleCollectionGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class FirewallPolicyRuleCollectionGroupData : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class FirewallPolicyRuleCollectionGroupData : Azure.ResourceManager.Network.Models.SubResource { public FirewallPolicyRuleCollectionGroupData() { } public string Etag { get { throw null; } } @@ -1271,7 +1271,7 @@ protected HubIpConfigurationContainer() { } public virtual Azure.Response GetIfExists(string ipConfigName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string ipConfigName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class HubIpConfigurationData : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class HubIpConfigurationData : Azure.ResourceManager.Network.Models.SubResource { public HubIpConfigurationData() { } public string Etag { get { throw null; } } @@ -1312,7 +1312,7 @@ protected HubRouteTableContainer() { } public virtual Azure.Response GetIfExists(string routeTableName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string routeTableName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class HubRouteTableData : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class HubRouteTableData : Azure.ResourceManager.Network.Models.SubResource { public HubRouteTableData() { } public System.Collections.Generic.IReadOnlyList AssociatedConnections { get { throw null; } } @@ -1353,7 +1353,7 @@ protected HubVirtualNetworkConnectionContainer() { } public virtual Azure.Response GetIfExists(string connectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string connectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class HubVirtualNetworkConnectionData : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class HubVirtualNetworkConnectionData : Azure.ResourceManager.Network.Models.SubResource { public HubVirtualNetworkConnectionData() { } public bool? AllowHubToRemoteVnetTransit { get { throw null; } set { } } @@ -1362,7 +1362,7 @@ public HubVirtualNetworkConnectionData() { } public string Etag { get { throw null; } } public string Name { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource RemoteVirtualNetwork { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource RemoteVirtualNetwork { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.RoutingConfiguration RoutingConfiguration { get { throw null; } set { } } } public partial class InboundNatRule : Azure.ResourceManager.Core.ArmResource @@ -1394,7 +1394,7 @@ protected InboundNatRuleContainer() { } public virtual Azure.Response GetIfExists(string inboundNatRuleName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string inboundNatRuleName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class InboundNatRuleData : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class InboundNatRuleData : Azure.ResourceManager.Network.Models.SubResource { public InboundNatRuleData() { } public Azure.ResourceManager.Network.Models.NetworkInterfaceIPConfiguration BackendIPConfiguration { get { throw null; } } @@ -1402,7 +1402,7 @@ public InboundNatRuleData() { } public bool? EnableFloatingIP { get { throw null; } set { } } public bool? EnableTcpReset { get { throw null; } set { } } public string Etag { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource FrontendIPConfiguration { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource FrontendIPConfiguration { get { throw null; } set { } } public int? FrontendPort { get { throw null; } set { } } public int? IdleTimeoutInMinutes { get { throw null; } set { } } public string Name { get { throw null; } set { } } @@ -1452,9 +1452,9 @@ public IpAllocationData() { } public string Prefix { get { throw null; } set { } } public int? PrefixLength { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.IPVersion? PrefixType { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource Subnet { get { throw null; } } + public Azure.ResourceManager.Resources.Models.WritableSubResource Subnet { get { throw null; } } public Azure.ResourceManager.Network.Models.IpAllocationType? TypePropertiesType { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource VirtualNetwork { get { throw null; } } + public Azure.ResourceManager.Resources.Models.WritableSubResource VirtualNetwork { get { throw null; } } } public partial class IpGroup : Azure.ResourceManager.Core.ArmResource { @@ -1493,8 +1493,8 @@ public partial class IpGroupData : Azure.ResourceManager.Network.Models.Resource { public IpGroupData() { } public string Etag { get { throw null; } } - public System.Collections.Generic.IReadOnlyList FirewallPolicies { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Firewalls { get { throw null; } } + public System.Collections.Generic.IReadOnlyList FirewallPolicies { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Firewalls { get { throw null; } } public System.Collections.Generic.IList IpAddresses { get { throw null; } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } } @@ -1652,11 +1652,11 @@ public NatGatewayData() { } public string Etag { get { throw null; } } public int? IdleTimeoutInMinutes { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } - public System.Collections.Generic.IList PublicIpAddresses { get { throw null; } } - public System.Collections.Generic.IList PublicIpPrefixes { get { throw null; } } + public System.Collections.Generic.IList PublicIpAddresses { get { throw null; } } + public System.Collections.Generic.IList PublicIpPrefixes { get { throw null; } } public string ResourceGuid { get { throw null; } } public Azure.ResourceManager.Network.Models.NatGatewaySku Sku { get { throw null; } set { } } - public System.Collections.Generic.IReadOnlyList Subnets { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Subnets { get { throw null; } } public System.Collections.Generic.IList Zones { get { throw null; } } } public partial class NetworkInterface : Azure.ResourceManager.Core.ArmResource @@ -1707,7 +1707,7 @@ public partial class NetworkInterfaceData : Azure.ResourceManager.Network.Models { public NetworkInterfaceData() { } public Azure.ResourceManager.Network.Models.NetworkInterfaceDnsSettings DnsSettings { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource DscpConfiguration { get { throw null; } } + public Azure.ResourceManager.Resources.Models.WritableSubResource DscpConfiguration { get { throw null; } } public bool? EnableAcceleratedNetworking { get { throw null; } set { } } public bool? EnableIPForwarding { get { throw null; } set { } } public string Etag { get { throw null; } } @@ -1724,7 +1724,7 @@ public NetworkInterfaceData() { } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } public string ResourceGuid { get { throw null; } } public System.Collections.Generic.IReadOnlyList TapConfigurations { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource VirtualMachine { get { throw null; } } + public Azure.ResourceManager.Resources.Models.WritableSubResource VirtualMachine { get { throw null; } } public string WorkloadType { get { throw null; } set { } } } public partial class NetworkInterfaceTapConfiguration : Azure.ResourceManager.Core.ArmResource @@ -1756,7 +1756,7 @@ protected NetworkInterfaceTapConfigurationContainer() { } public virtual Azure.Response GetIfExists(string tapConfigurationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string tapConfigurationName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class NetworkInterfaceTapConfigurationData : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class NetworkInterfaceTapConfigurationData : Azure.ResourceManager.Network.Models.SubResource { public NetworkInterfaceTapConfigurationData() { } public string Etag { get { throw null; } } @@ -1900,13 +1900,13 @@ public NetworkVirtualApplianceData() { } public System.Collections.Generic.IList CloudInitConfigurationBlobs { get { throw null; } } public string Etag { get { throw null; } } public Azure.ResourceManager.Resources.Models.ResourceIdentity Identity { get { throw null; } set { } } - public System.Collections.Generic.IReadOnlyList InboundSecurityRules { get { throw null; } } + public System.Collections.Generic.IReadOnlyList InboundSecurityRules { get { throw null; } } public Azure.ResourceManager.Network.Models.VirtualApplianceSkuProperties NvaSku { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } public long? VirtualApplianceAsn { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList VirtualApplianceNics { get { throw null; } } - public System.Collections.Generic.IReadOnlyList VirtualApplianceSites { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource VirtualHub { get { throw null; } set { } } + public System.Collections.Generic.IReadOnlyList VirtualApplianceSites { get { throw null; } } + public Azure.ResourceManager.Resources.Models.WritableSubResource VirtualHub { get { throw null; } set { } } } public partial class NetworkWatcher : Azure.ResourceManager.Core.ArmResource { @@ -2025,10 +2025,10 @@ public P2SVpnGatewayData() { } public bool? IsRoutingPreferenceInternet { get { throw null; } set { } } public System.Collections.Generic.IList P2SConnectionConfigurations { get { throw null; } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource VirtualHub { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource VirtualHub { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.VpnClientConnectionHealth VpnClientConnectionHealth { get { throw null; } } public int? VpnGatewayScaleUnit { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource VpnServerConfiguration { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource VpnServerConfiguration { get { throw null; } set { } } } public partial class PacketCapture : Azure.ResourceManager.Core.ArmResource { @@ -2063,12 +2063,13 @@ protected PacketCaptureContainer() { } public virtual Azure.Response GetIfExists(string packetCaptureName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string packetCaptureName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class PacketCaptureData : Azure.ResourceManager.Resources.Models.SubResource + public partial class PacketCaptureData { internal PacketCaptureData() { } public long? BytesToCapturePerPacket { get { throw null; } } public string Etag { get { throw null; } } public System.Collections.Generic.IReadOnlyList Filters { get { throw null; } } + public string Id { get { throw null; } } public string Name { get { throw null; } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } public Azure.ResourceManager.Network.Models.PacketCaptureStorageLocation StorageLocation { get { throw null; } } @@ -2105,7 +2106,7 @@ protected PrivateDnsZoneGroupContainer() { } public virtual Azure.Response GetIfExists(string privateDnsZoneGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string privateDnsZoneGroupName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class PrivateDnsZoneGroupData : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class PrivateDnsZoneGroupData : Azure.ResourceManager.Network.Models.SubResource { public PrivateDnsZoneGroupData() { } public string Etag { get { throw null; } } @@ -2269,7 +2270,7 @@ public PublicIPAddressData() { } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } public Azure.ResourceManager.Network.Models.IPVersion? PublicIPAddressVersion { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.IPAllocationMethod? PublicIPAllocationMethod { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource PublicIPPrefix { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource PublicIPPrefix { get { throw null; } set { } } public string ResourceGuid { get { throw null; } } public Azure.ResourceManager.Network.PublicIPAddressData ServicePublicIPAddress { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.PublicIPAddressSku Sku { get { throw null; } set { } } @@ -2311,16 +2312,16 @@ protected PublicIPPrefixContainer() { } public partial class PublicIPPrefixData : Azure.ResourceManager.Network.Models.Resource { public PublicIPPrefixData() { } - public Azure.ResourceManager.Network.Models.SubResource CustomIPPrefix { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource CustomIPPrefix { get { throw null; } set { } } public string Etag { get { throw null; } } public Azure.ResourceManager.Network.Models.ExtendedLocation ExtendedLocation { get { throw null; } set { } } public string IpPrefix { get { throw null; } } public System.Collections.Generic.IList IpTags { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource LoadBalancerFrontendIpConfiguration { get { throw null; } } + public Azure.ResourceManager.Resources.Models.WritableSubResource LoadBalancerFrontendIpConfiguration { get { throw null; } } public Azure.ResourceManager.Network.NatGatewayData NatGateway { get { throw null; } set { } } public int? PrefixLength { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } - public System.Collections.Generic.IReadOnlyList PublicIPAddresses { get { throw null; } } + public System.Collections.Generic.IReadOnlyList PublicIPAddresses { get { throw null; } } public Azure.ResourceManager.Network.Models.IPVersion? PublicIPAddressVersion { get { throw null; } set { } } public string ResourceGuid { get { throw null; } } public Azure.ResourceManager.Network.Models.PublicIPPrefixSku Sku { get { throw null; } set { } } @@ -2405,7 +2406,7 @@ protected RouteContainer() { } public virtual Azure.Response GetIfExists(string routeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string routeName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class RouteData : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class RouteData : Azure.ResourceManager.Network.Models.SubResource { public RouteData() { } public string AddressPrefix { get { throw null; } set { } } @@ -2489,7 +2490,7 @@ protected RouteFilterRuleContainer() { } public virtual Azure.Response GetIfExists(string ruleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string ruleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class RouteFilterRuleData : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class RouteFilterRuleData : Azure.ResourceManager.Network.Models.SubResource { public RouteFilterRuleData() { } public Azure.ResourceManager.Network.Models.Access? Access { get { throw null; } set { } } @@ -2584,7 +2585,7 @@ public SecurityPartnerProviderData() { } public string Etag { get { throw null; } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } public Azure.ResourceManager.Network.Models.SecurityProviderName? SecurityProviderName { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource VirtualHub { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource VirtualHub { get { throw null; } set { } } } public partial class SecurityRule : Azure.ResourceManager.Core.ArmResource { @@ -2615,7 +2616,7 @@ protected SecurityRuleContainer() { } public virtual Azure.Response GetIfExists(string securityRuleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string securityRuleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class SecurityRuleData : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class SecurityRuleData : Azure.ResourceManager.Network.Models.SubResource { public SecurityRuleData() { } public Azure.ResourceManager.Network.Models.SecurityRuleAccess? Access { get { throw null; } set { } } @@ -2711,7 +2712,7 @@ protected ServiceEndpointPolicyDefinitionContainer() { } public virtual Azure.Response GetIfExists(string serviceEndpointPolicyDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string serviceEndpointPolicyDefinitionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class ServiceEndpointPolicyDefinitionData : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ServiceEndpointPolicyDefinitionData : Azure.ResourceManager.Network.Models.SubResource { public ServiceEndpointPolicyDefinitionData() { } public string Description { get { throw null; } set { } } @@ -2758,7 +2759,7 @@ protected SubnetContainer() { } public virtual Azure.Response GetIfExists(string subnetName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string subnetName, string expand = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class SubnetData : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class SubnetData : Azure.ResourceManager.Network.Models.SubResource { public SubnetData() { } public string AddressPrefix { get { throw null; } set { } } @@ -2766,11 +2767,11 @@ public SubnetData() { } public System.Collections.Generic.IList ApplicationGatewayIpConfigurations { get { throw null; } } public System.Collections.Generic.IList Delegations { get { throw null; } } public string Etag { get { throw null; } } - public System.Collections.Generic.IList IpAllocations { get { throw null; } } + public System.Collections.Generic.IList IpAllocations { get { throw null; } } public System.Collections.Generic.IReadOnlyList IpConfigurationProfiles { get { throw null; } } public System.Collections.Generic.IReadOnlyList IpConfigurations { get { throw null; } } public string Name { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource NatGateway { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource NatGateway { get { throw null; } set { } } public Azure.ResourceManager.Network.NetworkSecurityGroupData NetworkSecurityGroup { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.VirtualNetworkPrivateEndpointNetworkPolicies? PrivateEndpointNetworkPolicies { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList PrivateEndpoints { get { throw null; } } @@ -3018,7 +3019,7 @@ protected VirtualApplianceSiteContainer() { } public virtual Azure.Response GetIfExists(string siteName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string siteName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class VirtualApplianceSiteData : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class VirtualApplianceSiteData : Azure.ResourceManager.Network.Models.SubResource { public VirtualApplianceSiteData() { } public string AddressPrefix { get { throw null; } set { } } @@ -3073,24 +3074,24 @@ public partial class VirtualHubData : Azure.ResourceManager.Network.Models.Resou public VirtualHubData() { } public string AddressPrefix { get { throw null; } set { } } public bool? AllowBranchToBranchTraffic { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource AzureFirewall { get { throw null; } set { } } - public System.Collections.Generic.IReadOnlyList BgpConnections { get { throw null; } } + public Azure.ResourceManager.Resources.Models.WritableSubResource AzureFirewall { get { throw null; } set { } } + public System.Collections.Generic.IReadOnlyList BgpConnections { get { throw null; } } public string Etag { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource ExpressRouteGateway { get { throw null; } set { } } - public System.Collections.Generic.IReadOnlyList IpConfigurations { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource P2SVpnGateway { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource ExpressRouteGateway { get { throw null; } set { } } + public System.Collections.Generic.IReadOnlyList IpConfigurations { get { throw null; } } + public Azure.ResourceManager.Resources.Models.WritableSubResource P2SVpnGateway { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.PreferredRoutingGateway? PreferredRoutingGateway { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } public Azure.ResourceManager.Network.Models.VirtualHubRouteTable RouteTable { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.RoutingState? RoutingState { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource SecurityPartnerProvider { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource SecurityPartnerProvider { get { throw null; } set { } } public string SecurityProviderName { get { throw null; } set { } } public string Sku { get { throw null; } set { } } public System.Collections.Generic.IList VirtualHubRouteTableV2S { get { throw null; } } public long? VirtualRouterAsn { get { throw null; } set { } } public System.Collections.Generic.IList VirtualRouterIps { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource VirtualWan { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource VpnGateway { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource VirtualWan { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource VpnGateway { get { throw null; } set { } } } public partial class VirtualHubRouteTableV2 : Azure.ResourceManager.Core.ArmResource { @@ -3121,7 +3122,7 @@ protected VirtualHubRouteTableV2Container() { } public virtual Azure.Response GetIfExists(string routeTableName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string routeTableName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class VirtualHubRouteTableV2Data : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class VirtualHubRouteTableV2Data : Azure.ResourceManager.Network.Models.SubResource { public VirtualHubRouteTableV2Data() { } public System.Collections.Generic.IList AttachedConnections { get { throw null; } } @@ -3174,14 +3175,14 @@ public partial class VirtualNetworkData : Azure.ResourceManager.Network.Models.R public VirtualNetworkData() { } public Azure.ResourceManager.Network.Models.AddressSpace AddressSpace { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.VirtualNetworkBgpCommunities BgpCommunities { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource DdosProtectionPlan { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource DdosProtectionPlan { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.DhcpOptions DhcpOptions { get { throw null; } set { } } public bool? EnableDdosProtection { get { throw null; } set { } } public bool? EnableVmProtection { get { throw null; } set { } } public string Etag { get { throw null; } } public Azure.ResourceManager.Network.Models.ExtendedLocation ExtendedLocation { get { throw null; } set { } } public int? FlowTimeoutInMinutes { get { throw null; } set { } } - public System.Collections.Generic.IList IpAllocations { get { throw null; } } + public System.Collections.Generic.IList IpAllocations { get { throw null; } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } public string ResourceGuid { get { throw null; } } public System.Collections.Generic.IList Subnets { get { throw null; } } @@ -3295,15 +3296,15 @@ public VirtualNetworkGatewayConnectionData(Azure.ResourceManager.Network.Virtual public Azure.ResourceManager.Network.Models.VirtualNetworkGatewayConnectionType ConnectionType { get { throw null; } set { } } public int? DpdTimeoutSeconds { get { throw null; } set { } } public long? EgressBytesTransferred { get { throw null; } } - public System.Collections.Generic.IList EgressNatRules { get { throw null; } } + public System.Collections.Generic.IList EgressNatRules { get { throw null; } } public bool? EnableBgp { get { throw null; } set { } } public string Etag { get { throw null; } } public bool? ExpressRouteGatewayBypass { get { throw null; } set { } } public long? IngressBytesTransferred { get { throw null; } } - public System.Collections.Generic.IList IngressNatRules { get { throw null; } } + public System.Collections.Generic.IList IngressNatRules { get { throw null; } } public System.Collections.Generic.IList IpsecPolicies { get { throw null; } } public Azure.ResourceManager.Network.LocalNetworkGatewayData LocalNetworkGateway2 { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource Peer { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource Peer { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } public string ResourceGuid { get { throw null; } } public int? RoutingWeight { get { throw null; } set { } } @@ -3344,7 +3345,7 @@ public VirtualNetworkGatewayData() { } public bool? EnablePrivateIpAddress { get { throw null; } set { } } public string Etag { get { throw null; } } public Azure.ResourceManager.Network.Models.ExtendedLocation ExtendedLocation { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource GatewayDefaultSite { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource GatewayDefaultSite { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.VirtualNetworkGatewayType? GatewayType { get { throw null; } set { } } public string InboundDnsForwardingEndpoint { get { throw null; } } public System.Collections.Generic.IList IpConfigurations { get { throw null; } } @@ -3386,7 +3387,7 @@ protected VirtualNetworkGatewayNatRuleContainer() { } public virtual Azure.Response GetIfExists(string natRuleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string natRuleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class VirtualNetworkGatewayNatRuleData : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class VirtualNetworkGatewayNatRuleData : Azure.ResourceManager.Network.Models.SubResource { public VirtualNetworkGatewayNatRuleData() { } public string Etag { get { throw null; } } @@ -3428,7 +3429,7 @@ protected VirtualNetworkPeeringContainer() { } public virtual Azure.Response GetIfExists(string virtualNetworkPeeringName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string virtualNetworkPeeringName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class VirtualNetworkPeeringData : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class VirtualNetworkPeeringData : Azure.ResourceManager.Network.Models.SubResource { public VirtualNetworkPeeringData() { } public bool? AllowForwardedTraffic { get { throw null; } set { } } @@ -3442,7 +3443,7 @@ public VirtualNetworkPeeringData() { } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } public Azure.ResourceManager.Network.Models.AddressSpace RemoteAddressSpace { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.VirtualNetworkBgpCommunities RemoteBgpCommunities { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource RemoteVirtualNetwork { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource RemoteVirtualNetwork { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.AddressSpace RemoteVirtualNetworkAddressSpace { get { throw null; } set { } } public string ResourceGuid { get { throw null; } } public string Type { get { throw null; } set { } } @@ -3528,9 +3529,9 @@ public partial class VirtualRouterData : Azure.ResourceManager.Network.Models.Re { public VirtualRouterData() { } public string Etag { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource HostedGateway { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource HostedSubnet { get { throw null; } set { } } - public System.Collections.Generic.IReadOnlyList Peerings { get { throw null; } } + public Azure.ResourceManager.Resources.Models.WritableSubResource HostedGateway { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource HostedSubnet { get { throw null; } set { } } + public System.Collections.Generic.IReadOnlyList Peerings { get { throw null; } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } public long? VirtualRouterAsn { get { throw null; } set { } } public System.Collections.Generic.IList VirtualRouterIps { get { throw null; } } @@ -3564,7 +3565,7 @@ protected VirtualRouterPeeringContainer() { } public virtual Azure.Response GetIfExists(string peeringName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string peeringName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class VirtualRouterPeeringData : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class VirtualRouterPeeringData : Azure.ResourceManager.Network.Models.SubResource { public VirtualRouterPeeringData() { } public string Etag { get { throw null; } } @@ -3619,8 +3620,8 @@ public VirtualWANData() { } public Azure.ResourceManager.Network.Models.OfficeTrafficCategory? Office365LocalBreakoutCategory { get { throw null; } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } public string TypePropertiesType { get { throw null; } set { } } - public System.Collections.Generic.IReadOnlyList VirtualHubs { get { throw null; } } - public System.Collections.Generic.IReadOnlyList VpnSites { get { throw null; } } + public System.Collections.Generic.IReadOnlyList VirtualHubs { get { throw null; } } + public System.Collections.Generic.IReadOnlyList VpnSites { get { throw null; } } } public partial class VpnConnection : Azure.ResourceManager.Core.ArmResource { @@ -3659,7 +3660,7 @@ protected VpnConnectionContainer() { } public virtual Azure.Response GetIfExists(string connectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string connectionName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class VpnConnectionData : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class VpnConnectionData : Azure.ResourceManager.Network.Models.SubResource { public VpnConnectionData() { } public int? ConnectionBandwidth { get { throw null; } set { } } @@ -3674,7 +3675,7 @@ public VpnConnectionData() { } public System.Collections.Generic.IList IpsecPolicies { get { throw null; } } public string Name { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource RemoteVpnSite { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource RemoteVpnSite { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.RoutingConfiguration RoutingConfiguration { get { throw null; } set { } } public int? RoutingWeight { get { throw null; } set { } } public string SharedKey { get { throw null; } set { } } @@ -3735,7 +3736,7 @@ public VpnGatewayData() { } public bool? IsRoutingPreferenceInternet { get { throw null; } set { } } public System.Collections.Generic.IList NatRules { get { throw null; } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource VirtualHub { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource VirtualHub { get { throw null; } set { } } public int? VpnGatewayScaleUnit { get { throw null; } set { } } } public partial class VpnGatewayNatRule : Azure.ResourceManager.Core.ArmResource @@ -3767,13 +3768,13 @@ protected VpnGatewayNatRuleContainer() { } public virtual Azure.Response GetIfExists(string natRuleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string natRuleName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class VpnGatewayNatRuleData : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class VpnGatewayNatRuleData : Azure.ResourceManager.Network.Models.SubResource { public VpnGatewayNatRuleData() { } - public System.Collections.Generic.IReadOnlyList EgressVpnSiteLinkConnections { get { throw null; } } + public System.Collections.Generic.IReadOnlyList EgressVpnSiteLinkConnections { get { throw null; } } public string Etag { get { throw null; } } public System.Collections.Generic.IList ExternalMappings { get { throw null; } } - public System.Collections.Generic.IReadOnlyList IngressVpnSiteLinkConnections { get { throw null; } } + public System.Collections.Generic.IReadOnlyList IngressVpnSiteLinkConnections { get { throw null; } } public System.Collections.Generic.IList InternalMappings { get { throw null; } } public string IpConfigurationId { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.VpnNatRuleMode? Mode { get { throw null; } set { } } @@ -3884,7 +3885,7 @@ public VpnSiteData() { } public Azure.ResourceManager.Network.Models.O365PolicyProperties O365Policy { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } public string SiteKey { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource VirtualWan { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource VirtualWan { get { throw null; } set { } } public System.Collections.Generic.IList VpnSiteLinks { get { throw null; } } } public partial class WebApplicationFirewallPolicy : Azure.ResourceManager.Core.ArmResource @@ -3924,9 +3925,9 @@ public WebApplicationFirewallPolicyData() { } public System.Collections.Generic.IReadOnlyList ApplicationGateways { get { throw null; } } public System.Collections.Generic.IList CustomRules { get { throw null; } } public string Etag { get { throw null; } } - public System.Collections.Generic.IReadOnlyList HttpListeners { get { throw null; } } + public System.Collections.Generic.IReadOnlyList HttpListeners { get { throw null; } } public Azure.ResourceManager.Network.Models.ManagedRulesDefinition ManagedRules { get { throw null; } set { } } - public System.Collections.Generic.IReadOnlyList PathBasedRules { get { throw null; } } + public System.Collections.Generic.IReadOnlyList PathBasedRules { get { throw null; } } public Azure.ResourceManager.Network.Models.PolicySettings PolicySettings { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } public Azure.ResourceManager.Network.Models.WebApplicationFirewallPolicyResourceState? ResourceState { get { throw null; } } @@ -3964,7 +3965,7 @@ public partial class AddressSpace public AddressSpace() { } public System.Collections.Generic.IList AddressPrefixes { get { throw null; } } } - public partial class ApplicationGatewayAuthenticationCertificate : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ApplicationGatewayAuthenticationCertificate : Azure.ResourceManager.Network.Models.SubResource { public ApplicationGatewayAuthenticationCertificate() { } public string Data { get { throw null; } set { } } @@ -3985,7 +3986,7 @@ public ApplicationGatewayAvailableSslOptions() { } public System.Collections.Generic.IList AvailableCipherSuites { get { throw null; } } public System.Collections.Generic.IList AvailableProtocols { get { throw null; } } public Azure.ResourceManager.Network.Models.ApplicationGatewaySslPolicyName? DefaultPolicy { get { throw null; } set { } } - public System.Collections.Generic.IList PredefinedPolicies { get { throw null; } } + public System.Collections.Generic.IList PredefinedPolicies { get { throw null; } } } public partial class ApplicationGatewayAvailableWafRuleSetsResult { @@ -3998,7 +3999,7 @@ public ApplicationGatewayBackendAddress() { } public string Fqdn { get { throw null; } set { } } public string IpAddress { get { throw null; } set { } } } - public partial class ApplicationGatewayBackendAddressPool : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ApplicationGatewayBackendAddressPool : Azure.ResourceManager.Network.Models.SubResource { public ApplicationGatewayBackendAddressPool() { } public System.Collections.Generic.IList BackendAddresses { get { throw null; } } @@ -4086,11 +4087,11 @@ internal ApplicationGatewayBackendHealthServer() { } public static bool operator !=(Azure.ResourceManager.Network.Models.ApplicationGatewayBackendHealthServerHealth left, Azure.ResourceManager.Network.Models.ApplicationGatewayBackendHealthServerHealth right) { throw null; } public override string ToString() { throw null; } } - public partial class ApplicationGatewayBackendHttpSettings : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ApplicationGatewayBackendHttpSettings : Azure.ResourceManager.Network.Models.SubResource { public ApplicationGatewayBackendHttpSettings() { } public string AffinityCookieName { get { throw null; } set { } } - public System.Collections.Generic.IList AuthenticationCertificates { get { throw null; } } + public System.Collections.Generic.IList AuthenticationCertificates { get { throw null; } } public Azure.ResourceManager.Network.Models.ApplicationGatewayConnectionDraining ConnectionDraining { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ApplicationGatewayCookieBasedAffinity? CookieBasedAffinity { get { throw null; } set { } } public string Etag { get { throw null; } } @@ -4099,12 +4100,12 @@ public ApplicationGatewayBackendHttpSettings() { } public string Path { get { throw null; } set { } } public bool? PickHostNameFromBackendAddress { get { throw null; } set { } } public int? Port { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource Probe { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource Probe { get { throw null; } set { } } public bool? ProbeEnabled { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ApplicationGatewayProtocol? Protocol { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } public int? RequestTimeout { get { throw null; } set { } } - public System.Collections.Generic.IList TrustedRootCertificates { get { throw null; } } + public System.Collections.Generic.IList TrustedRootCertificates { get { throw null; } } public string Type { get { throw null; } } } public partial class ApplicationGatewayClientAuthConfiguration @@ -4236,20 +4237,20 @@ public ApplicationGatewayFirewallRuleSet() { } public string RuleSetType { get { throw null; } set { } } public string RuleSetVersion { get { throw null; } set { } } } - public partial class ApplicationGatewayFrontendIPConfiguration : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ApplicationGatewayFrontendIPConfiguration : Azure.ResourceManager.Network.Models.SubResource { public ApplicationGatewayFrontendIPConfiguration() { } public string Etag { get { throw null; } } public string Name { get { throw null; } set { } } public string PrivateIPAddress { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.IPAllocationMethod? PrivateIPAllocationMethod { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource PrivateLinkConfiguration { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource PrivateLinkConfiguration { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource PublicIPAddress { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource Subnet { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource PublicIPAddress { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource Subnet { get { throw null; } set { } } public string Type { get { throw null; } } } - public partial class ApplicationGatewayFrontendPort : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ApplicationGatewayFrontendPort : Azure.ResourceManager.Network.Models.SubResource { public ApplicationGatewayFrontendPort() { } public string Etag { get { throw null; } } @@ -4264,38 +4265,38 @@ public ApplicationGatewayHeaderConfiguration() { } public string HeaderName { get { throw null; } set { } } public string HeaderValue { get { throw null; } set { } } } - public partial class ApplicationGatewayHttpListener : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ApplicationGatewayHttpListener : Azure.ResourceManager.Network.Models.SubResource { public ApplicationGatewayHttpListener() { } public System.Collections.Generic.IList CustomErrorConfigurations { get { throw null; } } public string Etag { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource FirewallPolicy { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource FrontendIPConfiguration { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource FrontendPort { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource FirewallPolicy { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource FrontendIPConfiguration { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource FrontendPort { get { throw null; } set { } } public string HostName { get { throw null; } set { } } public System.Collections.Generic.IList HostNames { get { throw null; } } public string Name { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ApplicationGatewayProtocol? Protocol { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } public bool? RequireServerNameIndication { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource SslCertificate { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource SslProfile { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource SslCertificate { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource SslProfile { get { throw null; } set { } } public string Type { get { throw null; } } } - public partial class ApplicationGatewayIPConfiguration : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ApplicationGatewayIPConfiguration : Azure.ResourceManager.Network.Models.SubResource { public ApplicationGatewayIPConfiguration() { } public string Etag { get { throw null; } } public string Name { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource Subnet { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource Subnet { get { throw null; } set { } } public string Type { get { throw null; } } } public partial class ApplicationGatewayOnDemandProbe { public ApplicationGatewayOnDemandProbe() { } - public Azure.ResourceManager.Network.Models.SubResource BackendAddressPool { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource BackendHttpSettings { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource BackendAddressPool { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource BackendHttpSettings { get { throw null; } set { } } public string Host { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ApplicationGatewayProbeHealthResponseMatch Match { get { throw null; } set { } } public string Path { get { throw null; } set { } } @@ -4323,18 +4324,18 @@ public ApplicationGatewayOnDemandProbe() { } public static bool operator !=(Azure.ResourceManager.Network.Models.ApplicationGatewayOperationalState left, Azure.ResourceManager.Network.Models.ApplicationGatewayOperationalState right) { throw null; } public override string ToString() { throw null; } } - public partial class ApplicationGatewayPathRule : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ApplicationGatewayPathRule : Azure.ResourceManager.Network.Models.SubResource { public ApplicationGatewayPathRule() { } - public Azure.ResourceManager.Network.Models.SubResource BackendAddressPool { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource BackendHttpSettings { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource BackendAddressPool { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource BackendHttpSettings { get { throw null; } set { } } public string Etag { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource FirewallPolicy { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource FirewallPolicy { get { throw null; } set { } } public string Name { get { throw null; } set { } } public System.Collections.Generic.IList Paths { get { throw null; } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource RedirectConfiguration { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource RewriteRuleSet { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource RedirectConfiguration { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource RewriteRuleSet { get { throw null; } set { } } public string Type { get { throw null; } } } public partial class ApplicationGatewayPrivateEndpointConnectionDeleteOperation : Azure.Operation @@ -4361,7 +4362,7 @@ protected ApplicationGatewayPrivateEndpointConnectionUpdateOperation() { } public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class ApplicationGatewayPrivateLinkConfiguration : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ApplicationGatewayPrivateLinkConfiguration : Azure.ResourceManager.Network.Models.SubResource { public ApplicationGatewayPrivateLinkConfiguration() { } public string Etag { get { throw null; } } @@ -4370,7 +4371,7 @@ public ApplicationGatewayPrivateLinkConfiguration() { } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } public string Type { get { throw null; } } } - public partial class ApplicationGatewayPrivateLinkIpConfiguration : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ApplicationGatewayPrivateLinkIpConfiguration : Azure.ResourceManager.Network.Models.SubResource { public ApplicationGatewayPrivateLinkIpConfiguration() { } public string Etag { get { throw null; } } @@ -4379,10 +4380,10 @@ public ApplicationGatewayPrivateLinkIpConfiguration() { } public string PrivateIPAddress { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.IPAllocationMethod? PrivateIPAllocationMethod { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource Subnet { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource Subnet { get { throw null; } set { } } public string Type { get { throw null; } } } - public partial class ApplicationGatewayPrivateLinkResource : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ApplicationGatewayPrivateLinkResource : Azure.ResourceManager.Network.Models.SubResource { public ApplicationGatewayPrivateLinkResource() { } public string Etag { get { throw null; } } @@ -4392,7 +4393,7 @@ public ApplicationGatewayPrivateLinkResource() { } public System.Collections.Generic.IList RequiredZoneNames { get { throw null; } } public string Type { get { throw null; } } } - public partial class ApplicationGatewayProbe : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ApplicationGatewayProbe : Azure.ResourceManager.Network.Models.SubResource { public ApplicationGatewayProbe() { } public string Etag { get { throw null; } } @@ -4434,20 +4435,20 @@ public ApplicationGatewayProbeHealthResponseMatch() { } public static bool operator !=(Azure.ResourceManager.Network.Models.ApplicationGatewayProtocol left, Azure.ResourceManager.Network.Models.ApplicationGatewayProtocol right) { throw null; } public override string ToString() { throw null; } } - public partial class ApplicationGatewayRedirectConfiguration : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ApplicationGatewayRedirectConfiguration : Azure.ResourceManager.Network.Models.SubResource { public ApplicationGatewayRedirectConfiguration() { } public string Etag { get { throw null; } } public bool? IncludePath { get { throw null; } set { } } public bool? IncludeQueryString { get { throw null; } set { } } public string Name { get { throw null; } set { } } - public System.Collections.Generic.IList PathRules { get { throw null; } } + public System.Collections.Generic.IList PathRules { get { throw null; } } public Azure.ResourceManager.Network.Models.ApplicationGatewayRedirectType? RedirectType { get { throw null; } set { } } - public System.Collections.Generic.IList RequestRoutingRules { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource TargetListener { get { throw null; } set { } } + public System.Collections.Generic.IList RequestRoutingRules { get { throw null; } } + public Azure.ResourceManager.Resources.Models.WritableSubResource TargetListener { get { throw null; } set { } } public string TargetUrl { get { throw null; } set { } } public string Type { get { throw null; } } - public System.Collections.Generic.IList UrlPathMaps { get { throw null; } } + public System.Collections.Generic.IList UrlPathMaps { get { throw null; } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct ApplicationGatewayRedirectType : System.IEquatable @@ -4469,21 +4470,21 @@ public ApplicationGatewayRedirectConfiguration() { } public static bool operator !=(Azure.ResourceManager.Network.Models.ApplicationGatewayRedirectType left, Azure.ResourceManager.Network.Models.ApplicationGatewayRedirectType right) { throw null; } public override string ToString() { throw null; } } - public partial class ApplicationGatewayRequestRoutingRule : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ApplicationGatewayRequestRoutingRule : Azure.ResourceManager.Network.Models.SubResource { public ApplicationGatewayRequestRoutingRule() { } - public Azure.ResourceManager.Network.Models.SubResource BackendAddressPool { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource BackendHttpSettings { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource BackendAddressPool { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource BackendHttpSettings { get { throw null; } set { } } public string Etag { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource HttpListener { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource HttpListener { get { throw null; } set { } } public string Name { get { throw null; } set { } } public int? Priority { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource RedirectConfiguration { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource RewriteRuleSet { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource RedirectConfiguration { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource RewriteRuleSet { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ApplicationGatewayRequestRoutingRuleType? RuleType { get { throw null; } set { } } public string Type { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource UrlPathMap { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource UrlPathMap { get { throw null; } set { } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct ApplicationGatewayRequestRoutingRuleType : System.IEquatable @@ -4526,7 +4527,7 @@ public ApplicationGatewayRewriteRuleCondition() { } public string Pattern { get { throw null; } set { } } public string Variable { get { throw null; } set { } } } - public partial class ApplicationGatewayRewriteRuleSet : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ApplicationGatewayRewriteRuleSet : Azure.ResourceManager.Network.Models.SubResource { public ApplicationGatewayRewriteRuleSet() { } public string Etag { get { throw null; } } @@ -4564,7 +4565,7 @@ public ApplicationGatewaySku() { } public static bool operator !=(Azure.ResourceManager.Network.Models.ApplicationGatewaySkuName left, Azure.ResourceManager.Network.Models.ApplicationGatewaySkuName right) { throw null; } public override string ToString() { throw null; } } - public partial class ApplicationGatewaySslCertificate : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ApplicationGatewaySslCertificate : Azure.ResourceManager.Network.Models.SubResource { public ApplicationGatewaySslCertificate() { } public string Data { get { throw null; } set { } } @@ -4666,14 +4667,14 @@ public ApplicationGatewaySslPolicy() { } public static bool operator !=(Azure.ResourceManager.Network.Models.ApplicationGatewaySslPolicyType left, Azure.ResourceManager.Network.Models.ApplicationGatewaySslPolicyType right) { throw null; } public override string ToString() { throw null; } } - public partial class ApplicationGatewaySslPredefinedPolicy : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ApplicationGatewaySslPredefinedPolicy : Azure.ResourceManager.Network.Models.SubResource { public ApplicationGatewaySslPredefinedPolicy() { } public System.Collections.Generic.IList CipherSuites { get { throw null; } } public Azure.ResourceManager.Network.Models.ApplicationGatewaySslProtocol? MinProtocolVersion { get { throw null; } set { } } public string Name { get { throw null; } set { } } } - public partial class ApplicationGatewaySslProfile : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ApplicationGatewaySslProfile : Azure.ResourceManager.Network.Models.SubResource { public ApplicationGatewaySslProfile() { } public Azure.ResourceManager.Network.Models.ApplicationGatewayClientAuthConfiguration ClientAuthConfiguration { get { throw null; } set { } } @@ -4681,7 +4682,7 @@ public ApplicationGatewaySslProfile() { } public string Name { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } public Azure.ResourceManager.Network.Models.ApplicationGatewaySslPolicy SslPolicy { get { throw null; } set { } } - public System.Collections.Generic.IList TrustedClientCertificates { get { throw null; } } + public System.Collections.Generic.IList TrustedClientCertificates { get { throw null; } } public string Type { get { throw null; } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] @@ -4745,7 +4746,7 @@ protected ApplicationGatewayStopOperation() { } public static bool operator !=(Azure.ResourceManager.Network.Models.ApplicationGatewayTier left, Azure.ResourceManager.Network.Models.ApplicationGatewayTier right) { throw null; } public override string ToString() { throw null; } } - public partial class ApplicationGatewayTrustedClientCertificate : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ApplicationGatewayTrustedClientCertificate : Azure.ResourceManager.Network.Models.SubResource { public ApplicationGatewayTrustedClientCertificate() { } public string ClientCertIssuerDN { get { throw null; } } @@ -4756,7 +4757,7 @@ public ApplicationGatewayTrustedClientCertificate() { } public string Type { get { throw null; } } public string ValidatedCertData { get { throw null; } } } - public partial class ApplicationGatewayTrustedRootCertificate : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ApplicationGatewayTrustedRootCertificate : Azure.ResourceManager.Network.Models.SubResource { public ApplicationGatewayTrustedRootCertificate() { } public string Data { get { throw null; } set { } } @@ -4786,13 +4787,13 @@ public ApplicationGatewayUrlConfiguration() { } public string ModifiedQueryString { get { throw null; } set { } } public bool? Reroute { get { throw null; } set { } } } - public partial class ApplicationGatewayUrlPathMap : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ApplicationGatewayUrlPathMap : Azure.ResourceManager.Network.Models.SubResource { public ApplicationGatewayUrlPathMap() { } - public Azure.ResourceManager.Network.Models.SubResource DefaultBackendAddressPool { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource DefaultBackendHttpSettings { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource DefaultRedirectConfiguration { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource DefaultRewriteRuleSet { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource DefaultBackendAddressPool { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource DefaultBackendHttpSettings { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource DefaultRedirectConfiguration { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource DefaultRewriteRuleSet { get { throw null; } set { } } public string Etag { get { throw null; } } public string Name { get { throw null; } set { } } public System.Collections.Generic.IList PathRules { get { throw null; } } @@ -4983,7 +4984,7 @@ public AzureFirewallApplicationRule() { } public System.Collections.Generic.IList SourceIpGroups { get { throw null; } } public System.Collections.Generic.IList TargetFqdns { get { throw null; } } } - public partial class AzureFirewallApplicationRuleCollection : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class AzureFirewallApplicationRuleCollection : Azure.ResourceManager.Network.Models.SubResource { public AzureFirewallApplicationRuleCollection() { } public Azure.ResourceManager.Network.Models.AzureFirewallRCAction Action { get { throw null; } set { } } @@ -5049,21 +5050,22 @@ public AzureFirewallFqdnTag() { } public string FqdnTagName { get { throw null; } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } } - public partial class AzureFirewallIPConfiguration : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class AzureFirewallIPConfiguration : Azure.ResourceManager.Network.Models.SubResource { public AzureFirewallIPConfiguration() { } public string Etag { get { throw null; } } public string Name { get { throw null; } set { } } public string PrivateIPAddress { get { throw null; } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource PublicIPAddress { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource Subnet { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource PublicIPAddress { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource Subnet { get { throw null; } set { } } public string Type { get { throw null; } } } - public partial class AzureFirewallIpGroups : Azure.ResourceManager.Resources.Models.SubResource + public partial class AzureFirewallIpGroups { internal AzureFirewallIpGroups() { } public string ChangeNumber { get { throw null; } } + public string Id { get { throw null; } } } public partial class AzureFirewallNatRCAction { @@ -5102,7 +5104,7 @@ public AzureFirewallNatRule() { } public string TranslatedFqdn { get { throw null; } set { } } public string TranslatedPort { get { throw null; } set { } } } - public partial class AzureFirewallNatRuleCollection : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class AzureFirewallNatRuleCollection : Azure.ResourceManager.Network.Models.SubResource { public AzureFirewallNatRuleCollection() { } public Azure.ResourceManager.Network.Models.AzureFirewallNatRCAction Action { get { throw null; } set { } } @@ -5125,7 +5127,7 @@ public AzureFirewallNetworkRule() { } public System.Collections.Generic.IList SourceAddresses { get { throw null; } } public System.Collections.Generic.IList SourceIpGroups { get { throw null; } } } - public partial class AzureFirewallNetworkRuleCollection : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class AzureFirewallNetworkRuleCollection : Azure.ResourceManager.Network.Models.SubResource { public AzureFirewallNetworkRuleCollection() { } public Azure.ResourceManager.Network.Models.AzureFirewallRCAction Action { get { throw null; } set { } } @@ -5323,15 +5325,15 @@ protected BastionHostDeleteOperation() { } public override System.Threading.Tasks.ValueTask WaitForCompletionResponseAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public override System.Threading.Tasks.ValueTask WaitForCompletionResponseAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class BastionHostIPConfiguration : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class BastionHostIPConfiguration : Azure.ResourceManager.Network.Models.SubResource { public BastionHostIPConfiguration() { } public string Etag { get { throw null; } } public string Name { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.IPAllocationMethod? PrivateIPAllocationMethod { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource PublicIPAddress { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource Subnet { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource PublicIPAddress { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource Subnet { get { throw null; } set { } } public string Type { get { throw null; } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] @@ -5762,7 +5764,7 @@ public partial class ConnectionResetSharedKey public ConnectionResetSharedKey(int keyLength) { } public int KeyLength { get { throw null; } set { } } } - public partial class ConnectionSharedKey : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ConnectionSharedKey : Azure.ResourceManager.Network.Models.SubResource { public ConnectionSharedKey(string value) { } public string Value { get { throw null; } set { } } @@ -5827,10 +5829,11 @@ public ConnectivityDestination() { } public int? Port { get { throw null; } set { } } public string ResourceId { get { throw null; } set { } } } - public partial class ConnectivityHop : Azure.ResourceManager.Resources.Models.SubResource + public partial class ConnectivityHop { internal ConnectivityHop() { } public string Address { get { throw null; } } + public string Id { get { throw null; } } public System.Collections.Generic.IReadOnlyList Issues { get { throw null; } } public System.Collections.Generic.IReadOnlyList Links { get { throw null; } } public System.Collections.Generic.IReadOnlyList NextHopIds { get { throw null; } } @@ -5873,14 +5876,10 @@ public ConnectivitySource(string resourceId) { } public int? Port { get { throw null; } set { } } public string ResourceId { get { throw null; } } } - public partial class Container : Azure.ResourceManager.Resources.Models.WritableSubResource - { - public Container() { } - } - public partial class ContainerNetworkInterface : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ContainerNetworkInterface : Azure.ResourceManager.Network.Models.SubResource { public ContainerNetworkInterface() { } - public Azure.ResourceManager.Network.Models.Container Container { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource Container { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ContainerNetworkInterfaceConfiguration ContainerNetworkInterfaceConfiguration { get { throw null; } } public string Etag { get { throw null; } } public System.Collections.Generic.IReadOnlyList IpConfigurations { get { throw null; } } @@ -5888,10 +5887,10 @@ public ContainerNetworkInterface() { } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } public string Type { get { throw null; } } } - public partial class ContainerNetworkInterfaceConfiguration : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ContainerNetworkInterfaceConfiguration : Azure.ResourceManager.Network.Models.SubResource { public ContainerNetworkInterfaceConfiguration() { } - public System.Collections.Generic.IList ContainerNetworkInterfaces { get { throw null; } } + public System.Collections.Generic.IList ContainerNetworkInterfaces { get { throw null; } } public string Etag { get { throw null; } } public System.Collections.Generic.IList IpConfigurations { get { throw null; } } public string Name { get { throw null; } set { } } @@ -6087,7 +6086,7 @@ protected DdosProtectionPlanUpdateTagsOperation() { } public partial class DdosSettings { public DdosSettings() { } - public Azure.ResourceManager.Network.Models.SubResource DdosCustomPolicy { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource DdosCustomPolicy { get { throw null; } set { } } public bool? ProtectedIP { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.DdosSettingsProtectionCoverage? ProtectionCoverage { get { throw null; } set { } } } @@ -6109,7 +6108,7 @@ public DdosSettings() { } public static bool operator !=(Azure.ResourceManager.Network.Models.DdosSettingsProtectionCoverage left, Azure.ResourceManager.Network.Models.DdosSettingsProtectionCoverage right) { throw null; } public override string ToString() { throw null; } } - public partial class Delegation : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class Delegation : Azure.ResourceManager.Network.Models.SubResource { public Delegation() { } public System.Collections.Generic.IReadOnlyList Actions { get { throw null; } } @@ -6250,15 +6249,15 @@ public partial class EffectiveNetworkSecurityGroup internal EffectiveNetworkSecurityGroup() { } public Azure.ResourceManager.Network.Models.EffectiveNetworkSecurityGroupAssociation Association { get { throw null; } } public System.Collections.Generic.IReadOnlyList EffectiveSecurityRules { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource NetworkSecurityGroup { get { throw null; } } + public Azure.ResourceManager.Resources.Models.WritableSubResource NetworkSecurityGroup { get { throw null; } } public string TagMap { get { throw null; } } } public partial class EffectiveNetworkSecurityGroupAssociation { internal EffectiveNetworkSecurityGroupAssociation() { } - public Azure.ResourceManager.Network.Models.SubResource NetworkInterface { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource NetworkManager { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource Subnet { get { throw null; } } + public Azure.ResourceManager.Resources.Models.WritableSubResource NetworkInterface { get { throw null; } } + public Azure.ResourceManager.Resources.Models.WritableSubResource NetworkManager { get { throw null; } } + public Azure.ResourceManager.Resources.Models.WritableSubResource Subnet { get { throw null; } } } public partial class EffectiveNetworkSecurityGroupListResult { @@ -6365,7 +6364,7 @@ public EffectiveRoutesParameters() { } public static bool operator !=(Azure.ResourceManager.Network.Models.EffectiveSecurityRuleProtocol left, Azure.ResourceManager.Network.Models.EffectiveSecurityRuleProtocol right) { throw null; } public override string ToString() { throw null; } } - public partial class EndpointServiceResult : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class EndpointServiceResult : Azure.ResourceManager.Network.Models.SubResource { public EndpointServiceResult() { } public string Name { get { throw null; } } @@ -6593,11 +6592,6 @@ protected ExpressRouteCircuitPeeringDeleteOperation() { } public override System.Threading.Tasks.ValueTask WaitForCompletionResponseAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public override System.Threading.Tasks.ValueTask WaitForCompletionResponseAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class ExpressRouteCircuitPeeringId - { - public ExpressRouteCircuitPeeringId() { } - public string Id { get { throw null; } set { } } - } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct ExpressRouteCircuitPeeringState : System.IEquatable { @@ -6616,11 +6610,6 @@ public ExpressRouteCircuitPeeringId() { } public static bool operator !=(Azure.ResourceManager.Network.Models.ExpressRouteCircuitPeeringState left, Azure.ResourceManager.Network.Models.ExpressRouteCircuitPeeringState right) { throw null; } public override string ToString() { throw null; } } - public partial class ExpressRouteCircuitReference - { - public ExpressRouteCircuitReference() { } - public string Id { get { throw null; } set { } } - } public partial class ExpressRouteCircuitRoutesTable { internal ExpressRouteCircuitRoutesTable() { } @@ -6754,11 +6743,6 @@ protected ExpressRouteConnectionDeleteOperation() { } public override System.Threading.Tasks.ValueTask WaitForCompletionResponseAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public override System.Threading.Tasks.ValueTask WaitForCompletionResponseAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class ExpressRouteConnectionId - { - public ExpressRouteConnectionId() { } - public string Id { get { throw null; } } - } public partial class ExpressRouteConnectionList { internal ExpressRouteConnectionList() { } @@ -6920,7 +6904,7 @@ protected ExpressRouteGatewayUpdateTagsOperation() { } public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class ExpressRouteLink : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ExpressRouteLink : Azure.ResourceManager.Network.Models.SubResource { public ExpressRouteLink() { } public Azure.ResourceManager.Network.Models.ExpressRouteLinkAdminState? AdminState { get { throw null; } set { } } @@ -7268,9 +7252,10 @@ public FirewallPolicyIntrusionDetectionConfiguration() { } public static bool operator !=(Azure.ResourceManager.Network.Models.FirewallPolicyIntrusionDetectionProtocol left, Azure.ResourceManager.Network.Models.FirewallPolicyIntrusionDetectionProtocol right) { throw null; } public override string ToString() { throw null; } } - public partial class FirewallPolicyIntrusionDetectionSignatureSpecification : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class FirewallPolicyIntrusionDetectionSignatureSpecification { public FirewallPolicyIntrusionDetectionSignatureSpecification() { } + public string Id { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.FirewallPolicyIntrusionDetectionStateType? Mode { get { throw null; } set { } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] @@ -7295,14 +7280,14 @@ public FirewallPolicyIntrusionDetectionSignatureSpecification() { } public partial class FirewallPolicyLogAnalyticsResources { public FirewallPolicyLogAnalyticsResources() { } - public Azure.ResourceManager.Network.Models.SubResource DefaultWorkspaceId { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource DefaultWorkspaceId { get { throw null; } set { } } public System.Collections.Generic.IList Workspaces { get { throw null; } } } public partial class FirewallPolicyLogAnalyticsWorkspace { public FirewallPolicyLogAnalyticsWorkspace() { } public string Region { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource WorkspaceId { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource WorkspaceId { get { throw null; } set { } } } public partial class FirewallPolicyNatRuleCollection : Azure.ResourceManager.Network.Models.FirewallPolicyRuleCollection { @@ -7563,22 +7548,22 @@ protected FlowLogUpdateTagsOperation() { } public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class FrontendIPConfiguration : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class FrontendIPConfiguration : Azure.ResourceManager.Network.Models.SubResource { public FrontendIPConfiguration() { } public string Etag { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource GatewayLoadBalancer { get { throw null; } set { } } - public System.Collections.Generic.IReadOnlyList InboundNatPools { get { throw null; } } - public System.Collections.Generic.IReadOnlyList InboundNatRules { get { throw null; } } - public System.Collections.Generic.IReadOnlyList LoadBalancingRules { get { throw null; } } + public Azure.ResourceManager.Resources.Models.WritableSubResource GatewayLoadBalancer { get { throw null; } set { } } + public System.Collections.Generic.IReadOnlyList InboundNatPools { get { throw null; } } + public System.Collections.Generic.IReadOnlyList InboundNatRules { get { throw null; } } + public System.Collections.Generic.IReadOnlyList LoadBalancingRules { get { throw null; } } public string Name { get { throw null; } set { } } - public System.Collections.Generic.IReadOnlyList OutboundRules { get { throw null; } } + public System.Collections.Generic.IReadOnlyList OutboundRules { get { throw null; } } public string PrivateIPAddress { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.IPVersion? PrivateIPAddressVersion { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.IPAllocationMethod? PrivateIPAllocationMethod { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } public Azure.ResourceManager.Network.PublicIPAddressData PublicIPAddress { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource PublicIPPrefix { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource PublicIPPrefix { get { throw null; } set { } } public Azure.ResourceManager.Network.SubnetData Subnet { get { throw null; } set { } } public string Type { get { throw null; } } public System.Collections.Generic.IList Zones { get { throw null; } } @@ -7855,14 +7840,14 @@ protected HubVirtualNetworkConnectionDeleteOperation() { } public static bool operator !=(Azure.ResourceManager.Network.Models.IkeIntegrity left, Azure.ResourceManager.Network.Models.IkeIntegrity right) { throw null; } public override string ToString() { throw null; } } - public partial class InboundNatPool : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class InboundNatPool : Azure.ResourceManager.Network.Models.SubResource { public InboundNatPool() { } public int? BackendPort { get { throw null; } set { } } public bool? EnableFloatingIP { get { throw null; } set { } } public bool? EnableTcpReset { get { throw null; } set { } } public string Etag { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource FrontendIPConfiguration { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource FrontendIPConfiguration { get { throw null; } set { } } public int? FrontendPortRangeEnd { get { throw null; } set { } } public int? FrontendPortRangeStart { get { throw null; } set { } } public int? IdleTimeoutInMinutes { get { throw null; } set { } } @@ -7895,7 +7880,7 @@ protected InboundNatRuleDeleteOperation() { } public override System.Threading.Tasks.ValueTask WaitForCompletionResponseAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public override System.Threading.Tasks.ValueTask WaitForCompletionResponseAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class InboundSecurityRule : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class InboundSecurityRule : Azure.ResourceManager.Network.Models.SubResource { public InboundSecurityRule() { } public string Etag { get { throw null; } } @@ -8022,7 +8007,7 @@ protected IpAllocationUpdateTagsOperation() { } public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class IPConfiguration : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class IPConfiguration : Azure.ResourceManager.Network.Models.SubResource { public IPConfiguration() { } public string Etag { get { throw null; } } @@ -8041,7 +8026,7 @@ public IPConfigurationBgpPeeringAddress() { } public string IpconfigurationId { get { throw null; } set { } } public System.Collections.Generic.IReadOnlyList TunnelIpAddresses { get { throw null; } } } - public partial class IPConfigurationProfile : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class IPConfigurationProfile : Azure.ResourceManager.Network.Models.SubResource { public IPConfigurationProfile() { } public string Etag { get { throw null; } } @@ -8181,7 +8166,7 @@ public partial class Ipv6ExpressRouteCircuitPeeringConfig public Ipv6ExpressRouteCircuitPeeringConfig() { } public Azure.ResourceManager.Network.Models.ExpressRouteCircuitPeeringConfig MicrosoftPeeringConfig { get { throw null; } set { } } public string PrimaryPeerAddressPrefix { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource RouteFilter { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource RouteFilter { get { throw null; } set { } } public string SecondaryPeerAddressPrefix { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ExpressRouteCircuitPeeringState? State { get { throw null; } set { } } } @@ -8232,11 +8217,11 @@ public partial class LoadBalancerBackendAddress { public LoadBalancerBackendAddress() { } public string IpAddress { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource LoadBalancerFrontendIPConfiguration { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource LoadBalancerFrontendIPConfiguration { get { throw null; } set { } } public string Name { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource NetworkInterfaceIPConfiguration { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource Subnet { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource VirtualNetwork { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource NetworkInterfaceIPConfiguration { get { throw null; } } + public Azure.ResourceManager.Resources.Models.WritableSubResource Subnet { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource VirtualNetwork { get { throw null; } set { } } } public partial class LoadBalancerBackendAddressPoolCreateOrUpdateOperation : Azure.Operation { @@ -8377,27 +8362,28 @@ public partial class LoadBalancerVipSwapRequest public LoadBalancerVipSwapRequest() { } public System.Collections.Generic.IList FrontendIPConfigurations { get { throw null; } } } - public partial class LoadBalancerVipSwapRequestFrontendIPConfiguration : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class LoadBalancerVipSwapRequestFrontendIPConfiguration { public LoadBalancerVipSwapRequestFrontendIPConfiguration() { } - public Azure.ResourceManager.Network.Models.SubResource PublicIPAddress { get { throw null; } set { } } + public string Id { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource PublicIPAddress { get { throw null; } set { } } } - public partial class LoadBalancingRule : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class LoadBalancingRule : Azure.ResourceManager.Network.Models.SubResource { public LoadBalancingRule() { } - public Azure.ResourceManager.Network.Models.SubResource BackendAddressPool { get { throw null; } set { } } - public System.Collections.Generic.IList BackendAddressPools { get { throw null; } } + public Azure.ResourceManager.Resources.Models.WritableSubResource BackendAddressPool { get { throw null; } set { } } + public System.Collections.Generic.IList BackendAddressPools { get { throw null; } } public int? BackendPort { get { throw null; } set { } } public bool? DisableOutboundSnat { get { throw null; } set { } } public bool? EnableFloatingIP { get { throw null; } set { } } public bool? EnableTcpReset { get { throw null; } set { } } public string Etag { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource FrontendIPConfiguration { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource FrontendIPConfiguration { get { throw null; } set { } } public int? FrontendPort { get { throw null; } set { } } public int? IdleTimeoutInMinutes { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.LoadDistribution? LoadDistribution { get { throw null; } set { } } public string Name { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource Probe { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource Probe { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.TransportProtocol? Protocol { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } public string Type { get { throw null; } } @@ -8654,9 +8640,10 @@ public NetworkIntentPolicyConfiguration() { } public string NetworkIntentPolicyName { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.NetworkIntentPolicy SourceNetworkIntentPolicy { get { throw null; } set { } } } - public partial class NetworkInterfaceAssociation : Azure.ResourceManager.Resources.Models.SubResource + public partial class NetworkInterfaceAssociation { internal NetworkInterfaceAssociation() { } + public string Id { get { throw null; } } public System.Collections.Generic.IReadOnlyList SecurityRules { get { throw null; } } } public partial class NetworkInterfaceCreateOrUpdateOperation : Azure.Operation @@ -8718,13 +8705,13 @@ protected NetworkInterfaceGetEffectiveRouteTableOperation() { } public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class NetworkInterfaceIPConfiguration : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class NetworkInterfaceIPConfiguration : Azure.ResourceManager.Network.Models.SubResource { public NetworkInterfaceIPConfiguration() { } public System.Collections.Generic.IList ApplicationGatewayBackendAddressPools { get { throw null; } } public System.Collections.Generic.IList ApplicationSecurityGroups { get { throw null; } } public string Etag { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource GatewayLoadBalancer { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource GatewayLoadBalancer { get { throw null; } set { } } public System.Collections.Generic.IList LoadBalancerBackendAddressPools { get { throw null; } } public System.Collections.Generic.IList LoadBalancerInboundNatRules { get { throw null; } } public string Name { get { throw null; } set { } } @@ -9247,14 +9234,14 @@ public Office365PolicyProperties() { } public static bool operator !=(Azure.ResourceManager.Network.Models.Origin left, Azure.ResourceManager.Network.Models.Origin right) { throw null; } public override string ToString() { throw null; } } - public partial class OutboundRule : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class OutboundRule : Azure.ResourceManager.Network.Models.SubResource { public OutboundRule() { } public int? AllocatedOutboundPorts { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource BackendAddressPool { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource BackendAddressPool { get { throw null; } set { } } public bool? EnableTcpReset { get { throw null; } set { } } public string Etag { get { throw null; } } - public System.Collections.Generic.IList FrontendIPConfigurations { get { throw null; } } + public System.Collections.Generic.IList FrontendIPConfigurations { get { throw null; } } public int? IdleTimeoutInMinutes { get { throw null; } set { } } public string Name { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.LoadBalancerOutboundRuleProtocol? Protocol { get { throw null; } set { } } @@ -9325,7 +9312,7 @@ public OwaspCrsExclusionEntry(Azure.ResourceManager.Network.Models.OwaspCrsExclu public static bool operator !=(Azure.ResourceManager.Network.Models.OwaspCrsExclusionEntrySelectorMatchOperator left, Azure.ResourceManager.Network.Models.OwaspCrsExclusionEntrySelectorMatchOperator right) { throw null; } public override string ToString() { throw null; } } - public partial class P2SConnectionConfiguration : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class P2SConnectionConfiguration : Azure.ResourceManager.Network.Models.SubResource { public P2SConnectionConfiguration() { } public bool? EnableInternetSecurity { get { throw null; } set { } } @@ -9512,10 +9499,11 @@ public PacketCaptureInput(string target, Azure.ResourceManager.Network.Models.Pa public int? TimeLimitInSeconds { get { throw null; } set { } } public long? TotalBytesPerSession { get { throw null; } set { } } } - public partial class PacketCaptureQueryStatusResult : Azure.ResourceManager.Resources.Models.SubResource + public partial class PacketCaptureQueryStatusResult { internal PacketCaptureQueryStatusResult() { } public System.DateTimeOffset? CaptureStartTime { get { throw null; } } + public string Id { get { throw null; } } public string Name { get { throw null; } } public System.Collections.Generic.IReadOnlyList PacketCaptureError { get { throw null; } } public Azure.ResourceManager.Network.Models.PcStatus? PacketCaptureStatus { get { throw null; } } @@ -9539,7 +9527,7 @@ public PacketCaptureStorageLocation() { } public string StorageId { get { throw null; } set { } } public string StoragePath { get { throw null; } set { } } } - public partial class PatchRouteFilter : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class PatchRouteFilter : Azure.ResourceManager.Network.Models.SubResource { public PatchRouteFilter() { } public string Etag { get { throw null; } } @@ -9551,7 +9539,7 @@ public PatchRouteFilter() { } public System.Collections.Generic.IDictionary Tags { get { throw null; } } public string Type { get { throw null; } } } - public partial class PatchRouteFilterRule : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class PatchRouteFilterRule : Azure.ResourceManager.Network.Models.SubResource { public PatchRouteFilterRule() { } public Azure.ResourceManager.Network.Models.Access? Access { get { throw null; } set { } } @@ -9622,7 +9610,7 @@ public PatchRouteFilterRule() { } public static bool operator !=(Azure.ResourceManager.Network.Models.PcStatus left, Azure.ResourceManager.Network.Models.PcStatus right) { throw null; } public override string ToString() { throw null; } } - public partial class PeerExpressRouteCircuitConnection : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class PeerExpressRouteCircuitConnection : Azure.ResourceManager.Network.Models.SubResource { public PeerExpressRouteCircuitConnection() { } public string AddressPrefix { get { throw null; } set { } } @@ -9630,9 +9618,9 @@ public PeerExpressRouteCircuitConnection() { } public Azure.ResourceManager.Network.Models.CircuitConnectionStatus? CircuitConnectionStatus { get { throw null; } } public string ConnectionName { get { throw null; } set { } } public string Etag { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource ExpressRouteCircuitPeering { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource ExpressRouteCircuitPeering { get { throw null; } set { } } public string Name { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource PeerExpressRouteCircuitPeering { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource PeerExpressRouteCircuitPeering { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } public string Type { get { throw null; } } } @@ -9760,7 +9748,7 @@ protected PrivateDnsZoneGroupDeleteOperation() { } public override System.Threading.Tasks.ValueTask WaitForCompletionResponseAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public override System.Threading.Tasks.ValueTask WaitForCompletionResponseAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class PrivateEndpointConnection : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class PrivateEndpointConnection : Azure.ResourceManager.Network.Models.SubResource { public PrivateEndpointConnection() { } public string Etag { get { throw null; } } @@ -9821,7 +9809,7 @@ protected PrivateLinkServiceCheckPrivateLinkServiceVisibilityOperation() { } public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class PrivateLinkServiceConnection : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class PrivateLinkServiceConnection : Azure.ResourceManager.Network.Models.SubResource { public PrivateLinkServiceConnection() { } public string Etag { get { throw null; } } @@ -9875,7 +9863,7 @@ protected PrivateLinkServiceDeletePrivateEndpointConnectionOperation() { } public override System.Threading.Tasks.ValueTask WaitForCompletionResponseAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public override System.Threading.Tasks.ValueTask WaitForCompletionResponseAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class PrivateLinkServiceIpConfiguration : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class PrivateLinkServiceIpConfiguration : Azure.ResourceManager.Network.Models.SubResource { public PrivateLinkServiceIpConfiguration() { } public string Etag { get { throw null; } } @@ -9914,12 +9902,12 @@ public partial class PrivateLinkServiceVisibility internal PrivateLinkServiceVisibility() { } public bool? Visible { get { throw null; } } } - public partial class Probe : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class Probe : Azure.ResourceManager.Network.Models.SubResource { public Probe() { } public string Etag { get { throw null; } } public int? IntervalInSeconds { get { throw null; } set { } } - public System.Collections.Generic.IReadOnlyList LoadBalancingRules { get { throw null; } } + public System.Collections.Generic.IReadOnlyList LoadBalancingRules { get { throw null; } } public string Name { get { throw null; } set { } } public int? NumberOfProbes { get { throw null; } set { } } public int? Port { get { throw null; } set { } } @@ -9968,7 +9956,7 @@ public Probe() { } public partial class PropagatedRouteTable { public PropagatedRouteTable() { } - public System.Collections.Generic.IList Ids { get { throw null; } } + public System.Collections.Generic.IList Ids { get { throw null; } } public System.Collections.Generic.IList Labels { get { throw null; } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] @@ -10268,14 +10256,10 @@ internal RecordSet() { } public string RecordType { get { throw null; } } public int? Ttl { get { throw null; } } } - public partial class ReferencedPublicIpAddress - { - internal ReferencedPublicIpAddress() { } - public string Id { get { throw null; } } - } - public partial class Resource : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class Resource { public Resource() { } + public string Id { get { throw null; } set { } } public string Location { get { throw null; } set { } } public string Name { get { throw null; } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } @@ -10288,7 +10272,7 @@ public enum ResourceIdentityType SystemAssignedUserAssigned = 2, None = 3, } - public partial class ResourceNavigationLink : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ResourceNavigationLink : Azure.ResourceManager.Network.Models.SubResource { public ResourceNavigationLink() { } public string Etag { get { throw null; } } @@ -10478,7 +10462,7 @@ protected RouteTableUpdateTagsOperation() { } public partial class RoutingConfiguration { public RoutingConfiguration() { } - public Azure.ResourceManager.Network.Models.SubResource AssociatedRouteTable { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource AssociatedRouteTable { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.PropagatedRouteTable PropagatedRouteTables { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.VnetRoute VnetRoutes { get { throw null; } set { } } } @@ -10502,9 +10486,10 @@ public RoutingConfiguration() { } public static bool operator !=(Azure.ResourceManager.Network.Models.RoutingState left, Azure.ResourceManager.Network.Models.RoutingState right) { throw null; } public override string ToString() { throw null; } } - public partial class SecurityGroupNetworkInterface : Azure.ResourceManager.Resources.Models.SubResource + public partial class SecurityGroupNetworkInterface { internal SecurityGroupNetworkInterface() { } + public string Id { get { throw null; } } public Azure.ResourceManager.Network.Models.SecurityRuleAssociations SecurityRuleAssociations { get { throw null; } } } public partial class SecurityGroupViewParameters @@ -10683,7 +10668,7 @@ protected SecurityRuleDeleteOperation() { } public static bool operator !=(Azure.ResourceManager.Network.Models.SecurityRuleProtocol left, Azure.ResourceManager.Network.Models.SecurityRuleProtocol right) { throw null; } public override string ToString() { throw null; } } - public partial class ServiceAssociationLink : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class ServiceAssociationLink : Azure.ResourceManager.Network.Models.SubResource { public ServiceAssociationLink() { } public bool? AllowDelete { get { throw null; } set { } } @@ -10789,9 +10774,10 @@ public ServiceEndpointPropertiesFormat() { } public static bool operator !=(Azure.ResourceManager.Network.Models.ServiceProviderProvisioningState left, Azure.ResourceManager.Network.Models.ServiceProviderProvisioningState right) { throw null; } public override string ToString() { throw null; } } - public partial class ServiceTagInformation : Azure.ResourceManager.Resources.Models.SubResource + public partial class ServiceTagInformation { internal ServiceTagInformation() { } + public string Id { get { throw null; } } public string Name { get { throw null; } } public Azure.ResourceManager.Network.Models.ServiceTagInformationPropertiesFormat Properties { get { throw null; } } } @@ -10842,9 +10828,10 @@ public StaticRoute() { } public string Name { get { throw null; } set { } } public string NextHopIpAddress { get { throw null; } set { } } } - public partial class SubnetAssociation : Azure.ResourceManager.Resources.Models.SubResource + public partial class SubnetAssociation { internal SubnetAssociation() { } + public string Id { get { throw null; } } public System.Collections.Generic.IReadOnlyList SecurityRules { get { throw null; } } } public partial class SubnetCreateOrUpdateOperation : Azure.Operation @@ -10920,10 +10907,11 @@ public partial class TagsObject public TagsObject() { } public System.Collections.Generic.IDictionary Tags { get { throw null; } } } - public partial class Topology : Azure.ResourceManager.Resources.Models.SubResource + public partial class Topology { internal Topology() { } public System.DateTimeOffset? CreatedDateTime { get { throw null; } } + public string Id { get { throw null; } } public System.DateTimeOffset? LastModified { get { throw null; } } public System.Collections.Generic.IReadOnlyList Resources { get { throw null; } } } @@ -10938,13 +10926,14 @@ public partial class TopologyParameters { public TopologyParameters() { } public string TargetResourceGroupName { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource TargetSubnet { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource TargetVirtualNetwork { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource TargetSubnet { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource TargetVirtualNetwork { get { throw null; } set { } } } - public partial class TopologyResource : Azure.ResourceManager.Resources.Models.SubResource + public partial class TopologyResource { internal TopologyResource() { } public System.Collections.Generic.IReadOnlyList Associations { get { throw null; } } + public string Id { get { throw null; } } public string Location { get { throw null; } } public string Name { get { throw null; } } } @@ -10987,10 +10976,11 @@ public TrafficSelectorPolicy(System.Collections.Generic.IEnumerable loca public static bool operator !=(Azure.ResourceManager.Network.Models.TransportProtocol left, Azure.ResourceManager.Network.Models.TransportProtocol right) { throw null; } public override string ToString() { throw null; } } - public partial class TroubleshootingDetails : Azure.ResourceManager.Resources.Models.SubResource + public partial class TroubleshootingDetails { internal TroubleshootingDetails() { } public string Detail { get { throw null; } } + public string Id { get { throw null; } } public string ReasonType { get { throw null; } } public System.Collections.Generic.IReadOnlyList RecommendedActions { get { throw null; } } public string Summary { get { throw null; } } @@ -11032,10 +11022,11 @@ public partial class UnprepareNetworkPoliciesRequest public UnprepareNetworkPoliciesRequest() { } public string ServiceName { get { throw null; } set { } } } - public partial class Usage : Azure.ResourceManager.Resources.Models.SubResource + public partial class Usage { internal Usage() { } public long CurrentValue { get { throw null; } } + public string Id { get { throw null; } } public long Limit { get { throw null; } } public Azure.ResourceManager.Network.Models.UsageName Name { get { throw null; } } public Azure.ResourceManager.Network.Models.UsageUnit Unit { get { throw null; } } @@ -11223,11 +11214,6 @@ protected VirtualHubGetEffectiveVirtualHubRoutesOperation() { } public override System.Threading.Tasks.ValueTask WaitForCompletionResponseAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public override System.Threading.Tasks.ValueTask WaitForCompletionResponseAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class VirtualHubId - { - public VirtualHubId() { } - public string Id { get { throw null; } set { } } - } public partial class VirtualHubIpConfigurationCreateOrUpdateOperation : Azure.Operation { protected VirtualHubIpConfigurationCreateOrUpdateOperation() { } @@ -11314,11 +11300,6 @@ public VirtualNetworkBgpCommunities(string virtualNetworkCommunity) { } public string RegionalCommunity { get { throw null; } } public string VirtualNetworkCommunity { get { throw null; } set { } } } - public partial class VirtualNetworkConnectionGatewayReference - { - public VirtualNetworkConnectionGatewayReference(string id) { } - public string Id { get { throw null; } set { } } - } public partial class VirtualNetworkCreateOrUpdateOperation : Azure.Operation { protected VirtualNetworkCreateOrUpdateOperation() { } @@ -11382,7 +11363,7 @@ protected VirtualNetworkGatewayConnectionGetIkeSasOperation() { } } public partial class VirtualNetworkGatewayConnectionListEntity : Azure.ResourceManager.Network.Models.Resource { - public VirtualNetworkGatewayConnectionListEntity(Azure.ResourceManager.Network.Models.VirtualNetworkConnectionGatewayReference virtualNetworkGateway1, Azure.ResourceManager.Network.Models.VirtualNetworkGatewayConnectionType connectionType) { } + public VirtualNetworkGatewayConnectionListEntity(Azure.ResourceManager.Resources.Models.WritableSubResource virtualNetworkGateway1, Azure.ResourceManager.Network.Models.VirtualNetworkGatewayConnectionType connectionType) { } public string AuthorizationKey { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.VirtualNetworkGatewayConnectionMode? ConnectionMode { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.VirtualNetworkGatewayConnectionProtocol? ConnectionProtocol { get { throw null; } set { } } @@ -11394,8 +11375,8 @@ public VirtualNetworkGatewayConnectionListEntity(Azure.ResourceManager.Network.M public bool? ExpressRouteGatewayBypass { get { throw null; } set { } } public long? IngressBytesTransferred { get { throw null; } } public System.Collections.Generic.IList IpsecPolicies { get { throw null; } } - public Azure.ResourceManager.Network.Models.VirtualNetworkConnectionGatewayReference LocalNetworkGateway2 { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource Peer { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource LocalNetworkGateway2 { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource Peer { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } public string ResourceGuid { get { throw null; } } public int? RoutingWeight { get { throw null; } set { } } @@ -11403,8 +11384,8 @@ public VirtualNetworkGatewayConnectionListEntity(Azure.ResourceManager.Network.M public System.Collections.Generic.IList TrafficSelectorPolicies { get { throw null; } } public System.Collections.Generic.IReadOnlyList TunnelConnectionStatus { get { throw null; } } public bool? UsePolicyBasedTrafficSelectors { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.VirtualNetworkConnectionGatewayReference VirtualNetworkGateway1 { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.VirtualNetworkConnectionGatewayReference VirtualNetworkGateway2 { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource VirtualNetworkGateway1 { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource VirtualNetworkGateway2 { get { throw null; } set { } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct VirtualNetworkGatewayConnectionMode : System.IEquatable @@ -11698,7 +11679,7 @@ protected VirtualNetworkGatewayGetVpnProfilePackageUrlOperation() { } public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class VirtualNetworkGatewayIPConfiguration : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class VirtualNetworkGatewayIPConfiguration : Azure.ResourceManager.Network.Models.SubResource { public VirtualNetworkGatewayIPConfiguration() { } public string Etag { get { throw null; } } @@ -11706,8 +11687,8 @@ public VirtualNetworkGatewayIPConfiguration() { } public string PrivateIPAddress { get { throw null; } } public Azure.ResourceManager.Network.Models.IPAllocationMethod? PrivateIPAllocationMethod { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } - public Azure.ResourceManager.Network.Models.SubResource PublicIPAddress { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource Subnet { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource PublicIPAddress { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource Subnet { get { throw null; } set { } } } public partial class VirtualNetworkGatewayNatRuleCreateOrUpdateOperation : Azure.Operation { @@ -12050,10 +12031,11 @@ protected VirtualNetworkUpdateTagsOperation() { } public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public override System.Threading.Tasks.ValueTask> WaitForCompletionAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class VirtualNetworkUsage : Azure.ResourceManager.Resources.Models.SubResource + public partial class VirtualNetworkUsage { internal VirtualNetworkUsage() { } public double? CurrentValue { get { throw null; } } + public string Id { get { throw null; } } public double? Limit { get { throw null; } } public Azure.ResourceManager.Network.Models.VirtualNetworkUsageName Name { get { throw null; } } public string Unit { get { throw null; } } @@ -12310,7 +12292,7 @@ public VpnClientParameters() { } public static bool operator !=(Azure.ResourceManager.Network.Models.VpnClientProtocol left, Azure.ResourceManager.Network.Models.VpnClientProtocol right) { throw null; } public override string ToString() { throw null; } } - public partial class VpnClientRevokedCertificate : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class VpnClientRevokedCertificate : Azure.ResourceManager.Network.Models.SubResource { public VpnClientRevokedCertificate() { } public string Etag { get { throw null; } } @@ -12318,7 +12300,7 @@ public VpnClientRevokedCertificate() { } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } public string Thumbprint { get { throw null; } set { } } } - public partial class VpnClientRootCertificate : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class VpnClientRootCertificate : Azure.ResourceManager.Network.Models.SubResource { public VpnClientRootCertificate(string publicCertData) { } public string Etag { get { throw null; } } @@ -12458,9 +12440,10 @@ protected VpnGatewayDeleteOperation() { } public static bool operator !=(Azure.ResourceManager.Network.Models.VpnGatewayGeneration left, Azure.ResourceManager.Network.Models.VpnGatewayGeneration right) { throw null; } public override string ToString() { throw null; } } - public partial class VpnGatewayIpConfiguration : Azure.ResourceManager.Resources.Models.SubResource + public partial class VpnGatewayIpConfiguration { internal VpnGatewayIpConfiguration() { } + public string Id { get { throw null; } } public string PrivateIpAddress { get { throw null; } } public string PublicIpAddress { get { throw null; } } } @@ -12758,7 +12741,7 @@ protected VpnSiteDeleteOperation() { } public override System.Threading.Tasks.ValueTask WaitForCompletionResponseAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public override System.Threading.Tasks.ValueTask WaitForCompletionResponseAsync(System.TimeSpan pollingInterval, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class VpnSiteLink : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class VpnSiteLink : Azure.ResourceManager.Network.Models.SubResource { public VpnSiteLink() { } public Azure.ResourceManager.Network.Models.VpnLinkBgpSettings BgpProperties { get { throw null; } set { } } @@ -12770,18 +12753,18 @@ public VpnSiteLink() { } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } public string Type { get { throw null; } } } - public partial class VpnSiteLinkConnection : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class VpnSiteLinkConnection : Azure.ResourceManager.Network.Models.SubResource { public VpnSiteLinkConnection() { } public int? ConnectionBandwidth { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.VpnConnectionStatus? ConnectionStatus { get { throw null; } } public long? EgressBytesTransferred { get { throw null; } } - public System.Collections.Generic.IList EgressNatRules { get { throw null; } } + public System.Collections.Generic.IList EgressNatRules { get { throw null; } } public bool? EnableBgp { get { throw null; } set { } } public bool? EnableRateLimiting { get { throw null; } set { } } public string Etag { get { throw null; } } public long? IngressBytesTransferred { get { throw null; } } - public System.Collections.Generic.IList IngressNatRules { get { throw null; } } + public System.Collections.Generic.IList IngressNatRules { get { throw null; } } public System.Collections.Generic.IList IpsecPolicies { get { throw null; } } public string Name { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.ProvisioningState? ProvisioningState { get { throw null; } } @@ -12792,7 +12775,7 @@ public VpnSiteLinkConnection() { } public bool? UsePolicyBasedTrafficSelectors { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.VirtualNetworkGatewayConnectionProtocol? VpnConnectionProtocolType { get { throw null; } set { } } public Azure.ResourceManager.Network.Models.VpnLinkConnectionMode? VpnLinkConnectionMode { get { throw null; } set { } } - public Azure.ResourceManager.Network.Models.SubResource VpnSiteLink { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.WritableSubResource VpnSiteLink { get { throw null; } set { } } } public partial class VpnSitesConfigurationDownloadOperation : Azure.Operation { diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayData.cs index b3a2639c23f6b..c159747b1b1ff 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayData.cs @@ -41,7 +41,7 @@ public ApplicationGatewayData() } /// Initializes a new instance of ApplicationGatewayData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. @@ -79,7 +79,7 @@ public ApplicationGatewayData() /// The provisioning state of the application gateway resource. /// Custom error configurations of the application gateway resource. /// If true, associates a firewall policy with an application gateway regardless whether the policy differs from the WAF Config. - internal ApplicationGatewayData(string id, string name, string type, string location, IDictionary tags, string etag, IList zones, ResourceIdentity identity, ApplicationGatewaySku sku, ApplicationGatewaySslPolicy sslPolicy, ApplicationGatewayOperationalState? operationalState, IList gatewayIPConfigurations, IList authenticationCertificates, IList trustedRootCertificates, IList trustedClientCertificates, IList sslCertificates, IList frontendIPConfigurations, IList frontendPorts, IList probes, IList backendAddressPools, IList backendHttpSettingsCollection, IList httpListeners, IList sslProfiles, IList urlPathMaps, IList requestRoutingRules, IList rewriteRuleSets, IList redirectConfigurations, ApplicationGatewayWebApplicationFirewallConfiguration webApplicationFirewallConfiguration, Models.SubResource firewallPolicy, bool? enableHttp2, bool? enableFips, ApplicationGatewayAutoscaleConfiguration autoscaleConfiguration, IList privateLinkConfigurations, IReadOnlyList privateEndpointConnections, string resourceGuid, ProvisioningState? provisioningState, IList customErrorConfigurations, bool? forceFirewallPolicyAssociation) : base(id, name, type, location, tags) + internal ApplicationGatewayData(string id, string name, string type, string location, IDictionary tags, string etag, IList zones, ResourceIdentity identity, ApplicationGatewaySku sku, ApplicationGatewaySslPolicy sslPolicy, ApplicationGatewayOperationalState? operationalState, IList gatewayIPConfigurations, IList authenticationCertificates, IList trustedRootCertificates, IList trustedClientCertificates, IList sslCertificates, IList frontendIPConfigurations, IList frontendPorts, IList probes, IList backendAddressPools, IList backendHttpSettingsCollection, IList httpListeners, IList sslProfiles, IList urlPathMaps, IList requestRoutingRules, IList rewriteRuleSets, IList redirectConfigurations, ApplicationGatewayWebApplicationFirewallConfiguration webApplicationFirewallConfiguration, WritableSubResource firewallPolicy, bool? enableHttp2, bool? enableFips, ApplicationGatewayAutoscaleConfiguration autoscaleConfiguration, IList privateLinkConfigurations, IReadOnlyList privateEndpointConnections, string resourceGuid, ProvisioningState? provisioningState, IList customErrorConfigurations, bool? forceFirewallPolicyAssociation) : base(id, name, type, location, tags) { Etag = etag; Zones = zones; @@ -163,7 +163,7 @@ internal ApplicationGatewayData(string id, string name, string type, string loca /// Web application firewall configuration. public ApplicationGatewayWebApplicationFirewallConfiguration WebApplicationFirewallConfiguration { get; set; } /// Reference to the FirewallPolicy resource. - public Models.SubResource FirewallPolicy { get; set; } + public WritableSubResource FirewallPolicy { get; set; } /// Whether HTTP2 is enabled on the application gateway resource. public bool? EnableHttp2 { get; set; } /// Whether FIPS is enabled on the application gateway resource. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayPrivateEndpointConnectionData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayPrivateEndpointConnectionData.cs index de2136362ba06..d23e366c09dc4 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayPrivateEndpointConnectionData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationGatewayPrivateEndpointConnectionData.cs @@ -6,12 +6,11 @@ #nullable disable using Azure.ResourceManager.Network.Models; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { /// A class representing the ApplicationGatewayPrivateEndpointConnection data model. - public partial class ApplicationGatewayPrivateEndpointConnectionData : WritableSubResource + public partial class ApplicationGatewayPrivateEndpointConnectionData : SubResource { /// Initializes a new instance of ApplicationGatewayPrivateEndpointConnectionData. public ApplicationGatewayPrivateEndpointConnectionData() @@ -19,7 +18,7 @@ public ApplicationGatewayPrivateEndpointConnectionData() } /// Initializes a new instance of ApplicationGatewayPrivateEndpointConnectionData. - /// The id. + /// Resource ID. /// Name of the private endpoint connection on an application gateway. /// A unique read-only string that changes whenever the resource is updated. /// Type of the resource. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationSecurityGroupData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationSecurityGroupData.cs index ecf4aeadc4b74..77cd6220343b7 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationSecurityGroupData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ApplicationSecurityGroupData.cs @@ -19,7 +19,7 @@ public ApplicationSecurityGroupData() } /// Initializes a new instance of ApplicationSecurityGroupData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/AzureFirewallData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/AzureFirewallData.cs index 6ac1a2a60b242..be2163f725336 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/AzureFirewallData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/AzureFirewallData.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -27,7 +28,7 @@ public AzureFirewallData() } /// Initializes a new instance of AzureFirewallData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. @@ -47,7 +48,7 @@ public AzureFirewallData() /// IpGroups associated with AzureFirewall. /// The Azure Firewall Resource SKU. /// The additional properties used to further config this azure firewall. - internal AzureFirewallData(string id, string name, string type, string location, IDictionary tags, IList zones, string etag, IList applicationRuleCollections, IList natRuleCollections, IList networkRuleCollections, IList ipConfigurations, AzureFirewallIPConfiguration managementIpConfiguration, ProvisioningState? provisioningState, AzureFirewallThreatIntelMode? threatIntelMode, SubResource virtualHub, SubResource firewallPolicy, HubIPAddresses hubIPAddresses, IReadOnlyList ipGroups, AzureFirewallSku sku, IDictionary additionalProperties) : base(id, name, type, location, tags) + internal AzureFirewallData(string id, string name, string type, string location, IDictionary tags, IList zones, string etag, IList applicationRuleCollections, IList natRuleCollections, IList networkRuleCollections, IList ipConfigurations, AzureFirewallIPConfiguration managementIpConfiguration, ProvisioningState? provisioningState, AzureFirewallThreatIntelMode? threatIntelMode, WritableSubResource virtualHub, WritableSubResource firewallPolicy, HubIPAddresses hubIPAddresses, IReadOnlyList ipGroups, AzureFirewallSku sku, IDictionary additionalProperties) : base(id, name, type, location, tags) { Zones = zones; Etag = etag; @@ -85,9 +86,9 @@ internal AzureFirewallData(string id, string name, string type, string location, /// The operation mode for Threat Intelligence. public AzureFirewallThreatIntelMode? ThreatIntelMode { get; set; } /// The virtualHub to which the firewall belongs. - public SubResource VirtualHub { get; set; } + public WritableSubResource VirtualHub { get; set; } /// The firewallPolicy associated with this azure firewall. - public SubResource FirewallPolicy { get; set; } + public WritableSubResource FirewallPolicy { get; set; } /// IP addresses associated with AzureFirewall. public HubIPAddresses HubIPAddresses { get; set; } /// IpGroups associated with AzureFirewall. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/BackendAddressPoolData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/BackendAddressPoolData.cs index eb824a803ed62..6e7deecc9466d 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/BackendAddressPoolData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/BackendAddressPoolData.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.Network { /// A class representing the BackendAddressPool data model. - public partial class BackendAddressPoolData : WritableSubResource + public partial class BackendAddressPoolData : Models.SubResource { /// Initializes a new instance of BackendAddressPoolData. public BackendAddressPoolData() @@ -21,12 +21,12 @@ public BackendAddressPoolData() TunnelInterfaces = new ChangeTrackingList(); LoadBalancerBackendAddresses = new ChangeTrackingList(); BackendIPConfigurations = new ChangeTrackingList(); - LoadBalancingRules = new ChangeTrackingList(); - OutboundRules = new ChangeTrackingList(); + LoadBalancingRules = new ChangeTrackingList(); + OutboundRules = new ChangeTrackingList(); } /// Initializes a new instance of BackendAddressPoolData. - /// The id. + /// Resource ID. /// The name of the resource that is unique within the set of backend address pools used by the load balancer. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// Type of the resource. @@ -38,7 +38,7 @@ public BackendAddressPoolData() /// A reference to an outbound rule that uses this backend address pool. /// An array of references to outbound rules that use this backend address pool. /// The provisioning state of the backend address pool resource. - internal BackendAddressPoolData(string id, string name, string etag, string type, string location, IList tunnelInterfaces, IList loadBalancerBackendAddresses, IReadOnlyList backendIPConfigurations, IReadOnlyList loadBalancingRules, Models.SubResource outboundRule, IReadOnlyList outboundRules, ProvisioningState? provisioningState) : base(id) + internal BackendAddressPoolData(string id, string name, string etag, string type, string location, IList tunnelInterfaces, IList loadBalancerBackendAddresses, IReadOnlyList backendIPConfigurations, IReadOnlyList loadBalancingRules, WritableSubResource outboundRule, IReadOnlyList outboundRules, ProvisioningState? provisioningState) : base(id) { Name = name; Etag = etag; @@ -68,11 +68,11 @@ internal BackendAddressPoolData(string id, string name, string etag, string type /// An array of references to IP addresses defined in network interfaces. public IReadOnlyList BackendIPConfigurations { get; } /// An array of references to load balancing rules that use this backend address pool. - public IReadOnlyList LoadBalancingRules { get; } + public IReadOnlyList LoadBalancingRules { get; } /// A reference to an outbound rule that uses this backend address pool. - public Models.SubResource OutboundRule { get; } + public WritableSubResource OutboundRule { get; } /// An array of references to outbound rules that use this backend address pool. - public IReadOnlyList OutboundRules { get; } + public IReadOnlyList OutboundRules { get; } /// The provisioning state of the backend address pool resource. public ProvisioningState? ProvisioningState { get; } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/BastionHostData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/BastionHostData.cs index e1b119e72993d..19eb73c13f9cf 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/BastionHostData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/BastionHostData.cs @@ -21,7 +21,7 @@ public BastionHostData() } /// Initializes a new instance of BastionHostData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/BgpConnectionData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/BgpConnectionData.cs index 0a61d5059ef60..1fcc49b436dee 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/BgpConnectionData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/BgpConnectionData.cs @@ -6,12 +6,11 @@ #nullable disable using Azure.ResourceManager.Network.Models; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { /// A class representing the BgpConnection data model. - public partial class BgpConnectionData : WritableSubResource + public partial class BgpConnectionData : SubResource { /// Initializes a new instance of BgpConnectionData. public BgpConnectionData() @@ -19,7 +18,7 @@ public BgpConnectionData() } /// Initializes a new instance of BgpConnectionData. - /// The id. + /// Resource ID. /// Name of the connection. /// A unique read-only string that changes whenever the resource is updated. /// Connection type. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/CustomIpPrefixData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/CustomIpPrefixData.cs index 3a1117116d4ad..b8ecd8cfb9457 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/CustomIpPrefixData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/CustomIpPrefixData.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -19,11 +20,11 @@ public CustomIpPrefixData() { Zones = new ChangeTrackingList(); ChildCustomIpPrefixes = new ChangeTrackingList(); - PublicIpPrefixes = new ChangeTrackingList(); + PublicIpPrefixes = new ChangeTrackingList(); } /// Initializes a new instance of CustomIpPrefixData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. @@ -41,7 +42,7 @@ public CustomIpPrefixData() /// The resource GUID property of the custom IP prefix resource. /// The reason why resource is in failed state. /// The provisioning state of the custom IP prefix resource. - internal CustomIpPrefixData(string id, string name, string type, string location, IDictionary tags, ExtendedLocation extendedLocation, string etag, IList zones, string cidr, string signedMessage, string authorizationMessage, CustomIpPrefixData customIpPrefixParent, IReadOnlyList childCustomIpPrefixes, CommissionedState? commissionedState, IReadOnlyList publicIpPrefixes, string resourceGuid, string failedReason, ProvisioningState? provisioningState) : base(id, name, type, location, tags) + internal CustomIpPrefixData(string id, string name, string type, string location, IDictionary tags, ExtendedLocation extendedLocation, string etag, IList zones, string cidr, string signedMessage, string authorizationMessage, CustomIpPrefixData customIpPrefixParent, IReadOnlyList childCustomIpPrefixes, CommissionedState? commissionedState, IReadOnlyList publicIpPrefixes, string resourceGuid, string failedReason, ProvisioningState? provisioningState) : base(id, name, type, location, tags) { ExtendedLocation = extendedLocation; Etag = etag; @@ -77,7 +78,7 @@ internal CustomIpPrefixData(string id, string name, string type, string location /// The commissioned state of the Custom IP Prefix. public CommissionedState? CommissionedState { get; set; } /// The list of all referenced PublicIpPrefixes. - public IReadOnlyList PublicIpPrefixes { get; } + public IReadOnlyList PublicIpPrefixes { get; } /// The resource GUID property of the custom IP prefix resource. public string ResourceGuid { get; } /// The reason why resource is in failed state. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/DdosCustomPolicyData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/DdosCustomPolicyData.cs index 0df27d11d72ba..12e4879aacbf7 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/DdosCustomPolicyData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/DdosCustomPolicyData.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -17,12 +18,12 @@ public partial class DdosCustomPolicyData : Resource /// Initializes a new instance of DdosCustomPolicyData. public DdosCustomPolicyData() { - PublicIPAddresses = new ChangeTrackingList(); + PublicIPAddresses = new ChangeTrackingList(); ProtocolCustomSettings = new ChangeTrackingList(); } /// Initializes a new instance of DdosCustomPolicyData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. @@ -32,7 +33,7 @@ public DdosCustomPolicyData() /// The provisioning state of the DDoS custom policy resource. /// The list of public IPs associated with the DDoS custom policy resource. This list is read-only. /// The protocol-specific DDoS policy customization parameters. - internal DdosCustomPolicyData(string id, string name, string type, string location, IDictionary tags, string etag, string resourceGuid, ProvisioningState? provisioningState, IReadOnlyList publicIPAddresses, IList protocolCustomSettings) : base(id, name, type, location, tags) + internal DdosCustomPolicyData(string id, string name, string type, string location, IDictionary tags, string etag, string resourceGuid, ProvisioningState? provisioningState, IReadOnlyList publicIPAddresses, IList protocolCustomSettings) : base(id, name, type, location, tags) { Etag = etag; ResourceGuid = resourceGuid; @@ -48,7 +49,7 @@ internal DdosCustomPolicyData(string id, string name, string type, string locati /// The provisioning state of the DDoS custom policy resource. public ProvisioningState? ProvisioningState { get; } /// The list of public IPs associated with the DDoS custom policy resource. This list is read-only. - public IReadOnlyList PublicIPAddresses { get; } + public IReadOnlyList PublicIPAddresses { get; } /// The protocol-specific DDoS policy customization parameters. public IList ProtocolCustomSettings { get; } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/DdosProtectionPlanData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/DdosProtectionPlanData.cs index 136dd8e040eb8..9f24088296d4f 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/DdosProtectionPlanData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/DdosProtectionPlanData.cs @@ -21,7 +21,7 @@ public partial class DdosProtectionPlanData : TrackedResource /// The location. public DdosProtectionPlanData(Location location) : base(location) { - VirtualNetworks = new ChangeTrackingList(); + VirtualNetworks = new ChangeTrackingList(); } /// Initializes a new instance of DdosProtectionPlanData. @@ -34,7 +34,7 @@ public DdosProtectionPlanData(Location location) : base(location) /// The resource GUID property of the DDoS protection plan resource. It uniquely identifies the resource, even if the user changes its name or migrate the resource across subscriptions or resource groups. /// The provisioning state of the DDoS protection plan resource. /// The list of virtual networks associated with the DDoS protection plan resource. This list is read-only. - internal DdosProtectionPlanData(ResourceIdentifier id, string name, ResourceType type, IDictionary tags, Location location, string etag, string resourceGuid, ProvisioningState? provisioningState, IReadOnlyList virtualNetworks) : base(id, name, type, tags, location) + internal DdosProtectionPlanData(ResourceIdentifier id, string name, ResourceType type, IDictionary tags, Location location, string etag, string resourceGuid, ProvisioningState? provisioningState, IReadOnlyList virtualNetworks) : base(id, name, type, tags, location) { Etag = etag; ResourceGuid = resourceGuid; @@ -49,6 +49,6 @@ internal DdosProtectionPlanData(ResourceIdentifier id, string name, ResourceType /// The provisioning state of the DDoS protection plan resource. public ProvisioningState? ProvisioningState { get; } /// The list of virtual networks associated with the DDoS protection plan resource. This list is read-only. - public IReadOnlyList VirtualNetworks { get; } + public IReadOnlyList VirtualNetworks { get; } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/DscpConfigurationData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/DscpConfigurationData.cs index 5625fb9162c7b..553afd845cd7a 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/DscpConfigurationData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/DscpConfigurationData.cs @@ -26,7 +26,7 @@ public DscpConfigurationData() } /// Initializes a new instance of DscpConfigurationData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitAuthorizationData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitAuthorizationData.cs index 9d913dca4721e..97aced71a85cb 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitAuthorizationData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitAuthorizationData.cs @@ -6,12 +6,11 @@ #nullable disable using Azure.ResourceManager.Network.Models; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { /// A class representing the ExpressRouteCircuitAuthorization data model. - public partial class ExpressRouteCircuitAuthorizationData : WritableSubResource + public partial class ExpressRouteCircuitAuthorizationData : SubResource { /// Initializes a new instance of ExpressRouteCircuitAuthorizationData. public ExpressRouteCircuitAuthorizationData() @@ -19,7 +18,7 @@ public ExpressRouteCircuitAuthorizationData() } /// Initializes a new instance of ExpressRouteCircuitAuthorizationData. - /// The id. + /// Resource ID. /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// Type of the resource. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitConnectionData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitConnectionData.cs index d0499352e8705..750b6a34dd71c 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitConnectionData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitConnectionData.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Network { /// A class representing the ExpressRouteCircuitConnection data model. - public partial class ExpressRouteCircuitConnectionData : WritableSubResource + public partial class ExpressRouteCircuitConnectionData : Models.SubResource { /// Initializes a new instance of ExpressRouteCircuitConnectionData. public ExpressRouteCircuitConnectionData() @@ -19,7 +19,7 @@ public ExpressRouteCircuitConnectionData() } /// Initializes a new instance of ExpressRouteCircuitConnectionData. - /// The id. + /// Resource ID. /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// Type of the resource. @@ -30,7 +30,7 @@ public ExpressRouteCircuitConnectionData() /// IPv6 Address PrefixProperties of the express route circuit connection. /// Express Route Circuit connection state. /// The provisioning state of the express route circuit connection resource. - internal ExpressRouteCircuitConnectionData(string id, string name, string etag, string type, Models.SubResource expressRouteCircuitPeering, Models.SubResource peerExpressRouteCircuitPeering, string addressPrefix, string authorizationKey, Ipv6CircuitConnectionConfig ipv6CircuitConnectionConfig, CircuitConnectionStatus? circuitConnectionStatus, ProvisioningState? provisioningState) : base(id) + internal ExpressRouteCircuitConnectionData(string id, string name, string etag, string type, WritableSubResource expressRouteCircuitPeering, WritableSubResource peerExpressRouteCircuitPeering, string addressPrefix, string authorizationKey, Ipv6CircuitConnectionConfig ipv6CircuitConnectionConfig, CircuitConnectionStatus? circuitConnectionStatus, ProvisioningState? provisioningState) : base(id) { Name = name; Etag = etag; @@ -51,9 +51,9 @@ internal ExpressRouteCircuitConnectionData(string id, string name, string etag, /// Type of the resource. public string Type { get; } /// Reference to Express Route Circuit Private Peering Resource of the circuit initiating connection. - public Models.SubResource ExpressRouteCircuitPeering { get; set; } + public WritableSubResource ExpressRouteCircuitPeering { get; set; } /// Reference to Express Route Circuit Private Peering Resource of the peered circuit. - public Models.SubResource PeerExpressRouteCircuitPeering { get; set; } + public WritableSubResource PeerExpressRouteCircuitPeering { get; set; } /// /29 IP address space to carve out Customer addresses for tunnels. public string AddressPrefix { get; set; } /// The authorization key. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitData.cs index 95e8d3a0127b1..d64c2ec4b617e 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitData.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -22,7 +23,7 @@ public ExpressRouteCircuitData() } /// Initializes a new instance of ExpressRouteCircuitData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. @@ -43,7 +44,7 @@ public ExpressRouteCircuitData() /// The provisioning state of the express route circuit resource. /// The GatewayManager Etag. /// Flag denoting global reach status. - internal ExpressRouteCircuitData(string id, string name, string type, string location, IDictionary tags, ExpressRouteCircuitSku sku, string etag, bool? allowClassicOperations, string circuitProvisioningState, ServiceProviderProvisioningState? serviceProviderProvisioningState, IList authorizations, IList peerings, string serviceKey, string serviceProviderNotes, ExpressRouteCircuitServiceProviderProperties serviceProviderProperties, SubResource expressRoutePort, float? bandwidthInGbps, int? stag, ProvisioningState? provisioningState, string gatewayManagerEtag, bool? globalReachEnabled) : base(id, name, type, location, tags) + internal ExpressRouteCircuitData(string id, string name, string type, string location, IDictionary tags, ExpressRouteCircuitSku sku, string etag, bool? allowClassicOperations, string circuitProvisioningState, ServiceProviderProvisioningState? serviceProviderProvisioningState, IList authorizations, IList peerings, string serviceKey, string serviceProviderNotes, ExpressRouteCircuitServiceProviderProperties serviceProviderProperties, WritableSubResource expressRoutePort, float? bandwidthInGbps, int? stag, ProvisioningState? provisioningState, string gatewayManagerEtag, bool? globalReachEnabled) : base(id, name, type, location, tags) { Sku = sku; Etag = etag; @@ -84,7 +85,7 @@ internal ExpressRouteCircuitData(string id, string name, string type, string loc /// The ServiceProviderProperties. public ExpressRouteCircuitServiceProviderProperties ServiceProviderProperties { get; set; } /// The reference to the ExpressRoutePort resource when the circuit is provisioned on an ExpressRoutePort resource. - public SubResource ExpressRoutePort { get; set; } + public WritableSubResource ExpressRoutePort { get; set; } /// The bandwidth of the circuit when the circuit is provisioned on an ExpressRoutePort resource. public float? BandwidthInGbps { get; set; } /// The identifier of the circuit traffic. Outer tag for QinQ encapsulation. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitPeeringData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitPeeringData.cs index d9f498621a8eb..82aae5d7fcf95 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitPeeringData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCircuitPeeringData.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.Network { /// A class representing the ExpressRouteCircuitPeering data model. - public partial class ExpressRouteCircuitPeeringData : WritableSubResource + public partial class ExpressRouteCircuitPeeringData : Models.SubResource { /// Initializes a new instance of ExpressRouteCircuitPeeringData. public ExpressRouteCircuitPeeringData() @@ -23,7 +23,7 @@ public ExpressRouteCircuitPeeringData() } /// Initializes a new instance of ExpressRouteCircuitPeeringData. - /// The id. + /// Resource ID. /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// Type of the resource. @@ -47,7 +47,7 @@ public ExpressRouteCircuitPeeringData() /// The ExpressRoute connection. /// The list of circuit connections associated with Azure Private Peering for this circuit. /// The list of peered circuit connections associated with Azure Private Peering for this circuit. - internal ExpressRouteCircuitPeeringData(string id, string name, string etag, string type, ExpressRoutePeeringType? peeringType, ExpressRoutePeeringState? state, int? azureASN, long? peerASN, string primaryPeerAddressPrefix, string secondaryPeerAddressPrefix, string primaryAzurePort, string secondaryAzurePort, string sharedKey, int? vlanId, ExpressRouteCircuitPeeringConfig microsoftPeeringConfig, ExpressRouteCircuitStats stats, ProvisioningState? provisioningState, string gatewayManagerEtag, string lastModifiedBy, Models.SubResource routeFilter, Ipv6ExpressRouteCircuitPeeringConfig ipv6PeeringConfig, ExpressRouteConnectionId expressRouteConnection, IList connections, IReadOnlyList peeredConnections) : base(id) + internal ExpressRouteCircuitPeeringData(string id, string name, string etag, string type, ExpressRoutePeeringType? peeringType, ExpressRoutePeeringState? state, int? azureASN, long? peerASN, string primaryPeerAddressPrefix, string secondaryPeerAddressPrefix, string primaryAzurePort, string secondaryAzurePort, string sharedKey, int? vlanId, ExpressRouteCircuitPeeringConfig microsoftPeeringConfig, ExpressRouteCircuitStats stats, ProvisioningState? provisioningState, string gatewayManagerEtag, string lastModifiedBy, WritableSubResource routeFilter, Ipv6ExpressRouteCircuitPeeringConfig ipv6PeeringConfig, Resources.Models.SubResource expressRouteConnection, IList connections, IReadOnlyList peeredConnections) : base(id) { Name = name; Etag = etag; @@ -111,11 +111,11 @@ internal ExpressRouteCircuitPeeringData(string id, string name, string etag, str /// Who was the last to modify the peering. public string LastModifiedBy { get; } /// The reference to the RouteFilter resource. - public Models.SubResource RouteFilter { get; set; } + public WritableSubResource RouteFilter { get; set; } /// The IPv6 peering configuration. public Ipv6ExpressRouteCircuitPeeringConfig Ipv6PeeringConfig { get; set; } /// The ExpressRoute connection. - public ExpressRouteConnectionId ExpressRouteConnection { get; set; } + public Resources.Models.SubResource ExpressRouteConnection { get; set; } /// The list of circuit connections associated with Azure Private Peering for this circuit. public IList Connections { get; } /// The list of peered circuit connections associated with Azure Private Peering for this circuit. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteConnectionData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteConnectionData.cs index c5913f6252f63..22b601702dff7 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteConnectionData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteConnectionData.cs @@ -12,7 +12,7 @@ namespace Azure.ResourceManager.Network { /// A class representing the ExpressRouteConnection data model. - public partial class ExpressRouteConnectionData : WritableSubResource + public partial class ExpressRouteConnectionData : Models.SubResource { /// Initializes a new instance of ExpressRouteConnectionData. /// The name of the resource. @@ -28,7 +28,7 @@ public ExpressRouteConnectionData(string name) } /// Initializes a new instance of ExpressRouteConnectionData. - /// The id. + /// Resource ID. /// The name of the resource. /// The provisioning state of the express route connection resource. /// The ExpressRoute circuit peering. @@ -37,7 +37,7 @@ public ExpressRouteConnectionData(string name) /// Enable internet security. /// Enable FastPath to vWan Firewall hub. /// The Routing Configuration indicating the associated and propagated route tables on this connection. - internal ExpressRouteConnectionData(string id, string name, ProvisioningState? provisioningState, ExpressRouteCircuitPeeringId expressRouteCircuitPeering, string authorizationKey, int? routingWeight, bool? enableInternetSecurity, bool? expressRouteGatewayBypass, RoutingConfiguration routingConfiguration) : base(id) + internal ExpressRouteConnectionData(string id, string name, ProvisioningState? provisioningState, WritableSubResource expressRouteCircuitPeering, string authorizationKey, int? routingWeight, bool? enableInternetSecurity, bool? expressRouteGatewayBypass, RoutingConfiguration routingConfiguration) : base(id) { Name = name; ProvisioningState = provisioningState; @@ -54,7 +54,7 @@ internal ExpressRouteConnectionData(string id, string name, ProvisioningState? p /// The provisioning state of the express route connection resource. public ProvisioningState? ProvisioningState { get; } /// The ExpressRoute circuit peering. - public ExpressRouteCircuitPeeringId ExpressRouteCircuitPeering { get; set; } + public WritableSubResource ExpressRouteCircuitPeering { get; set; } /// Authorization key to establish the connection. public string AuthorizationKey { get; set; } /// The routing weight associated to the connection. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCrossConnectionData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCrossConnectionData.cs index 142f5fece31c3..8dedcbdf97e70 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCrossConnectionData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCrossConnectionData.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -21,7 +22,7 @@ public ExpressRouteCrossConnectionData() } /// Initializes a new instance of ExpressRouteCrossConnectionData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. @@ -37,7 +38,7 @@ public ExpressRouteCrossConnectionData() /// Additional read only notes set by the connectivity provider. /// The provisioning state of the express route cross connection resource. /// The list of peerings. - internal ExpressRouteCrossConnectionData(string id, string name, string type, string location, IDictionary tags, string etag, string primaryAzurePort, string secondaryAzurePort, int? sTag, string peeringLocation, int? bandwidthInMbps, ExpressRouteCircuitReference expressRouteCircuit, ServiceProviderProvisioningState? serviceProviderProvisioningState, string serviceProviderNotes, ProvisioningState? provisioningState, IList peerings) : base(id, name, type, location, tags) + internal ExpressRouteCrossConnectionData(string id, string name, string type, string location, IDictionary tags, string etag, string primaryAzurePort, string secondaryAzurePort, int? sTag, string peeringLocation, int? bandwidthInMbps, WritableSubResource expressRouteCircuit, ServiceProviderProvisioningState? serviceProviderProvisioningState, string serviceProviderNotes, ProvisioningState? provisioningState, IList peerings) : base(id, name, type, location, tags) { Etag = etag; PrimaryAzurePort = primaryAzurePort; @@ -65,7 +66,7 @@ internal ExpressRouteCrossConnectionData(string id, string name, string type, st /// The circuit bandwidth In Mbps. public int? BandwidthInMbps { get; } /// The ExpressRouteCircuit. - public ExpressRouteCircuitReference ExpressRouteCircuit { get; set; } + public WritableSubResource ExpressRouteCircuit { get; set; } /// The provisioning state of the circuit in the connectivity provider system. public ServiceProviderProvisioningState? ServiceProviderProvisioningState { get; set; } /// Additional read only notes set by the connectivity provider. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCrossConnectionPeeringData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCrossConnectionPeeringData.cs index aba25a58c6a69..8e2e6c17faf2c 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCrossConnectionPeeringData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteCrossConnectionPeeringData.cs @@ -6,12 +6,11 @@ #nullable disable using Azure.ResourceManager.Network.Models; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { /// A class representing the ExpressRouteCrossConnectionPeering data model. - public partial class ExpressRouteCrossConnectionPeeringData : WritableSubResource + public partial class ExpressRouteCrossConnectionPeeringData : SubResource { /// Initializes a new instance of ExpressRouteCrossConnectionPeeringData. public ExpressRouteCrossConnectionPeeringData() @@ -19,7 +18,7 @@ public ExpressRouteCrossConnectionPeeringData() } /// Initializes a new instance of ExpressRouteCrossConnectionPeeringData. - /// The id. + /// Resource ID. /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// The peering type. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteGatewayData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteGatewayData.cs index 155ffdce0e432..da5e2dea15126 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteGatewayData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRouteGatewayData.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -21,7 +22,7 @@ public ExpressRouteGatewayData() } /// Initializes a new instance of ExpressRouteGatewayData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. @@ -31,7 +32,7 @@ public ExpressRouteGatewayData() /// List of ExpressRoute connections to the ExpressRoute gateway. /// The provisioning state of the express route gateway resource. /// The Virtual Hub where the ExpressRoute gateway is or will be deployed. - internal ExpressRouteGatewayData(string id, string name, string type, string location, IDictionary tags, string etag, ExpressRouteGatewayPropertiesAutoScaleConfiguration autoScaleConfiguration, IReadOnlyList expressRouteConnections, ProvisioningState? provisioningState, VirtualHubId virtualHub) : base(id, name, type, location, tags) + internal ExpressRouteGatewayData(string id, string name, string type, string location, IDictionary tags, string etag, ExpressRouteGatewayPropertiesAutoScaleConfiguration autoScaleConfiguration, IReadOnlyList expressRouteConnections, ProvisioningState? provisioningState, WritableSubResource virtualHub) : base(id, name, type, location, tags) { Etag = etag; AutoScaleConfiguration = autoScaleConfiguration; @@ -49,6 +50,6 @@ internal ExpressRouteGatewayData(string id, string name, string type, string loc /// The provisioning state of the express route gateway resource. public ProvisioningState? ProvisioningState { get; } /// The Virtual Hub where the ExpressRoute gateway is or will be deployed. - public VirtualHubId VirtualHub { get; set; } + public WritableSubResource VirtualHub { get; set; } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRoutePortData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRoutePortData.cs index 0a0a86ba4ec43..8f0482fa62a20 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRoutePortData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ExpressRoutePortData.cs @@ -19,11 +19,11 @@ public partial class ExpressRoutePortData : Resource public ExpressRoutePortData() { Links = new ChangeTrackingList(); - Circuits = new ChangeTrackingList(); + Circuits = new ChangeTrackingList(); } /// Initializes a new instance of ExpressRoutePortData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. @@ -41,7 +41,7 @@ public ExpressRoutePortData() /// Reference the ExpressRoute circuit(s) that are provisioned on this ExpressRoutePort resource. /// The provisioning state of the express route port resource. /// The resource GUID property of the express route port resource. - internal ExpressRoutePortData(string id, string name, string type, string location, IDictionary tags, string etag, ResourceIdentity identity, string peeringLocation, int? bandwidthInGbps, float? provisionedBandwidthInGbps, string mtu, ExpressRoutePortsEncapsulation? encapsulation, string etherType, string allocationDate, IList links, IReadOnlyList circuits, ProvisioningState? provisioningState, string resourceGuid) : base(id, name, type, location, tags) + internal ExpressRoutePortData(string id, string name, string type, string location, IDictionary tags, string etag, ResourceIdentity identity, string peeringLocation, int? bandwidthInGbps, float? provisionedBandwidthInGbps, string mtu, ExpressRoutePortsEncapsulation? encapsulation, string etherType, string allocationDate, IList links, IReadOnlyList circuits, ProvisioningState? provisioningState, string resourceGuid) : base(id, name, type, location, tags) { Etag = etag; Identity = identity; @@ -79,7 +79,7 @@ internal ExpressRoutePortData(string id, string name, string type, string locati /// The set of physical links of the ExpressRoutePort resource. public IList Links { get; } /// Reference the ExpressRoute circuit(s) that are provisioned on this ExpressRoutePort resource. - public IReadOnlyList Circuits { get; } + public IReadOnlyList Circuits { get; } /// The provisioning state of the express route port resource. public ProvisioningState? ProvisioningState { get; } /// The resource GUID property of the express route port resource. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/FirewallPolicyData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/FirewallPolicyData.cs index 42d918ea4d486..bd719b2faf9c3 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/FirewallPolicyData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/FirewallPolicyData.cs @@ -18,13 +18,13 @@ public partial class FirewallPolicyData : Resource /// Initializes a new instance of FirewallPolicyData. public FirewallPolicyData() { - RuleCollectionGroups = new ChangeTrackingList(); - Firewalls = new ChangeTrackingList(); - ChildPolicies = new ChangeTrackingList(); + RuleCollectionGroups = new ChangeTrackingList(); + Firewalls = new ChangeTrackingList(); + ChildPolicies = new ChangeTrackingList(); } /// Initializes a new instance of FirewallPolicyData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. @@ -44,7 +44,7 @@ public FirewallPolicyData() /// The configuration for Intrusion detection. /// TLS Configuration definition. /// The Firewall Policy SKU. - internal FirewallPolicyData(string id, string name, string type, string location, IDictionary tags, string etag, ResourceIdentity identity, IReadOnlyList ruleCollectionGroups, ProvisioningState? provisioningState, Models.SubResource basePolicy, IReadOnlyList firewalls, IReadOnlyList childPolicies, AzureFirewallThreatIntelMode? threatIntelMode, FirewallPolicyThreatIntelWhitelist threatIntelWhitelist, FirewallPolicyInsights insights, FirewallPolicySnat snat, DnsSettings dnsSettings, FirewallPolicyIntrusionDetection intrusionDetection, FirewallPolicyTransportSecurity transportSecurity, FirewallPolicySku sku) : base(id, name, type, location, tags) + internal FirewallPolicyData(string id, string name, string type, string location, IDictionary tags, string etag, ResourceIdentity identity, IReadOnlyList ruleCollectionGroups, ProvisioningState? provisioningState, WritableSubResource basePolicy, IReadOnlyList firewalls, IReadOnlyList childPolicies, AzureFirewallThreatIntelMode? threatIntelMode, FirewallPolicyThreatIntelWhitelist threatIntelWhitelist, FirewallPolicyInsights insights, FirewallPolicySnat snat, DnsSettings dnsSettings, FirewallPolicyIntrusionDetection intrusionDetection, FirewallPolicyTransportSecurity transportSecurity, FirewallPolicySku sku) : base(id, name, type, location, tags) { Etag = etag; Identity = identity; @@ -68,15 +68,15 @@ internal FirewallPolicyData(string id, string name, string type, string location /// The identity of the firewall policy. public ResourceIdentity Identity { get; set; } /// List of references to FirewallPolicyRuleCollectionGroups. - public IReadOnlyList RuleCollectionGroups { get; } + public IReadOnlyList RuleCollectionGroups { get; } /// The provisioning state of the firewall policy resource. public ProvisioningState? ProvisioningState { get; } /// The parent firewall policy from which rules are inherited. - public Models.SubResource BasePolicy { get; set; } + public WritableSubResource BasePolicy { get; set; } /// List of references to Azure Firewalls that this Firewall Policy is associated with. - public IReadOnlyList Firewalls { get; } + public IReadOnlyList Firewalls { get; } /// List of references to Child Firewall Policies. - public IReadOnlyList ChildPolicies { get; } + public IReadOnlyList ChildPolicies { get; } /// The operation mode for Threat Intelligence. public AzureFirewallThreatIntelMode? ThreatIntelMode { get; set; } /// ThreatIntel Whitelist for Firewall Policy. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/FirewallPolicyRuleCollectionGroupData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/FirewallPolicyRuleCollectionGroupData.cs index b2022210caf3e..bf5e3789c3e46 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/FirewallPolicyRuleCollectionGroupData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/FirewallPolicyRuleCollectionGroupData.cs @@ -8,12 +8,11 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network.Models; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { /// A class representing the FirewallPolicyRuleCollectionGroup data model. - public partial class FirewallPolicyRuleCollectionGroupData : WritableSubResource + public partial class FirewallPolicyRuleCollectionGroupData : SubResource { /// Initializes a new instance of FirewallPolicyRuleCollectionGroupData. public FirewallPolicyRuleCollectionGroupData() @@ -22,7 +21,7 @@ public FirewallPolicyRuleCollectionGroupData() } /// Initializes a new instance of FirewallPolicyRuleCollectionGroupData. - /// The id. + /// Resource ID. /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// Rule Group type. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/FlowLogData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/FlowLogData.cs index d3ae5de75e267..7827e919e1a95 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/FlowLogData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/FlowLogData.cs @@ -19,7 +19,7 @@ public FlowLogData() } /// Initializes a new instance of FlowLogData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/HubIpConfigurationData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/HubIpConfigurationData.cs index 1c5d8d25fc4f1..8420fa4a33032 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/HubIpConfigurationData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/HubIpConfigurationData.cs @@ -6,12 +6,11 @@ #nullable disable using Azure.ResourceManager.Network.Models; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { /// A class representing the HubIpConfiguration data model. - public partial class HubIpConfigurationData : WritableSubResource + public partial class HubIpConfigurationData : SubResource { /// Initializes a new instance of HubIpConfigurationData. public HubIpConfigurationData() @@ -19,7 +18,7 @@ public HubIpConfigurationData() } /// Initializes a new instance of HubIpConfigurationData. - /// The id. + /// Resource ID. /// Name of the Ip Configuration. /// A unique read-only string that changes whenever the resource is updated. /// Ipconfiguration type. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/HubRouteTableData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/HubRouteTableData.cs index 2dd15d3e214ad..59bad344c762b 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/HubRouteTableData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/HubRouteTableData.cs @@ -8,12 +8,11 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network.Models; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { /// A class representing the HubRouteTable data model. - public partial class HubRouteTableData : WritableSubResource + public partial class HubRouteTableData : SubResource { /// Initializes a new instance of HubRouteTableData. public HubRouteTableData() @@ -25,7 +24,7 @@ public HubRouteTableData() } /// Initializes a new instance of HubRouteTableData. - /// The id. + /// Resource ID. /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// Resource type. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/HubVirtualNetworkConnectionData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/HubVirtualNetworkConnectionData.cs index 8204f734a5709..e4f15038f405f 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/HubVirtualNetworkConnectionData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/HubVirtualNetworkConnectionData.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Network { /// A class representing the HubVirtualNetworkConnection data model. - public partial class HubVirtualNetworkConnectionData : WritableSubResource + public partial class HubVirtualNetworkConnectionData : Models.SubResource { /// Initializes a new instance of HubVirtualNetworkConnectionData. public HubVirtualNetworkConnectionData() @@ -19,7 +19,7 @@ public HubVirtualNetworkConnectionData() } /// Initializes a new instance of HubVirtualNetworkConnectionData. - /// The id. + /// Resource ID. /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// Reference to the remote virtual network. @@ -28,7 +28,7 @@ public HubVirtualNetworkConnectionData() /// Enable internet security. /// The Routing Configuration indicating the associated and propagated route tables on this connection. /// The provisioning state of the hub virtual network connection resource. - internal HubVirtualNetworkConnectionData(string id, string name, string etag, Models.SubResource remoteVirtualNetwork, bool? allowHubToRemoteVnetTransit, bool? allowRemoteVnetToUseHubVnetGateways, bool? enableInternetSecurity, RoutingConfiguration routingConfiguration, ProvisioningState? provisioningState) : base(id) + internal HubVirtualNetworkConnectionData(string id, string name, string etag, WritableSubResource remoteVirtualNetwork, bool? allowHubToRemoteVnetTransit, bool? allowRemoteVnetToUseHubVnetGateways, bool? enableInternetSecurity, RoutingConfiguration routingConfiguration, ProvisioningState? provisioningState) : base(id) { Name = name; Etag = etag; @@ -45,7 +45,7 @@ internal HubVirtualNetworkConnectionData(string id, string name, string etag, Mo /// A unique read-only string that changes whenever the resource is updated. public string Etag { get; } /// Reference to the remote virtual network. - public Models.SubResource RemoteVirtualNetwork { get; set; } + public WritableSubResource RemoteVirtualNetwork { get; set; } /// Deprecated: VirtualHub to RemoteVnet transit to enabled or not. public bool? AllowHubToRemoteVnetTransit { get; set; } /// Deprecated: Allow RemoteVnet to use Virtual Hub's gateways. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/InboundNatRuleData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/InboundNatRuleData.cs index a8f6d00e860f8..ce2b184da379d 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/InboundNatRuleData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/InboundNatRuleData.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Network { /// A class representing the InboundNatRule data model. - public partial class InboundNatRuleData : WritableSubResource + public partial class InboundNatRuleData : Models.SubResource { /// Initializes a new instance of InboundNatRuleData. public InboundNatRuleData() @@ -19,7 +19,7 @@ public InboundNatRuleData() } /// Initializes a new instance of InboundNatRuleData. - /// The id. + /// Resource ID. /// The name of the resource that is unique within the set of inbound NAT rules used by the load balancer. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// Type of the resource. @@ -32,7 +32,7 @@ public InboundNatRuleData() /// Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL AlwaysOn Availability Group. This setting is required when using the SQL AlwaysOn Availability Groups in SQL server. This setting can't be changed after you create the endpoint. /// Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This element is only used when the protocol is set to TCP. /// The provisioning state of the inbound NAT rule resource. - internal InboundNatRuleData(string id, string name, string etag, string type, Models.SubResource frontendIPConfiguration, NetworkInterfaceIPConfiguration backendIPConfiguration, TransportProtocol? protocol, int? frontendPort, int? backendPort, int? idleTimeoutInMinutes, bool? enableFloatingIP, bool? enableTcpReset, ProvisioningState? provisioningState) : base(id) + internal InboundNatRuleData(string id, string name, string etag, string type, WritableSubResource frontendIPConfiguration, NetworkInterfaceIPConfiguration backendIPConfiguration, TransportProtocol? protocol, int? frontendPort, int? backendPort, int? idleTimeoutInMinutes, bool? enableFloatingIP, bool? enableTcpReset, ProvisioningState? provisioningState) : base(id) { Name = name; Etag = etag; @@ -55,7 +55,7 @@ internal InboundNatRuleData(string id, string name, string etag, string type, Mo /// Type of the resource. public string Type { get; } /// A reference to frontend IP addresses. - public Models.SubResource FrontendIPConfiguration { get; set; } + public WritableSubResource FrontendIPConfiguration { get; set; } /// A reference to a private IP address defined on a network interface of a VM. Traffic sent to the frontend port of each of the frontend IP configurations is forwarded to the backend IP. public NetworkInterfaceIPConfiguration BackendIPConfiguration { get; } /// The reference to the transport protocol used by the load balancing rule. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/IpAllocationData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/IpAllocationData.cs index b7db4c660784c..b97a306444735 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/IpAllocationData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/IpAllocationData.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -21,7 +22,7 @@ public IpAllocationData() } /// Initializes a new instance of IpAllocationData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. @@ -35,7 +36,7 @@ public IpAllocationData() /// The address prefix Type for the IpAllocation. /// The IPAM allocation ID. /// IpAllocation tags. - internal IpAllocationData(string id, string name, string type, string location, IDictionary tags, string etag, SubResource subnet, SubResource virtualNetwork, IpAllocationType? typePropertiesType, string prefix, int? prefixLength, IPVersion? prefixType, string ipamAllocationId, IDictionary allocationTags) : base(id, name, type, location, tags) + internal IpAllocationData(string id, string name, string type, string location, IDictionary tags, string etag, WritableSubResource subnet, WritableSubResource virtualNetwork, IpAllocationType? typePropertiesType, string prefix, int? prefixLength, IPVersion? prefixType, string ipamAllocationId, IDictionary allocationTags) : base(id, name, type, location, tags) { Etag = etag; Subnet = subnet; @@ -51,9 +52,9 @@ internal IpAllocationData(string id, string name, string type, string location, /// A unique read-only string that changes whenever the resource is updated. public string Etag { get; } /// The Subnet that using the prefix of this IpAllocation resource. - public SubResource Subnet { get; } + public WritableSubResource Subnet { get; } /// The VirtualNetwork that using the prefix of this IpAllocation resource. - public SubResource VirtualNetwork { get; } + public WritableSubResource VirtualNetwork { get; } /// The type for the IpAllocation. public IpAllocationType? TypePropertiesType { get; set; } /// The address prefix for the IpAllocation. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/IpGroupData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/IpGroupData.cs index 999dc02814089..297725d45bd98 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/IpGroupData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/IpGroupData.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -18,12 +19,12 @@ public partial class IpGroupData : Resource public IpGroupData() { IpAddresses = new ChangeTrackingList(); - Firewalls = new ChangeTrackingList(); - FirewallPolicies = new ChangeTrackingList(); + Firewalls = new ChangeTrackingList(); + FirewallPolicies = new ChangeTrackingList(); } /// Initializes a new instance of IpGroupData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. @@ -33,7 +34,7 @@ public IpGroupData() /// IpAddresses/IpAddressPrefixes in the IpGroups resource. /// List of references to Firewall resources that this IpGroups is associated with. /// List of references to Firewall Policies resources that this IpGroups is associated with. - internal IpGroupData(string id, string name, string type, string location, IDictionary tags, string etag, ProvisioningState? provisioningState, IList ipAddresses, IReadOnlyList firewalls, IReadOnlyList firewallPolicies) : base(id, name, type, location, tags) + internal IpGroupData(string id, string name, string type, string location, IDictionary tags, string etag, ProvisioningState? provisioningState, IList ipAddresses, IReadOnlyList firewalls, IReadOnlyList firewallPolicies) : base(id, name, type, location, tags) { Etag = etag; ProvisioningState = provisioningState; @@ -49,8 +50,8 @@ internal IpGroupData(string id, string name, string type, string location, IDict /// IpAddresses/IpAddressPrefixes in the IpGroups resource. public IList IpAddresses { get; } /// List of references to Firewall resources that this IpGroups is associated with. - public IReadOnlyList Firewalls { get; } + public IReadOnlyList Firewalls { get; } /// List of references to Firewall Policies resources that this IpGroups is associated with. - public IReadOnlyList FirewallPolicies { get; } + public IReadOnlyList FirewallPolicies { get; } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/LoadBalancerData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/LoadBalancerData.cs index 94fc08ac86c83..86193ad19d9ce 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/LoadBalancerData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/LoadBalancerData.cs @@ -27,7 +27,7 @@ public LoadBalancerData() } /// Initializes a new instance of LoadBalancerData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/LocalNetworkGatewayData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/LocalNetworkGatewayData.cs index ea7d1be5409e4..92dc4521ff2e6 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/LocalNetworkGatewayData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/LocalNetworkGatewayData.cs @@ -19,7 +19,7 @@ public LocalNetworkGatewayData() } /// Initializes a new instance of LocalNetworkGatewayData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayAuthenticationCertificate.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayAuthenticationCertificate.Serialization.cs index 75e625a5dfbf9..03be9591e2d30 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayAuthenticationCertificate.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayAuthenticationCertificate.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -21,8 +20,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Data)) @@ -39,7 +41,7 @@ internal static ApplicationGatewayAuthenticationCertificate DeserializeApplicati Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional data = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) @@ -92,7 +94,7 @@ internal static ApplicationGatewayAuthenticationCertificate DeserializeApplicati continue; } } - return new ApplicationGatewayAuthenticationCertificate(id, name.Value, etag.Value, type.Value, data.Value, Optional.ToNullable(provisioningState)); + return new ApplicationGatewayAuthenticationCertificate(id.Value, name.Value, etag.Value, type.Value, data.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayAuthenticationCertificate.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayAuthenticationCertificate.cs index 7b4fee6bb9495..8d8f70ce5819f 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayAuthenticationCertificate.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayAuthenticationCertificate.cs @@ -5,12 +5,10 @@ #nullable disable -using Azure.ResourceManager.Resources.Models; - namespace Azure.ResourceManager.Network.Models { /// Authentication certificates of an application gateway. - public partial class ApplicationGatewayAuthenticationCertificate : WritableSubResource + public partial class ApplicationGatewayAuthenticationCertificate : SubResource { /// Initializes a new instance of ApplicationGatewayAuthenticationCertificate. public ApplicationGatewayAuthenticationCertificate() @@ -18,7 +16,7 @@ public ApplicationGatewayAuthenticationCertificate() } /// Initializes a new instance of ApplicationGatewayAuthenticationCertificate. - /// The id. + /// Resource ID. /// Name of the authentication certificate that is unique within an Application Gateway. /// A unique read-only string that changes whenever the resource is updated. /// Type of the resource. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayAvailableSslOptions.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayAvailableSslOptions.Serialization.cs index 3106c91be30d1..161c4c632bbe0 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayAvailableSslOptions.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayAvailableSslOptions.Serialization.cs @@ -8,7 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -17,6 +17,11 @@ public partial class ApplicationGatewayAvailableSslOptions : IUtf8JsonSerializab void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -33,8 +38,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsCollectionDefined(PredefinedPolicies)) @@ -43,7 +46,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in PredefinedPolicies) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } @@ -78,17 +81,22 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static ApplicationGatewayAvailableSslOptions DeserializeApplicationGatewayAvailableSslOptions(JsonElement element) { + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; - Optional> predefinedPolicies = default; + Optional> predefinedPolicies = default; Optional defaultPolicy = default; Optional> availableCipherSuites = default; Optional> availableProtocols = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -119,11 +127,6 @@ internal static ApplicationGatewayAvailableSslOptions DeserializeApplicationGate tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -140,10 +143,10 @@ internal static ApplicationGatewayAvailableSslOptions DeserializeApplicationGate property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } predefinedPolicies = array; continue; @@ -192,7 +195,7 @@ internal static ApplicationGatewayAvailableSslOptions DeserializeApplicationGate continue; } } - return new ApplicationGatewayAvailableSslOptions(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), Optional.ToList(predefinedPolicies), Optional.ToNullable(defaultPolicy), Optional.ToList(availableCipherSuites), Optional.ToList(availableProtocols)); + return new ApplicationGatewayAvailableSslOptions(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), Optional.ToList(predefinedPolicies), Optional.ToNullable(defaultPolicy), Optional.ToList(availableCipherSuites), Optional.ToList(availableProtocols)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayAvailableSslOptions.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayAvailableSslOptions.cs index 7221f0a049a52..f40f2b2f4df6b 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayAvailableSslOptions.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayAvailableSslOptions.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -16,13 +17,13 @@ public partial class ApplicationGatewayAvailableSslOptions : Resource /// Initializes a new instance of ApplicationGatewayAvailableSslOptions. public ApplicationGatewayAvailableSslOptions() { - PredefinedPolicies = new ChangeTrackingList(); + PredefinedPolicies = new ChangeTrackingList(); AvailableCipherSuites = new ChangeTrackingList(); AvailableProtocols = new ChangeTrackingList(); } /// Initializes a new instance of ApplicationGatewayAvailableSslOptions. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. @@ -31,7 +32,7 @@ public ApplicationGatewayAvailableSslOptions() /// Name of the Ssl predefined policy applied by default to application gateway. /// List of available Ssl cipher suites. /// List of available Ssl protocols. - internal ApplicationGatewayAvailableSslOptions(string id, string name, string type, string location, IDictionary tags, IList predefinedPolicies, ApplicationGatewaySslPolicyName? defaultPolicy, IList availableCipherSuites, IList availableProtocols) : base(id, name, type, location, tags) + internal ApplicationGatewayAvailableSslOptions(string id, string name, string type, string location, IDictionary tags, IList predefinedPolicies, ApplicationGatewaySslPolicyName? defaultPolicy, IList availableCipherSuites, IList availableProtocols) : base(id, name, type, location, tags) { PredefinedPolicies = predefinedPolicies; DefaultPolicy = defaultPolicy; @@ -40,7 +41,7 @@ internal ApplicationGatewayAvailableSslOptions(string id, string name, string ty } /// List of available Ssl predefined policy. - public IList PredefinedPolicies { get; } + public IList PredefinedPolicies { get; } /// Name of the Ssl predefined policy applied by default to application gateway. public ApplicationGatewaySslPolicyName? DefaultPolicy { get; set; } /// List of available Ssl cipher suites. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayBackendAddressPool.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayBackendAddressPool.Serialization.cs index 47911e61d3b6a..39989f464d046 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayBackendAddressPool.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayBackendAddressPool.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -22,8 +21,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsCollectionDefined(BackendAddresses)) @@ -45,7 +47,7 @@ internal static ApplicationGatewayBackendAddressPool DeserializeApplicationGatew Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional> backendIPConfigurations = default; Optional> backendAddresses = default; Optional provisioningState = default; @@ -124,7 +126,7 @@ internal static ApplicationGatewayBackendAddressPool DeserializeApplicationGatew continue; } } - return new ApplicationGatewayBackendAddressPool(id, name.Value, etag.Value, type.Value, Optional.ToList(backendIPConfigurations), Optional.ToList(backendAddresses), Optional.ToNullable(provisioningState)); + return new ApplicationGatewayBackendAddressPool(id.Value, name.Value, etag.Value, type.Value, Optional.ToList(backendIPConfigurations), Optional.ToList(backendAddresses), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayBackendAddressPool.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayBackendAddressPool.cs index f30d6c3764536..8aea26659b4bc 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayBackendAddressPool.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayBackendAddressPool.cs @@ -7,12 +7,11 @@ using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { /// Backend Address Pool of an application gateway. - public partial class ApplicationGatewayBackendAddressPool : WritableSubResource + public partial class ApplicationGatewayBackendAddressPool : SubResource { /// Initializes a new instance of ApplicationGatewayBackendAddressPool. public ApplicationGatewayBackendAddressPool() @@ -22,7 +21,7 @@ public ApplicationGatewayBackendAddressPool() } /// Initializes a new instance of ApplicationGatewayBackendAddressPool. - /// The id. + /// Resource ID. /// Name of the backend address pool that is unique within an Application Gateway. /// A unique read-only string that changes whenever the resource is updated. /// Type of the resource. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayBackendHttpSettings.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayBackendHttpSettings.Serialization.cs index af940a08e3918..8cd46bdf25ae5 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayBackendHttpSettings.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayBackendHttpSettings.Serialization.cs @@ -8,7 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -22,8 +22,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Port)) @@ -49,7 +52,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Probe)) { writer.WritePropertyName("probe"); - writer.WriteObjectValue(Probe); + JsonSerializer.Serialize(writer, Probe); } if (Optional.IsCollectionDefined(AuthenticationCertificates)) { @@ -57,7 +60,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in AuthenticationCertificates) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } @@ -67,7 +70,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in TrustedRootCertificates) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } @@ -110,14 +113,14 @@ internal static ApplicationGatewayBackendHttpSettings DeserializeApplicationGate Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional port = default; Optional protocol = default; Optional cookieBasedAffinity = default; Optional requestTimeout = default; - Optional probe = default; - Optional> authenticationCertificates = default; - Optional> trustedRootCertificates = default; + Optional probe = default; + Optional> authenticationCertificates = default; + Optional> trustedRootCertificates = default; Optional connectionDraining = default; Optional hostName = default; Optional pickHostNameFromBackendAddress = default; @@ -203,7 +206,7 @@ internal static ApplicationGatewayBackendHttpSettings DeserializeApplicationGate property0.ThrowNonNullablePropertyIsNull(); continue; } - probe = SubResource.DeserializeSubResource(property0.Value); + probe = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("authenticationCertificates")) @@ -213,10 +216,10 @@ internal static ApplicationGatewayBackendHttpSettings DeserializeApplicationGate property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } authenticationCertificates = array; continue; @@ -228,10 +231,10 @@ internal static ApplicationGatewayBackendHttpSettings DeserializeApplicationGate property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } trustedRootCertificates = array; continue; @@ -295,7 +298,7 @@ internal static ApplicationGatewayBackendHttpSettings DeserializeApplicationGate continue; } } - return new ApplicationGatewayBackendHttpSettings(id, name.Value, etag.Value, type.Value, Optional.ToNullable(port), Optional.ToNullable(protocol), Optional.ToNullable(cookieBasedAffinity), Optional.ToNullable(requestTimeout), probe.Value, Optional.ToList(authenticationCertificates), Optional.ToList(trustedRootCertificates), connectionDraining.Value, hostName.Value, Optional.ToNullable(pickHostNameFromBackendAddress), affinityCookieName.Value, Optional.ToNullable(probeEnabled), path.Value, Optional.ToNullable(provisioningState)); + return new ApplicationGatewayBackendHttpSettings(id.Value, name.Value, etag.Value, type.Value, Optional.ToNullable(port), Optional.ToNullable(protocol), Optional.ToNullable(cookieBasedAffinity), Optional.ToNullable(requestTimeout), probe, Optional.ToList(authenticationCertificates), Optional.ToList(trustedRootCertificates), connectionDraining.Value, hostName.Value, Optional.ToNullable(pickHostNameFromBackendAddress), affinityCookieName.Value, Optional.ToNullable(probeEnabled), path.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayBackendHttpSettings.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayBackendHttpSettings.cs index fe74e29c8f717..eeb0ed7639121 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayBackendHttpSettings.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayBackendHttpSettings.cs @@ -12,17 +12,17 @@ namespace Azure.ResourceManager.Network.Models { /// Backend address pool settings of an application gateway. - public partial class ApplicationGatewayBackendHttpSettings : WritableSubResource + public partial class ApplicationGatewayBackendHttpSettings : SubResource { /// Initializes a new instance of ApplicationGatewayBackendHttpSettings. public ApplicationGatewayBackendHttpSettings() { - AuthenticationCertificates = new ChangeTrackingList(); - TrustedRootCertificates = new ChangeTrackingList(); + AuthenticationCertificates = new ChangeTrackingList(); + TrustedRootCertificates = new ChangeTrackingList(); } /// Initializes a new instance of ApplicationGatewayBackendHttpSettings. - /// The id. + /// Resource ID. /// Name of the backend http settings that is unique within an Application Gateway. /// A unique read-only string that changes whenever the resource is updated. /// Type of the resource. @@ -40,7 +40,7 @@ public ApplicationGatewayBackendHttpSettings() /// Whether the probe is enabled. Default value is false. /// Path which should be used as a prefix for all HTTP requests. Null means no path will be prefixed. Default value is null. /// The provisioning state of the backend HTTP settings resource. - internal ApplicationGatewayBackendHttpSettings(string id, string name, string etag, string type, int? port, ApplicationGatewayProtocol? protocol, ApplicationGatewayCookieBasedAffinity? cookieBasedAffinity, int? requestTimeout, SubResource probe, IList authenticationCertificates, IList trustedRootCertificates, ApplicationGatewayConnectionDraining connectionDraining, string hostName, bool? pickHostNameFromBackendAddress, string affinityCookieName, bool? probeEnabled, string path, ProvisioningState? provisioningState) : base(id) + internal ApplicationGatewayBackendHttpSettings(string id, string name, string etag, string type, int? port, ApplicationGatewayProtocol? protocol, ApplicationGatewayCookieBasedAffinity? cookieBasedAffinity, int? requestTimeout, WritableSubResource probe, IList authenticationCertificates, IList trustedRootCertificates, ApplicationGatewayConnectionDraining connectionDraining, string hostName, bool? pickHostNameFromBackendAddress, string affinityCookieName, bool? probeEnabled, string path, ProvisioningState? provisioningState) : base(id) { Name = name; Etag = etag; @@ -76,11 +76,11 @@ internal ApplicationGatewayBackendHttpSettings(string id, string name, string et /// Request timeout in seconds. Application Gateway will fail the request if response is not received within RequestTimeout. Acceptable values are from 1 second to 86400 seconds. public int? RequestTimeout { get; set; } /// Probe resource of an application gateway. - public SubResource Probe { get; set; } + public WritableSubResource Probe { get; set; } /// Array of references to application gateway authentication certificates. - public IList AuthenticationCertificates { get; } + public IList AuthenticationCertificates { get; } /// Array of references to application gateway trusted root certificates. - public IList TrustedRootCertificates { get; } + public IList TrustedRootCertificates { get; } /// Connection draining of the backend http settings resource. public ApplicationGatewayConnectionDraining ConnectionDraining { get; set; } /// Host header to be sent to the backend servers. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayData.Serialization.cs index 4dbde803132aa..a0b67a3107769 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayData.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; using Azure.ResourceManager.Resources.Models; @@ -34,6 +33,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("identity"); JsonSerializer.Serialize(writer, Identity); } + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -50,8 +54,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Sku)) @@ -232,7 +234,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(FirewallPolicy)) { writer.WritePropertyName("firewallPolicy"); - writer.WriteObjectValue(FirewallPolicy); + JsonSerializer.Serialize(writer, FirewallPolicy); } if (Optional.IsDefined(EnableHttp2)) { @@ -283,11 +285,11 @@ internal static ApplicationGatewayData DeserializeApplicationGatewayData(JsonEle Optional etag = default; Optional> zones = default; Optional identity = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional sku = default; Optional sslPolicy = default; Optional operationalState = default; @@ -308,7 +310,7 @@ internal static ApplicationGatewayData DeserializeApplicationGatewayData(JsonEle Optional> rewriteRuleSets = default; Optional> redirectConfigurations = default; Optional webApplicationFirewallConfiguration = default; - Optional firewallPolicy = default; + Optional firewallPolicy = default; Optional enableHttp2 = default; Optional enableFips = default; Optional autoscaleConfiguration = default; @@ -350,6 +352,11 @@ internal static ApplicationGatewayData DeserializeApplicationGatewayData(JsonEle identity = JsonSerializer.Deserialize(property.Value.ToString()); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -380,11 +387,6 @@ internal static ApplicationGatewayData DeserializeApplicationGatewayData(JsonEle tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -681,7 +683,7 @@ internal static ApplicationGatewayData DeserializeApplicationGatewayData(JsonEle property0.ThrowNonNullablePropertyIsNull(); continue; } - firewallPolicy = Models.SubResource.DeserializeSubResource(property0.Value); + firewallPolicy = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("enableHttp2")) @@ -788,7 +790,7 @@ internal static ApplicationGatewayData DeserializeApplicationGatewayData(JsonEle continue; } } - return new ApplicationGatewayData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, Optional.ToList(zones), identity, sku.Value, sslPolicy.Value, Optional.ToNullable(operationalState), Optional.ToList(gatewayIPConfigurations), Optional.ToList(authenticationCertificates), Optional.ToList(trustedRootCertificates), Optional.ToList(trustedClientCertificates), Optional.ToList(sslCertificates), Optional.ToList(frontendIPConfigurations), Optional.ToList(frontendPorts), Optional.ToList(probes), Optional.ToList(backendAddressPools), Optional.ToList(backendHttpSettingsCollection), Optional.ToList(httpListeners), Optional.ToList(sslProfiles), Optional.ToList(urlPathMaps), Optional.ToList(requestRoutingRules), Optional.ToList(rewriteRuleSets), Optional.ToList(redirectConfigurations), webApplicationFirewallConfiguration.Value, firewallPolicy.Value, Optional.ToNullable(enableHttp2), Optional.ToNullable(enableFips), autoscaleConfiguration.Value, Optional.ToList(privateLinkConfigurations), Optional.ToList(privateEndpointConnections), resourceGuid.Value, Optional.ToNullable(provisioningState), Optional.ToList(customErrorConfigurations), Optional.ToNullable(forceFirewallPolicyAssociation)); + return new ApplicationGatewayData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, Optional.ToList(zones), identity, sku.Value, sslPolicy.Value, Optional.ToNullable(operationalState), Optional.ToList(gatewayIPConfigurations), Optional.ToList(authenticationCertificates), Optional.ToList(trustedRootCertificates), Optional.ToList(trustedClientCertificates), Optional.ToList(sslCertificates), Optional.ToList(frontendIPConfigurations), Optional.ToList(frontendPorts), Optional.ToList(probes), Optional.ToList(backendAddressPools), Optional.ToList(backendHttpSettingsCollection), Optional.ToList(httpListeners), Optional.ToList(sslProfiles), Optional.ToList(urlPathMaps), Optional.ToList(requestRoutingRules), Optional.ToList(rewriteRuleSets), Optional.ToList(redirectConfigurations), webApplicationFirewallConfiguration.Value, firewallPolicy, Optional.ToNullable(enableHttp2), Optional.ToNullable(enableFips), autoscaleConfiguration.Value, Optional.ToList(privateLinkConfigurations), Optional.ToList(privateEndpointConnections), resourceGuid.Value, Optional.ToNullable(provisioningState), Optional.ToList(customErrorConfigurations), Optional.ToNullable(forceFirewallPolicyAssociation)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayFirewallRuleSet.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayFirewallRuleSet.Serialization.cs index ef16f94ee12c9..18bb3357d5f59 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayFirewallRuleSet.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayFirewallRuleSet.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -17,6 +16,11 @@ public partial class ApplicationGatewayFirewallRuleSet : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -33,8 +37,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(RuleSetType)) @@ -63,17 +65,22 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static ApplicationGatewayFirewallRuleSet DeserializeApplicationGatewayFirewallRuleSet(JsonElement element) { + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional provisioningState = default; Optional ruleSetType = default; Optional ruleSetVersion = default; Optional> ruleGroups = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -104,11 +111,6 @@ internal static ApplicationGatewayFirewallRuleSet DeserializeApplicationGatewayF tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -157,7 +159,7 @@ internal static ApplicationGatewayFirewallRuleSet DeserializeApplicationGatewayF continue; } } - return new ApplicationGatewayFirewallRuleSet(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), Optional.ToNullable(provisioningState), ruleSetType.Value, ruleSetVersion.Value, Optional.ToList(ruleGroups)); + return new ApplicationGatewayFirewallRuleSet(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), Optional.ToNullable(provisioningState), ruleSetType.Value, ruleSetVersion.Value, Optional.ToList(ruleGroups)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayFirewallRuleSet.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayFirewallRuleSet.cs index c89723e1494ea..01ab630f932e0 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayFirewallRuleSet.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayFirewallRuleSet.cs @@ -20,7 +20,7 @@ public ApplicationGatewayFirewallRuleSet() } /// Initializes a new instance of ApplicationGatewayFirewallRuleSet. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayFrontendIPConfiguration.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayFrontendIPConfiguration.Serialization.cs index cede920ee241d..51d7e9f4285e7 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayFrontendIPConfiguration.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayFrontendIPConfiguration.Serialization.cs @@ -7,7 +7,7 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -21,8 +21,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(PrivateIPAddress)) @@ -38,17 +41,17 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Subnet)) { writer.WritePropertyName("subnet"); - writer.WriteObjectValue(Subnet); + JsonSerializer.Serialize(writer, Subnet); } if (Optional.IsDefined(PublicIPAddress)) { writer.WritePropertyName("publicIPAddress"); - writer.WriteObjectValue(PublicIPAddress); + JsonSerializer.Serialize(writer, PublicIPAddress); } if (Optional.IsDefined(PrivateLinkConfiguration)) { writer.WritePropertyName("privateLinkConfiguration"); - writer.WriteObjectValue(PrivateLinkConfiguration); + JsonSerializer.Serialize(writer, PrivateLinkConfiguration); } writer.WriteEndObject(); writer.WriteEndObject(); @@ -59,12 +62,12 @@ internal static ApplicationGatewayFrontendIPConfiguration DeserializeApplication Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional privateIPAddress = default; Optional privateIPAllocationMethod = default; - Optional subnet = default; - Optional publicIPAddress = default; - Optional privateLinkConfiguration = default; + Optional subnet = default; + Optional publicIPAddress = default; + Optional privateLinkConfiguration = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) { @@ -119,7 +122,7 @@ internal static ApplicationGatewayFrontendIPConfiguration DeserializeApplication property0.ThrowNonNullablePropertyIsNull(); continue; } - subnet = SubResource.DeserializeSubResource(property0.Value); + subnet = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("publicIPAddress")) @@ -129,7 +132,7 @@ internal static ApplicationGatewayFrontendIPConfiguration DeserializeApplication property0.ThrowNonNullablePropertyIsNull(); continue; } - publicIPAddress = SubResource.DeserializeSubResource(property0.Value); + publicIPAddress = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("privateLinkConfiguration")) @@ -139,7 +142,7 @@ internal static ApplicationGatewayFrontendIPConfiguration DeserializeApplication property0.ThrowNonNullablePropertyIsNull(); continue; } - privateLinkConfiguration = SubResource.DeserializeSubResource(property0.Value); + privateLinkConfiguration = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("provisioningState")) @@ -156,7 +159,7 @@ internal static ApplicationGatewayFrontendIPConfiguration DeserializeApplication continue; } } - return new ApplicationGatewayFrontendIPConfiguration(id, name.Value, etag.Value, type.Value, privateIPAddress.Value, Optional.ToNullable(privateIPAllocationMethod), subnet.Value, publicIPAddress.Value, privateLinkConfiguration.Value, Optional.ToNullable(provisioningState)); + return new ApplicationGatewayFrontendIPConfiguration(id.Value, name.Value, etag.Value, type.Value, privateIPAddress.Value, Optional.ToNullable(privateIPAllocationMethod), subnet, publicIPAddress, privateLinkConfiguration, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayFrontendIPConfiguration.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayFrontendIPConfiguration.cs index 6eb636b98ae1e..f0fb2e8c5f068 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayFrontendIPConfiguration.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayFrontendIPConfiguration.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.Network.Models { /// Frontend IP configuration of an application gateway. - public partial class ApplicationGatewayFrontendIPConfiguration : WritableSubResource + public partial class ApplicationGatewayFrontendIPConfiguration : SubResource { /// Initializes a new instance of ApplicationGatewayFrontendIPConfiguration. public ApplicationGatewayFrontendIPConfiguration() @@ -18,7 +18,7 @@ public ApplicationGatewayFrontendIPConfiguration() } /// Initializes a new instance of ApplicationGatewayFrontendIPConfiguration. - /// The id. + /// Resource ID. /// Name of the frontend IP configuration that is unique within an Application Gateway. /// A unique read-only string that changes whenever the resource is updated. /// Type of the resource. @@ -28,7 +28,7 @@ public ApplicationGatewayFrontendIPConfiguration() /// Reference to the PublicIP resource. /// Reference to the application gateway private link configuration. /// The provisioning state of the frontend IP configuration resource. - internal ApplicationGatewayFrontendIPConfiguration(string id, string name, string etag, string type, string privateIPAddress, IPAllocationMethod? privateIPAllocationMethod, SubResource subnet, SubResource publicIPAddress, SubResource privateLinkConfiguration, ProvisioningState? provisioningState) : base(id) + internal ApplicationGatewayFrontendIPConfiguration(string id, string name, string etag, string type, string privateIPAddress, IPAllocationMethod? privateIPAllocationMethod, WritableSubResource subnet, WritableSubResource publicIPAddress, WritableSubResource privateLinkConfiguration, ProvisioningState? provisioningState) : base(id) { Name = name; Etag = etag; @@ -52,11 +52,11 @@ internal ApplicationGatewayFrontendIPConfiguration(string id, string name, strin /// The private IP address allocation method. public IPAllocationMethod? PrivateIPAllocationMethod { get; set; } /// Reference to the subnet resource. - public SubResource Subnet { get; set; } + public WritableSubResource Subnet { get; set; } /// Reference to the PublicIP resource. - public SubResource PublicIPAddress { get; set; } + public WritableSubResource PublicIPAddress { get; set; } /// Reference to the application gateway private link configuration. - public SubResource PrivateLinkConfiguration { get; set; } + public WritableSubResource PrivateLinkConfiguration { get; set; } /// The provisioning state of the frontend IP configuration resource. public ProvisioningState? ProvisioningState { get; } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayFrontendPort.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayFrontendPort.Serialization.cs index 244e876ce3a48..d09e64d13f5eb 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayFrontendPort.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayFrontendPort.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -21,8 +20,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Port)) @@ -39,7 +41,7 @@ internal static ApplicationGatewayFrontendPort DeserializeApplicationGatewayFron Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional port = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) @@ -97,7 +99,7 @@ internal static ApplicationGatewayFrontendPort DeserializeApplicationGatewayFron continue; } } - return new ApplicationGatewayFrontendPort(id, name.Value, etag.Value, type.Value, Optional.ToNullable(port), Optional.ToNullable(provisioningState)); + return new ApplicationGatewayFrontendPort(id.Value, name.Value, etag.Value, type.Value, Optional.ToNullable(port), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayFrontendPort.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayFrontendPort.cs index 259af7b6e3fd7..c67097fd6c026 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayFrontendPort.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayFrontendPort.cs @@ -5,12 +5,10 @@ #nullable disable -using Azure.ResourceManager.Resources.Models; - namespace Azure.ResourceManager.Network.Models { /// Frontend port of an application gateway. - public partial class ApplicationGatewayFrontendPort : WritableSubResource + public partial class ApplicationGatewayFrontendPort : SubResource { /// Initializes a new instance of ApplicationGatewayFrontendPort. public ApplicationGatewayFrontendPort() @@ -18,7 +16,7 @@ public ApplicationGatewayFrontendPort() } /// Initializes a new instance of ApplicationGatewayFrontendPort. - /// The id. + /// Resource ID. /// Name of the frontend port that is unique within an Application Gateway. /// A unique read-only string that changes whenever the resource is updated. /// Type of the resource. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayHttpListener.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayHttpListener.Serialization.cs index 4c528a12db2cb..9ac5257884546 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayHttpListener.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayHttpListener.Serialization.cs @@ -8,7 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -22,19 +22,22 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(FrontendIPConfiguration)) { writer.WritePropertyName("frontendIPConfiguration"); - writer.WriteObjectValue(FrontendIPConfiguration); + JsonSerializer.Serialize(writer, FrontendIPConfiguration); } if (Optional.IsDefined(FrontendPort)) { writer.WritePropertyName("frontendPort"); - writer.WriteObjectValue(FrontendPort); + JsonSerializer.Serialize(writer, FrontendPort); } if (Optional.IsDefined(Protocol)) { @@ -49,12 +52,12 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(SslCertificate)) { writer.WritePropertyName("sslCertificate"); - writer.WriteObjectValue(SslCertificate); + JsonSerializer.Serialize(writer, SslCertificate); } if (Optional.IsDefined(SslProfile)) { writer.WritePropertyName("sslProfile"); - writer.WriteObjectValue(SslProfile); + JsonSerializer.Serialize(writer, SslProfile); } if (Optional.IsDefined(RequireServerNameIndication)) { @@ -74,7 +77,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(FirewallPolicy)) { writer.WritePropertyName("firewallPolicy"); - writer.WriteObjectValue(FirewallPolicy); + JsonSerializer.Serialize(writer, FirewallPolicy); } if (Optional.IsCollectionDefined(HostNames)) { @@ -95,17 +98,17 @@ internal static ApplicationGatewayHttpListener DeserializeApplicationGatewayHttp Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; - Optional frontendIPConfiguration = default; - Optional frontendPort = default; + Optional id = default; + Optional frontendIPConfiguration = default; + Optional frontendPort = default; Optional protocol = default; Optional hostName = default; - Optional sslCertificate = default; - Optional sslProfile = default; + Optional sslCertificate = default; + Optional sslProfile = default; Optional requireServerNameIndication = default; Optional provisioningState = default; Optional> customErrorConfigurations = default; - Optional firewallPolicy = default; + Optional firewallPolicy = default; Optional> hostNames = default; foreach (var property in element.EnumerateObject()) { @@ -145,7 +148,7 @@ internal static ApplicationGatewayHttpListener DeserializeApplicationGatewayHttp property0.ThrowNonNullablePropertyIsNull(); continue; } - frontendIPConfiguration = SubResource.DeserializeSubResource(property0.Value); + frontendIPConfiguration = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("frontendPort")) @@ -155,7 +158,7 @@ internal static ApplicationGatewayHttpListener DeserializeApplicationGatewayHttp property0.ThrowNonNullablePropertyIsNull(); continue; } - frontendPort = SubResource.DeserializeSubResource(property0.Value); + frontendPort = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("protocol")) @@ -180,7 +183,7 @@ internal static ApplicationGatewayHttpListener DeserializeApplicationGatewayHttp property0.ThrowNonNullablePropertyIsNull(); continue; } - sslCertificate = SubResource.DeserializeSubResource(property0.Value); + sslCertificate = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("sslProfile")) @@ -190,7 +193,7 @@ internal static ApplicationGatewayHttpListener DeserializeApplicationGatewayHttp property0.ThrowNonNullablePropertyIsNull(); continue; } - sslProfile = SubResource.DeserializeSubResource(property0.Value); + sslProfile = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("requireServerNameIndication")) @@ -235,7 +238,7 @@ internal static ApplicationGatewayHttpListener DeserializeApplicationGatewayHttp property0.ThrowNonNullablePropertyIsNull(); continue; } - firewallPolicy = SubResource.DeserializeSubResource(property0.Value); + firewallPolicy = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("hostNames")) @@ -257,7 +260,7 @@ internal static ApplicationGatewayHttpListener DeserializeApplicationGatewayHttp continue; } } - return new ApplicationGatewayHttpListener(id, name.Value, etag.Value, type.Value, frontendIPConfiguration.Value, frontendPort.Value, Optional.ToNullable(protocol), hostName.Value, sslCertificate.Value, sslProfile.Value, Optional.ToNullable(requireServerNameIndication), Optional.ToNullable(provisioningState), Optional.ToList(customErrorConfigurations), firewallPolicy.Value, Optional.ToList(hostNames)); + return new ApplicationGatewayHttpListener(id.Value, name.Value, etag.Value, type.Value, frontendIPConfiguration, frontendPort, Optional.ToNullable(protocol), hostName.Value, sslCertificate, sslProfile, Optional.ToNullable(requireServerNameIndication), Optional.ToNullable(provisioningState), Optional.ToList(customErrorConfigurations), firewallPolicy, Optional.ToList(hostNames)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayHttpListener.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayHttpListener.cs index 5ba4daf32a55a..1a727e7b34ec3 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayHttpListener.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayHttpListener.cs @@ -12,7 +12,7 @@ namespace Azure.ResourceManager.Network.Models { /// Http listener of an application gateway. - public partial class ApplicationGatewayHttpListener : WritableSubResource + public partial class ApplicationGatewayHttpListener : SubResource { /// Initializes a new instance of ApplicationGatewayHttpListener. public ApplicationGatewayHttpListener() @@ -22,7 +22,7 @@ public ApplicationGatewayHttpListener() } /// Initializes a new instance of ApplicationGatewayHttpListener. - /// The id. + /// Resource ID. /// Name of the HTTP listener that is unique within an Application Gateway. /// A unique read-only string that changes whenever the resource is updated. /// Type of the resource. @@ -37,7 +37,7 @@ public ApplicationGatewayHttpListener() /// Custom error configurations of the HTTP listener. /// Reference to the FirewallPolicy resource. /// List of Host names for HTTP Listener that allows special wildcard characters as well. - internal ApplicationGatewayHttpListener(string id, string name, string etag, string type, SubResource frontendIPConfiguration, SubResource frontendPort, ApplicationGatewayProtocol? protocol, string hostName, SubResource sslCertificate, SubResource sslProfile, bool? requireServerNameIndication, ProvisioningState? provisioningState, IList customErrorConfigurations, SubResource firewallPolicy, IList hostNames) : base(id) + internal ApplicationGatewayHttpListener(string id, string name, string etag, string type, WritableSubResource frontendIPConfiguration, WritableSubResource frontendPort, ApplicationGatewayProtocol? protocol, string hostName, WritableSubResource sslCertificate, WritableSubResource sslProfile, bool? requireServerNameIndication, ProvisioningState? provisioningState, IList customErrorConfigurations, WritableSubResource firewallPolicy, IList hostNames) : base(id) { Name = name; Etag = etag; @@ -62,17 +62,17 @@ internal ApplicationGatewayHttpListener(string id, string name, string etag, str /// Type of the resource. public string Type { get; } /// Frontend IP configuration resource of an application gateway. - public SubResource FrontendIPConfiguration { get; set; } + public WritableSubResource FrontendIPConfiguration { get; set; } /// Frontend port resource of an application gateway. - public SubResource FrontendPort { get; set; } + public WritableSubResource FrontendPort { get; set; } /// Protocol of the HTTP listener. public ApplicationGatewayProtocol? Protocol { get; set; } /// Host name of HTTP listener. public string HostName { get; set; } /// SSL certificate resource of an application gateway. - public SubResource SslCertificate { get; set; } + public WritableSubResource SslCertificate { get; set; } /// SSL profile resource of the application gateway. - public SubResource SslProfile { get; set; } + public WritableSubResource SslProfile { get; set; } /// Applicable only if protocol is https. Enables SNI for multi-hosting. public bool? RequireServerNameIndication { get; set; } /// The provisioning state of the HTTP listener resource. @@ -80,7 +80,7 @@ internal ApplicationGatewayHttpListener(string id, string name, string etag, str /// Custom error configurations of the HTTP listener. public IList CustomErrorConfigurations { get; } /// Reference to the FirewallPolicy resource. - public SubResource FirewallPolicy { get; set; } + public WritableSubResource FirewallPolicy { get; set; } /// List of Host names for HTTP Listener that allows special wildcard characters as well. public IList HostNames { get; } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayIPConfiguration.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayIPConfiguration.Serialization.cs index 4fb68253ddee7..2db4da0232d1e 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayIPConfiguration.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayIPConfiguration.Serialization.cs @@ -7,7 +7,7 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -21,14 +21,17 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Subnet)) { writer.WritePropertyName("subnet"); - writer.WriteObjectValue(Subnet); + JsonSerializer.Serialize(writer, Subnet); } writer.WriteEndObject(); writer.WriteEndObject(); @@ -39,8 +42,8 @@ internal static ApplicationGatewayIPConfiguration DeserializeApplicationGatewayI Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; - Optional subnet = default; + Optional id = default; + Optional subnet = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) { @@ -80,7 +83,7 @@ internal static ApplicationGatewayIPConfiguration DeserializeApplicationGatewayI property0.ThrowNonNullablePropertyIsNull(); continue; } - subnet = SubResource.DeserializeSubResource(property0.Value); + subnet = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("provisioningState")) @@ -97,7 +100,7 @@ internal static ApplicationGatewayIPConfiguration DeserializeApplicationGatewayI continue; } } - return new ApplicationGatewayIPConfiguration(id, name.Value, etag.Value, type.Value, subnet.Value, Optional.ToNullable(provisioningState)); + return new ApplicationGatewayIPConfiguration(id.Value, name.Value, etag.Value, type.Value, subnet, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayIPConfiguration.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayIPConfiguration.cs index ad26b82faaf2c..9527e31af717d 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayIPConfiguration.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayIPConfiguration.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.Network.Models { /// IP configuration of an application gateway. Currently 1 public and 1 private IP configuration is allowed. - public partial class ApplicationGatewayIPConfiguration : WritableSubResource + public partial class ApplicationGatewayIPConfiguration : SubResource { /// Initializes a new instance of ApplicationGatewayIPConfiguration. public ApplicationGatewayIPConfiguration() @@ -18,13 +18,13 @@ public ApplicationGatewayIPConfiguration() } /// Initializes a new instance of ApplicationGatewayIPConfiguration. - /// The id. + /// Resource ID. /// Name of the IP configuration that is unique within an Application Gateway. /// A unique read-only string that changes whenever the resource is updated. /// Type of the resource. /// Reference to the subnet resource. A subnet from where application gateway gets its private address. /// The provisioning state of the application gateway IP configuration resource. - internal ApplicationGatewayIPConfiguration(string id, string name, string etag, string type, SubResource subnet, ProvisioningState? provisioningState) : base(id) + internal ApplicationGatewayIPConfiguration(string id, string name, string etag, string type, WritableSubResource subnet, ProvisioningState? provisioningState) : base(id) { Name = name; Etag = etag; @@ -40,7 +40,7 @@ internal ApplicationGatewayIPConfiguration(string id, string name, string etag, /// Type of the resource. public string Type { get; } /// Reference to the subnet resource. A subnet from where application gateway gets its private address. - public SubResource Subnet { get; set; } + public WritableSubResource Subnet { get; set; } /// The provisioning state of the application gateway IP configuration resource. public ProvisioningState? ProvisioningState { get; } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayOnDemandProbe.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayOnDemandProbe.Serialization.cs index 2140f13bf4a39..48acc9e9ca2f0 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayOnDemandProbe.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayOnDemandProbe.Serialization.cs @@ -48,12 +48,12 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(BackendAddressPool)) { writer.WritePropertyName("backendAddressPool"); - writer.WriteObjectValue(BackendAddressPool); + JsonSerializer.Serialize(writer, BackendAddressPool); } if (Optional.IsDefined(BackendHttpSettings)) { writer.WritePropertyName("backendHttpSettings"); - writer.WriteObjectValue(BackendHttpSettings); + JsonSerializer.Serialize(writer, BackendHttpSettings); } writer.WriteEndObject(); } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayOnDemandProbe.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayOnDemandProbe.cs index 48a27a39a8d4f..b110eb4a656ce 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayOnDemandProbe.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayOnDemandProbe.cs @@ -5,6 +5,8 @@ #nullable disable +using Azure.ResourceManager.Resources.Models; + namespace Azure.ResourceManager.Network.Models { /// Details of on demand test probe request. @@ -28,8 +30,8 @@ public ApplicationGatewayOnDemandProbe() /// Criterion for classifying a healthy probe response. public ApplicationGatewayProbeHealthResponseMatch Match { get; set; } /// Reference to backend pool of application gateway to which probe request will be sent. - public SubResource BackendAddressPool { get; set; } + public WritableSubResource BackendAddressPool { get; set; } /// Reference to backend http setting of application gateway to be used for test probe. - public SubResource BackendHttpSettings { get; set; } + public WritableSubResource BackendHttpSettings { get; set; } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPathRule.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPathRule.Serialization.cs index 885f5ac16c031..ce17a962ed01f 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPathRule.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPathRule.Serialization.cs @@ -8,7 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -22,8 +22,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsCollectionDefined(Paths)) @@ -39,27 +42,27 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(BackendAddressPool)) { writer.WritePropertyName("backendAddressPool"); - writer.WriteObjectValue(BackendAddressPool); + JsonSerializer.Serialize(writer, BackendAddressPool); } if (Optional.IsDefined(BackendHttpSettings)) { writer.WritePropertyName("backendHttpSettings"); - writer.WriteObjectValue(BackendHttpSettings); + JsonSerializer.Serialize(writer, BackendHttpSettings); } if (Optional.IsDefined(RedirectConfiguration)) { writer.WritePropertyName("redirectConfiguration"); - writer.WriteObjectValue(RedirectConfiguration); + JsonSerializer.Serialize(writer, RedirectConfiguration); } if (Optional.IsDefined(RewriteRuleSet)) { writer.WritePropertyName("rewriteRuleSet"); - writer.WriteObjectValue(RewriteRuleSet); + JsonSerializer.Serialize(writer, RewriteRuleSet); } if (Optional.IsDefined(FirewallPolicy)) { writer.WritePropertyName("firewallPolicy"); - writer.WriteObjectValue(FirewallPolicy); + JsonSerializer.Serialize(writer, FirewallPolicy); } writer.WriteEndObject(); writer.WriteEndObject(); @@ -70,14 +73,14 @@ internal static ApplicationGatewayPathRule DeserializeApplicationGatewayPathRule Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional> paths = default; - Optional backendAddressPool = default; - Optional backendHttpSettings = default; - Optional redirectConfiguration = default; - Optional rewriteRuleSet = default; + Optional backendAddressPool = default; + Optional backendHttpSettings = default; + Optional redirectConfiguration = default; + Optional rewriteRuleSet = default; Optional provisioningState = default; - Optional firewallPolicy = default; + Optional firewallPolicy = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) @@ -131,7 +134,7 @@ internal static ApplicationGatewayPathRule DeserializeApplicationGatewayPathRule property0.ThrowNonNullablePropertyIsNull(); continue; } - backendAddressPool = SubResource.DeserializeSubResource(property0.Value); + backendAddressPool = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("backendHttpSettings")) @@ -141,7 +144,7 @@ internal static ApplicationGatewayPathRule DeserializeApplicationGatewayPathRule property0.ThrowNonNullablePropertyIsNull(); continue; } - backendHttpSettings = SubResource.DeserializeSubResource(property0.Value); + backendHttpSettings = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("redirectConfiguration")) @@ -151,7 +154,7 @@ internal static ApplicationGatewayPathRule DeserializeApplicationGatewayPathRule property0.ThrowNonNullablePropertyIsNull(); continue; } - redirectConfiguration = SubResource.DeserializeSubResource(property0.Value); + redirectConfiguration = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("rewriteRuleSet")) @@ -161,7 +164,7 @@ internal static ApplicationGatewayPathRule DeserializeApplicationGatewayPathRule property0.ThrowNonNullablePropertyIsNull(); continue; } - rewriteRuleSet = SubResource.DeserializeSubResource(property0.Value); + rewriteRuleSet = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("provisioningState")) @@ -181,14 +184,14 @@ internal static ApplicationGatewayPathRule DeserializeApplicationGatewayPathRule property0.ThrowNonNullablePropertyIsNull(); continue; } - firewallPolicy = SubResource.DeserializeSubResource(property0.Value); + firewallPolicy = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } } continue; } } - return new ApplicationGatewayPathRule(id, name.Value, etag.Value, type.Value, Optional.ToList(paths), backendAddressPool.Value, backendHttpSettings.Value, redirectConfiguration.Value, rewriteRuleSet.Value, Optional.ToNullable(provisioningState), firewallPolicy.Value); + return new ApplicationGatewayPathRule(id.Value, name.Value, etag.Value, type.Value, Optional.ToList(paths), backendAddressPool, backendHttpSettings, redirectConfiguration, rewriteRuleSet, Optional.ToNullable(provisioningState), firewallPolicy); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPathRule.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPathRule.cs index 544de29f29ca6..7e93e90ad949f 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPathRule.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPathRule.cs @@ -12,7 +12,7 @@ namespace Azure.ResourceManager.Network.Models { /// Path rule of URL path map of an application gateway. - public partial class ApplicationGatewayPathRule : WritableSubResource + public partial class ApplicationGatewayPathRule : SubResource { /// Initializes a new instance of ApplicationGatewayPathRule. public ApplicationGatewayPathRule() @@ -21,7 +21,7 @@ public ApplicationGatewayPathRule() } /// Initializes a new instance of ApplicationGatewayPathRule. - /// The id. + /// Resource ID. /// Name of the path rule that is unique within an Application Gateway. /// A unique read-only string that changes whenever the resource is updated. /// Type of the resource. @@ -32,7 +32,7 @@ public ApplicationGatewayPathRule() /// Rewrite rule set resource of URL path map path rule. /// The provisioning state of the path rule resource. /// Reference to the FirewallPolicy resource. - internal ApplicationGatewayPathRule(string id, string name, string etag, string type, IList paths, SubResource backendAddressPool, SubResource backendHttpSettings, SubResource redirectConfiguration, SubResource rewriteRuleSet, ProvisioningState? provisioningState, SubResource firewallPolicy) : base(id) + internal ApplicationGatewayPathRule(string id, string name, string etag, string type, IList paths, WritableSubResource backendAddressPool, WritableSubResource backendHttpSettings, WritableSubResource redirectConfiguration, WritableSubResource rewriteRuleSet, ProvisioningState? provisioningState, WritableSubResource firewallPolicy) : base(id) { Name = name; Etag = etag; @@ -55,16 +55,16 @@ internal ApplicationGatewayPathRule(string id, string name, string etag, string /// Path rules of URL path map. public IList Paths { get; } /// Backend address pool resource of URL path map path rule. - public SubResource BackendAddressPool { get; set; } + public WritableSubResource BackendAddressPool { get; set; } /// Backend http settings resource of URL path map path rule. - public SubResource BackendHttpSettings { get; set; } + public WritableSubResource BackendHttpSettings { get; set; } /// Redirect configuration resource of URL path map path rule. - public SubResource RedirectConfiguration { get; set; } + public WritableSubResource RedirectConfiguration { get; set; } /// Rewrite rule set resource of URL path map path rule. - public SubResource RewriteRuleSet { get; set; } + public WritableSubResource RewriteRuleSet { get; set; } /// The provisioning state of the path rule resource. public ProvisioningState? ProvisioningState { get; } /// Reference to the FirewallPolicy resource. - public SubResource FirewallPolicy { get; set; } + public WritableSubResource FirewallPolicy { get; set; } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPrivateEndpointConnectionData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPrivateEndpointConnectionData.Serialization.cs index 68044a3fa5d50..4a532bbfb2a82 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPrivateEndpointConnectionData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPrivateEndpointConnectionData.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -22,8 +21,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(PrivateLinkServiceConnectionState)) @@ -40,7 +42,7 @@ internal static ApplicationGatewayPrivateEndpointConnectionData DeserializeAppli Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional privateEndpoint = default; Optional privateLinkServiceConnectionState = default; Optional provisioningState = default; @@ -115,7 +117,7 @@ internal static ApplicationGatewayPrivateEndpointConnectionData DeserializeAppli continue; } } - return new ApplicationGatewayPrivateEndpointConnectionData(id, name.Value, etag.Value, type.Value, privateEndpoint.Value, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState), linkIdentifier.Value); + return new ApplicationGatewayPrivateEndpointConnectionData(id.Value, name.Value, etag.Value, type.Value, privateEndpoint.Value, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState), linkIdentifier.Value); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPrivateLinkConfiguration.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPrivateLinkConfiguration.Serialization.cs index f9273c9d56726..a2159e5b9fd81 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPrivateLinkConfiguration.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPrivateLinkConfiguration.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -22,8 +21,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsCollectionDefined(IpConfigurations)) @@ -45,7 +47,7 @@ internal static ApplicationGatewayPrivateLinkConfiguration DeserializeApplicatio Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional> ipConfigurations = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) @@ -108,7 +110,7 @@ internal static ApplicationGatewayPrivateLinkConfiguration DeserializeApplicatio continue; } } - return new ApplicationGatewayPrivateLinkConfiguration(id, name.Value, etag.Value, type.Value, Optional.ToList(ipConfigurations), Optional.ToNullable(provisioningState)); + return new ApplicationGatewayPrivateLinkConfiguration(id.Value, name.Value, etag.Value, type.Value, Optional.ToList(ipConfigurations), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPrivateLinkConfiguration.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPrivateLinkConfiguration.cs index 919f2335ac914..81b3eaafe1ebd 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPrivateLinkConfiguration.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPrivateLinkConfiguration.cs @@ -7,12 +7,11 @@ using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { /// Private Link Configuration on an application gateway. - public partial class ApplicationGatewayPrivateLinkConfiguration : WritableSubResource + public partial class ApplicationGatewayPrivateLinkConfiguration : SubResource { /// Initializes a new instance of ApplicationGatewayPrivateLinkConfiguration. public ApplicationGatewayPrivateLinkConfiguration() @@ -21,7 +20,7 @@ public ApplicationGatewayPrivateLinkConfiguration() } /// Initializes a new instance of ApplicationGatewayPrivateLinkConfiguration. - /// The id. + /// Resource ID. /// Name of the private link configuration that is unique within an Application Gateway. /// A unique read-only string that changes whenever the resource is updated. /// Type of the resource. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPrivateLinkIpConfiguration.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPrivateLinkIpConfiguration.Serialization.cs index 230ec498ef6fc..bcdab3caf3dee 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPrivateLinkIpConfiguration.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPrivateLinkIpConfiguration.Serialization.cs @@ -7,7 +7,7 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -21,8 +21,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(PrivateIPAddress)) @@ -38,7 +41,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Subnet)) { writer.WritePropertyName("subnet"); - writer.WriteObjectValue(Subnet); + JsonSerializer.Serialize(writer, Subnet); } if (Optional.IsDefined(Primary)) { @@ -54,10 +57,10 @@ internal static ApplicationGatewayPrivateLinkIpConfiguration DeserializeApplicat Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional privateIPAddress = default; Optional privateIPAllocationMethod = default; - Optional subnet = default; + Optional subnet = default; Optional primary = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) @@ -113,7 +116,7 @@ internal static ApplicationGatewayPrivateLinkIpConfiguration DeserializeApplicat property0.ThrowNonNullablePropertyIsNull(); continue; } - subnet = SubResource.DeserializeSubResource(property0.Value); + subnet = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("primary")) @@ -140,7 +143,7 @@ internal static ApplicationGatewayPrivateLinkIpConfiguration DeserializeApplicat continue; } } - return new ApplicationGatewayPrivateLinkIpConfiguration(id, name.Value, etag.Value, type.Value, privateIPAddress.Value, Optional.ToNullable(privateIPAllocationMethod), subnet.Value, Optional.ToNullable(primary), Optional.ToNullable(provisioningState)); + return new ApplicationGatewayPrivateLinkIpConfiguration(id.Value, name.Value, etag.Value, type.Value, privateIPAddress.Value, Optional.ToNullable(privateIPAllocationMethod), subnet, Optional.ToNullable(primary), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPrivateLinkIpConfiguration.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPrivateLinkIpConfiguration.cs index c0a145cbc5756..3c6fac313d614 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPrivateLinkIpConfiguration.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPrivateLinkIpConfiguration.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.Network.Models { /// The application gateway private link ip configuration. - public partial class ApplicationGatewayPrivateLinkIpConfiguration : WritableSubResource + public partial class ApplicationGatewayPrivateLinkIpConfiguration : SubResource { /// Initializes a new instance of ApplicationGatewayPrivateLinkIpConfiguration. public ApplicationGatewayPrivateLinkIpConfiguration() @@ -18,7 +18,7 @@ public ApplicationGatewayPrivateLinkIpConfiguration() } /// Initializes a new instance of ApplicationGatewayPrivateLinkIpConfiguration. - /// The id. + /// Resource ID. /// The name of application gateway private link ip configuration. /// A unique read-only string that changes whenever the resource is updated. /// The resource type. @@ -27,7 +27,7 @@ public ApplicationGatewayPrivateLinkIpConfiguration() /// Reference to the subnet resource. /// Whether the ip configuration is primary or not. /// The provisioning state of the application gateway private link IP configuration. - internal ApplicationGatewayPrivateLinkIpConfiguration(string id, string name, string etag, string type, string privateIPAddress, IPAllocationMethod? privateIPAllocationMethod, SubResource subnet, bool? primary, ProvisioningState? provisioningState) : base(id) + internal ApplicationGatewayPrivateLinkIpConfiguration(string id, string name, string etag, string type, string privateIPAddress, IPAllocationMethod? privateIPAllocationMethod, WritableSubResource subnet, bool? primary, ProvisioningState? provisioningState) : base(id) { Name = name; Etag = etag; @@ -50,7 +50,7 @@ internal ApplicationGatewayPrivateLinkIpConfiguration(string id, string name, st /// The private IP address allocation method. public IPAllocationMethod? PrivateIPAllocationMethod { get; set; } /// Reference to the subnet resource. - public SubResource Subnet { get; set; } + public WritableSubResource Subnet { get; set; } /// Whether the ip configuration is primary or not. public bool? Primary { get; set; } /// The provisioning state of the application gateway private link IP configuration. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPrivateLinkResource.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPrivateLinkResource.Serialization.cs index 94f42daef2b77..9d80442d5c8ba 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPrivateLinkResource.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPrivateLinkResource.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -22,8 +21,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsCollectionDefined(RequiredZoneNames)) @@ -45,7 +47,7 @@ internal static ApplicationGatewayPrivateLinkResource DeserializeApplicationGate Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional groupId = default; Optional> requiredMembers = default; Optional> requiredZoneNames = default; @@ -119,7 +121,7 @@ internal static ApplicationGatewayPrivateLinkResource DeserializeApplicationGate continue; } } - return new ApplicationGatewayPrivateLinkResource(id, name.Value, etag.Value, type.Value, groupId.Value, Optional.ToList(requiredMembers), Optional.ToList(requiredZoneNames)); + return new ApplicationGatewayPrivateLinkResource(id.Value, name.Value, etag.Value, type.Value, groupId.Value, Optional.ToList(requiredMembers), Optional.ToList(requiredZoneNames)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPrivateLinkResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPrivateLinkResource.cs index fb0dbe4bcb76e..628db3373c151 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPrivateLinkResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayPrivateLinkResource.cs @@ -7,12 +7,11 @@ using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { /// PrivateLink Resource of an application gateway. - public partial class ApplicationGatewayPrivateLinkResource : WritableSubResource + public partial class ApplicationGatewayPrivateLinkResource : SubResource { /// Initializes a new instance of ApplicationGatewayPrivateLinkResource. public ApplicationGatewayPrivateLinkResource() @@ -22,7 +21,7 @@ public ApplicationGatewayPrivateLinkResource() } /// Initializes a new instance of ApplicationGatewayPrivateLinkResource. - /// The id. + /// Resource ID. /// Name of the private link resource that is unique within an Application Gateway. /// A unique read-only string that changes whenever the resource is updated. /// Type of the resource. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayProbe.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayProbe.Serialization.cs index 0b19f95d4f9a3..62fa7a62c642f 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayProbe.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayProbe.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -21,8 +20,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Protocol)) @@ -84,7 +86,7 @@ internal static ApplicationGatewayProbe DeserializeApplicationGatewayProbe(JsonE Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional protocol = default; Optional host = default; Optional path = default; @@ -231,7 +233,7 @@ internal static ApplicationGatewayProbe DeserializeApplicationGatewayProbe(JsonE continue; } } - return new ApplicationGatewayProbe(id, name.Value, etag.Value, type.Value, Optional.ToNullable(protocol), host.Value, path.Value, Optional.ToNullable(interval), Optional.ToNullable(timeout), Optional.ToNullable(unhealthyThreshold), Optional.ToNullable(pickHostNameFromBackendHttpSettings), Optional.ToNullable(minServers), match.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(port)); + return new ApplicationGatewayProbe(id.Value, name.Value, etag.Value, type.Value, Optional.ToNullable(protocol), host.Value, path.Value, Optional.ToNullable(interval), Optional.ToNullable(timeout), Optional.ToNullable(unhealthyThreshold), Optional.ToNullable(pickHostNameFromBackendHttpSettings), Optional.ToNullable(minServers), match.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(port)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayProbe.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayProbe.cs index 2ddbf7e4e8dee..9d562265e0475 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayProbe.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayProbe.cs @@ -5,12 +5,10 @@ #nullable disable -using Azure.ResourceManager.Resources.Models; - namespace Azure.ResourceManager.Network.Models { /// Probe of the application gateway. - public partial class ApplicationGatewayProbe : WritableSubResource + public partial class ApplicationGatewayProbe : SubResource { /// Initializes a new instance of ApplicationGatewayProbe. public ApplicationGatewayProbe() @@ -18,7 +16,7 @@ public ApplicationGatewayProbe() } /// Initializes a new instance of ApplicationGatewayProbe. - /// The id. + /// Resource ID. /// Name of the probe that is unique within an Application Gateway. /// A unique read-only string that changes whenever the resource is updated. /// Type of the resource. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayRedirectConfiguration.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayRedirectConfiguration.Serialization.cs index c3c948ec62f7b..fdd924e0318e9 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayRedirectConfiguration.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayRedirectConfiguration.Serialization.cs @@ -8,7 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -22,8 +22,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(RedirectType)) @@ -34,7 +37,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(TargetListener)) { writer.WritePropertyName("targetListener"); - writer.WriteObjectValue(TargetListener); + JsonSerializer.Serialize(writer, TargetListener); } if (Optional.IsDefined(TargetUrl)) { @@ -57,7 +60,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in RequestRoutingRules) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } @@ -67,7 +70,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in UrlPathMaps) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } @@ -77,7 +80,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in PathRules) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } @@ -90,15 +93,15 @@ internal static ApplicationGatewayRedirectConfiguration DeserializeApplicationGa Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional redirectType = default; - Optional targetListener = default; + Optional targetListener = default; Optional targetUrl = default; Optional includePath = default; Optional includeQueryString = default; - Optional> requestRoutingRules = default; - Optional> urlPathMaps = default; - Optional> pathRules = default; + Optional> requestRoutingRules = default; + Optional> urlPathMaps = default; + Optional> pathRules = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) @@ -147,7 +150,7 @@ internal static ApplicationGatewayRedirectConfiguration DeserializeApplicationGa property0.ThrowNonNullablePropertyIsNull(); continue; } - targetListener = SubResource.DeserializeSubResource(property0.Value); + targetListener = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("targetUrl")) @@ -182,10 +185,10 @@ internal static ApplicationGatewayRedirectConfiguration DeserializeApplicationGa property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } requestRoutingRules = array; continue; @@ -197,10 +200,10 @@ internal static ApplicationGatewayRedirectConfiguration DeserializeApplicationGa property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } urlPathMaps = array; continue; @@ -212,10 +215,10 @@ internal static ApplicationGatewayRedirectConfiguration DeserializeApplicationGa property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } pathRules = array; continue; @@ -224,7 +227,7 @@ internal static ApplicationGatewayRedirectConfiguration DeserializeApplicationGa continue; } } - return new ApplicationGatewayRedirectConfiguration(id, name.Value, etag.Value, type.Value, Optional.ToNullable(redirectType), targetListener.Value, targetUrl.Value, Optional.ToNullable(includePath), Optional.ToNullable(includeQueryString), Optional.ToList(requestRoutingRules), Optional.ToList(urlPathMaps), Optional.ToList(pathRules)); + return new ApplicationGatewayRedirectConfiguration(id.Value, name.Value, etag.Value, type.Value, Optional.ToNullable(redirectType), targetListener, targetUrl.Value, Optional.ToNullable(includePath), Optional.ToNullable(includeQueryString), Optional.ToList(requestRoutingRules), Optional.ToList(urlPathMaps), Optional.ToList(pathRules)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayRedirectConfiguration.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayRedirectConfiguration.cs index 3bc40ab85c591..43ef3fb24fce3 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayRedirectConfiguration.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayRedirectConfiguration.cs @@ -12,18 +12,18 @@ namespace Azure.ResourceManager.Network.Models { /// Redirect configuration of an application gateway. - public partial class ApplicationGatewayRedirectConfiguration : WritableSubResource + public partial class ApplicationGatewayRedirectConfiguration : SubResource { /// Initializes a new instance of ApplicationGatewayRedirectConfiguration. public ApplicationGatewayRedirectConfiguration() { - RequestRoutingRules = new ChangeTrackingList(); - UrlPathMaps = new ChangeTrackingList(); - PathRules = new ChangeTrackingList(); + RequestRoutingRules = new ChangeTrackingList(); + UrlPathMaps = new ChangeTrackingList(); + PathRules = new ChangeTrackingList(); } /// Initializes a new instance of ApplicationGatewayRedirectConfiguration. - /// The id. + /// Resource ID. /// Name of the redirect configuration that is unique within an Application Gateway. /// A unique read-only string that changes whenever the resource is updated. /// Type of the resource. @@ -35,7 +35,7 @@ public ApplicationGatewayRedirectConfiguration() /// Request routing specifying redirect configuration. /// Url path maps specifying default redirect configuration. /// Path rules specifying redirect configuration. - internal ApplicationGatewayRedirectConfiguration(string id, string name, string etag, string type, ApplicationGatewayRedirectType? redirectType, SubResource targetListener, string targetUrl, bool? includePath, bool? includeQueryString, IList requestRoutingRules, IList urlPathMaps, IList pathRules) : base(id) + internal ApplicationGatewayRedirectConfiguration(string id, string name, string etag, string type, ApplicationGatewayRedirectType? redirectType, WritableSubResource targetListener, string targetUrl, bool? includePath, bool? includeQueryString, IList requestRoutingRules, IList urlPathMaps, IList pathRules) : base(id) { Name = name; Etag = etag; @@ -59,7 +59,7 @@ internal ApplicationGatewayRedirectConfiguration(string id, string name, string /// HTTP redirection type. public ApplicationGatewayRedirectType? RedirectType { get; set; } /// Reference to a listener to redirect the request to. - public SubResource TargetListener { get; set; } + public WritableSubResource TargetListener { get; set; } /// Url to redirect the request to. public string TargetUrl { get; set; } /// Include path in the redirected url. @@ -67,10 +67,10 @@ internal ApplicationGatewayRedirectConfiguration(string id, string name, string /// Include query string in the redirected url. public bool? IncludeQueryString { get; set; } /// Request routing specifying redirect configuration. - public IList RequestRoutingRules { get; } + public IList RequestRoutingRules { get; } /// Url path maps specifying default redirect configuration. - public IList UrlPathMaps { get; } + public IList UrlPathMaps { get; } /// Path rules specifying redirect configuration. - public IList PathRules { get; } + public IList PathRules { get; } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayRequestRoutingRule.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayRequestRoutingRule.Serialization.cs index 650ea719ec4e9..5f0868a10d094 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayRequestRoutingRule.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayRequestRoutingRule.Serialization.cs @@ -7,7 +7,7 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -21,8 +21,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(RuleType)) @@ -38,32 +41,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(BackendAddressPool)) { writer.WritePropertyName("backendAddressPool"); - writer.WriteObjectValue(BackendAddressPool); + JsonSerializer.Serialize(writer, BackendAddressPool); } if (Optional.IsDefined(BackendHttpSettings)) { writer.WritePropertyName("backendHttpSettings"); - writer.WriteObjectValue(BackendHttpSettings); + JsonSerializer.Serialize(writer, BackendHttpSettings); } if (Optional.IsDefined(HttpListener)) { writer.WritePropertyName("httpListener"); - writer.WriteObjectValue(HttpListener); + JsonSerializer.Serialize(writer, HttpListener); } if (Optional.IsDefined(UrlPathMap)) { writer.WritePropertyName("urlPathMap"); - writer.WriteObjectValue(UrlPathMap); + JsonSerializer.Serialize(writer, UrlPathMap); } if (Optional.IsDefined(RewriteRuleSet)) { writer.WritePropertyName("rewriteRuleSet"); - writer.WriteObjectValue(RewriteRuleSet); + JsonSerializer.Serialize(writer, RewriteRuleSet); } if (Optional.IsDefined(RedirectConfiguration)) { writer.WritePropertyName("redirectConfiguration"); - writer.WriteObjectValue(RedirectConfiguration); + JsonSerializer.Serialize(writer, RedirectConfiguration); } writer.WriteEndObject(); writer.WriteEndObject(); @@ -74,15 +77,15 @@ internal static ApplicationGatewayRequestRoutingRule DeserializeApplicationGatew Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional ruleType = default; Optional priority = default; - Optional backendAddressPool = default; - Optional backendHttpSettings = default; - Optional httpListener = default; - Optional urlPathMap = default; - Optional rewriteRuleSet = default; - Optional redirectConfiguration = default; + Optional backendAddressPool = default; + Optional backendHttpSettings = default; + Optional httpListener = default; + Optional urlPathMap = default; + Optional rewriteRuleSet = default; + Optional redirectConfiguration = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) { @@ -142,7 +145,7 @@ internal static ApplicationGatewayRequestRoutingRule DeserializeApplicationGatew property0.ThrowNonNullablePropertyIsNull(); continue; } - backendAddressPool = SubResource.DeserializeSubResource(property0.Value); + backendAddressPool = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("backendHttpSettings")) @@ -152,7 +155,7 @@ internal static ApplicationGatewayRequestRoutingRule DeserializeApplicationGatew property0.ThrowNonNullablePropertyIsNull(); continue; } - backendHttpSettings = SubResource.DeserializeSubResource(property0.Value); + backendHttpSettings = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("httpListener")) @@ -162,7 +165,7 @@ internal static ApplicationGatewayRequestRoutingRule DeserializeApplicationGatew property0.ThrowNonNullablePropertyIsNull(); continue; } - httpListener = SubResource.DeserializeSubResource(property0.Value); + httpListener = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("urlPathMap")) @@ -172,7 +175,7 @@ internal static ApplicationGatewayRequestRoutingRule DeserializeApplicationGatew property0.ThrowNonNullablePropertyIsNull(); continue; } - urlPathMap = SubResource.DeserializeSubResource(property0.Value); + urlPathMap = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("rewriteRuleSet")) @@ -182,7 +185,7 @@ internal static ApplicationGatewayRequestRoutingRule DeserializeApplicationGatew property0.ThrowNonNullablePropertyIsNull(); continue; } - rewriteRuleSet = SubResource.DeserializeSubResource(property0.Value); + rewriteRuleSet = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("redirectConfiguration")) @@ -192,7 +195,7 @@ internal static ApplicationGatewayRequestRoutingRule DeserializeApplicationGatew property0.ThrowNonNullablePropertyIsNull(); continue; } - redirectConfiguration = SubResource.DeserializeSubResource(property0.Value); + redirectConfiguration = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("provisioningState")) @@ -209,7 +212,7 @@ internal static ApplicationGatewayRequestRoutingRule DeserializeApplicationGatew continue; } } - return new ApplicationGatewayRequestRoutingRule(id, name.Value, etag.Value, type.Value, Optional.ToNullable(ruleType), Optional.ToNullable(priority), backendAddressPool.Value, backendHttpSettings.Value, httpListener.Value, urlPathMap.Value, rewriteRuleSet.Value, redirectConfiguration.Value, Optional.ToNullable(provisioningState)); + return new ApplicationGatewayRequestRoutingRule(id.Value, name.Value, etag.Value, type.Value, Optional.ToNullable(ruleType), Optional.ToNullable(priority), backendAddressPool, backendHttpSettings, httpListener, urlPathMap, rewriteRuleSet, redirectConfiguration, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayRequestRoutingRule.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayRequestRoutingRule.cs index 61683765fc32d..e76fd8b817dce 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayRequestRoutingRule.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayRequestRoutingRule.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.Network.Models { /// Request routing rule of an application gateway. - public partial class ApplicationGatewayRequestRoutingRule : WritableSubResource + public partial class ApplicationGatewayRequestRoutingRule : SubResource { /// Initializes a new instance of ApplicationGatewayRequestRoutingRule. public ApplicationGatewayRequestRoutingRule() @@ -18,7 +18,7 @@ public ApplicationGatewayRequestRoutingRule() } /// Initializes a new instance of ApplicationGatewayRequestRoutingRule. - /// The id. + /// Resource ID. /// Name of the request routing rule that is unique within an Application Gateway. /// A unique read-only string that changes whenever the resource is updated. /// Type of the resource. @@ -31,7 +31,7 @@ public ApplicationGatewayRequestRoutingRule() /// Rewrite Rule Set resource in Basic rule of the application gateway. /// Redirect configuration resource of the application gateway. /// The provisioning state of the request routing rule resource. - internal ApplicationGatewayRequestRoutingRule(string id, string name, string etag, string type, ApplicationGatewayRequestRoutingRuleType? ruleType, int? priority, SubResource backendAddressPool, SubResource backendHttpSettings, SubResource httpListener, SubResource urlPathMap, SubResource rewriteRuleSet, SubResource redirectConfiguration, ProvisioningState? provisioningState) : base(id) + internal ApplicationGatewayRequestRoutingRule(string id, string name, string etag, string type, ApplicationGatewayRequestRoutingRuleType? ruleType, int? priority, WritableSubResource backendAddressPool, WritableSubResource backendHttpSettings, WritableSubResource httpListener, WritableSubResource urlPathMap, WritableSubResource rewriteRuleSet, WritableSubResource redirectConfiguration, ProvisioningState? provisioningState) : base(id) { Name = name; Etag = etag; @@ -58,17 +58,17 @@ internal ApplicationGatewayRequestRoutingRule(string id, string name, string eta /// Priority of the request routing rule. public int? Priority { get; set; } /// Backend address pool resource of the application gateway. - public SubResource BackendAddressPool { get; set; } + public WritableSubResource BackendAddressPool { get; set; } /// Backend http settings resource of the application gateway. - public SubResource BackendHttpSettings { get; set; } + public WritableSubResource BackendHttpSettings { get; set; } /// Http listener resource of the application gateway. - public SubResource HttpListener { get; set; } + public WritableSubResource HttpListener { get; set; } /// URL path map resource of the application gateway. - public SubResource UrlPathMap { get; set; } + public WritableSubResource UrlPathMap { get; set; } /// Rewrite Rule Set resource in Basic rule of the application gateway. - public SubResource RewriteRuleSet { get; set; } + public WritableSubResource RewriteRuleSet { get; set; } /// Redirect configuration resource of the application gateway. - public SubResource RedirectConfiguration { get; set; } + public WritableSubResource RedirectConfiguration { get; set; } /// The provisioning state of the request routing rule resource. public ProvisioningState? ProvisioningState { get; } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayRewriteRuleSet.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayRewriteRuleSet.Serialization.cs index 7d6b1db62c141..29816be7da49f 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayRewriteRuleSet.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayRewriteRuleSet.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -22,8 +21,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsCollectionDefined(RewriteRules)) @@ -44,7 +46,7 @@ internal static ApplicationGatewayRewriteRuleSet DeserializeApplicationGatewayRe { Optional name = default; Optional etag = default; - ResourceIdentifier id = default; + Optional id = default; Optional> rewriteRules = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) @@ -102,7 +104,7 @@ internal static ApplicationGatewayRewriteRuleSet DeserializeApplicationGatewayRe continue; } } - return new ApplicationGatewayRewriteRuleSet(id, name.Value, etag.Value, Optional.ToList(rewriteRules), Optional.ToNullable(provisioningState)); + return new ApplicationGatewayRewriteRuleSet(id.Value, name.Value, etag.Value, Optional.ToList(rewriteRules), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayRewriteRuleSet.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayRewriteRuleSet.cs index 4e9ccb1998875..de7155ff592d5 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayRewriteRuleSet.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayRewriteRuleSet.cs @@ -7,12 +7,11 @@ using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { /// Rewrite rule set of an application gateway. - public partial class ApplicationGatewayRewriteRuleSet : WritableSubResource + public partial class ApplicationGatewayRewriteRuleSet : SubResource { /// Initializes a new instance of ApplicationGatewayRewriteRuleSet. public ApplicationGatewayRewriteRuleSet() @@ -21,7 +20,7 @@ public ApplicationGatewayRewriteRuleSet() } /// Initializes a new instance of ApplicationGatewayRewriteRuleSet. - /// The id. + /// Resource ID. /// Name of the rewrite rule set that is unique within an Application Gateway. /// A unique read-only string that changes whenever the resource is updated. /// Rewrite rules in the rewrite rule set. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewaySslCertificate.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewaySslCertificate.Serialization.cs index 0c707a39597a4..554789668abad 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewaySslCertificate.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewaySslCertificate.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -21,8 +20,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Data)) @@ -49,7 +51,7 @@ internal static ApplicationGatewaySslCertificate DeserializeApplicationGatewaySs Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional data = default; Optional password = default; Optional publicCertData = default; @@ -120,7 +122,7 @@ internal static ApplicationGatewaySslCertificate DeserializeApplicationGatewaySs continue; } } - return new ApplicationGatewaySslCertificate(id, name.Value, etag.Value, type.Value, data.Value, password.Value, publicCertData.Value, keyVaultSecretId.Value, Optional.ToNullable(provisioningState)); + return new ApplicationGatewaySslCertificate(id.Value, name.Value, etag.Value, type.Value, data.Value, password.Value, publicCertData.Value, keyVaultSecretId.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewaySslCertificate.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewaySslCertificate.cs index 2988b39297a65..bdb05e7fc2f9c 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewaySslCertificate.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewaySslCertificate.cs @@ -5,12 +5,10 @@ #nullable disable -using Azure.ResourceManager.Resources.Models; - namespace Azure.ResourceManager.Network.Models { /// SSL certificates of an application gateway. - public partial class ApplicationGatewaySslCertificate : WritableSubResource + public partial class ApplicationGatewaySslCertificate : SubResource { /// Initializes a new instance of ApplicationGatewaySslCertificate. public ApplicationGatewaySslCertificate() @@ -18,7 +16,7 @@ public ApplicationGatewaySslCertificate() } /// Initializes a new instance of ApplicationGatewaySslCertificate. - /// The id. + /// Resource ID. /// Name of the SSL certificate that is unique within an Application Gateway. /// A unique read-only string that changes whenever the resource is updated. /// Type of the resource. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewaySslPredefinedPolicy.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewaySslPredefinedPolicy.Serialization.cs index 3b7986d6eea8b..0e2002fee261a 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewaySslPredefinedPolicy.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewaySslPredefinedPolicy.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -22,8 +21,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsCollectionDefined(CipherSuites)) @@ -48,7 +50,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static ApplicationGatewaySslPredefinedPolicy DeserializeApplicationGatewaySslPredefinedPolicy(JsonElement element) { Optional name = default; - ResourceIdentifier id = default; + Optional id = default; Optional> cipherSuites = default; Optional minProtocolVersion = default; foreach (var property in element.EnumerateObject()) @@ -101,7 +103,7 @@ internal static ApplicationGatewaySslPredefinedPolicy DeserializeApplicationGate continue; } } - return new ApplicationGatewaySslPredefinedPolicy(id, name.Value, Optional.ToList(cipherSuites), Optional.ToNullable(minProtocolVersion)); + return new ApplicationGatewaySslPredefinedPolicy(id.Value, name.Value, Optional.ToList(cipherSuites), Optional.ToNullable(minProtocolVersion)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewaySslPredefinedPolicy.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewaySslPredefinedPolicy.cs index d792e65ca6105..31282d1dc24d1 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewaySslPredefinedPolicy.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewaySslPredefinedPolicy.cs @@ -7,12 +7,11 @@ using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { /// An Ssl predefined policy. - public partial class ApplicationGatewaySslPredefinedPolicy : WritableSubResource + public partial class ApplicationGatewaySslPredefinedPolicy : SubResource { /// Initializes a new instance of ApplicationGatewaySslPredefinedPolicy. public ApplicationGatewaySslPredefinedPolicy() @@ -21,7 +20,7 @@ public ApplicationGatewaySslPredefinedPolicy() } /// Initializes a new instance of ApplicationGatewaySslPredefinedPolicy. - /// The id. + /// Resource ID. /// Name of the Ssl predefined policy. /// Ssl cipher suites to be enabled in the specified order for application gateway. /// Minimum version of Ssl protocol to be supported on application gateway. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewaySslProfile.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewaySslProfile.Serialization.cs index e299e5b87e6da..ca094091b71f4 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewaySslProfile.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewaySslProfile.Serialization.cs @@ -8,7 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -22,8 +22,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsCollectionDefined(TrustedClientCertificates)) @@ -32,7 +35,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in TrustedClientCertificates) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } @@ -55,8 +58,8 @@ internal static ApplicationGatewaySslProfile DeserializeApplicationGatewaySslPro Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; - Optional> trustedClientCertificates = default; + Optional id = default; + Optional> trustedClientCertificates = default; Optional sslPolicy = default; Optional clientAuthConfiguration = default; Optional provisioningState = default; @@ -98,10 +101,10 @@ internal static ApplicationGatewaySslProfile DeserializeApplicationGatewaySslPro property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } trustedClientCertificates = array; continue; @@ -140,7 +143,7 @@ internal static ApplicationGatewaySslProfile DeserializeApplicationGatewaySslPro continue; } } - return new ApplicationGatewaySslProfile(id, name.Value, etag.Value, type.Value, Optional.ToList(trustedClientCertificates), sslPolicy.Value, clientAuthConfiguration.Value, Optional.ToNullable(provisioningState)); + return new ApplicationGatewaySslProfile(id.Value, name.Value, etag.Value, type.Value, Optional.ToList(trustedClientCertificates), sslPolicy.Value, clientAuthConfiguration.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewaySslProfile.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewaySslProfile.cs index a005f3304e10a..73b7ca44e7673 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewaySslProfile.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewaySslProfile.cs @@ -12,16 +12,16 @@ namespace Azure.ResourceManager.Network.Models { /// SSL profile of an application gateway. - public partial class ApplicationGatewaySslProfile : WritableSubResource + public partial class ApplicationGatewaySslProfile : SubResource { /// Initializes a new instance of ApplicationGatewaySslProfile. public ApplicationGatewaySslProfile() { - TrustedClientCertificates = new ChangeTrackingList(); + TrustedClientCertificates = new ChangeTrackingList(); } /// Initializes a new instance of ApplicationGatewaySslProfile. - /// The id. + /// Resource ID. /// Name of the SSL profile that is unique within an Application Gateway. /// A unique read-only string that changes whenever the resource is updated. /// Type of the resource. @@ -29,7 +29,7 @@ public ApplicationGatewaySslProfile() /// SSL policy of the application gateway resource. /// Client authentication configuration of the application gateway resource. /// The provisioning state of the HTTP listener resource. - internal ApplicationGatewaySslProfile(string id, string name, string etag, string type, IList trustedClientCertificates, ApplicationGatewaySslPolicy sslPolicy, ApplicationGatewayClientAuthConfiguration clientAuthConfiguration, ProvisioningState? provisioningState) : base(id) + internal ApplicationGatewaySslProfile(string id, string name, string etag, string type, IList trustedClientCertificates, ApplicationGatewaySslPolicy sslPolicy, ApplicationGatewayClientAuthConfiguration clientAuthConfiguration, ProvisioningState? provisioningState) : base(id) { Name = name; Etag = etag; @@ -47,7 +47,7 @@ internal ApplicationGatewaySslProfile(string id, string name, string etag, strin /// Type of the resource. public string Type { get; } /// Array of references to application gateway trusted client certificates. - public IList TrustedClientCertificates { get; } + public IList TrustedClientCertificates { get; } /// SSL policy of the application gateway resource. public ApplicationGatewaySslPolicy SslPolicy { get; set; } /// Client authentication configuration of the application gateway resource. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayTrustedClientCertificate.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayTrustedClientCertificate.Serialization.cs index e4b7d453f0b9d..bb112d95b8057 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayTrustedClientCertificate.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayTrustedClientCertificate.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -21,8 +20,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Data)) @@ -39,7 +41,7 @@ internal static ApplicationGatewayTrustedClientCertificate DeserializeApplicatio Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional data = default; Optional validatedCertData = default; Optional clientCertIssuerDN = default; @@ -104,7 +106,7 @@ internal static ApplicationGatewayTrustedClientCertificate DeserializeApplicatio continue; } } - return new ApplicationGatewayTrustedClientCertificate(id, name.Value, etag.Value, type.Value, data.Value, validatedCertData.Value, clientCertIssuerDN.Value, Optional.ToNullable(provisioningState)); + return new ApplicationGatewayTrustedClientCertificate(id.Value, name.Value, etag.Value, type.Value, data.Value, validatedCertData.Value, clientCertIssuerDN.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayTrustedClientCertificate.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayTrustedClientCertificate.cs index b7eb91d11fb82..f42975fae84c0 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayTrustedClientCertificate.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayTrustedClientCertificate.cs @@ -5,12 +5,10 @@ #nullable disable -using Azure.ResourceManager.Resources.Models; - namespace Azure.ResourceManager.Network.Models { /// Trusted client certificates of an application gateway. - public partial class ApplicationGatewayTrustedClientCertificate : WritableSubResource + public partial class ApplicationGatewayTrustedClientCertificate : SubResource { /// Initializes a new instance of ApplicationGatewayTrustedClientCertificate. public ApplicationGatewayTrustedClientCertificate() @@ -18,7 +16,7 @@ public ApplicationGatewayTrustedClientCertificate() } /// Initializes a new instance of ApplicationGatewayTrustedClientCertificate. - /// The id. + /// Resource ID. /// Name of the trusted client certificate that is unique within an Application Gateway. /// A unique read-only string that changes whenever the resource is updated. /// Type of the resource. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayTrustedRootCertificate.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayTrustedRootCertificate.Serialization.cs index 7286dfb524dca..8530d75c5d076 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayTrustedRootCertificate.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayTrustedRootCertificate.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -21,8 +20,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Data)) @@ -44,7 +46,7 @@ internal static ApplicationGatewayTrustedRootCertificate DeserializeApplicationG Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional data = default; Optional keyVaultSecretId = default; Optional provisioningState = default; @@ -103,7 +105,7 @@ internal static ApplicationGatewayTrustedRootCertificate DeserializeApplicationG continue; } } - return new ApplicationGatewayTrustedRootCertificate(id, name.Value, etag.Value, type.Value, data.Value, keyVaultSecretId.Value, Optional.ToNullable(provisioningState)); + return new ApplicationGatewayTrustedRootCertificate(id.Value, name.Value, etag.Value, type.Value, data.Value, keyVaultSecretId.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayTrustedRootCertificate.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayTrustedRootCertificate.cs index 65db3ffb3f15e..3bef06d878bc1 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayTrustedRootCertificate.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayTrustedRootCertificate.cs @@ -5,12 +5,10 @@ #nullable disable -using Azure.ResourceManager.Resources.Models; - namespace Azure.ResourceManager.Network.Models { /// Trusted Root certificates of an application gateway. - public partial class ApplicationGatewayTrustedRootCertificate : WritableSubResource + public partial class ApplicationGatewayTrustedRootCertificate : SubResource { /// Initializes a new instance of ApplicationGatewayTrustedRootCertificate. public ApplicationGatewayTrustedRootCertificate() @@ -18,7 +16,7 @@ public ApplicationGatewayTrustedRootCertificate() } /// Initializes a new instance of ApplicationGatewayTrustedRootCertificate. - /// The id. + /// Resource ID. /// Name of the trusted root certificate that is unique within an Application Gateway. /// A unique read-only string that changes whenever the resource is updated. /// Type of the resource. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayUrlPathMap.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayUrlPathMap.Serialization.cs index a2c86d9a61329..6f8bc4faa67ce 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayUrlPathMap.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayUrlPathMap.Serialization.cs @@ -8,7 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -22,29 +22,32 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(DefaultBackendAddressPool)) { writer.WritePropertyName("defaultBackendAddressPool"); - writer.WriteObjectValue(DefaultBackendAddressPool); + JsonSerializer.Serialize(writer, DefaultBackendAddressPool); } if (Optional.IsDefined(DefaultBackendHttpSettings)) { writer.WritePropertyName("defaultBackendHttpSettings"); - writer.WriteObjectValue(DefaultBackendHttpSettings); + JsonSerializer.Serialize(writer, DefaultBackendHttpSettings); } if (Optional.IsDefined(DefaultRewriteRuleSet)) { writer.WritePropertyName("defaultRewriteRuleSet"); - writer.WriteObjectValue(DefaultRewriteRuleSet); + JsonSerializer.Serialize(writer, DefaultRewriteRuleSet); } if (Optional.IsDefined(DefaultRedirectConfiguration)) { writer.WritePropertyName("defaultRedirectConfiguration"); - writer.WriteObjectValue(DefaultRedirectConfiguration); + JsonSerializer.Serialize(writer, DefaultRedirectConfiguration); } if (Optional.IsCollectionDefined(PathRules)) { @@ -65,11 +68,11 @@ internal static ApplicationGatewayUrlPathMap DeserializeApplicationGatewayUrlPat Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; - Optional defaultBackendAddressPool = default; - Optional defaultBackendHttpSettings = default; - Optional defaultRewriteRuleSet = default; - Optional defaultRedirectConfiguration = default; + Optional id = default; + Optional defaultBackendAddressPool = default; + Optional defaultBackendHttpSettings = default; + Optional defaultRewriteRuleSet = default; + Optional defaultRedirectConfiguration = default; Optional> pathRules = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) @@ -110,7 +113,7 @@ internal static ApplicationGatewayUrlPathMap DeserializeApplicationGatewayUrlPat property0.ThrowNonNullablePropertyIsNull(); continue; } - defaultBackendAddressPool = SubResource.DeserializeSubResource(property0.Value); + defaultBackendAddressPool = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("defaultBackendHttpSettings")) @@ -120,7 +123,7 @@ internal static ApplicationGatewayUrlPathMap DeserializeApplicationGatewayUrlPat property0.ThrowNonNullablePropertyIsNull(); continue; } - defaultBackendHttpSettings = SubResource.DeserializeSubResource(property0.Value); + defaultBackendHttpSettings = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("defaultRewriteRuleSet")) @@ -130,7 +133,7 @@ internal static ApplicationGatewayUrlPathMap DeserializeApplicationGatewayUrlPat property0.ThrowNonNullablePropertyIsNull(); continue; } - defaultRewriteRuleSet = SubResource.DeserializeSubResource(property0.Value); + defaultRewriteRuleSet = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("defaultRedirectConfiguration")) @@ -140,7 +143,7 @@ internal static ApplicationGatewayUrlPathMap DeserializeApplicationGatewayUrlPat property0.ThrowNonNullablePropertyIsNull(); continue; } - defaultRedirectConfiguration = SubResource.DeserializeSubResource(property0.Value); + defaultRedirectConfiguration = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("pathRules")) @@ -172,7 +175,7 @@ internal static ApplicationGatewayUrlPathMap DeserializeApplicationGatewayUrlPat continue; } } - return new ApplicationGatewayUrlPathMap(id, name.Value, etag.Value, type.Value, defaultBackendAddressPool.Value, defaultBackendHttpSettings.Value, defaultRewriteRuleSet.Value, defaultRedirectConfiguration.Value, Optional.ToList(pathRules), Optional.ToNullable(provisioningState)); + return new ApplicationGatewayUrlPathMap(id.Value, name.Value, etag.Value, type.Value, defaultBackendAddressPool, defaultBackendHttpSettings, defaultRewriteRuleSet, defaultRedirectConfiguration, Optional.ToList(pathRules), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayUrlPathMap.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayUrlPathMap.cs index 15c03961147cd..9ed6a0699dc7a 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayUrlPathMap.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationGatewayUrlPathMap.cs @@ -12,7 +12,7 @@ namespace Azure.ResourceManager.Network.Models { /// UrlPathMaps give a url path to the backend mapping information for PathBasedRouting. - public partial class ApplicationGatewayUrlPathMap : WritableSubResource + public partial class ApplicationGatewayUrlPathMap : SubResource { /// Initializes a new instance of ApplicationGatewayUrlPathMap. public ApplicationGatewayUrlPathMap() @@ -21,7 +21,7 @@ public ApplicationGatewayUrlPathMap() } /// Initializes a new instance of ApplicationGatewayUrlPathMap. - /// The id. + /// Resource ID. /// Name of the URL path map that is unique within an Application Gateway. /// A unique read-only string that changes whenever the resource is updated. /// Type of the resource. @@ -31,7 +31,7 @@ public ApplicationGatewayUrlPathMap() /// Default redirect configuration resource of URL path map. /// Path rule of URL path map resource. /// The provisioning state of the URL path map resource. - internal ApplicationGatewayUrlPathMap(string id, string name, string etag, string type, SubResource defaultBackendAddressPool, SubResource defaultBackendHttpSettings, SubResource defaultRewriteRuleSet, SubResource defaultRedirectConfiguration, IList pathRules, ProvisioningState? provisioningState) : base(id) + internal ApplicationGatewayUrlPathMap(string id, string name, string etag, string type, WritableSubResource defaultBackendAddressPool, WritableSubResource defaultBackendHttpSettings, WritableSubResource defaultRewriteRuleSet, WritableSubResource defaultRedirectConfiguration, IList pathRules, ProvisioningState? provisioningState) : base(id) { Name = name; Etag = etag; @@ -51,13 +51,13 @@ internal ApplicationGatewayUrlPathMap(string id, string name, string etag, strin /// Type of the resource. public string Type { get; } /// Default backend address pool resource of URL path map. - public SubResource DefaultBackendAddressPool { get; set; } + public WritableSubResource DefaultBackendAddressPool { get; set; } /// Default backend http settings resource of URL path map. - public SubResource DefaultBackendHttpSettings { get; set; } + public WritableSubResource DefaultBackendHttpSettings { get; set; } /// Default Rewrite rule set resource of URL path map. - public SubResource DefaultRewriteRuleSet { get; set; } + public WritableSubResource DefaultRewriteRuleSet { get; set; } /// Default redirect configuration resource of URL path map. - public SubResource DefaultRedirectConfiguration { get; set; } + public WritableSubResource DefaultRedirectConfiguration { get; set; } /// Path rule of URL path map resource. public IList PathRules { get; } /// The provisioning state of the URL path map resource. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationSecurityGroupData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationSecurityGroupData.Serialization.cs index 68d0da6523dd6..13efe10654d54 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationSecurityGroupData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ApplicationSecurityGroupData.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -18,6 +17,11 @@ public partial class ApplicationSecurityGroupData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -34,8 +38,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); writer.WriteEndObject(); @@ -45,11 +47,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static ApplicationSecurityGroupData DeserializeApplicationSecurityGroupData(JsonElement element) { Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional resourceGuid = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) @@ -59,6 +61,11 @@ internal static ApplicationSecurityGroupData DeserializeApplicationSecurityGroup etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -89,11 +96,6 @@ internal static ApplicationSecurityGroupData DeserializeApplicationSecurityGroup tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -122,7 +124,7 @@ internal static ApplicationSecurityGroupData DeserializeApplicationSecurityGroup continue; } } - return new ApplicationSecurityGroupData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, resourceGuid.Value, Optional.ToNullable(provisioningState)); + return new ApplicationSecurityGroupData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, resourceGuid.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallApplicationRuleCollection.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallApplicationRuleCollection.Serialization.cs index 04ac2e8a530a0..4b1b94271916f 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallApplicationRuleCollection.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallApplicationRuleCollection.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -22,8 +21,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Priority)) @@ -54,7 +56,7 @@ internal static AzureFirewallApplicationRuleCollection DeserializeAzureFirewallA { Optional name = default; Optional etag = default; - ResourceIdentifier id = default; + Optional id = default; Optional priority = default; Optional action = default; Optional> rules = default; @@ -134,7 +136,7 @@ internal static AzureFirewallApplicationRuleCollection DeserializeAzureFirewallA continue; } } - return new AzureFirewallApplicationRuleCollection(id, name.Value, etag.Value, Optional.ToNullable(priority), action.Value, Optional.ToList(rules), Optional.ToNullable(provisioningState)); + return new AzureFirewallApplicationRuleCollection(id.Value, name.Value, etag.Value, Optional.ToNullable(priority), action.Value, Optional.ToList(rules), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallApplicationRuleCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallApplicationRuleCollection.cs index 3002a9eb42202..eb4fc1b708108 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallApplicationRuleCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallApplicationRuleCollection.cs @@ -7,12 +7,11 @@ using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { /// Application rule collection resource. - public partial class AzureFirewallApplicationRuleCollection : WritableSubResource + public partial class AzureFirewallApplicationRuleCollection : SubResource { /// Initializes a new instance of AzureFirewallApplicationRuleCollection. public AzureFirewallApplicationRuleCollection() @@ -21,7 +20,7 @@ public AzureFirewallApplicationRuleCollection() } /// Initializes a new instance of AzureFirewallApplicationRuleCollection. - /// The id. + /// Resource ID. /// The name of the resource that is unique within the Azure firewall. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// Priority of the application rule collection resource. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallData.Serialization.cs index 2e4dccca59932..d0c077afe7e56 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallData.Serialization.cs @@ -8,8 +8,8 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -28,6 +28,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -44,8 +49,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsCollectionDefined(ApplicationRuleCollections)) @@ -101,12 +104,12 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(VirtualHub)) { writer.WritePropertyName("virtualHub"); - writer.WriteObjectValue(VirtualHub); + JsonSerializer.Serialize(writer, VirtualHub); } if (Optional.IsDefined(FirewallPolicy)) { writer.WritePropertyName("firewallPolicy"); - writer.WriteObjectValue(FirewallPolicy); + JsonSerializer.Serialize(writer, FirewallPolicy); } if (Optional.IsDefined(HubIPAddresses)) { @@ -137,11 +140,11 @@ internal static AzureFirewallData DeserializeAzureFirewallData(JsonElement eleme { Optional> zones = default; Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional> applicationRuleCollections = default; Optional> natRuleCollections = default; Optional> networkRuleCollections = default; @@ -149,8 +152,8 @@ internal static AzureFirewallData DeserializeAzureFirewallData(JsonElement eleme Optional managementIpConfiguration = default; Optional provisioningState = default; Optional threatIntelMode = default; - Optional virtualHub = default; - Optional firewallPolicy = default; + Optional virtualHub = default; + Optional firewallPolicy = default; Optional hubIPAddresses = default; Optional> ipGroups = default; Optional sku = default; @@ -177,6 +180,11 @@ internal static AzureFirewallData DeserializeAzureFirewallData(JsonElement eleme etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -207,11 +215,6 @@ internal static AzureFirewallData DeserializeAzureFirewallData(JsonElement eleme tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -318,7 +321,7 @@ internal static AzureFirewallData DeserializeAzureFirewallData(JsonElement eleme property0.ThrowNonNullablePropertyIsNull(); continue; } - virtualHub = SubResource.DeserializeSubResource(property0.Value); + virtualHub = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("firewallPolicy")) @@ -328,7 +331,7 @@ internal static AzureFirewallData DeserializeAzureFirewallData(JsonElement eleme property0.ThrowNonNullablePropertyIsNull(); continue; } - firewallPolicy = SubResource.DeserializeSubResource(property0.Value); + firewallPolicy = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("hubIPAddresses")) @@ -385,7 +388,7 @@ internal static AzureFirewallData DeserializeAzureFirewallData(JsonElement eleme continue; } } - return new AzureFirewallData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), Optional.ToList(zones), etag.Value, Optional.ToList(applicationRuleCollections), Optional.ToList(natRuleCollections), Optional.ToList(networkRuleCollections), Optional.ToList(ipConfigurations), managementIpConfiguration.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(threatIntelMode), virtualHub.Value, firewallPolicy.Value, hubIPAddresses.Value, Optional.ToList(ipGroups), sku.Value, Optional.ToDictionary(additionalProperties)); + return new AzureFirewallData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), Optional.ToList(zones), etag.Value, Optional.ToList(applicationRuleCollections), Optional.ToList(natRuleCollections), Optional.ToList(networkRuleCollections), Optional.ToList(ipConfigurations), managementIpConfiguration.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(threatIntelMode), virtualHub, firewallPolicy, hubIPAddresses.Value, Optional.ToList(ipGroups), sku.Value, Optional.ToDictionary(additionalProperties)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallFqdnTag.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallFqdnTag.Serialization.cs index 21dd72f6ec7ae..f44cad3a1093a 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallFqdnTag.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallFqdnTag.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -17,6 +16,11 @@ public partial class AzureFirewallFqdnTag : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -33,8 +37,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); writer.WriteEndObject(); @@ -44,11 +46,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static AzureFirewallFqdnTag DeserializeAzureFirewallFqdnTag(JsonElement element) { Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional provisioningState = default; Optional fqdnTagName = default; foreach (var property in element.EnumerateObject()) @@ -58,6 +60,11 @@ internal static AzureFirewallFqdnTag DeserializeAzureFirewallFqdnTag(JsonElement etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -88,11 +95,6 @@ internal static AzureFirewallFqdnTag DeserializeAzureFirewallFqdnTag(JsonElement tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -121,7 +123,7 @@ internal static AzureFirewallFqdnTag DeserializeAzureFirewallFqdnTag(JsonElement continue; } } - return new AzureFirewallFqdnTag(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, Optional.ToNullable(provisioningState), fqdnTagName.Value); + return new AzureFirewallFqdnTag(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, Optional.ToNullable(provisioningState), fqdnTagName.Value); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallFqdnTag.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallFqdnTag.cs index c8223f170e4aa..8532dc164d27b 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallFqdnTag.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallFqdnTag.cs @@ -18,7 +18,7 @@ public AzureFirewallFqdnTag() } /// Initializes a new instance of AzureFirewallFqdnTag. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallIPConfiguration.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallIPConfiguration.Serialization.cs index 85e0271614336..93d2c24ce0517 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallIPConfiguration.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallIPConfiguration.Serialization.cs @@ -7,7 +7,7 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -21,19 +21,22 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Subnet)) { writer.WritePropertyName("subnet"); - writer.WriteObjectValue(Subnet); + JsonSerializer.Serialize(writer, Subnet); } if (Optional.IsDefined(PublicIPAddress)) { writer.WritePropertyName("publicIPAddress"); - writer.WriteObjectValue(PublicIPAddress); + JsonSerializer.Serialize(writer, PublicIPAddress); } writer.WriteEndObject(); writer.WriteEndObject(); @@ -44,10 +47,10 @@ internal static AzureFirewallIPConfiguration DeserializeAzureFirewallIPConfigura Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional privateIPAddress = default; - Optional subnet = default; - Optional publicIPAddress = default; + Optional subnet = default; + Optional publicIPAddress = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) { @@ -92,7 +95,7 @@ internal static AzureFirewallIPConfiguration DeserializeAzureFirewallIPConfigura property0.ThrowNonNullablePropertyIsNull(); continue; } - subnet = SubResource.DeserializeSubResource(property0.Value); + subnet = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("publicIPAddress")) @@ -102,7 +105,7 @@ internal static AzureFirewallIPConfiguration DeserializeAzureFirewallIPConfigura property0.ThrowNonNullablePropertyIsNull(); continue; } - publicIPAddress = SubResource.DeserializeSubResource(property0.Value); + publicIPAddress = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("provisioningState")) @@ -119,7 +122,7 @@ internal static AzureFirewallIPConfiguration DeserializeAzureFirewallIPConfigura continue; } } - return new AzureFirewallIPConfiguration(id, name.Value, etag.Value, type.Value, privateIPAddress.Value, subnet.Value, publicIPAddress.Value, Optional.ToNullable(provisioningState)); + return new AzureFirewallIPConfiguration(id.Value, name.Value, etag.Value, type.Value, privateIPAddress.Value, subnet, publicIPAddress, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallIPConfiguration.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallIPConfiguration.cs index 6dc6b812162a1..bbc03655c5ff4 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallIPConfiguration.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallIPConfiguration.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.Network.Models { /// IP configuration of an Azure Firewall. - public partial class AzureFirewallIPConfiguration : WritableSubResource + public partial class AzureFirewallIPConfiguration : SubResource { /// Initializes a new instance of AzureFirewallIPConfiguration. public AzureFirewallIPConfiguration() @@ -18,7 +18,7 @@ public AzureFirewallIPConfiguration() } /// Initializes a new instance of AzureFirewallIPConfiguration. - /// The id. + /// Resource ID. /// Name of the resource that is unique within a resource group. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// Type of the resource. @@ -26,7 +26,7 @@ public AzureFirewallIPConfiguration() /// Reference to the subnet resource. This resource must be named 'AzureFirewallSubnet' or 'AzureFirewallManagementSubnet'. /// Reference to the PublicIP resource. This field is a mandatory input if subnet is not null. /// The provisioning state of the Azure firewall IP configuration resource. - internal AzureFirewallIPConfiguration(string id, string name, string etag, string type, string privateIPAddress, SubResource subnet, SubResource publicIPAddress, ProvisioningState? provisioningState) : base(id) + internal AzureFirewallIPConfiguration(string id, string name, string etag, string type, string privateIPAddress, WritableSubResource subnet, WritableSubResource publicIPAddress, ProvisioningState? provisioningState) : base(id) { Name = name; Etag = etag; @@ -46,9 +46,9 @@ internal AzureFirewallIPConfiguration(string id, string name, string etag, strin /// The Firewall Internal Load Balancer IP to be used as the next hop in User Defined Routes. public string PrivateIPAddress { get; } /// Reference to the subnet resource. This resource must be named 'AzureFirewallSubnet' or 'AzureFirewallManagementSubnet'. - public SubResource Subnet { get; set; } + public WritableSubResource Subnet { get; set; } /// Reference to the PublicIP resource. This field is a mandatory input if subnet is not null. - public SubResource PublicIPAddress { get; set; } + public WritableSubResource PublicIPAddress { get; set; } /// The provisioning state of the Azure firewall IP configuration resource. public ProvisioningState? ProvisioningState { get; } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallIpGroups.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallIpGroups.Serialization.cs index 71a9b691bbdf3..4cba9a229d998 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallIpGroups.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallIpGroups.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -15,22 +14,22 @@ public partial class AzureFirewallIpGroups { internal static AzureFirewallIpGroups DeserializeAzureFirewallIpGroups(JsonElement element) { + Optional id = default; Optional changeNumber = default; - ResourceIdentifier id = default; foreach (var property in element.EnumerateObject()) { - if (property.NameEquals("changeNumber")) + if (property.NameEquals("id")) { - changeNumber = property.Value.GetString(); + id = property.Value.GetString(); continue; } - if (property.NameEquals("id")) + if (property.NameEquals("changeNumber")) { - id = property.Value.GetString(); + changeNumber = property.Value.GetString(); continue; } } - return new AzureFirewallIpGroups(id, changeNumber.Value); + return new AzureFirewallIpGroups(id.Value, changeNumber.Value); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallIpGroups.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallIpGroups.cs index 4a0d6e279be79..4adaa836e1889 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallIpGroups.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallIpGroups.cs @@ -5,12 +5,10 @@ #nullable disable -using Azure.ResourceManager.Resources.Models; - namespace Azure.ResourceManager.Network.Models { /// IpGroups associated with azure firewall. - public partial class AzureFirewallIpGroups : Resources.Models.SubResource + public partial class AzureFirewallIpGroups { /// Initializes a new instance of AzureFirewallIpGroups. internal AzureFirewallIpGroups() @@ -18,13 +16,16 @@ internal AzureFirewallIpGroups() } /// Initializes a new instance of AzureFirewallIpGroups. - /// The id. + /// Resource ID. /// The iteration number. - internal AzureFirewallIpGroups(string id, string changeNumber) : base(id) + internal AzureFirewallIpGroups(string id, string changeNumber) { + Id = id; ChangeNumber = changeNumber; } + /// Resource ID. + public string Id { get; } /// The iteration number. public string ChangeNumber { get; } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallNatRuleCollection.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallNatRuleCollection.Serialization.cs index 5f91ab6b3f2fb..eb3466d632ff8 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallNatRuleCollection.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallNatRuleCollection.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -22,8 +21,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Priority)) @@ -54,7 +56,7 @@ internal static AzureFirewallNatRuleCollection DeserializeAzureFirewallNatRuleCo { Optional name = default; Optional etag = default; - ResourceIdentifier id = default; + Optional id = default; Optional priority = default; Optional action = default; Optional> rules = default; @@ -134,7 +136,7 @@ internal static AzureFirewallNatRuleCollection DeserializeAzureFirewallNatRuleCo continue; } } - return new AzureFirewallNatRuleCollection(id, name.Value, etag.Value, Optional.ToNullable(priority), action.Value, Optional.ToList(rules), Optional.ToNullable(provisioningState)); + return new AzureFirewallNatRuleCollection(id.Value, name.Value, etag.Value, Optional.ToNullable(priority), action.Value, Optional.ToList(rules), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallNatRuleCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallNatRuleCollection.cs index f24726a8bab85..ddc434011cb67 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallNatRuleCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallNatRuleCollection.cs @@ -7,12 +7,11 @@ using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { /// NAT rule collection resource. - public partial class AzureFirewallNatRuleCollection : WritableSubResource + public partial class AzureFirewallNatRuleCollection : SubResource { /// Initializes a new instance of AzureFirewallNatRuleCollection. public AzureFirewallNatRuleCollection() @@ -21,7 +20,7 @@ public AzureFirewallNatRuleCollection() } /// Initializes a new instance of AzureFirewallNatRuleCollection. - /// The id. + /// Resource ID. /// The name of the resource that is unique within the Azure firewall. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// Priority of the NAT rule collection resource. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallNetworkRuleCollection.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallNetworkRuleCollection.Serialization.cs index b44735fcea9b0..4c8dcfaecfeb5 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallNetworkRuleCollection.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallNetworkRuleCollection.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -22,8 +21,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Priority)) @@ -54,7 +56,7 @@ internal static AzureFirewallNetworkRuleCollection DeserializeAzureFirewallNetwo { Optional name = default; Optional etag = default; - ResourceIdentifier id = default; + Optional id = default; Optional priority = default; Optional action = default; Optional> rules = default; @@ -134,7 +136,7 @@ internal static AzureFirewallNetworkRuleCollection DeserializeAzureFirewallNetwo continue; } } - return new AzureFirewallNetworkRuleCollection(id, name.Value, etag.Value, Optional.ToNullable(priority), action.Value, Optional.ToList(rules), Optional.ToNullable(provisioningState)); + return new AzureFirewallNetworkRuleCollection(id.Value, name.Value, etag.Value, Optional.ToNullable(priority), action.Value, Optional.ToList(rules), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallNetworkRuleCollection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallNetworkRuleCollection.cs index b45a47d143139..c574073f0fc42 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallNetworkRuleCollection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/AzureFirewallNetworkRuleCollection.cs @@ -7,12 +7,11 @@ using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { /// Network rule collection resource. - public partial class AzureFirewallNetworkRuleCollection : WritableSubResource + public partial class AzureFirewallNetworkRuleCollection : SubResource { /// Initializes a new instance of AzureFirewallNetworkRuleCollection. public AzureFirewallNetworkRuleCollection() @@ -21,7 +20,7 @@ public AzureFirewallNetworkRuleCollection() } /// Initializes a new instance of AzureFirewallNetworkRuleCollection. - /// The id. + /// Resource ID. /// The name of the resource that is unique within the Azure firewall. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// Priority of the network rule collection resource. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/BackendAddressPoolData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/BackendAddressPoolData.Serialization.cs index 709ebd2ec2dfb..744d6457d8e3d 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/BackendAddressPoolData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/BackendAddressPoolData.Serialization.cs @@ -8,8 +8,8 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -23,8 +23,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Location)) @@ -61,14 +64,14 @@ internal static BackendAddressPoolData DeserializeBackendAddressPoolData(JsonEle Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional location = default; Optional> tunnelInterfaces = default; Optional> loadBalancerBackendAddresses = default; Optional> backendIPConfigurations = default; - Optional> loadBalancingRules = default; - Optional outboundRule = default; - Optional> outboundRules = default; + Optional> loadBalancingRules = default; + Optional outboundRule = default; + Optional> outboundRules = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) { @@ -158,10 +161,10 @@ internal static BackendAddressPoolData DeserializeBackendAddressPoolData(JsonEle property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } loadBalancingRules = array; continue; @@ -173,7 +176,7 @@ internal static BackendAddressPoolData DeserializeBackendAddressPoolData(JsonEle property0.ThrowNonNullablePropertyIsNull(); continue; } - outboundRule = SubResource.DeserializeSubResource(property0.Value); + outboundRule = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("outboundRules")) @@ -183,10 +186,10 @@ internal static BackendAddressPoolData DeserializeBackendAddressPoolData(JsonEle property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } outboundRules = array; continue; @@ -205,7 +208,7 @@ internal static BackendAddressPoolData DeserializeBackendAddressPoolData(JsonEle continue; } } - return new BackendAddressPoolData(id, name.Value, etag.Value, type.Value, location.Value, Optional.ToList(tunnelInterfaces), Optional.ToList(loadBalancerBackendAddresses), Optional.ToList(backendIPConfigurations), Optional.ToList(loadBalancingRules), outboundRule.Value, Optional.ToList(outboundRules), Optional.ToNullable(provisioningState)); + return new BackendAddressPoolData(id.Value, name.Value, etag.Value, type.Value, location.Value, Optional.ToList(tunnelInterfaces), Optional.ToList(loadBalancerBackendAddresses), Optional.ToList(backendIPConfigurations), Optional.ToList(loadBalancingRules), outboundRule, Optional.ToList(outboundRules), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/BastionHostData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/BastionHostData.Serialization.cs index b115afc9f9d0c..2add926ce7658 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/BastionHostData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/BastionHostData.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -23,6 +22,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("sku"); writer.WriteObjectValue(Sku); } + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -39,8 +43,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsCollectionDefined(IpConfigurations)) @@ -66,11 +68,11 @@ internal static BastionHostData DeserializeBastionHostData(JsonElement element) { Optional etag = default; Optional sku = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional> ipConfigurations = default; Optional dnsName = default; Optional provisioningState = default; @@ -91,6 +93,11 @@ internal static BastionHostData DeserializeBastionHostData(JsonElement element) sku = Sku.DeserializeSku(property.Value); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -121,11 +128,6 @@ internal static BastionHostData DeserializeBastionHostData(JsonElement element) tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -169,7 +171,7 @@ internal static BastionHostData DeserializeBastionHostData(JsonElement element) continue; } } - return new BastionHostData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, sku.Value, Optional.ToList(ipConfigurations), dnsName.Value, Optional.ToNullable(provisioningState)); + return new BastionHostData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, sku.Value, Optional.ToList(ipConfigurations), dnsName.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/BastionHostIPConfiguration.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/BastionHostIPConfiguration.Serialization.cs index 30f26fd478abf..5361c87575614 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/BastionHostIPConfiguration.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/BastionHostIPConfiguration.Serialization.cs @@ -7,7 +7,7 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -21,19 +21,22 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Subnet)) { writer.WritePropertyName("subnet"); - writer.WriteObjectValue(Subnet); + JsonSerializer.Serialize(writer, Subnet); } if (Optional.IsDefined(PublicIPAddress)) { writer.WritePropertyName("publicIPAddress"); - writer.WriteObjectValue(PublicIPAddress); + JsonSerializer.Serialize(writer, PublicIPAddress); } if (Optional.IsDefined(PrivateIPAllocationMethod)) { @@ -49,9 +52,9 @@ internal static BastionHostIPConfiguration DeserializeBastionHostIPConfiguration Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; - Optional subnet = default; - Optional publicIPAddress = default; + Optional id = default; + Optional subnet = default; + Optional publicIPAddress = default; Optional provisioningState = default; Optional privateIPAllocationMethod = default; foreach (var property in element.EnumerateObject()) @@ -92,7 +95,7 @@ internal static BastionHostIPConfiguration DeserializeBastionHostIPConfiguration property0.ThrowNonNullablePropertyIsNull(); continue; } - subnet = SubResource.DeserializeSubResource(property0.Value); + subnet = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("publicIPAddress")) @@ -102,7 +105,7 @@ internal static BastionHostIPConfiguration DeserializeBastionHostIPConfiguration property0.ThrowNonNullablePropertyIsNull(); continue; } - publicIPAddress = SubResource.DeserializeSubResource(property0.Value); + publicIPAddress = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("provisioningState")) @@ -129,7 +132,7 @@ internal static BastionHostIPConfiguration DeserializeBastionHostIPConfiguration continue; } } - return new BastionHostIPConfiguration(id, name.Value, etag.Value, type.Value, subnet.Value, publicIPAddress.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(privateIPAllocationMethod)); + return new BastionHostIPConfiguration(id.Value, name.Value, etag.Value, type.Value, subnet, publicIPAddress, Optional.ToNullable(provisioningState), Optional.ToNullable(privateIPAllocationMethod)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/BastionHostIPConfiguration.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/BastionHostIPConfiguration.cs index ccf266d6cea22..b9e37799d4eac 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/BastionHostIPConfiguration.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/BastionHostIPConfiguration.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.Network.Models { /// IP configuration of an Bastion Host. - public partial class BastionHostIPConfiguration : WritableSubResource + public partial class BastionHostIPConfiguration : SubResource { /// Initializes a new instance of BastionHostIPConfiguration. public BastionHostIPConfiguration() @@ -18,7 +18,7 @@ public BastionHostIPConfiguration() } /// Initializes a new instance of BastionHostIPConfiguration. - /// The id. + /// Resource ID. /// Name of the resource that is unique within a resource group. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// Ip configuration type. @@ -26,7 +26,7 @@ public BastionHostIPConfiguration() /// Reference of the PublicIP resource. /// The provisioning state of the bastion host IP configuration resource. /// Private IP allocation method. - internal BastionHostIPConfiguration(string id, string name, string etag, string type, SubResource subnet, SubResource publicIPAddress, ProvisioningState? provisioningState, IPAllocationMethod? privateIPAllocationMethod) : base(id) + internal BastionHostIPConfiguration(string id, string name, string etag, string type, WritableSubResource subnet, WritableSubResource publicIPAddress, ProvisioningState? provisioningState, IPAllocationMethod? privateIPAllocationMethod) : base(id) { Name = name; Etag = etag; @@ -44,9 +44,9 @@ internal BastionHostIPConfiguration(string id, string name, string etag, string /// Ip configuration type. public string Type { get; } /// Reference of the subnet resource. - public SubResource Subnet { get; set; } + public WritableSubResource Subnet { get; set; } /// Reference of the PublicIP resource. - public SubResource PublicIPAddress { get; set; } + public WritableSubResource PublicIPAddress { get; set; } /// The provisioning state of the bastion host IP configuration resource. public ProvisioningState? ProvisioningState { get; } /// Private IP allocation method. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/BgpConnectionData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/BgpConnectionData.Serialization.cs index df1a86f9174c9..1926bde62fb2c 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/BgpConnectionData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/BgpConnectionData.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -22,8 +21,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(PeerAsn)) @@ -45,7 +47,7 @@ internal static BgpConnectionData DeserializeBgpConnectionData(JsonElement eleme Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional peerAsn = default; Optional peerIp = default; Optional provisioningState = default; @@ -120,7 +122,7 @@ internal static BgpConnectionData DeserializeBgpConnectionData(JsonElement eleme continue; } } - return new BgpConnectionData(id, name.Value, etag.Value, type.Value, Optional.ToNullable(peerAsn), peerIp.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(connectionState)); + return new BgpConnectionData(id.Value, name.Value, etag.Value, type.Value, Optional.ToNullable(peerAsn), peerIp.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(connectionState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/BgpServiceCommunity.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/BgpServiceCommunity.Serialization.cs index c7269473b706f..f6b6c9a251518 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/BgpServiceCommunity.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/BgpServiceCommunity.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -17,6 +16,11 @@ public partial class BgpServiceCommunity : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -33,8 +37,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(ServiceName)) @@ -58,15 +60,20 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static BgpServiceCommunity DeserializeBgpServiceCommunity(JsonElement element) { + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional serviceName = default; Optional> bgpCommunities = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -97,11 +104,6 @@ internal static BgpServiceCommunity DeserializeBgpServiceCommunity(JsonElement e tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -135,7 +137,7 @@ internal static BgpServiceCommunity DeserializeBgpServiceCommunity(JsonElement e continue; } } - return new BgpServiceCommunity(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), serviceName.Value, Optional.ToList(bgpCommunities)); + return new BgpServiceCommunity(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), serviceName.Value, Optional.ToList(bgpCommunities)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/BgpServiceCommunity.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/BgpServiceCommunity.cs index c6fddee314afd..a5ba66c7208f9 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/BgpServiceCommunity.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/BgpServiceCommunity.cs @@ -20,7 +20,7 @@ public BgpServiceCommunity() } /// Initializes a new instance of BgpServiceCommunity. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ConnectionSharedKey.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ConnectionSharedKey.Serialization.cs index b4c4be6567795..4625648d6f69f 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ConnectionSharedKey.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ConnectionSharedKey.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -18,15 +17,18 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartObject(); writer.WritePropertyName("value"); writer.WriteStringValue(Value); - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WriteEndObject(); } internal static ConnectionSharedKey DeserializeConnectionSharedKey(JsonElement element) { string value = default; - ResourceIdentifier id = default; + Optional id = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("value")) @@ -40,7 +42,7 @@ internal static ConnectionSharedKey DeserializeConnectionSharedKey(JsonElement e continue; } } - return new ConnectionSharedKey(id, value); + return new ConnectionSharedKey(id.Value, value); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ConnectionSharedKey.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ConnectionSharedKey.cs index 45c7e2ea35355..6e23fba3c6b42 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ConnectionSharedKey.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ConnectionSharedKey.cs @@ -6,12 +6,11 @@ #nullable disable using System; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { /// Response for GetConnectionSharedKey API service call. - public partial class ConnectionSharedKey : WritableSubResource + public partial class ConnectionSharedKey : SubResource { /// Initializes a new instance of ConnectionSharedKey. /// The virtual network connection shared key value. @@ -27,7 +26,7 @@ public ConnectionSharedKey(string value) } /// Initializes a new instance of ConnectionSharedKey. - /// The id. + /// Resource ID. /// The virtual network connection shared key value. internal ConnectionSharedKey(string id, string value) : base(id) { diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ConnectivityHop.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ConnectivityHop.Serialization.cs index 475c7d44fb24f..d829b3634e074 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ConnectivityHop.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ConnectivityHop.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -17,6 +16,7 @@ public partial class ConnectivityHop internal static ConnectivityHop DeserializeConnectivityHop(JsonElement element) { Optional type = default; + Optional id = default; Optional address = default; Optional resourceId = default; Optional> nextHopIds = default; @@ -24,7 +24,6 @@ internal static ConnectivityHop DeserializeConnectivityHop(JsonElement element) Optional> links = default; Optional> previousLinks = default; Optional> issues = default; - ResourceIdentifier id = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("type")) @@ -32,6 +31,11 @@ internal static ConnectivityHop DeserializeConnectivityHop(JsonElement element) type = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("address")) { address = property.Value.GetString(); @@ -117,13 +121,8 @@ internal static ConnectivityHop DeserializeConnectivityHop(JsonElement element) issues = array; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } } - return new ConnectivityHop(id, type.Value, address.Value, resourceId.Value, Optional.ToList(nextHopIds), Optional.ToList(previousHopIds), Optional.ToList(links), Optional.ToList(previousLinks), Optional.ToList(issues)); + return new ConnectivityHop(type.Value, id.Value, address.Value, resourceId.Value, Optional.ToList(nextHopIds), Optional.ToList(previousHopIds), Optional.ToList(links), Optional.ToList(previousLinks), Optional.ToList(issues)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ConnectivityHop.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ConnectivityHop.cs index 5afadbb15dfcb..2c71b918fcea4 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ConnectivityHop.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ConnectivityHop.cs @@ -7,12 +7,11 @@ using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { /// Information about a hop between the source and the destination. - public partial class ConnectivityHop : Resources.Models.SubResource + public partial class ConnectivityHop { /// Initializes a new instance of ConnectivityHop. internal ConnectivityHop() @@ -25,8 +24,8 @@ internal ConnectivityHop() } /// Initializes a new instance of ConnectivityHop. - /// The id. /// The type of the hop. + /// The ID of the hop. /// The IP address of the hop. /// The ID of the resource corresponding to this hop. /// List of next hop identifiers. @@ -34,9 +33,10 @@ internal ConnectivityHop() /// List of hop links. /// List of previous hop links. /// List of issues. - internal ConnectivityHop(string id, string type, string address, string resourceId, IReadOnlyList nextHopIds, IReadOnlyList previousHopIds, IReadOnlyList links, IReadOnlyList previousLinks, IReadOnlyList issues) : base(id) + internal ConnectivityHop(string type, string id, string address, string resourceId, IReadOnlyList nextHopIds, IReadOnlyList previousHopIds, IReadOnlyList links, IReadOnlyList previousLinks, IReadOnlyList issues) { Type = type; + Id = id; Address = address; ResourceId = resourceId; NextHopIds = nextHopIds; @@ -48,6 +48,8 @@ internal ConnectivityHop(string id, string type, string address, string resource /// The type of the hop. public string Type { get; } + /// The ID of the hop. + public string Id { get; } /// The IP address of the hop. public string Address { get; } /// The ID of the resource corresponding to this hop. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Container.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Container.Serialization.cs deleted file mode 100644 index 15d6c3fd3d430..0000000000000 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Container.Serialization.cs +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; -using Azure.ResourceManager; - -namespace Azure.ResourceManager.Network.Models -{ - public partial class Container : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); - writer.WriteEndObject(); - } - - internal static Container DeserializeContainer(JsonElement element) - { - ResourceIdentifier id = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - } - return new Container(id); - } - } -} diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Container.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Container.cs deleted file mode 100644 index 5a11c67751d1e..0000000000000 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Container.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.ResourceManager.Resources.Models; - -namespace Azure.ResourceManager.Network.Models -{ - /// Reference to container resource in remote resource provider. - public partial class Container : WritableSubResource - { - /// Initializes a new instance of Container. - public Container() - { - } - - /// Initializes a new instance of Container. - /// The id. - internal Container(string id) : base(id) - { - } - } -} diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ContainerNetworkInterface.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ContainerNetworkInterface.Serialization.cs index 364b50e300834..21599d0527603 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ContainerNetworkInterface.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ContainerNetworkInterface.Serialization.cs @@ -8,7 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -22,14 +22,17 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Container)) { writer.WritePropertyName("container"); - writer.WriteObjectValue(Container); + JsonSerializer.Serialize(writer, Container); } writer.WriteEndObject(); writer.WriteEndObject(); @@ -40,9 +43,9 @@ internal static ContainerNetworkInterface DeserializeContainerNetworkInterface(J Optional name = default; Optional type = default; Optional etag = default; - ResourceIdentifier id = default; + Optional id = default; Optional containerNetworkInterfaceConfiguration = default; - Optional container = default; + Optional container = default; Optional> ipConfigurations = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) @@ -93,7 +96,7 @@ internal static ContainerNetworkInterface DeserializeContainerNetworkInterface(J property0.ThrowNonNullablePropertyIsNull(); continue; } - container = Container.DeserializeContainer(property0.Value); + container = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("ipConfigurations")) @@ -125,7 +128,7 @@ internal static ContainerNetworkInterface DeserializeContainerNetworkInterface(J continue; } } - return new ContainerNetworkInterface(id, name.Value, type.Value, etag.Value, containerNetworkInterfaceConfiguration.Value, container.Value, Optional.ToList(ipConfigurations), Optional.ToNullable(provisioningState)); + return new ContainerNetworkInterface(id.Value, name.Value, type.Value, etag.Value, containerNetworkInterfaceConfiguration.Value, container, Optional.ToList(ipConfigurations), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ContainerNetworkInterface.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ContainerNetworkInterface.cs index 3ae3d85470ba6..71cdbb8675481 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ContainerNetworkInterface.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ContainerNetworkInterface.cs @@ -12,7 +12,7 @@ namespace Azure.ResourceManager.Network.Models { /// Container network interface child resource. - public partial class ContainerNetworkInterface : WritableSubResource + public partial class ContainerNetworkInterface : SubResource { /// Initializes a new instance of ContainerNetworkInterface. public ContainerNetworkInterface() @@ -21,7 +21,7 @@ public ContainerNetworkInterface() } /// Initializes a new instance of ContainerNetworkInterface. - /// The id. + /// Resource ID. /// The name of the resource. This name can be used to access the resource. /// Sub Resource type. /// A unique read-only string that changes whenever the resource is updated. @@ -29,7 +29,7 @@ public ContainerNetworkInterface() /// Reference to the container to which this container network interface is attached. /// Reference to the ip configuration on this container nic. /// The provisioning state of the container network interface resource. - internal ContainerNetworkInterface(string id, string name, string type, string etag, ContainerNetworkInterfaceConfiguration containerNetworkInterfaceConfiguration, Container container, IReadOnlyList ipConfigurations, ProvisioningState? provisioningState) : base(id) + internal ContainerNetworkInterface(string id, string name, string type, string etag, ContainerNetworkInterfaceConfiguration containerNetworkInterfaceConfiguration, WritableSubResource container, IReadOnlyList ipConfigurations, ProvisioningState? provisioningState) : base(id) { Name = name; Type = type; @@ -49,7 +49,7 @@ internal ContainerNetworkInterface(string id, string name, string type, string e /// Container network interface configuration from which this container network interface is created. public ContainerNetworkInterfaceConfiguration ContainerNetworkInterfaceConfiguration { get; } /// Reference to the container to which this container network interface is attached. - public Container Container { get; set; } + public WritableSubResource Container { get; set; } /// Reference to the ip configuration on this container nic. public IReadOnlyList IpConfigurations { get; } /// The provisioning state of the container network interface resource. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ContainerNetworkInterfaceConfiguration.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ContainerNetworkInterfaceConfiguration.Serialization.cs index f2509bede38cf..5fd9067839e68 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ContainerNetworkInterfaceConfiguration.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ContainerNetworkInterfaceConfiguration.Serialization.cs @@ -8,7 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -22,8 +22,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsCollectionDefined(IpConfigurations)) @@ -42,7 +45,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in ContainerNetworkInterfaces) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } @@ -55,9 +58,9 @@ internal static ContainerNetworkInterfaceConfiguration DeserializeContainerNetwo Optional name = default; Optional type = default; Optional etag = default; - ResourceIdentifier id = default; + Optional id = default; Optional> ipConfigurations = default; - Optional> containerNetworkInterfaces = default; + Optional> containerNetworkInterfaces = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) { @@ -112,10 +115,10 @@ internal static ContainerNetworkInterfaceConfiguration DeserializeContainerNetwo property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } containerNetworkInterfaces = array; continue; @@ -134,7 +137,7 @@ internal static ContainerNetworkInterfaceConfiguration DeserializeContainerNetwo continue; } } - return new ContainerNetworkInterfaceConfiguration(id, name.Value, type.Value, etag.Value, Optional.ToList(ipConfigurations), Optional.ToList(containerNetworkInterfaces), Optional.ToNullable(provisioningState)); + return new ContainerNetworkInterfaceConfiguration(id.Value, name.Value, type.Value, etag.Value, Optional.ToList(ipConfigurations), Optional.ToList(containerNetworkInterfaces), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ContainerNetworkInterfaceConfiguration.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ContainerNetworkInterfaceConfiguration.cs index 24cd395d3b147..03604278270d3 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ContainerNetworkInterfaceConfiguration.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ContainerNetworkInterfaceConfiguration.cs @@ -12,24 +12,24 @@ namespace Azure.ResourceManager.Network.Models { /// Container network interface configuration child resource. - public partial class ContainerNetworkInterfaceConfiguration : WritableSubResource + public partial class ContainerNetworkInterfaceConfiguration : SubResource { /// Initializes a new instance of ContainerNetworkInterfaceConfiguration. public ContainerNetworkInterfaceConfiguration() { IpConfigurations = new ChangeTrackingList(); - ContainerNetworkInterfaces = new ChangeTrackingList(); + ContainerNetworkInterfaces = new ChangeTrackingList(); } /// Initializes a new instance of ContainerNetworkInterfaceConfiguration. - /// The id. + /// Resource ID. /// The name of the resource. This name can be used to access the resource. /// Sub Resource type. /// A unique read-only string that changes whenever the resource is updated. /// A list of ip configurations of the container network interface configuration. /// A list of container network interfaces created from this container network interface configuration. /// The provisioning state of the container network interface configuration resource. - internal ContainerNetworkInterfaceConfiguration(string id, string name, string type, string etag, IList ipConfigurations, IList containerNetworkInterfaces, ProvisioningState? provisioningState) : base(id) + internal ContainerNetworkInterfaceConfiguration(string id, string name, string type, string etag, IList ipConfigurations, IList containerNetworkInterfaces, ProvisioningState? provisioningState) : base(id) { Name = name; Type = type; @@ -48,7 +48,7 @@ internal ContainerNetworkInterfaceConfiguration(string id, string name, string t /// A list of ip configurations of the container network interface configuration. public IList IpConfigurations { get; } /// A list of container network interfaces created from this container network interface configuration. - public IList ContainerNetworkInterfaces { get; } + public IList ContainerNetworkInterfaces { get; } /// The provisioning state of the container network interface configuration resource. public ProvisioningState? ProvisioningState { get; } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/CustomIpPrefixData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/CustomIpPrefixData.Serialization.cs index 1f1872f6a6e2c..d0321fae36b3d 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/CustomIpPrefixData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/CustomIpPrefixData.Serialization.cs @@ -8,8 +8,8 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -33,6 +33,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -49,8 +54,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Cidr)) @@ -87,18 +90,18 @@ internal static CustomIpPrefixData DeserializeCustomIpPrefixData(JsonElement ele Optional extendedLocation = default; Optional etag = default; Optional> zones = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional cidr = default; Optional signedMessage = default; Optional authorizationMessage = default; Optional customIpPrefixParent = default; Optional> childCustomIpPrefixes = default; Optional commissionedState = default; - Optional> publicIpPrefixes = default; + Optional> publicIpPrefixes = default; Optional resourceGuid = default; Optional failedReason = default; Optional provisioningState = default; @@ -134,6 +137,11 @@ internal static CustomIpPrefixData DeserializeCustomIpPrefixData(JsonElement ele zones = array; continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -164,11 +172,6 @@ internal static CustomIpPrefixData DeserializeCustomIpPrefixData(JsonElement ele tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -235,10 +238,10 @@ internal static CustomIpPrefixData DeserializeCustomIpPrefixData(JsonElement ele property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } publicIpPrefixes = array; continue; @@ -267,7 +270,7 @@ internal static CustomIpPrefixData DeserializeCustomIpPrefixData(JsonElement ele continue; } } - return new CustomIpPrefixData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), extendedLocation.Value, etag.Value, Optional.ToList(zones), cidr.Value, signedMessage.Value, authorizationMessage.Value, customIpPrefixParent.Value, Optional.ToList(childCustomIpPrefixes), Optional.ToNullable(commissionedState), Optional.ToList(publicIpPrefixes), resourceGuid.Value, failedReason.Value, Optional.ToNullable(provisioningState)); + return new CustomIpPrefixData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), extendedLocation.Value, etag.Value, Optional.ToList(zones), cidr.Value, signedMessage.Value, authorizationMessage.Value, customIpPrefixParent.Value, Optional.ToList(childCustomIpPrefixes), Optional.ToNullable(commissionedState), Optional.ToList(publicIpPrefixes), resourceGuid.Value, failedReason.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/DdosCustomPolicyData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/DdosCustomPolicyData.Serialization.cs index e077a087a5581..ec0ae33be2e15 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/DdosCustomPolicyData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/DdosCustomPolicyData.Serialization.cs @@ -8,8 +8,8 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -18,6 +18,11 @@ public partial class DdosCustomPolicyData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -34,8 +39,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsCollectionDefined(ProtocolCustomSettings)) @@ -55,14 +58,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static DdosCustomPolicyData DeserializeDdosCustomPolicyData(JsonElement element) { Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional resourceGuid = default; Optional provisioningState = default; - Optional> publicIPAddresses = default; + Optional> publicIPAddresses = default; Optional> protocolCustomSettings = default; foreach (var property in element.EnumerateObject()) { @@ -71,6 +74,11 @@ internal static DdosCustomPolicyData DeserializeDdosCustomPolicyData(JsonElement etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -101,11 +109,6 @@ internal static DdosCustomPolicyData DeserializeDdosCustomPolicyData(JsonElement tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -137,10 +140,10 @@ internal static DdosCustomPolicyData DeserializeDdosCustomPolicyData(JsonElement property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } publicIPAddresses = array; continue; @@ -164,7 +167,7 @@ internal static DdosCustomPolicyData DeserializeDdosCustomPolicyData(JsonElement continue; } } - return new DdosCustomPolicyData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, resourceGuid.Value, Optional.ToNullable(provisioningState), Optional.ToList(publicIPAddresses), Optional.ToList(protocolCustomSettings)); + return new DdosCustomPolicyData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, resourceGuid.Value, Optional.ToNullable(provisioningState), Optional.ToList(publicIPAddresses), Optional.ToList(protocolCustomSettings)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/DdosProtectionPlanData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/DdosProtectionPlanData.Serialization.cs index 3e123afc7c128..ace158b4fca54 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/DdosProtectionPlanData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/DdosProtectionPlanData.Serialization.cs @@ -45,7 +45,7 @@ internal static DdosProtectionPlanData DeserializeDdosProtectionPlanData(JsonEle ResourceType type = default; Optional resourceGuid = default; Optional provisioningState = default; - Optional> virtualNetworks = default; + Optional> virtualNetworks = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag")) @@ -114,10 +114,10 @@ internal static DdosProtectionPlanData DeserializeDdosProtectionPlanData(JsonEle property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(Models.SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } virtualNetworks = array; continue; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/DdosSettings.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/DdosSettings.Serialization.cs index a326d5aade73e..29a4cdf36f4bd 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/DdosSettings.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/DdosSettings.Serialization.cs @@ -7,6 +7,7 @@ using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -18,7 +19,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DdosCustomPolicy)) { writer.WritePropertyName("ddosCustomPolicy"); - writer.WriteObjectValue(DdosCustomPolicy); + JsonSerializer.Serialize(writer, DdosCustomPolicy); } if (Optional.IsDefined(ProtectionCoverage)) { @@ -35,7 +36,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static DdosSettings DeserializeDdosSettings(JsonElement element) { - Optional ddosCustomPolicy = default; + Optional ddosCustomPolicy = default; Optional protectionCoverage = default; Optional protectedIP = default; foreach (var property in element.EnumerateObject()) @@ -47,7 +48,7 @@ internal static DdosSettings DeserializeDdosSettings(JsonElement element) property.ThrowNonNullablePropertyIsNull(); continue; } - ddosCustomPolicy = SubResource.DeserializeSubResource(property.Value); + ddosCustomPolicy = JsonSerializer.Deserialize(property.Value.ToString()); continue; } if (property.NameEquals("protectionCoverage")) @@ -71,7 +72,7 @@ internal static DdosSettings DeserializeDdosSettings(JsonElement element) continue; } } - return new DdosSettings(ddosCustomPolicy.Value, Optional.ToNullable(protectionCoverage), Optional.ToNullable(protectedIP)); + return new DdosSettings(ddosCustomPolicy, Optional.ToNullable(protectionCoverage), Optional.ToNullable(protectedIP)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/DdosSettings.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/DdosSettings.cs index bf61d93a42a63..3c9c7c57bf740 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/DdosSettings.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/DdosSettings.cs @@ -5,6 +5,8 @@ #nullable disable +using Azure.ResourceManager.Resources.Models; + namespace Azure.ResourceManager.Network.Models { /// Contains the DDoS protection settings of the public IP. @@ -19,7 +21,7 @@ public DdosSettings() /// The DDoS custom policy associated with the public IP. /// The DDoS protection policy customizability of the public IP. Only standard coverage will have the ability to be customized. /// Enables DDoS protection on the public IP. - internal DdosSettings(SubResource ddosCustomPolicy, DdosSettingsProtectionCoverage? protectionCoverage, bool? protectedIP) + internal DdosSettings(WritableSubResource ddosCustomPolicy, DdosSettingsProtectionCoverage? protectionCoverage, bool? protectedIP) { DdosCustomPolicy = ddosCustomPolicy; ProtectionCoverage = protectionCoverage; @@ -27,7 +29,7 @@ internal DdosSettings(SubResource ddosCustomPolicy, DdosSettingsProtectionCovera } /// The DDoS custom policy associated with the public IP. - public SubResource DdosCustomPolicy { get; set; } + public WritableSubResource DdosCustomPolicy { get; set; } /// The DDoS protection policy customizability of the public IP. Only standard coverage will have the ability to be customized. public DdosSettingsProtectionCoverage? ProtectionCoverage { get; set; } /// Enables DDoS protection on the public IP. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Delegation.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Delegation.Serialization.cs index 74bc8485863d0..8f12efe235d82 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Delegation.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Delegation.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -27,8 +26,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("type"); writer.WriteStringValue(Type); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(ServiceName)) @@ -45,7 +47,7 @@ internal static Delegation DeserializeDelegation(JsonElement element) Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional serviceName = default; Optional> actions = default; Optional provisioningState = default; @@ -114,7 +116,7 @@ internal static Delegation DeserializeDelegation(JsonElement element) continue; } } - return new Delegation(id, name.Value, etag.Value, type.Value, serviceName.Value, Optional.ToList(actions), Optional.ToNullable(provisioningState)); + return new Delegation(id.Value, name.Value, etag.Value, type.Value, serviceName.Value, Optional.ToList(actions), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Delegation.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Delegation.cs index 2cd9da6ddad72..6592f29f762fc 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Delegation.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Delegation.cs @@ -7,12 +7,11 @@ using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { /// Details the service to which the subnet is delegated. - public partial class Delegation : WritableSubResource + public partial class Delegation : SubResource { /// Initializes a new instance of Delegation. public Delegation() @@ -21,7 +20,7 @@ public Delegation() } /// Initializes a new instance of Delegation. - /// The id. + /// Resource ID. /// The name of the resource that is unique within a subnet. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// Resource type. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/DscpConfigurationData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/DscpConfigurationData.Serialization.cs index d50bb2dca15ed..eb683b55f2f49 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/DscpConfigurationData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/DscpConfigurationData.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -18,6 +17,11 @@ public partial class DscpConfigurationData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -34,8 +38,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsCollectionDefined(Markings)) @@ -100,11 +102,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static DscpConfigurationData DeserializeDscpConfigurationData(JsonElement element) { Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional> markings = default; Optional> sourceIpRanges = default; Optional> destinationIpRanges = default; @@ -122,6 +124,11 @@ internal static DscpConfigurationData DeserializeDscpConfigurationData(JsonEleme etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -152,11 +159,6 @@ internal static DscpConfigurationData DeserializeDscpConfigurationData(JsonEleme tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -290,7 +292,7 @@ internal static DscpConfigurationData DeserializeDscpConfigurationData(JsonEleme continue; } } - return new DscpConfigurationData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, Optional.ToList(markings), Optional.ToList(sourceIpRanges), Optional.ToList(destinationIpRanges), Optional.ToList(sourcePortRanges), Optional.ToList(destinationPortRanges), Optional.ToNullable(protocol), qosCollectionId.Value, Optional.ToList(associatedNetworkInterfaces), resourceGuid.Value, Optional.ToNullable(provisioningState)); + return new DscpConfigurationData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, Optional.ToList(markings), Optional.ToList(sourceIpRanges), Optional.ToList(destinationIpRanges), Optional.ToList(sourcePortRanges), Optional.ToList(destinationPortRanges), Optional.ToNullable(protocol), qosCollectionId.Value, Optional.ToList(associatedNetworkInterfaces), resourceGuid.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/EffectiveNetworkSecurityGroup.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/EffectiveNetworkSecurityGroup.Serialization.cs index 182557bfc165a..315e9e9d34479 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/EffectiveNetworkSecurityGroup.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/EffectiveNetworkSecurityGroup.Serialization.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -15,7 +16,7 @@ public partial class EffectiveNetworkSecurityGroup { internal static EffectiveNetworkSecurityGroup DeserializeEffectiveNetworkSecurityGroup(JsonElement element) { - Optional networkSecurityGroup = default; + Optional networkSecurityGroup = default; Optional association = default; Optional> effectiveSecurityRules = default; Optional tagMap = default; @@ -28,7 +29,7 @@ internal static EffectiveNetworkSecurityGroup DeserializeEffectiveNetworkSecurit property.ThrowNonNullablePropertyIsNull(); continue; } - networkSecurityGroup = SubResource.DeserializeSubResource(property.Value); + networkSecurityGroup = JsonSerializer.Deserialize(property.Value.ToString()); continue; } if (property.NameEquals("association")) @@ -62,7 +63,7 @@ internal static EffectiveNetworkSecurityGroup DeserializeEffectiveNetworkSecurit continue; } } - return new EffectiveNetworkSecurityGroup(networkSecurityGroup.Value, association.Value, Optional.ToList(effectiveSecurityRules), tagMap.Value); + return new EffectiveNetworkSecurityGroup(networkSecurityGroup, association.Value, Optional.ToList(effectiveSecurityRules), tagMap.Value); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/EffectiveNetworkSecurityGroup.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/EffectiveNetworkSecurityGroup.cs index e327682073726..97f72cf501684 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/EffectiveNetworkSecurityGroup.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/EffectiveNetworkSecurityGroup.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -24,7 +25,7 @@ internal EffectiveNetworkSecurityGroup() /// Associated resources. /// A collection of effective security rules. /// Mapping of tags to list of IP Addresses included within the tag. - internal EffectiveNetworkSecurityGroup(SubResource networkSecurityGroup, EffectiveNetworkSecurityGroupAssociation association, IReadOnlyList effectiveSecurityRules, string tagMap) + internal EffectiveNetworkSecurityGroup(WritableSubResource networkSecurityGroup, EffectiveNetworkSecurityGroupAssociation association, IReadOnlyList effectiveSecurityRules, string tagMap) { NetworkSecurityGroup = networkSecurityGroup; Association = association; @@ -33,7 +34,7 @@ internal EffectiveNetworkSecurityGroup(SubResource networkSecurityGroup, Effecti } /// The ID of network security group that is applied. - public SubResource NetworkSecurityGroup { get; } + public WritableSubResource NetworkSecurityGroup { get; } /// Associated resources. public EffectiveNetworkSecurityGroupAssociation Association { get; } /// A collection of effective security rules. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/EffectiveNetworkSecurityGroupAssociation.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/EffectiveNetworkSecurityGroupAssociation.Serialization.cs index 4099c3339fc1f..d9e2a73a196c9 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/EffectiveNetworkSecurityGroupAssociation.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/EffectiveNetworkSecurityGroupAssociation.Serialization.cs @@ -7,6 +7,7 @@ using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -14,9 +15,9 @@ public partial class EffectiveNetworkSecurityGroupAssociation { internal static EffectiveNetworkSecurityGroupAssociation DeserializeEffectiveNetworkSecurityGroupAssociation(JsonElement element) { - Optional networkManager = default; - Optional subnet = default; - Optional networkInterface = default; + Optional networkManager = default; + Optional subnet = default; + Optional networkInterface = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("networkManager")) @@ -26,7 +27,7 @@ internal static EffectiveNetworkSecurityGroupAssociation DeserializeEffectiveNet property.ThrowNonNullablePropertyIsNull(); continue; } - networkManager = SubResource.DeserializeSubResource(property.Value); + networkManager = JsonSerializer.Deserialize(property.Value.ToString()); continue; } if (property.NameEquals("subnet")) @@ -36,7 +37,7 @@ internal static EffectiveNetworkSecurityGroupAssociation DeserializeEffectiveNet property.ThrowNonNullablePropertyIsNull(); continue; } - subnet = SubResource.DeserializeSubResource(property.Value); + subnet = JsonSerializer.Deserialize(property.Value.ToString()); continue; } if (property.NameEquals("networkInterface")) @@ -46,11 +47,11 @@ internal static EffectiveNetworkSecurityGroupAssociation DeserializeEffectiveNet property.ThrowNonNullablePropertyIsNull(); continue; } - networkInterface = SubResource.DeserializeSubResource(property.Value); + networkInterface = JsonSerializer.Deserialize(property.Value.ToString()); continue; } } - return new EffectiveNetworkSecurityGroupAssociation(networkManager.Value, subnet.Value, networkInterface.Value); + return new EffectiveNetworkSecurityGroupAssociation(networkManager, subnet, networkInterface); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/EffectiveNetworkSecurityGroupAssociation.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/EffectiveNetworkSecurityGroupAssociation.cs index c76a53b057f70..af344d9fddf52 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/EffectiveNetworkSecurityGroupAssociation.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/EffectiveNetworkSecurityGroupAssociation.cs @@ -5,6 +5,8 @@ #nullable disable +using Azure.ResourceManager.Resources.Models; + namespace Azure.ResourceManager.Network.Models { /// The effective network security group association. @@ -19,7 +21,7 @@ internal EffectiveNetworkSecurityGroupAssociation() /// The ID of the Azure network manager if assigned. /// The ID of the subnet if assigned. /// The ID of the network interface if assigned. - internal EffectiveNetworkSecurityGroupAssociation(SubResource networkManager, SubResource subnet, SubResource networkInterface) + internal EffectiveNetworkSecurityGroupAssociation(WritableSubResource networkManager, WritableSubResource subnet, WritableSubResource networkInterface) { NetworkManager = networkManager; Subnet = subnet; @@ -27,10 +29,10 @@ internal EffectiveNetworkSecurityGroupAssociation(SubResource networkManager, Su } /// The ID of the Azure network manager if assigned. - public SubResource NetworkManager { get; } + public WritableSubResource NetworkManager { get; } /// The ID of the subnet if assigned. - public SubResource Subnet { get; } + public WritableSubResource Subnet { get; } /// The ID of the network interface if assigned. - public SubResource NetworkInterface { get; } + public WritableSubResource NetworkInterface { get; } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/EndpointServiceResult.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/EndpointServiceResult.Serialization.cs index ab2fa866428da..b464bc3ba3fb4 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/EndpointServiceResult.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/EndpointServiceResult.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -16,8 +15,11 @@ public partial class EndpointServiceResult : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WriteEndObject(); } @@ -25,7 +27,7 @@ internal static EndpointServiceResult DeserializeEndpointServiceResult(JsonEleme { Optional name = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) @@ -44,7 +46,7 @@ internal static EndpointServiceResult DeserializeEndpointServiceResult(JsonEleme continue; } } - return new EndpointServiceResult(id, name.Value, type.Value); + return new EndpointServiceResult(id.Value, name.Value, type.Value); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/EndpointServiceResult.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/EndpointServiceResult.cs index 78e7f31f182ce..8c6c0437d6fc9 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/EndpointServiceResult.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/EndpointServiceResult.cs @@ -5,12 +5,10 @@ #nullable disable -using Azure.ResourceManager.Resources.Models; - namespace Azure.ResourceManager.Network.Models { /// Endpoint service. - public partial class EndpointServiceResult : WritableSubResource + public partial class EndpointServiceResult : SubResource { /// Initializes a new instance of EndpointServiceResult. public EndpointServiceResult() @@ -18,7 +16,7 @@ public EndpointServiceResult() } /// Initializes a new instance of EndpointServiceResult. - /// The id. + /// Resource ID. /// Name of the endpoint service. /// Type of the endpoint service. internal EndpointServiceResult(string id, string name, string type) : base(id) diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCircuitAuthorizationData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCircuitAuthorizationData.Serialization.cs index 32660164d7a8f..d118a5b30a7d4 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCircuitAuthorizationData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCircuitAuthorizationData.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -22,8 +21,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(AuthorizationKey)) @@ -45,7 +47,7 @@ internal static ExpressRouteCircuitAuthorizationData DeserializeExpressRouteCirc Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional authorizationKey = default; Optional authorizationUseStatus = default; Optional provisioningState = default; @@ -109,7 +111,7 @@ internal static ExpressRouteCircuitAuthorizationData DeserializeExpressRouteCirc continue; } } - return new ExpressRouteCircuitAuthorizationData(id, name.Value, etag.Value, type.Value, authorizationKey.Value, Optional.ToNullable(authorizationUseStatus), Optional.ToNullable(provisioningState)); + return new ExpressRouteCircuitAuthorizationData(id.Value, name.Value, etag.Value, type.Value, authorizationKey.Value, Optional.ToNullable(authorizationUseStatus), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCircuitConnectionData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCircuitConnectionData.Serialization.cs index c700fd42259f1..01b2ad1959961 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCircuitConnectionData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCircuitConnectionData.Serialization.cs @@ -7,8 +7,8 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -22,19 +22,22 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(ExpressRouteCircuitPeering)) { writer.WritePropertyName("expressRouteCircuitPeering"); - writer.WriteObjectValue(ExpressRouteCircuitPeering); + JsonSerializer.Serialize(writer, ExpressRouteCircuitPeering); } if (Optional.IsDefined(PeerExpressRouteCircuitPeering)) { writer.WritePropertyName("peerExpressRouteCircuitPeering"); - writer.WriteObjectValue(PeerExpressRouteCircuitPeering); + JsonSerializer.Serialize(writer, PeerExpressRouteCircuitPeering); } if (Optional.IsDefined(AddressPrefix)) { @@ -60,9 +63,9 @@ internal static ExpressRouteCircuitConnectionData DeserializeExpressRouteCircuit Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; - Optional expressRouteCircuitPeering = default; - Optional peerExpressRouteCircuitPeering = default; + Optional id = default; + Optional expressRouteCircuitPeering = default; + Optional peerExpressRouteCircuitPeering = default; Optional addressPrefix = default; Optional authorizationKey = default; Optional ipv6CircuitConnectionConfig = default; @@ -106,7 +109,7 @@ internal static ExpressRouteCircuitConnectionData DeserializeExpressRouteCircuit property0.ThrowNonNullablePropertyIsNull(); continue; } - expressRouteCircuitPeering = SubResource.DeserializeSubResource(property0.Value); + expressRouteCircuitPeering = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("peerExpressRouteCircuitPeering")) @@ -116,7 +119,7 @@ internal static ExpressRouteCircuitConnectionData DeserializeExpressRouteCircuit property0.ThrowNonNullablePropertyIsNull(); continue; } - peerExpressRouteCircuitPeering = SubResource.DeserializeSubResource(property0.Value); + peerExpressRouteCircuitPeering = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("addressPrefix")) @@ -163,7 +166,7 @@ internal static ExpressRouteCircuitConnectionData DeserializeExpressRouteCircuit continue; } } - return new ExpressRouteCircuitConnectionData(id, name.Value, etag.Value, type.Value, expressRouteCircuitPeering.Value, peerExpressRouteCircuitPeering.Value, addressPrefix.Value, authorizationKey.Value, ipv6CircuitConnectionConfig.Value, Optional.ToNullable(circuitConnectionStatus), Optional.ToNullable(provisioningState)); + return new ExpressRouteCircuitConnectionData(id.Value, name.Value, etag.Value, type.Value, expressRouteCircuitPeering, peerExpressRouteCircuitPeering, addressPrefix.Value, authorizationKey.Value, ipv6CircuitConnectionConfig.Value, Optional.ToNullable(circuitConnectionStatus), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCircuitData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCircuitData.Serialization.cs index 34aeadb6ce905..9c9f406271da5 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCircuitData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCircuitData.Serialization.cs @@ -8,8 +8,8 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -23,6 +23,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("sku"); writer.WriteObjectValue(Sku); } + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -39,8 +44,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(AllowClassicOperations)) @@ -96,7 +99,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ExpressRoutePort)) { writer.WritePropertyName("expressRoutePort"); - writer.WriteObjectValue(ExpressRoutePort); + JsonSerializer.Serialize(writer, ExpressRoutePort); } if (Optional.IsDefined(BandwidthInGbps)) { @@ -121,11 +124,11 @@ internal static ExpressRouteCircuitData DeserializeExpressRouteCircuitData(JsonE { Optional sku = default; Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional allowClassicOperations = default; Optional circuitProvisioningState = default; Optional serviceProviderProvisioningState = default; @@ -134,7 +137,7 @@ internal static ExpressRouteCircuitData DeserializeExpressRouteCircuitData(JsonE Optional serviceKey = default; Optional serviceProviderNotes = default; Optional serviceProviderProperties = default; - Optional expressRoutePort = default; + Optional expressRoutePort = default; Optional bandwidthInGbps = default; Optional stag = default; Optional provisioningState = default; @@ -157,6 +160,11 @@ internal static ExpressRouteCircuitData DeserializeExpressRouteCircuitData(JsonE etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -187,11 +195,6 @@ internal static ExpressRouteCircuitData DeserializeExpressRouteCircuitData(JsonE tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -283,7 +286,7 @@ internal static ExpressRouteCircuitData DeserializeExpressRouteCircuitData(JsonE property0.ThrowNonNullablePropertyIsNull(); continue; } - expressRoutePort = SubResource.DeserializeSubResource(property0.Value); + expressRoutePort = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("bandwidthInGbps")) @@ -335,7 +338,7 @@ internal static ExpressRouteCircuitData DeserializeExpressRouteCircuitData(JsonE continue; } } - return new ExpressRouteCircuitData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), sku.Value, etag.Value, Optional.ToNullable(allowClassicOperations), circuitProvisioningState.Value, Optional.ToNullable(serviceProviderProvisioningState), Optional.ToList(authorizations), Optional.ToList(peerings), serviceKey.Value, serviceProviderNotes.Value, serviceProviderProperties.Value, expressRoutePort.Value, Optional.ToNullable(bandwidthInGbps), Optional.ToNullable(stag), Optional.ToNullable(provisioningState), gatewayManagerEtag.Value, Optional.ToNullable(globalReachEnabled)); + return new ExpressRouteCircuitData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), sku.Value, etag.Value, Optional.ToNullable(allowClassicOperations), circuitProvisioningState.Value, Optional.ToNullable(serviceProviderProvisioningState), Optional.ToList(authorizations), Optional.ToList(peerings), serviceKey.Value, serviceProviderNotes.Value, serviceProviderProperties.Value, expressRoutePort, Optional.ToNullable(bandwidthInGbps), Optional.ToNullable(stag), Optional.ToNullable(provisioningState), gatewayManagerEtag.Value, Optional.ToNullable(globalReachEnabled)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCircuitPeeringData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCircuitPeeringData.Serialization.cs index c79976c46ffdc..996f8d8dd88ad 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCircuitPeeringData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCircuitPeeringData.Serialization.cs @@ -8,8 +8,8 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -23,8 +23,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(PeeringType)) @@ -95,7 +98,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RouteFilter)) { writer.WritePropertyName("routeFilter"); - writer.WriteObjectValue(RouteFilter); + JsonSerializer.Serialize(writer, RouteFilter); } if (Optional.IsDefined(Ipv6PeeringConfig)) { @@ -105,7 +108,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(ExpressRouteConnection)) { writer.WritePropertyName("expressRouteConnection"); - writer.WriteObjectValue(ExpressRouteConnection); + JsonSerializer.Serialize(writer, ExpressRouteConnection); } if (Optional.IsCollectionDefined(Connections)) { @@ -126,7 +129,7 @@ internal static ExpressRouteCircuitPeeringData DeserializeExpressRouteCircuitPee Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional peeringType = default; Optional state = default; Optional azureASN = default; @@ -142,9 +145,9 @@ internal static ExpressRouteCircuitPeeringData DeserializeExpressRouteCircuitPee Optional provisioningState = default; Optional gatewayManagerEtag = default; Optional lastModifiedBy = default; - Optional routeFilter = default; + Optional routeFilter = default; Optional ipv6PeeringConfig = default; - Optional expressRouteConnection = default; + Optional expressRouteConnection = default; Optional> connections = default; Optional> peeredConnections = default; foreach (var property in element.EnumerateObject()) @@ -300,7 +303,7 @@ internal static ExpressRouteCircuitPeeringData DeserializeExpressRouteCircuitPee property0.ThrowNonNullablePropertyIsNull(); continue; } - routeFilter = SubResource.DeserializeSubResource(property0.Value); + routeFilter = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("ipv6PeeringConfig")) @@ -320,7 +323,7 @@ internal static ExpressRouteCircuitPeeringData DeserializeExpressRouteCircuitPee property0.ThrowNonNullablePropertyIsNull(); continue; } - expressRouteConnection = ExpressRouteConnectionId.DeserializeExpressRouteConnectionId(property0.Value); + expressRouteConnection = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("connections")) @@ -357,7 +360,7 @@ internal static ExpressRouteCircuitPeeringData DeserializeExpressRouteCircuitPee continue; } } - return new ExpressRouteCircuitPeeringData(id, name.Value, etag.Value, type.Value, Optional.ToNullable(peeringType), Optional.ToNullable(state), Optional.ToNullable(azureASN), Optional.ToNullable(peerASN), primaryPeerAddressPrefix.Value, secondaryPeerAddressPrefix.Value, primaryAzurePort.Value, secondaryAzurePort.Value, sharedKey.Value, Optional.ToNullable(vlanId), microsoftPeeringConfig.Value, stats.Value, Optional.ToNullable(provisioningState), gatewayManagerEtag.Value, lastModifiedBy.Value, routeFilter.Value, ipv6PeeringConfig.Value, expressRouteConnection.Value, Optional.ToList(connections), Optional.ToList(peeredConnections)); + return new ExpressRouteCircuitPeeringData(id.Value, name.Value, etag.Value, type.Value, Optional.ToNullable(peeringType), Optional.ToNullable(state), Optional.ToNullable(azureASN), Optional.ToNullable(peerASN), primaryPeerAddressPrefix.Value, secondaryPeerAddressPrefix.Value, primaryAzurePort.Value, secondaryAzurePort.Value, sharedKey.Value, Optional.ToNullable(vlanId), microsoftPeeringConfig.Value, stats.Value, Optional.ToNullable(provisioningState), gatewayManagerEtag.Value, lastModifiedBy.Value, routeFilter, ipv6PeeringConfig.Value, expressRouteConnection, Optional.ToList(connections), Optional.ToList(peeredConnections)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCircuitPeeringId.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCircuitPeeringId.Serialization.cs deleted file mode 100644 index 498c0f7d245cd..0000000000000 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCircuitPeeringId.Serialization.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Network.Models -{ - public partial class ExpressRouteCircuitPeeringId : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(Id)) - { - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); - } - writer.WriteEndObject(); - } - - internal static ExpressRouteCircuitPeeringId DeserializeExpressRouteCircuitPeeringId(JsonElement element) - { - Optional id = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - } - return new ExpressRouteCircuitPeeringId(id.Value); - } - } -} diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCircuitPeeringId.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCircuitPeeringId.cs deleted file mode 100644 index 6b396a1c05eb7..0000000000000 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCircuitPeeringId.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Network.Models -{ - /// ExpressRoute circuit peering identifier. - public partial class ExpressRouteCircuitPeeringId - { - /// Initializes a new instance of ExpressRouteCircuitPeeringId. - public ExpressRouteCircuitPeeringId() - { - } - - /// Initializes a new instance of ExpressRouteCircuitPeeringId. - /// The ID of the ExpressRoute circuit peering. - internal ExpressRouteCircuitPeeringId(string id) - { - Id = id; - } - - /// The ID of the ExpressRoute circuit peering. - public string Id { get; set; } - } -} diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCircuitReference.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCircuitReference.Serialization.cs deleted file mode 100644 index 1f1e71dc02dbc..0000000000000 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCircuitReference.Serialization.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Network.Models -{ - public partial class ExpressRouteCircuitReference : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(Id)) - { - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); - } - writer.WriteEndObject(); - } - - internal static ExpressRouteCircuitReference DeserializeExpressRouteCircuitReference(JsonElement element) - { - Optional id = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - } - return new ExpressRouteCircuitReference(id.Value); - } - } -} diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCircuitReference.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCircuitReference.cs deleted file mode 100644 index bfd7727933d0b..0000000000000 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCircuitReference.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Network.Models -{ - /// Reference to an express route circuit. - public partial class ExpressRouteCircuitReference - { - /// Initializes a new instance of ExpressRouteCircuitReference. - public ExpressRouteCircuitReference() - { - } - - /// Initializes a new instance of ExpressRouteCircuitReference. - /// Corresponding Express Route Circuit Id. - internal ExpressRouteCircuitReference(string id) - { - Id = id; - } - - /// Corresponding Express Route Circuit Id. - public string Id { get; set; } - } -} diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteConnectionData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteConnectionData.Serialization.cs index f1ae6f05b597d..b5258fdf80c69 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteConnectionData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteConnectionData.Serialization.cs @@ -7,8 +7,8 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -19,14 +19,17 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartObject(); writer.WritePropertyName("name"); writer.WriteStringValue(Name); - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(ExpressRouteCircuitPeering)) { writer.WritePropertyName("expressRouteCircuitPeering"); - writer.WriteObjectValue(ExpressRouteCircuitPeering); + JsonSerializer.Serialize(writer, ExpressRouteCircuitPeering); } if (Optional.IsDefined(AuthorizationKey)) { @@ -60,9 +63,9 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static ExpressRouteConnectionData DeserializeExpressRouteConnectionData(JsonElement element) { string name = default; - ResourceIdentifier id = default; + Optional id = default; Optional provisioningState = default; - Optional expressRouteCircuitPeering = default; + Optional expressRouteCircuitPeering = default; Optional authorizationKey = default; Optional routingWeight = default; Optional enableInternetSecurity = default; @@ -106,7 +109,7 @@ internal static ExpressRouteConnectionData DeserializeExpressRouteConnectionData property0.ThrowNonNullablePropertyIsNull(); continue; } - expressRouteCircuitPeering = ExpressRouteCircuitPeeringId.DeserializeExpressRouteCircuitPeeringId(property0.Value); + expressRouteCircuitPeering = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("authorizationKey")) @@ -158,7 +161,7 @@ internal static ExpressRouteConnectionData DeserializeExpressRouteConnectionData continue; } } - return new ExpressRouteConnectionData(id, name, Optional.ToNullable(provisioningState), expressRouteCircuitPeering.Value, authorizationKey.Value, Optional.ToNullable(routingWeight), Optional.ToNullable(enableInternetSecurity), Optional.ToNullable(expressRouteGatewayBypass), routingConfiguration.Value); + return new ExpressRouteConnectionData(id.Value, name, Optional.ToNullable(provisioningState), expressRouteCircuitPeering, authorizationKey.Value, Optional.ToNullable(routingWeight), Optional.ToNullable(enableInternetSecurity), Optional.ToNullable(expressRouteGatewayBypass), routingConfiguration.Value); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteConnectionId.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteConnectionId.Serialization.cs deleted file mode 100644 index de57dd8851a1b..0000000000000 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteConnectionId.Serialization.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Network.Models -{ - public partial class ExpressRouteConnectionId : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WriteEndObject(); - } - - internal static ExpressRouteConnectionId DeserializeExpressRouteConnectionId(JsonElement element) - { - Optional id = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - } - return new ExpressRouteConnectionId(id.Value); - } - } -} diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteConnectionId.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteConnectionId.cs deleted file mode 100644 index 859419d221fbc..0000000000000 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteConnectionId.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Network.Models -{ - /// The ID of the ExpressRouteConnection. - public partial class ExpressRouteConnectionId - { - /// Initializes a new instance of ExpressRouteConnectionId. - public ExpressRouteConnectionId() - { - } - - /// Initializes a new instance of ExpressRouteConnectionId. - /// The ID of the ExpressRouteConnection. - internal ExpressRouteConnectionId(string id) - { - Id = id; - } - - /// The ID of the ExpressRouteConnection. - public string Id { get; } - } -} diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCrossConnectionData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCrossConnectionData.Serialization.cs index b3e2e6e129c63..21c7f9971eaa1 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCrossConnectionData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCrossConnectionData.Serialization.cs @@ -8,8 +8,8 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -18,6 +18,11 @@ public partial class ExpressRouteCrossConnectionData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -34,14 +39,12 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(ExpressRouteCircuit)) { writer.WritePropertyName("expressRouteCircuit"); - writer.WriteObjectValue(ExpressRouteCircuit); + JsonSerializer.Serialize(writer, ExpressRouteCircuit); } if (Optional.IsDefined(ServiceProviderProvisioningState)) { @@ -70,17 +73,17 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static ExpressRouteCrossConnectionData DeserializeExpressRouteCrossConnectionData(JsonElement element) { Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional primaryAzurePort = default; Optional secondaryAzurePort = default; Optional sTag = default; Optional peeringLocation = default; Optional bandwidthInMbps = default; - Optional expressRouteCircuit = default; + Optional expressRouteCircuit = default; Optional serviceProviderProvisioningState = default; Optional serviceProviderNotes = default; Optional provisioningState = default; @@ -92,6 +95,11 @@ internal static ExpressRouteCrossConnectionData DeserializeExpressRouteCrossConn etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -122,11 +130,6 @@ internal static ExpressRouteCrossConnectionData DeserializeExpressRouteCrossConn tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -178,7 +181,7 @@ internal static ExpressRouteCrossConnectionData DeserializeExpressRouteCrossConn property0.ThrowNonNullablePropertyIsNull(); continue; } - expressRouteCircuit = ExpressRouteCircuitReference.DeserializeExpressRouteCircuitReference(property0.Value); + expressRouteCircuit = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("serviceProviderProvisioningState")) @@ -225,7 +228,7 @@ internal static ExpressRouteCrossConnectionData DeserializeExpressRouteCrossConn continue; } } - return new ExpressRouteCrossConnectionData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, primaryAzurePort.Value, secondaryAzurePort.Value, Optional.ToNullable(sTag), peeringLocation.Value, Optional.ToNullable(bandwidthInMbps), expressRouteCircuit.Value, Optional.ToNullable(serviceProviderProvisioningState), serviceProviderNotes.Value, Optional.ToNullable(provisioningState), Optional.ToList(peerings)); + return new ExpressRouteCrossConnectionData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, primaryAzurePort.Value, secondaryAzurePort.Value, Optional.ToNullable(sTag), peeringLocation.Value, Optional.ToNullable(bandwidthInMbps), expressRouteCircuit, Optional.ToNullable(serviceProviderProvisioningState), serviceProviderNotes.Value, Optional.ToNullable(provisioningState), Optional.ToList(peerings)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCrossConnectionPeeringData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCrossConnectionPeeringData.Serialization.cs index ad466385ae0eb..3629c301e9965 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCrossConnectionPeeringData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteCrossConnectionPeeringData.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -22,8 +21,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(PeeringType)) @@ -84,7 +86,7 @@ internal static ExpressRouteCrossConnectionPeeringData DeserializeExpressRouteCr { Optional name = default; Optional etag = default; - ResourceIdentifier id = default; + Optional id = default; Optional peeringType = default; Optional state = default; Optional azureASN = default; @@ -245,7 +247,7 @@ internal static ExpressRouteCrossConnectionPeeringData DeserializeExpressRouteCr continue; } } - return new ExpressRouteCrossConnectionPeeringData(id, name.Value, etag.Value, Optional.ToNullable(peeringType), Optional.ToNullable(state), Optional.ToNullable(azureASN), Optional.ToNullable(peerASN), primaryPeerAddressPrefix.Value, secondaryPeerAddressPrefix.Value, primaryAzurePort.Value, secondaryAzurePort.Value, sharedKey.Value, Optional.ToNullable(vlanId), microsoftPeeringConfig.Value, Optional.ToNullable(provisioningState), gatewayManagerEtag.Value, lastModifiedBy.Value, ipv6PeeringConfig.Value); + return new ExpressRouteCrossConnectionPeeringData(id.Value, name.Value, etag.Value, Optional.ToNullable(peeringType), Optional.ToNullable(state), Optional.ToNullable(azureASN), Optional.ToNullable(peerASN), primaryPeerAddressPrefix.Value, secondaryPeerAddressPrefix.Value, primaryAzurePort.Value, secondaryAzurePort.Value, sharedKey.Value, Optional.ToNullable(vlanId), microsoftPeeringConfig.Value, Optional.ToNullable(provisioningState), gatewayManagerEtag.Value, lastModifiedBy.Value, ipv6PeeringConfig.Value); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteGatewayData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteGatewayData.Serialization.cs index 6560573a3857b..e86a9c3e2f8b8 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteGatewayData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteGatewayData.Serialization.cs @@ -8,8 +8,8 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -18,6 +18,11 @@ public partial class ExpressRouteGatewayData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -34,8 +39,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(AutoScaleConfiguration)) @@ -46,7 +49,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(VirtualHub)) { writer.WritePropertyName("virtualHub"); - writer.WriteObjectValue(VirtualHub); + JsonSerializer.Serialize(writer, VirtualHub); } writer.WriteEndObject(); writer.WriteEndObject(); @@ -55,15 +58,15 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static ExpressRouteGatewayData DeserializeExpressRouteGatewayData(JsonElement element) { Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional autoScaleConfiguration = default; Optional> expressRouteConnections = default; Optional provisioningState = default; - Optional virtualHub = default; + Optional virtualHub = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag")) @@ -71,6 +74,11 @@ internal static ExpressRouteGatewayData DeserializeExpressRouteGatewayData(JsonE etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -101,11 +109,6 @@ internal static ExpressRouteGatewayData DeserializeExpressRouteGatewayData(JsonE tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -157,14 +160,14 @@ internal static ExpressRouteGatewayData DeserializeExpressRouteGatewayData(JsonE property0.ThrowNonNullablePropertyIsNull(); continue; } - virtualHub = VirtualHubId.DeserializeVirtualHubId(property0.Value); + virtualHub = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } } continue; } } - return new ExpressRouteGatewayData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, autoScaleConfiguration.Value, Optional.ToList(expressRouteConnections), Optional.ToNullable(provisioningState), virtualHub.Value); + return new ExpressRouteGatewayData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, autoScaleConfiguration.Value, Optional.ToList(expressRouteConnections), Optional.ToNullable(provisioningState), virtualHub); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteLink.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteLink.Serialization.cs index b0feee6679e1d..61f7996531b0c 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteLink.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteLink.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -21,8 +20,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(AdminState)) @@ -43,7 +45,7 @@ internal static ExpressRouteLink DeserializeExpressRouteLink(JsonElement element { Optional name = default; Optional etag = default; - ResourceIdentifier id = default; + Optional id = default; Optional routerName = default; Optional interfaceName = default; Optional patchPanelId = default; @@ -142,7 +144,7 @@ internal static ExpressRouteLink DeserializeExpressRouteLink(JsonElement element continue; } } - return new ExpressRouteLink(id, name.Value, etag.Value, routerName.Value, interfaceName.Value, patchPanelId.Value, rackId.Value, Optional.ToNullable(connectorType), Optional.ToNullable(adminState), Optional.ToNullable(provisioningState), macSecConfig.Value); + return new ExpressRouteLink(id.Value, name.Value, etag.Value, routerName.Value, interfaceName.Value, patchPanelId.Value, rackId.Value, Optional.ToNullable(connectorType), Optional.ToNullable(adminState), Optional.ToNullable(provisioningState), macSecConfig.Value); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteLink.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteLink.cs index b591467f0486e..add7c36fe24fa 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteLink.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteLink.cs @@ -5,12 +5,10 @@ #nullable disable -using Azure.ResourceManager.Resources.Models; - namespace Azure.ResourceManager.Network.Models { /// ExpressRouteLink child resource definition. - public partial class ExpressRouteLink : WritableSubResource + public partial class ExpressRouteLink : SubResource { /// Initializes a new instance of ExpressRouteLink. public ExpressRouteLink() @@ -18,7 +16,7 @@ public ExpressRouteLink() } /// Initializes a new instance of ExpressRouteLink. - /// The id. + /// Resource ID. /// Name of child port resource that is unique among child port resources of the parent. /// A unique read-only string that changes whenever the resource is updated. /// Name of Azure router associated with physical port. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRoutePortData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRoutePortData.Serialization.cs index 40a28d11f31fb..854b2ae803850 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRoutePortData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRoutePortData.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; using Azure.ResourceManager.Resources.Models; @@ -24,6 +23,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("identity"); JsonSerializer.Serialize(writer, Identity); } + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -40,8 +44,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(PeeringLocation)) @@ -77,11 +79,11 @@ internal static ExpressRoutePortData DeserializeExpressRoutePortData(JsonElement { Optional etag = default; Optional identity = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional peeringLocation = default; Optional bandwidthInGbps = default; Optional provisionedBandwidthInGbps = default; @@ -90,7 +92,7 @@ internal static ExpressRoutePortData DeserializeExpressRoutePortData(JsonElement Optional etherType = default; Optional allocationDate = default; Optional> links = default; - Optional> circuits = default; + Optional> circuits = default; Optional provisioningState = default; Optional resourceGuid = default; foreach (var property in element.EnumerateObject()) @@ -110,6 +112,11 @@ internal static ExpressRoutePortData DeserializeExpressRoutePortData(JsonElement identity = JsonSerializer.Deserialize(property.Value.ToString()); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -140,11 +147,6 @@ internal static ExpressRoutePortData DeserializeExpressRoutePortData(JsonElement tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -226,10 +228,10 @@ internal static ExpressRoutePortData DeserializeExpressRoutePortData(JsonElement property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(Models.SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } circuits = array; continue; @@ -253,7 +255,7 @@ internal static ExpressRoutePortData DeserializeExpressRoutePortData(JsonElement continue; } } - return new ExpressRoutePortData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, identity, peeringLocation.Value, Optional.ToNullable(bandwidthInGbps), Optional.ToNullable(provisionedBandwidthInGbps), mtu.Value, Optional.ToNullable(encapsulation), etherType.Value, allocationDate.Value, Optional.ToList(links), Optional.ToList(circuits), Optional.ToNullable(provisioningState), resourceGuid.Value); + return new ExpressRoutePortData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, identity, peeringLocation.Value, Optional.ToNullable(bandwidthInGbps), Optional.ToNullable(provisionedBandwidthInGbps), mtu.Value, Optional.ToNullable(encapsulation), etherType.Value, allocationDate.Value, Optional.ToList(links), Optional.ToList(circuits), Optional.ToNullable(provisioningState), resourceGuid.Value); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRoutePortsLocation.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRoutePortsLocation.Serialization.cs index 5801be47fec11..4ea6544040051 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRoutePortsLocation.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRoutePortsLocation.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -17,6 +16,11 @@ public partial class ExpressRoutePortsLocation : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -33,8 +37,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsCollectionDefined(AvailableBandwidths)) @@ -53,17 +55,22 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static ExpressRoutePortsLocation DeserializeExpressRoutePortsLocation(JsonElement element) { + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional address = default; Optional contact = default; Optional> availableBandwidths = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -94,11 +101,6 @@ internal static ExpressRoutePortsLocation DeserializeExpressRoutePortsLocation(J tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -147,7 +149,7 @@ internal static ExpressRoutePortsLocation DeserializeExpressRoutePortsLocation(J continue; } } - return new ExpressRoutePortsLocation(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), address.Value, contact.Value, Optional.ToList(availableBandwidths), Optional.ToNullable(provisioningState)); + return new ExpressRoutePortsLocation(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), address.Value, contact.Value, Optional.ToList(availableBandwidths), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRoutePortsLocation.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRoutePortsLocation.cs index e92f2af411ab0..c8e4292cc3847 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRoutePortsLocation.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRoutePortsLocation.cs @@ -20,7 +20,7 @@ public ExpressRoutePortsLocation() } /// Initializes a new instance of ExpressRoutePortsLocation. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteServiceProvider.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteServiceProvider.Serialization.cs index 3d1dcaf98f0f0..e716ad05b70f6 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteServiceProvider.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteServiceProvider.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -17,6 +16,11 @@ public partial class ExpressRouteServiceProvider : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -33,8 +37,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsCollectionDefined(PeeringLocations)) @@ -63,16 +65,21 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static ExpressRouteServiceProvider DeserializeExpressRouteServiceProvider(JsonElement element) { + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional> peeringLocations = default; Optional> bandwidthsOffered = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -103,11 +110,6 @@ internal static ExpressRouteServiceProvider DeserializeExpressRouteServiceProvid tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -161,7 +163,7 @@ internal static ExpressRouteServiceProvider DeserializeExpressRouteServiceProvid continue; } } - return new ExpressRouteServiceProvider(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), Optional.ToList(peeringLocations), Optional.ToList(bandwidthsOffered), Optional.ToNullable(provisioningState)); + return new ExpressRouteServiceProvider(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), Optional.ToList(peeringLocations), Optional.ToList(bandwidthsOffered), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteServiceProvider.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteServiceProvider.cs index 11bcb392d98de..a54af036ab122 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteServiceProvider.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ExpressRouteServiceProvider.cs @@ -21,7 +21,7 @@ public ExpressRouteServiceProvider() } /// Initializes a new instance of ExpressRouteServiceProvider. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyData.Serialization.cs index dfc0c45578200..aa89b854eed77 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyData.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; using Azure.ResourceManager.Resources.Models; @@ -24,6 +23,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("identity"); JsonSerializer.Serialize(writer, Identity); } + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -40,14 +44,12 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(BasePolicy)) { writer.WritePropertyName("basePolicy"); - writer.WriteObjectValue(BasePolicy); + JsonSerializer.Serialize(writer, BasePolicy); } if (Optional.IsDefined(ThreatIntelMode)) { @@ -97,16 +99,16 @@ internal static FirewallPolicyData DeserializeFirewallPolicyData(JsonElement ele { Optional etag = default; Optional identity = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; - Optional> ruleCollectionGroups = default; + Optional> ruleCollectionGroups = default; Optional provisioningState = default; - Optional basePolicy = default; - Optional> firewalls = default; - Optional> childPolicies = default; + Optional basePolicy = default; + Optional> firewalls = default; + Optional> childPolicies = default; Optional threatIntelMode = default; Optional threatIntelWhitelist = default; Optional insights = default; @@ -132,6 +134,11 @@ internal static FirewallPolicyData DeserializeFirewallPolicyData(JsonElement ele identity = JsonSerializer.Deserialize(property.Value.ToString()); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -162,11 +169,6 @@ internal static FirewallPolicyData DeserializeFirewallPolicyData(JsonElement ele tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -183,10 +185,10 @@ internal static FirewallPolicyData DeserializeFirewallPolicyData(JsonElement ele property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(Models.SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } ruleCollectionGroups = array; continue; @@ -208,7 +210,7 @@ internal static FirewallPolicyData DeserializeFirewallPolicyData(JsonElement ele property0.ThrowNonNullablePropertyIsNull(); continue; } - basePolicy = Models.SubResource.DeserializeSubResource(property0.Value); + basePolicy = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("firewalls")) @@ -218,10 +220,10 @@ internal static FirewallPolicyData DeserializeFirewallPolicyData(JsonElement ele property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(Models.SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } firewalls = array; continue; @@ -233,10 +235,10 @@ internal static FirewallPolicyData DeserializeFirewallPolicyData(JsonElement ele property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(Models.SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } childPolicies = array; continue; @@ -325,7 +327,7 @@ internal static FirewallPolicyData DeserializeFirewallPolicyData(JsonElement ele continue; } } - return new FirewallPolicyData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, identity, Optional.ToList(ruleCollectionGroups), Optional.ToNullable(provisioningState), basePolicy.Value, Optional.ToList(firewalls), Optional.ToList(childPolicies), Optional.ToNullable(threatIntelMode), threatIntelWhitelist.Value, insights.Value, snat.Value, dnsSettings.Value, intrusionDetection.Value, transportSecurity.Value, sku.Value); + return new FirewallPolicyData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, identity, Optional.ToList(ruleCollectionGroups), Optional.ToNullable(provisioningState), basePolicy, Optional.ToList(firewalls), Optional.ToList(childPolicies), Optional.ToNullable(threatIntelMode), threatIntelWhitelist.Value, insights.Value, snat.Value, dnsSettings.Value, intrusionDetection.Value, transportSecurity.Value, sku.Value); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyIntrusionDetectionSignatureSpecification.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyIntrusionDetectionSignatureSpecification.Serialization.cs index 96409f8ae0d5e..0fa72a0b4d01f 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyIntrusionDetectionSignatureSpecification.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyIntrusionDetectionSignatureSpecification.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -16,22 +15,30 @@ public partial class FirewallPolicyIntrusionDetectionSignatureSpecification : IU void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Mode)) { writer.WritePropertyName("mode"); writer.WriteStringValue(Mode.Value.ToString()); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WriteEndObject(); } internal static FirewallPolicyIntrusionDetectionSignatureSpecification DeserializeFirewallPolicyIntrusionDetectionSignatureSpecification(JsonElement element) { + Optional id = default; Optional mode = default; - ResourceIdentifier id = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("mode")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -42,13 +49,8 @@ internal static FirewallPolicyIntrusionDetectionSignatureSpecification Deseriali mode = new FirewallPolicyIntrusionDetectionStateType(property.Value.GetString()); continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } } - return new FirewallPolicyIntrusionDetectionSignatureSpecification(id, Optional.ToNullable(mode)); + return new FirewallPolicyIntrusionDetectionSignatureSpecification(id.Value, Optional.ToNullable(mode)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyIntrusionDetectionSignatureSpecification.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyIntrusionDetectionSignatureSpecification.cs index 5434e1b63619e..d2b915e062307 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyIntrusionDetectionSignatureSpecification.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyIntrusionDetectionSignatureSpecification.cs @@ -5,12 +5,10 @@ #nullable disable -using Azure.ResourceManager.Resources.Models; - namespace Azure.ResourceManager.Network.Models { /// Intrusion detection signatures specification states. - public partial class FirewallPolicyIntrusionDetectionSignatureSpecification : WritableSubResource + public partial class FirewallPolicyIntrusionDetectionSignatureSpecification { /// Initializes a new instance of FirewallPolicyIntrusionDetectionSignatureSpecification. public FirewallPolicyIntrusionDetectionSignatureSpecification() @@ -18,13 +16,16 @@ public FirewallPolicyIntrusionDetectionSignatureSpecification() } /// Initializes a new instance of FirewallPolicyIntrusionDetectionSignatureSpecification. - /// The id. + /// Signature id. /// The signature state. - internal FirewallPolicyIntrusionDetectionSignatureSpecification(string id, FirewallPolicyIntrusionDetectionStateType? mode) : base(id) + internal FirewallPolicyIntrusionDetectionSignatureSpecification(string id, FirewallPolicyIntrusionDetectionStateType? mode) { + Id = id; Mode = mode; } + /// Signature id. + public string Id { get; set; } /// The signature state. public FirewallPolicyIntrusionDetectionStateType? Mode { get; set; } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyLogAnalyticsResources.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyLogAnalyticsResources.Serialization.cs index 684ff0577dd3c..59f2a70b24e38 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyLogAnalyticsResources.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyLogAnalyticsResources.Serialization.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -29,7 +30,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DefaultWorkspaceId)) { writer.WritePropertyName("defaultWorkspaceId"); - writer.WriteObjectValue(DefaultWorkspaceId); + JsonSerializer.Serialize(writer, DefaultWorkspaceId); } writer.WriteEndObject(); } @@ -37,7 +38,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static FirewallPolicyLogAnalyticsResources DeserializeFirewallPolicyLogAnalyticsResources(JsonElement element) { Optional> workspaces = default; - Optional defaultWorkspaceId = default; + Optional defaultWorkspaceId = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("workspaces")) @@ -62,11 +63,11 @@ internal static FirewallPolicyLogAnalyticsResources DeserializeFirewallPolicyLog property.ThrowNonNullablePropertyIsNull(); continue; } - defaultWorkspaceId = SubResource.DeserializeSubResource(property.Value); + defaultWorkspaceId = JsonSerializer.Deserialize(property.Value.ToString()); continue; } } - return new FirewallPolicyLogAnalyticsResources(Optional.ToList(workspaces), defaultWorkspaceId.Value); + return new FirewallPolicyLogAnalyticsResources(Optional.ToList(workspaces), defaultWorkspaceId); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyLogAnalyticsResources.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyLogAnalyticsResources.cs index 55de2eefbac1c..8a10d30461487 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyLogAnalyticsResources.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyLogAnalyticsResources.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -22,7 +23,7 @@ public FirewallPolicyLogAnalyticsResources() /// Initializes a new instance of FirewallPolicyLogAnalyticsResources. /// List of workspaces for Firewall Policy Insights. /// The default workspace Id for Firewall Policy Insights. - internal FirewallPolicyLogAnalyticsResources(IList workspaces, SubResource defaultWorkspaceId) + internal FirewallPolicyLogAnalyticsResources(IList workspaces, WritableSubResource defaultWorkspaceId) { Workspaces = workspaces; DefaultWorkspaceId = defaultWorkspaceId; @@ -31,6 +32,6 @@ internal FirewallPolicyLogAnalyticsResources(IList List of workspaces for Firewall Policy Insights. public IList Workspaces { get; } /// The default workspace Id for Firewall Policy Insights. - public SubResource DefaultWorkspaceId { get; set; } + public WritableSubResource DefaultWorkspaceId { get; set; } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyLogAnalyticsWorkspace.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyLogAnalyticsWorkspace.Serialization.cs index 95ba6b72ac131..adde1aa3ca034 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyLogAnalyticsWorkspace.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyLogAnalyticsWorkspace.Serialization.cs @@ -7,6 +7,7 @@ using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -23,7 +24,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(WorkspaceId)) { writer.WritePropertyName("workspaceId"); - writer.WriteObjectValue(WorkspaceId); + JsonSerializer.Serialize(writer, WorkspaceId); } writer.WriteEndObject(); } @@ -31,7 +32,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static FirewallPolicyLogAnalyticsWorkspace DeserializeFirewallPolicyLogAnalyticsWorkspace(JsonElement element) { Optional region = default; - Optional workspaceId = default; + Optional workspaceId = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("region")) @@ -46,11 +47,11 @@ internal static FirewallPolicyLogAnalyticsWorkspace DeserializeFirewallPolicyLog property.ThrowNonNullablePropertyIsNull(); continue; } - workspaceId = SubResource.DeserializeSubResource(property.Value); + workspaceId = JsonSerializer.Deserialize(property.Value.ToString()); continue; } } - return new FirewallPolicyLogAnalyticsWorkspace(region.Value, workspaceId.Value); + return new FirewallPolicyLogAnalyticsWorkspace(region.Value, workspaceId); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyLogAnalyticsWorkspace.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyLogAnalyticsWorkspace.cs index d847be04e59b5..5c32d2683f4a6 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyLogAnalyticsWorkspace.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyLogAnalyticsWorkspace.cs @@ -5,6 +5,8 @@ #nullable disable +using Azure.ResourceManager.Resources.Models; + namespace Azure.ResourceManager.Network.Models { /// Log Analytics Workspace for Firewall Policy Insights. @@ -18,7 +20,7 @@ public FirewallPolicyLogAnalyticsWorkspace() /// Initializes a new instance of FirewallPolicyLogAnalyticsWorkspace. /// Region to configure the Workspace. /// The workspace Id for Firewall Policy Insights. - internal FirewallPolicyLogAnalyticsWorkspace(string region, SubResource workspaceId) + internal FirewallPolicyLogAnalyticsWorkspace(string region, WritableSubResource workspaceId) { Region = region; WorkspaceId = workspaceId; @@ -27,6 +29,6 @@ internal FirewallPolicyLogAnalyticsWorkspace(string region, SubResource workspac /// Region to configure the Workspace. public string Region { get; set; } /// The workspace Id for Firewall Policy Insights. - public SubResource WorkspaceId { get; set; } + public WritableSubResource WorkspaceId { get; set; } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyRuleCollectionGroupData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyRuleCollectionGroupData.Serialization.cs index 82317ec818854..cb8bac9b598f5 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyRuleCollectionGroupData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FirewallPolicyRuleCollectionGroupData.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -23,8 +22,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Priority)) @@ -51,7 +53,7 @@ internal static FirewallPolicyRuleCollectionGroupData DeserializeFirewallPolicyR Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional priority = default; Optional> ruleCollections = default; Optional provisioningState = default; @@ -125,7 +127,7 @@ internal static FirewallPolicyRuleCollectionGroupData DeserializeFirewallPolicyR continue; } } - return new FirewallPolicyRuleCollectionGroupData(id, name.Value, etag.Value, type.Value, Optional.ToNullable(priority), Optional.ToList(ruleCollections), Optional.ToNullable(provisioningState)); + return new FirewallPolicyRuleCollectionGroupData(id.Value, name.Value, etag.Value, type.Value, Optional.ToNullable(priority), Optional.ToList(ruleCollections), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FlowLogData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FlowLogData.Serialization.cs index 753283a837c58..305317f9a215d 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FlowLogData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FlowLogData.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -18,6 +17,11 @@ public partial class FlowLogData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -34,8 +38,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(TargetResourceId)) @@ -75,11 +77,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static FlowLogData DeserializeFlowLogData(JsonElement element) { Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional targetResourceId = default; Optional targetResourceGuid = default; Optional storageId = default; @@ -95,6 +97,11 @@ internal static FlowLogData DeserializeFlowLogData(JsonElement element) etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -125,11 +132,6 @@ internal static FlowLogData DeserializeFlowLogData(JsonElement element) tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -208,7 +210,7 @@ internal static FlowLogData DeserializeFlowLogData(JsonElement element) continue; } } - return new FlowLogData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, targetResourceId.Value, targetResourceGuid.Value, storageId.Value, Optional.ToNullable(enabled), retentionPolicy.Value, format.Value, flowAnalyticsConfiguration.Value, Optional.ToNullable(provisioningState)); + return new FlowLogData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, targetResourceId.Value, targetResourceGuid.Value, storageId.Value, Optional.ToNullable(enabled), retentionPolicy.Value, format.Value, flowAnalyticsConfiguration.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FrontendIPConfiguration.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FrontendIPConfiguration.Serialization.cs index 7c126e33cbca9..36e75b9cd5741 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FrontendIPConfiguration.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FrontendIPConfiguration.Serialization.cs @@ -8,8 +8,8 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -33,8 +33,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(PrivateIPAddress)) @@ -65,12 +68,12 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PublicIPPrefix)) { writer.WritePropertyName("publicIPPrefix"); - writer.WriteObjectValue(PublicIPPrefix); + JsonSerializer.Serialize(writer, PublicIPPrefix); } if (Optional.IsDefined(GatewayLoadBalancer)) { writer.WritePropertyName("gatewayLoadBalancer"); - writer.WriteObjectValue(GatewayLoadBalancer); + JsonSerializer.Serialize(writer, GatewayLoadBalancer); } writer.WriteEndObject(); writer.WriteEndObject(); @@ -82,18 +85,18 @@ internal static FrontendIPConfiguration DeserializeFrontendIPConfiguration(JsonE Optional etag = default; Optional type = default; Optional> zones = default; - ResourceIdentifier id = default; - Optional> inboundNatRules = default; - Optional> inboundNatPools = default; - Optional> outboundRules = default; - Optional> loadBalancingRules = default; + Optional id = default; + Optional> inboundNatRules = default; + Optional> inboundNatPools = default; + Optional> outboundRules = default; + Optional> loadBalancingRules = default; Optional privateIPAddress = default; Optional privateIPAllocationMethod = default; Optional privateIPAddressVersion = default; Optional subnet = default; Optional publicIPAddress = default; - Optional publicIPPrefix = default; - Optional gatewayLoadBalancer = default; + Optional publicIPPrefix = default; + Optional gatewayLoadBalancer = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) { @@ -148,10 +151,10 @@ internal static FrontendIPConfiguration DeserializeFrontendIPConfiguration(JsonE property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } inboundNatRules = array; continue; @@ -163,10 +166,10 @@ internal static FrontendIPConfiguration DeserializeFrontendIPConfiguration(JsonE property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } inboundNatPools = array; continue; @@ -178,10 +181,10 @@ internal static FrontendIPConfiguration DeserializeFrontendIPConfiguration(JsonE property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } outboundRules = array; continue; @@ -193,10 +196,10 @@ internal static FrontendIPConfiguration DeserializeFrontendIPConfiguration(JsonE property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } loadBalancingRules = array; continue; @@ -253,7 +256,7 @@ internal static FrontendIPConfiguration DeserializeFrontendIPConfiguration(JsonE property0.ThrowNonNullablePropertyIsNull(); continue; } - publicIPPrefix = SubResource.DeserializeSubResource(property0.Value); + publicIPPrefix = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("gatewayLoadBalancer")) @@ -263,7 +266,7 @@ internal static FrontendIPConfiguration DeserializeFrontendIPConfiguration(JsonE property0.ThrowNonNullablePropertyIsNull(); continue; } - gatewayLoadBalancer = SubResource.DeserializeSubResource(property0.Value); + gatewayLoadBalancer = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("provisioningState")) @@ -280,7 +283,7 @@ internal static FrontendIPConfiguration DeserializeFrontendIPConfiguration(JsonE continue; } } - return new FrontendIPConfiguration(id, name.Value, etag.Value, type.Value, Optional.ToList(zones), Optional.ToList(inboundNatRules), Optional.ToList(inboundNatPools), Optional.ToList(outboundRules), Optional.ToList(loadBalancingRules), privateIPAddress.Value, Optional.ToNullable(privateIPAllocationMethod), Optional.ToNullable(privateIPAddressVersion), subnet.Value, publicIPAddress.Value, publicIPPrefix.Value, gatewayLoadBalancer.Value, Optional.ToNullable(provisioningState)); + return new FrontendIPConfiguration(id.Value, name.Value, etag.Value, type.Value, Optional.ToList(zones), Optional.ToList(inboundNatRules), Optional.ToList(inboundNatPools), Optional.ToList(outboundRules), Optional.ToList(loadBalancingRules), privateIPAddress.Value, Optional.ToNullable(privateIPAllocationMethod), Optional.ToNullable(privateIPAddressVersion), subnet.Value, publicIPAddress.Value, publicIPPrefix, gatewayLoadBalancer, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FrontendIPConfiguration.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FrontendIPConfiguration.cs index ba6f2c65d96fc..4bf73a0688211 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FrontendIPConfiguration.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/FrontendIPConfiguration.cs @@ -13,20 +13,20 @@ namespace Azure.ResourceManager.Network.Models { /// Frontend IP address of the load balancer. - public partial class FrontendIPConfiguration : WritableSubResource + public partial class FrontendIPConfiguration : SubResource { /// Initializes a new instance of FrontendIPConfiguration. public FrontendIPConfiguration() { Zones = new ChangeTrackingList(); - InboundNatRules = new ChangeTrackingList(); - InboundNatPools = new ChangeTrackingList(); - OutboundRules = new ChangeTrackingList(); - LoadBalancingRules = new ChangeTrackingList(); + InboundNatRules = new ChangeTrackingList(); + InboundNatPools = new ChangeTrackingList(); + OutboundRules = new ChangeTrackingList(); + LoadBalancingRules = new ChangeTrackingList(); } /// Initializes a new instance of FrontendIPConfiguration. - /// The id. + /// Resource ID. /// The name of the resource that is unique within the set of frontend IP configurations used by the load balancer. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// Type of the resource. @@ -43,7 +43,7 @@ public FrontendIPConfiguration() /// The reference to the Public IP Prefix resource. /// The reference to gateway load balancer frontend IP. /// The provisioning state of the frontend IP configuration resource. - internal FrontendIPConfiguration(string id, string name, string etag, string type, IList zones, IReadOnlyList inboundNatRules, IReadOnlyList inboundNatPools, IReadOnlyList outboundRules, IReadOnlyList loadBalancingRules, string privateIPAddress, IPAllocationMethod? privateIPAllocationMethod, IPVersion? privateIPAddressVersion, SubnetData subnet, PublicIPAddressData publicIPAddress, SubResource publicIPPrefix, SubResource gatewayLoadBalancer, ProvisioningState? provisioningState) : base(id) + internal FrontendIPConfiguration(string id, string name, string etag, string type, IList zones, IReadOnlyList inboundNatRules, IReadOnlyList inboundNatPools, IReadOnlyList outboundRules, IReadOnlyList loadBalancingRules, string privateIPAddress, IPAllocationMethod? privateIPAllocationMethod, IPVersion? privateIPAddressVersion, SubnetData subnet, PublicIPAddressData publicIPAddress, WritableSubResource publicIPPrefix, WritableSubResource gatewayLoadBalancer, ProvisioningState? provisioningState) : base(id) { Name = name; Etag = etag; @@ -72,13 +72,13 @@ internal FrontendIPConfiguration(string id, string name, string etag, string typ /// A list of availability zones denoting the IP allocated for the resource needs to come from. public IList Zones { get; } /// An array of references to inbound rules that use this frontend IP. - public IReadOnlyList InboundNatRules { get; } + public IReadOnlyList InboundNatRules { get; } /// An array of references to inbound pools that use this frontend IP. - public IReadOnlyList InboundNatPools { get; } + public IReadOnlyList InboundNatPools { get; } /// An array of references to outbound rules that use this frontend IP. - public IReadOnlyList OutboundRules { get; } + public IReadOnlyList OutboundRules { get; } /// An array of references to load balancing rules that use this frontend IP. - public IReadOnlyList LoadBalancingRules { get; } + public IReadOnlyList LoadBalancingRules { get; } /// The private IP address of the IP configuration. public string PrivateIPAddress { get; set; } /// The Private IP allocation method. @@ -90,9 +90,9 @@ internal FrontendIPConfiguration(string id, string name, string etag, string typ /// The reference to the Public IP resource. public PublicIPAddressData PublicIPAddress { get; set; } /// The reference to the Public IP Prefix resource. - public SubResource PublicIPPrefix { get; set; } + public WritableSubResource PublicIPPrefix { get; set; } /// The reference to gateway load balancer frontend IP. - public SubResource GatewayLoadBalancer { get; set; } + public WritableSubResource GatewayLoadBalancer { get; set; } /// The provisioning state of the frontend IP configuration resource. public ProvisioningState? ProvisioningState { get; } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/HubIpConfigurationData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/HubIpConfigurationData.Serialization.cs index 1580eaa5bc8f0..568c45d37fde4 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/HubIpConfigurationData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/HubIpConfigurationData.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -22,8 +21,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(PrivateIPAddress)) @@ -55,7 +57,7 @@ internal static HubIpConfigurationData DeserializeHubIpConfigurationData(JsonEle Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional privateIPAddress = default; Optional privateIPAllocationMethod = default; Optional subnet = default; @@ -141,7 +143,7 @@ internal static HubIpConfigurationData DeserializeHubIpConfigurationData(JsonEle continue; } } - return new HubIpConfigurationData(id, name.Value, etag.Value, type.Value, privateIPAddress.Value, Optional.ToNullable(privateIPAllocationMethod), subnet.Value, publicIPAddress.Value, Optional.ToNullable(provisioningState)); + return new HubIpConfigurationData(id.Value, name.Value, etag.Value, type.Value, privateIPAddress.Value, Optional.ToNullable(privateIPAllocationMethod), subnet.Value, publicIPAddress.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/HubRouteTableData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/HubRouteTableData.Serialization.cs index df9b84a54f931..e813728038751 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/HubRouteTableData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/HubRouteTableData.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -23,8 +22,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsCollectionDefined(Routes)) @@ -56,7 +58,7 @@ internal static HubRouteTableData DeserializeHubRouteTableData(JsonElement eleme Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional> routes = default; Optional> labels = default; Optional> associatedConnections = default; @@ -167,7 +169,7 @@ internal static HubRouteTableData DeserializeHubRouteTableData(JsonElement eleme continue; } } - return new HubRouteTableData(id, name.Value, etag.Value, type.Value, Optional.ToList(routes), Optional.ToList(labels), Optional.ToList(associatedConnections), Optional.ToList(propagatingConnections), Optional.ToNullable(provisioningState)); + return new HubRouteTableData(id.Value, name.Value, etag.Value, type.Value, Optional.ToList(routes), Optional.ToList(labels), Optional.ToList(associatedConnections), Optional.ToList(propagatingConnections), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/HubVirtualNetworkConnectionData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/HubVirtualNetworkConnectionData.Serialization.cs index 32ea29698922f..45b4a43f74834 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/HubVirtualNetworkConnectionData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/HubVirtualNetworkConnectionData.Serialization.cs @@ -7,8 +7,8 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -22,14 +22,17 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(RemoteVirtualNetwork)) { writer.WritePropertyName("remoteVirtualNetwork"); - writer.WriteObjectValue(RemoteVirtualNetwork); + JsonSerializer.Serialize(writer, RemoteVirtualNetwork); } if (Optional.IsDefined(AllowHubToRemoteVnetTransit)) { @@ -59,8 +62,8 @@ internal static HubVirtualNetworkConnectionData DeserializeHubVirtualNetworkConn { Optional name = default; Optional etag = default; - ResourceIdentifier id = default; - Optional remoteVirtualNetwork = default; + Optional id = default; + Optional remoteVirtualNetwork = default; Optional allowHubToRemoteVnetTransit = default; Optional allowRemoteVnetToUseHubVnetGateways = default; Optional enableInternetSecurity = default; @@ -99,7 +102,7 @@ internal static HubVirtualNetworkConnectionData DeserializeHubVirtualNetworkConn property0.ThrowNonNullablePropertyIsNull(); continue; } - remoteVirtualNetwork = SubResource.DeserializeSubResource(property0.Value); + remoteVirtualNetwork = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("allowHubToRemoteVnetTransit")) @@ -156,7 +159,7 @@ internal static HubVirtualNetworkConnectionData DeserializeHubVirtualNetworkConn continue; } } - return new HubVirtualNetworkConnectionData(id, name.Value, etag.Value, remoteVirtualNetwork.Value, Optional.ToNullable(allowHubToRemoteVnetTransit), Optional.ToNullable(allowRemoteVnetToUseHubVnetGateways), Optional.ToNullable(enableInternetSecurity), routingConfiguration.Value, Optional.ToNullable(provisioningState)); + return new HubVirtualNetworkConnectionData(id.Value, name.Value, etag.Value, remoteVirtualNetwork, Optional.ToNullable(allowHubToRemoteVnetTransit), Optional.ToNullable(allowRemoteVnetToUseHubVnetGateways), Optional.ToNullable(enableInternetSecurity), routingConfiguration.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/IPConfiguration.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/IPConfiguration.Serialization.cs index 7aea4b0668764..249968df88203 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/IPConfiguration.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/IPConfiguration.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network; namespace Azure.ResourceManager.Network.Models @@ -22,8 +21,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(PrivateIPAddress)) @@ -54,7 +56,7 @@ internal static IPConfiguration DeserializeIPConfiguration(JsonElement element) { Optional name = default; Optional etag = default; - ResourceIdentifier id = default; + Optional id = default; Optional privateIPAddress = default; Optional privateIPAllocationMethod = default; Optional subnet = default; @@ -135,7 +137,7 @@ internal static IPConfiguration DeserializeIPConfiguration(JsonElement element) continue; } } - return new IPConfiguration(id, name.Value, etag.Value, privateIPAddress.Value, Optional.ToNullable(privateIPAllocationMethod), subnet.Value, publicIPAddress.Value, Optional.ToNullable(provisioningState)); + return new IPConfiguration(id.Value, name.Value, etag.Value, privateIPAddress.Value, Optional.ToNullable(privateIPAllocationMethod), subnet.Value, publicIPAddress.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/IPConfiguration.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/IPConfiguration.cs index 2daef9adec77a..3ae329d35b91b 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/IPConfiguration.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/IPConfiguration.cs @@ -6,12 +6,11 @@ #nullable disable using Azure.ResourceManager.Network; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { /// IP configuration. - public partial class IPConfiguration : WritableSubResource + public partial class IPConfiguration : SubResource { /// Initializes a new instance of IPConfiguration. public IPConfiguration() @@ -19,7 +18,7 @@ public IPConfiguration() } /// Initializes a new instance of IPConfiguration. - /// The id. + /// Resource ID. /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// The private IP address of the IP configuration. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/IPConfigurationProfile.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/IPConfigurationProfile.Serialization.cs index 442133c5dd128..7ec1a3e290dd7 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/IPConfigurationProfile.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/IPConfigurationProfile.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network; namespace Azure.ResourceManager.Network.Models @@ -22,8 +21,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Subnet)) @@ -40,7 +42,7 @@ internal static IPConfigurationProfile DeserializeIPConfigurationProfile(JsonEle Optional name = default; Optional type = default; Optional etag = default; - ResourceIdentifier id = default; + Optional id = default; Optional subnet = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) @@ -98,7 +100,7 @@ internal static IPConfigurationProfile DeserializeIPConfigurationProfile(JsonEle continue; } } - return new IPConfigurationProfile(id, name.Value, type.Value, etag.Value, subnet.Value, Optional.ToNullable(provisioningState)); + return new IPConfigurationProfile(id.Value, name.Value, type.Value, etag.Value, subnet.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/IPConfigurationProfile.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/IPConfigurationProfile.cs index 78d4e76014fd7..e7ad43542b02f 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/IPConfigurationProfile.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/IPConfigurationProfile.cs @@ -6,12 +6,11 @@ #nullable disable using Azure.ResourceManager.Network; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { /// IP configuration profile child resource. - public partial class IPConfigurationProfile : WritableSubResource + public partial class IPConfigurationProfile : SubResource { /// Initializes a new instance of IPConfigurationProfile. public IPConfigurationProfile() @@ -19,7 +18,7 @@ public IPConfigurationProfile() } /// Initializes a new instance of IPConfigurationProfile. - /// The id. + /// Resource ID. /// The name of the resource. This name can be used to access the resource. /// Sub Resource type. /// A unique read-only string that changes whenever the resource is updated. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/InboundNatPool.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/InboundNatPool.Serialization.cs index fcc9c9bc03ba6..5391094d2e5f0 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/InboundNatPool.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/InboundNatPool.Serialization.cs @@ -7,7 +7,7 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -21,14 +21,17 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(FrontendIPConfiguration)) { writer.WritePropertyName("frontendIPConfiguration"); - writer.WriteObjectValue(FrontendIPConfiguration); + JsonSerializer.Serialize(writer, FrontendIPConfiguration); } if (Optional.IsDefined(Protocol)) { @@ -74,8 +77,8 @@ internal static InboundNatPool DeserializeInboundNatPool(JsonElement element) Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; - Optional frontendIPConfiguration = default; + Optional id = default; + Optional frontendIPConfiguration = default; Optional protocol = default; Optional frontendPortRangeStart = default; Optional frontendPortRangeEnd = default; @@ -122,7 +125,7 @@ internal static InboundNatPool DeserializeInboundNatPool(JsonElement element) property0.ThrowNonNullablePropertyIsNull(); continue; } - frontendIPConfiguration = SubResource.DeserializeSubResource(property0.Value); + frontendIPConfiguration = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("protocol")) @@ -209,7 +212,7 @@ internal static InboundNatPool DeserializeInboundNatPool(JsonElement element) continue; } } - return new InboundNatPool(id, name.Value, etag.Value, type.Value, frontendIPConfiguration.Value, Optional.ToNullable(protocol), Optional.ToNullable(frontendPortRangeStart), Optional.ToNullable(frontendPortRangeEnd), Optional.ToNullable(backendPort), Optional.ToNullable(idleTimeoutInMinutes), Optional.ToNullable(enableFloatingIP), Optional.ToNullable(enableTcpReset), Optional.ToNullable(provisioningState)); + return new InboundNatPool(id.Value, name.Value, etag.Value, type.Value, frontendIPConfiguration, Optional.ToNullable(protocol), Optional.ToNullable(frontendPortRangeStart), Optional.ToNullable(frontendPortRangeEnd), Optional.ToNullable(backendPort), Optional.ToNullable(idleTimeoutInMinutes), Optional.ToNullable(enableFloatingIP), Optional.ToNullable(enableTcpReset), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/InboundNatPool.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/InboundNatPool.cs index 063e7af2591b8..39dab7597fede 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/InboundNatPool.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/InboundNatPool.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.Network.Models { /// Inbound NAT pool of the load balancer. - public partial class InboundNatPool : WritableSubResource + public partial class InboundNatPool : SubResource { /// Initializes a new instance of InboundNatPool. public InboundNatPool() @@ -18,7 +18,7 @@ public InboundNatPool() } /// Initializes a new instance of InboundNatPool. - /// The id. + /// Resource ID. /// The name of the resource that is unique within the set of inbound NAT pools used by the load balancer. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// Type of the resource. @@ -31,7 +31,7 @@ public InboundNatPool() /// Configures a virtual machine's endpoint for the floating IP capability required to configure a SQL AlwaysOn Availability Group. This setting is required when using the SQL AlwaysOn Availability Groups in SQL server. This setting can't be changed after you create the endpoint. /// Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This element is only used when the protocol is set to TCP. /// The provisioning state of the inbound NAT pool resource. - internal InboundNatPool(string id, string name, string etag, string type, SubResource frontendIPConfiguration, TransportProtocol? protocol, int? frontendPortRangeStart, int? frontendPortRangeEnd, int? backendPort, int? idleTimeoutInMinutes, bool? enableFloatingIP, bool? enableTcpReset, ProvisioningState? provisioningState) : base(id) + internal InboundNatPool(string id, string name, string etag, string type, WritableSubResource frontendIPConfiguration, TransportProtocol? protocol, int? frontendPortRangeStart, int? frontendPortRangeEnd, int? backendPort, int? idleTimeoutInMinutes, bool? enableFloatingIP, bool? enableTcpReset, ProvisioningState? provisioningState) : base(id) { Name = name; Etag = etag; @@ -54,7 +54,7 @@ internal InboundNatPool(string id, string name, string etag, string type, SubRes /// Type of the resource. public string Type { get; } /// A reference to frontend IP addresses. - public SubResource FrontendIPConfiguration { get; set; } + public WritableSubResource FrontendIPConfiguration { get; set; } /// The reference to the transport protocol used by the inbound NAT pool. public TransportProtocol? Protocol { get; set; } /// The first port number in the range of external ports that will be used to provide Inbound Nat to NICs associated with a load balancer. Acceptable values range between 1 and 65534. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/InboundNatRuleData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/InboundNatRuleData.Serialization.cs index 551f93b02e6c8..f8b23142538d7 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/InboundNatRuleData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/InboundNatRuleData.Serialization.cs @@ -7,8 +7,8 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -22,14 +22,17 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(FrontendIPConfiguration)) { writer.WritePropertyName("frontendIPConfiguration"); - writer.WriteObjectValue(FrontendIPConfiguration); + JsonSerializer.Serialize(writer, FrontendIPConfiguration); } if (Optional.IsDefined(Protocol)) { @@ -70,8 +73,8 @@ internal static InboundNatRuleData DeserializeInboundNatRuleData(JsonElement ele Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; - Optional frontendIPConfiguration = default; + Optional id = default; + Optional frontendIPConfiguration = default; Optional backendIPConfiguration = default; Optional protocol = default; Optional frontendPort = default; @@ -118,7 +121,7 @@ internal static InboundNatRuleData DeserializeInboundNatRuleData(JsonElement ele property0.ThrowNonNullablePropertyIsNull(); continue; } - frontendIPConfiguration = SubResource.DeserializeSubResource(property0.Value); + frontendIPConfiguration = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("backendIPConfiguration")) @@ -205,7 +208,7 @@ internal static InboundNatRuleData DeserializeInboundNatRuleData(JsonElement ele continue; } } - return new InboundNatRuleData(id, name.Value, etag.Value, type.Value, frontendIPConfiguration.Value, backendIPConfiguration.Value, Optional.ToNullable(protocol), Optional.ToNullable(frontendPort), Optional.ToNullable(backendPort), Optional.ToNullable(idleTimeoutInMinutes), Optional.ToNullable(enableFloatingIP), Optional.ToNullable(enableTcpReset), Optional.ToNullable(provisioningState)); + return new InboundNatRuleData(id.Value, name.Value, etag.Value, type.Value, frontendIPConfiguration, backendIPConfiguration.Value, Optional.ToNullable(protocol), Optional.ToNullable(frontendPort), Optional.ToNullable(backendPort), Optional.ToNullable(idleTimeoutInMinutes), Optional.ToNullable(enableFloatingIP), Optional.ToNullable(enableTcpReset), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/InboundSecurityRule.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/InboundSecurityRule.Serialization.cs index cd6d6d796fc21..8f5c1527eceaa 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/InboundSecurityRule.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/InboundSecurityRule.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -22,8 +21,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsCollectionDefined(Rules)) @@ -45,7 +47,7 @@ internal static InboundSecurityRule DeserializeInboundSecurityRule(JsonElement e Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional> rules = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) @@ -108,7 +110,7 @@ internal static InboundSecurityRule DeserializeInboundSecurityRule(JsonElement e continue; } } - return new InboundSecurityRule(id, name.Value, etag.Value, type.Value, Optional.ToList(rules), Optional.ToNullable(provisioningState)); + return new InboundSecurityRule(id.Value, name.Value, etag.Value, type.Value, Optional.ToList(rules), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/InboundSecurityRule.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/InboundSecurityRule.cs index 3848f6404ac80..70d47ad1b11f9 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/InboundSecurityRule.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/InboundSecurityRule.cs @@ -7,12 +7,11 @@ using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { /// NVA Inbound Security Rule resource. - public partial class InboundSecurityRule : WritableSubResource + public partial class InboundSecurityRule : SubResource { /// Initializes a new instance of InboundSecurityRule. public InboundSecurityRule() @@ -21,7 +20,7 @@ public InboundSecurityRule() } /// Initializes a new instance of InboundSecurityRule. - /// The id. + /// Resource ID. /// Name of security rule collection. /// A unique read-only string that changes whenever the resource is updated. /// NVA inbound security rule type. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/IpAllocationData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/IpAllocationData.Serialization.cs index aed8c5568f057..122a94db053a7 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/IpAllocationData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/IpAllocationData.Serialization.cs @@ -8,8 +8,8 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -18,6 +18,11 @@ public partial class IpAllocationData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -34,8 +39,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(TypePropertiesType)) @@ -88,13 +91,13 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static IpAllocationData DeserializeIpAllocationData(JsonElement element) { Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; - Optional subnet = default; - Optional virtualNetwork = default; + Optional subnet = default; + Optional virtualNetwork = default; Optional type0 = default; Optional prefix = default; Optional prefixLength = default; @@ -108,6 +111,11 @@ internal static IpAllocationData DeserializeIpAllocationData(JsonElement element etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -138,11 +146,6 @@ internal static IpAllocationData DeserializeIpAllocationData(JsonElement element tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -159,7 +162,7 @@ internal static IpAllocationData DeserializeIpAllocationData(JsonElement element property0.ThrowNonNullablePropertyIsNull(); continue; } - subnet = SubResource.DeserializeSubResource(property0.Value); + subnet = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("virtualNetwork")) @@ -169,7 +172,7 @@ internal static IpAllocationData DeserializeIpAllocationData(JsonElement element property0.ThrowNonNullablePropertyIsNull(); continue; } - virtualNetwork = SubResource.DeserializeSubResource(property0.Value); + virtualNetwork = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("type")) @@ -231,7 +234,7 @@ internal static IpAllocationData DeserializeIpAllocationData(JsonElement element continue; } } - return new IpAllocationData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, subnet.Value, virtualNetwork.Value, Optional.ToNullable(type0), prefix.Value, Optional.ToNullable(prefixLength), Optional.ToNullable(prefixType), ipamAllocationId.Value, Optional.ToDictionary(allocationTags)); + return new IpAllocationData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, subnet, virtualNetwork, Optional.ToNullable(type0), prefix.Value, Optional.ToNullable(prefixLength), Optional.ToNullable(prefixType), ipamAllocationId.Value, Optional.ToDictionary(allocationTags)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/IpGroupData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/IpGroupData.Serialization.cs index 37018aa836253..d5c818216ea2f 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/IpGroupData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/IpGroupData.Serialization.cs @@ -8,8 +8,8 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -18,6 +18,11 @@ public partial class IpGroupData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -34,8 +39,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsCollectionDefined(IpAddresses)) @@ -55,15 +58,15 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static IpGroupData DeserializeIpGroupData(JsonElement element) { Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional provisioningState = default; Optional> ipAddresses = default; - Optional> firewalls = default; - Optional> firewallPolicies = default; + Optional> firewalls = default; + Optional> firewallPolicies = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag")) @@ -71,6 +74,11 @@ internal static IpGroupData DeserializeIpGroupData(JsonElement element) etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -101,11 +109,6 @@ internal static IpGroupData DeserializeIpGroupData(JsonElement element) tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -147,10 +150,10 @@ internal static IpGroupData DeserializeIpGroupData(JsonElement element) property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } firewalls = array; continue; @@ -162,10 +165,10 @@ internal static IpGroupData DeserializeIpGroupData(JsonElement element) property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } firewallPolicies = array; continue; @@ -174,7 +177,7 @@ internal static IpGroupData DeserializeIpGroupData(JsonElement element) continue; } } - return new IpGroupData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, Optional.ToNullable(provisioningState), Optional.ToList(ipAddresses), Optional.ToList(firewalls), Optional.ToList(firewallPolicies)); + return new IpGroupData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, Optional.ToNullable(provisioningState), Optional.ToList(ipAddresses), Optional.ToList(firewalls), Optional.ToList(firewallPolicies)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Ipv6ExpressRouteCircuitPeeringConfig.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Ipv6ExpressRouteCircuitPeeringConfig.Serialization.cs index 99de429d20f5c..b4f6d3ab8a8fa 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Ipv6ExpressRouteCircuitPeeringConfig.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Ipv6ExpressRouteCircuitPeeringConfig.Serialization.cs @@ -7,6 +7,7 @@ using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -33,7 +34,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RouteFilter)) { writer.WritePropertyName("routeFilter"); - writer.WriteObjectValue(RouteFilter); + JsonSerializer.Serialize(writer, RouteFilter); } if (Optional.IsDefined(State)) { @@ -48,7 +49,7 @@ internal static Ipv6ExpressRouteCircuitPeeringConfig DeserializeIpv6ExpressRoute Optional primaryPeerAddressPrefix = default; Optional secondaryPeerAddressPrefix = default; Optional microsoftPeeringConfig = default; - Optional routeFilter = default; + Optional routeFilter = default; Optional state = default; foreach (var property in element.EnumerateObject()) { @@ -79,7 +80,7 @@ internal static Ipv6ExpressRouteCircuitPeeringConfig DeserializeIpv6ExpressRoute property.ThrowNonNullablePropertyIsNull(); continue; } - routeFilter = SubResource.DeserializeSubResource(property.Value); + routeFilter = JsonSerializer.Deserialize(property.Value.ToString()); continue; } if (property.NameEquals("state")) @@ -93,7 +94,7 @@ internal static Ipv6ExpressRouteCircuitPeeringConfig DeserializeIpv6ExpressRoute continue; } } - return new Ipv6ExpressRouteCircuitPeeringConfig(primaryPeerAddressPrefix.Value, secondaryPeerAddressPrefix.Value, microsoftPeeringConfig.Value, routeFilter.Value, Optional.ToNullable(state)); + return new Ipv6ExpressRouteCircuitPeeringConfig(primaryPeerAddressPrefix.Value, secondaryPeerAddressPrefix.Value, microsoftPeeringConfig.Value, routeFilter, Optional.ToNullable(state)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Ipv6ExpressRouteCircuitPeeringConfig.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Ipv6ExpressRouteCircuitPeeringConfig.cs index faadb70c2076d..2b47b7408061f 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Ipv6ExpressRouteCircuitPeeringConfig.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Ipv6ExpressRouteCircuitPeeringConfig.cs @@ -5,6 +5,8 @@ #nullable disable +using Azure.ResourceManager.Resources.Models; + namespace Azure.ResourceManager.Network.Models { /// Contains IPv6 peering config. @@ -21,7 +23,7 @@ public Ipv6ExpressRouteCircuitPeeringConfig() /// The Microsoft peering configuration. /// The reference to the RouteFilter resource. /// The state of peering. - internal Ipv6ExpressRouteCircuitPeeringConfig(string primaryPeerAddressPrefix, string secondaryPeerAddressPrefix, ExpressRouteCircuitPeeringConfig microsoftPeeringConfig, SubResource routeFilter, ExpressRouteCircuitPeeringState? state) + internal Ipv6ExpressRouteCircuitPeeringConfig(string primaryPeerAddressPrefix, string secondaryPeerAddressPrefix, ExpressRouteCircuitPeeringConfig microsoftPeeringConfig, WritableSubResource routeFilter, ExpressRouteCircuitPeeringState? state) { PrimaryPeerAddressPrefix = primaryPeerAddressPrefix; SecondaryPeerAddressPrefix = secondaryPeerAddressPrefix; @@ -37,7 +39,7 @@ internal Ipv6ExpressRouteCircuitPeeringConfig(string primaryPeerAddressPrefix, s /// The Microsoft peering configuration. public ExpressRouteCircuitPeeringConfig MicrosoftPeeringConfig { get; set; } /// The reference to the RouteFilter resource. - public SubResource RouteFilter { get; set; } + public WritableSubResource RouteFilter { get; set; } /// The state of peering. public ExpressRouteCircuitPeeringState? State { get; set; } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/LoadBalancerBackendAddress.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/LoadBalancerBackendAddress.Serialization.cs index 102ddab6d3d2d..f14ce74f2c332 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/LoadBalancerBackendAddress.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/LoadBalancerBackendAddress.Serialization.cs @@ -7,6 +7,7 @@ using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -25,12 +26,12 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(VirtualNetwork)) { writer.WritePropertyName("virtualNetwork"); - writer.WriteObjectValue(VirtualNetwork); + JsonSerializer.Serialize(writer, VirtualNetwork); } if (Optional.IsDefined(Subnet)) { writer.WritePropertyName("subnet"); - writer.WriteObjectValue(Subnet); + JsonSerializer.Serialize(writer, Subnet); } if (Optional.IsDefined(IpAddress)) { @@ -40,7 +41,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(LoadBalancerFrontendIPConfiguration)) { writer.WritePropertyName("loadBalancerFrontendIPConfiguration"); - writer.WriteObjectValue(LoadBalancerFrontendIPConfiguration); + JsonSerializer.Serialize(writer, LoadBalancerFrontendIPConfiguration); } writer.WriteEndObject(); writer.WriteEndObject(); @@ -49,11 +50,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static LoadBalancerBackendAddress DeserializeLoadBalancerBackendAddress(JsonElement element) { Optional name = default; - Optional virtualNetwork = default; - Optional subnet = default; + Optional virtualNetwork = default; + Optional subnet = default; Optional ipAddress = default; - Optional networkInterfaceIPConfiguration = default; - Optional loadBalancerFrontendIPConfiguration = default; + Optional networkInterfaceIPConfiguration = default; + Optional loadBalancerFrontendIPConfiguration = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) @@ -77,7 +78,7 @@ internal static LoadBalancerBackendAddress DeserializeLoadBalancerBackendAddress property0.ThrowNonNullablePropertyIsNull(); continue; } - virtualNetwork = SubResource.DeserializeSubResource(property0.Value); + virtualNetwork = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("subnet")) @@ -87,7 +88,7 @@ internal static LoadBalancerBackendAddress DeserializeLoadBalancerBackendAddress property0.ThrowNonNullablePropertyIsNull(); continue; } - subnet = SubResource.DeserializeSubResource(property0.Value); + subnet = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("ipAddress")) @@ -102,7 +103,7 @@ internal static LoadBalancerBackendAddress DeserializeLoadBalancerBackendAddress property0.ThrowNonNullablePropertyIsNull(); continue; } - networkInterfaceIPConfiguration = SubResource.DeserializeSubResource(property0.Value); + networkInterfaceIPConfiguration = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("loadBalancerFrontendIPConfiguration")) @@ -112,14 +113,14 @@ internal static LoadBalancerBackendAddress DeserializeLoadBalancerBackendAddress property0.ThrowNonNullablePropertyIsNull(); continue; } - loadBalancerFrontendIPConfiguration = SubResource.DeserializeSubResource(property0.Value); + loadBalancerFrontendIPConfiguration = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } } continue; } } - return new LoadBalancerBackendAddress(name.Value, virtualNetwork.Value, subnet.Value, ipAddress.Value, networkInterfaceIPConfiguration.Value, loadBalancerFrontendIPConfiguration.Value); + return new LoadBalancerBackendAddress(name.Value, virtualNetwork, subnet, ipAddress.Value, networkInterfaceIPConfiguration, loadBalancerFrontendIPConfiguration); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/LoadBalancerBackendAddress.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/LoadBalancerBackendAddress.cs index 52e31073c0660..c3e521826e1eb 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/LoadBalancerBackendAddress.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/LoadBalancerBackendAddress.cs @@ -5,6 +5,8 @@ #nullable disable +using Azure.ResourceManager.Resources.Models; + namespace Azure.ResourceManager.Network.Models { /// Load balancer backend addresses. @@ -22,7 +24,7 @@ public LoadBalancerBackendAddress() /// IP Address belonging to the referenced virtual network. /// Reference to IP address defined in network interfaces. /// Reference to the frontend ip address configuration defined in regional loadbalancer. - internal LoadBalancerBackendAddress(string name, SubResource virtualNetwork, SubResource subnet, string ipAddress, SubResource networkInterfaceIPConfiguration, SubResource loadBalancerFrontendIPConfiguration) + internal LoadBalancerBackendAddress(string name, WritableSubResource virtualNetwork, WritableSubResource subnet, string ipAddress, WritableSubResource networkInterfaceIPConfiguration, WritableSubResource loadBalancerFrontendIPConfiguration) { Name = name; VirtualNetwork = virtualNetwork; @@ -35,14 +37,14 @@ internal LoadBalancerBackendAddress(string name, SubResource virtualNetwork, Sub /// Name of the backend address. public string Name { get; set; } /// Reference to an existing virtual network. - public SubResource VirtualNetwork { get; set; } + public WritableSubResource VirtualNetwork { get; set; } /// Reference to an existing subnet. - public SubResource Subnet { get; set; } + public WritableSubResource Subnet { get; set; } /// IP Address belonging to the referenced virtual network. public string IpAddress { get; set; } /// Reference to IP address defined in network interfaces. - public SubResource NetworkInterfaceIPConfiguration { get; } + public WritableSubResource NetworkInterfaceIPConfiguration { get; } /// Reference to the frontend ip address configuration defined in regional loadbalancer. - public SubResource LoadBalancerFrontendIPConfiguration { get; set; } + public WritableSubResource LoadBalancerFrontendIPConfiguration { get; set; } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/LoadBalancerData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/LoadBalancerData.Serialization.cs index 76d9af9d4f1a9..351bf5ecb117a 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/LoadBalancerData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/LoadBalancerData.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -28,6 +27,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("sku"); writer.WriteObjectValue(Sku); } + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -44,8 +48,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsCollectionDefined(FrontendIPConfigurations)) @@ -127,11 +129,11 @@ internal static LoadBalancerData DeserializeLoadBalancerData(JsonElement element Optional extendedLocation = default; Optional sku = default; Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional> frontendIPConfigurations = default; Optional> backendAddressPools = default; Optional> loadBalancingRules = default; @@ -168,6 +170,11 @@ internal static LoadBalancerData DeserializeLoadBalancerData(JsonElement element etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -198,11 +205,6 @@ internal static LoadBalancerData DeserializeLoadBalancerData(JsonElement element tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -336,7 +338,7 @@ internal static LoadBalancerData DeserializeLoadBalancerData(JsonElement element continue; } } - return new LoadBalancerData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), extendedLocation.Value, sku.Value, etag.Value, Optional.ToList(frontendIPConfigurations), Optional.ToList(backendAddressPools), Optional.ToList(loadBalancingRules), Optional.ToList(probes), Optional.ToList(inboundNatRules), Optional.ToList(inboundNatPools), Optional.ToList(outboundRules), resourceGuid.Value, Optional.ToNullable(provisioningState)); + return new LoadBalancerData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), extendedLocation.Value, sku.Value, etag.Value, Optional.ToList(frontendIPConfigurations), Optional.ToList(backendAddressPools), Optional.ToList(loadBalancingRules), Optional.ToList(probes), Optional.ToList(inboundNatRules), Optional.ToList(inboundNatPools), Optional.ToList(outboundRules), resourceGuid.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/LoadBalancerVipSwapRequestFrontendIPConfiguration.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/LoadBalancerVipSwapRequestFrontendIPConfiguration.Serialization.cs index 0c8edbd078e2d..c185a431382a5 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/LoadBalancerVipSwapRequestFrontendIPConfiguration.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/LoadBalancerVipSwapRequestFrontendIPConfiguration.Serialization.cs @@ -15,14 +15,17 @@ public partial class LoadBalancerVipSwapRequestFrontendIPConfiguration : IUtf8Js void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(PublicIPAddress)) { writer.WritePropertyName("publicIPAddress"); - writer.WriteObjectValue(PublicIPAddress); + JsonSerializer.Serialize(writer, PublicIPAddress); } writer.WriteEndObject(); writer.WriteEndObject(); diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/LoadBalancerVipSwapRequestFrontendIPConfiguration.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/LoadBalancerVipSwapRequestFrontendIPConfiguration.cs index 05fda813b9c8a..d040e1497354b 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/LoadBalancerVipSwapRequestFrontendIPConfiguration.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/LoadBalancerVipSwapRequestFrontendIPConfiguration.cs @@ -10,14 +10,16 @@ namespace Azure.ResourceManager.Network.Models { /// VIP swap request's frontend IP configuration object. - public partial class LoadBalancerVipSwapRequestFrontendIPConfiguration : WritableSubResource + public partial class LoadBalancerVipSwapRequestFrontendIPConfiguration { /// Initializes a new instance of LoadBalancerVipSwapRequestFrontendIPConfiguration. public LoadBalancerVipSwapRequestFrontendIPConfiguration() { } + /// The ID of frontend IP configuration resource. + public string Id { get; set; } /// A reference to public IP address resource. - public SubResource PublicIPAddress { get; set; } + public WritableSubResource PublicIPAddress { get; set; } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/LoadBalancingRule.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/LoadBalancingRule.Serialization.cs index c45870566f3b8..c820e697f8806 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/LoadBalancingRule.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/LoadBalancingRule.Serialization.cs @@ -8,7 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -22,19 +22,22 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(FrontendIPConfiguration)) { writer.WritePropertyName("frontendIPConfiguration"); - writer.WriteObjectValue(FrontendIPConfiguration); + JsonSerializer.Serialize(writer, FrontendIPConfiguration); } if (Optional.IsDefined(BackendAddressPool)) { writer.WritePropertyName("backendAddressPool"); - writer.WriteObjectValue(BackendAddressPool); + JsonSerializer.Serialize(writer, BackendAddressPool); } if (Optional.IsCollectionDefined(BackendAddressPools)) { @@ -42,14 +45,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in BackendAddressPools) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } if (Optional.IsDefined(Probe)) { writer.WritePropertyName("probe"); - writer.WriteObjectValue(Probe); + JsonSerializer.Serialize(writer, Probe); } if (Optional.IsDefined(Protocol)) { @@ -100,11 +103,11 @@ internal static LoadBalancingRule DeserializeLoadBalancingRule(JsonElement eleme Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; - Optional frontendIPConfiguration = default; - Optional backendAddressPool = default; - Optional> backendAddressPools = default; - Optional probe = default; + Optional id = default; + Optional frontendIPConfiguration = default; + Optional backendAddressPool = default; + Optional> backendAddressPools = default; + Optional probe = default; Optional protocol = default; Optional loadDistribution = default; Optional frontendPort = default; @@ -152,7 +155,7 @@ internal static LoadBalancingRule DeserializeLoadBalancingRule(JsonElement eleme property0.ThrowNonNullablePropertyIsNull(); continue; } - frontendIPConfiguration = SubResource.DeserializeSubResource(property0.Value); + frontendIPConfiguration = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("backendAddressPool")) @@ -162,7 +165,7 @@ internal static LoadBalancingRule DeserializeLoadBalancingRule(JsonElement eleme property0.ThrowNonNullablePropertyIsNull(); continue; } - backendAddressPool = SubResource.DeserializeSubResource(property0.Value); + backendAddressPool = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("backendAddressPools")) @@ -172,10 +175,10 @@ internal static LoadBalancingRule DeserializeLoadBalancingRule(JsonElement eleme property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } backendAddressPools = array; continue; @@ -187,7 +190,7 @@ internal static LoadBalancingRule DeserializeLoadBalancingRule(JsonElement eleme property0.ThrowNonNullablePropertyIsNull(); continue; } - probe = SubResource.DeserializeSubResource(property0.Value); + probe = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("protocol")) @@ -284,7 +287,7 @@ internal static LoadBalancingRule DeserializeLoadBalancingRule(JsonElement eleme continue; } } - return new LoadBalancingRule(id, name.Value, etag.Value, type.Value, frontendIPConfiguration.Value, backendAddressPool.Value, Optional.ToList(backendAddressPools), probe.Value, Optional.ToNullable(protocol), Optional.ToNullable(loadDistribution), Optional.ToNullable(frontendPort), Optional.ToNullable(backendPort), Optional.ToNullable(idleTimeoutInMinutes), Optional.ToNullable(enableFloatingIP), Optional.ToNullable(enableTcpReset), Optional.ToNullable(disableOutboundSnat), Optional.ToNullable(provisioningState)); + return new LoadBalancingRule(id.Value, name.Value, etag.Value, type.Value, frontendIPConfiguration, backendAddressPool, Optional.ToList(backendAddressPools), probe, Optional.ToNullable(protocol), Optional.ToNullable(loadDistribution), Optional.ToNullable(frontendPort), Optional.ToNullable(backendPort), Optional.ToNullable(idleTimeoutInMinutes), Optional.ToNullable(enableFloatingIP), Optional.ToNullable(enableTcpReset), Optional.ToNullable(disableOutboundSnat), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/LoadBalancingRule.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/LoadBalancingRule.cs index dbfdddec1cda5..eb6a02e1c5080 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/LoadBalancingRule.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/LoadBalancingRule.cs @@ -12,16 +12,16 @@ namespace Azure.ResourceManager.Network.Models { /// A load balancing rule for a load balancer. - public partial class LoadBalancingRule : WritableSubResource + public partial class LoadBalancingRule : SubResource { /// Initializes a new instance of LoadBalancingRule. public LoadBalancingRule() { - BackendAddressPools = new ChangeTrackingList(); + BackendAddressPools = new ChangeTrackingList(); } /// Initializes a new instance of LoadBalancingRule. - /// The id. + /// Resource ID. /// The name of the resource that is unique within the set of load balancing rules used by the load balancer. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// Type of the resource. @@ -38,7 +38,7 @@ public LoadBalancingRule() /// Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This element is only used when the protocol is set to TCP. /// Configures SNAT for the VMs in the backend pool to use the publicIP address specified in the frontend of the load balancing rule. /// The provisioning state of the load balancing rule resource. - internal LoadBalancingRule(string id, string name, string etag, string type, SubResource frontendIPConfiguration, SubResource backendAddressPool, IList backendAddressPools, SubResource probe, TransportProtocol? protocol, LoadDistribution? loadDistribution, int? frontendPort, int? backendPort, int? idleTimeoutInMinutes, bool? enableFloatingIP, bool? enableTcpReset, bool? disableOutboundSnat, ProvisioningState? provisioningState) : base(id) + internal LoadBalancingRule(string id, string name, string etag, string type, WritableSubResource frontendIPConfiguration, WritableSubResource backendAddressPool, IList backendAddressPools, WritableSubResource probe, TransportProtocol? protocol, LoadDistribution? loadDistribution, int? frontendPort, int? backendPort, int? idleTimeoutInMinutes, bool? enableFloatingIP, bool? enableTcpReset, bool? disableOutboundSnat, ProvisioningState? provisioningState) : base(id) { Name = name; Etag = etag; @@ -65,13 +65,13 @@ internal LoadBalancingRule(string id, string name, string etag, string type, Sub /// Type of the resource. public string Type { get; } /// A reference to frontend IP addresses. - public SubResource FrontendIPConfiguration { get; set; } + public WritableSubResource FrontendIPConfiguration { get; set; } /// A reference to a pool of DIPs. Inbound traffic is randomly load balanced across IPs in the backend IPs. - public SubResource BackendAddressPool { get; set; } + public WritableSubResource BackendAddressPool { get; set; } /// An array of references to pool of DIPs. - public IList BackendAddressPools { get; } + public IList BackendAddressPools { get; } /// The reference to the load balancer probe used by the load balancing rule. - public SubResource Probe { get; set; } + public WritableSubResource Probe { get; set; } /// The reference to the transport protocol used by the load balancing rule. public TransportProtocol? Protocol { get; set; } /// The load distribution policy for this rule. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/LocalNetworkGatewayData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/LocalNetworkGatewayData.Serialization.cs index 26fb24cffc108..7d059d9801916 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/LocalNetworkGatewayData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/LocalNetworkGatewayData.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -18,6 +17,11 @@ public partial class LocalNetworkGatewayData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -34,8 +38,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(LocalNetworkAddressSpace)) @@ -65,11 +67,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static LocalNetworkGatewayData DeserializeLocalNetworkGatewayData(JsonElement element) { Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional localNetworkAddressSpace = default; Optional gatewayIpAddress = default; Optional fqdn = default; @@ -83,6 +85,11 @@ internal static LocalNetworkGatewayData DeserializeLocalNetworkGatewayData(JsonE etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -113,11 +120,6 @@ internal static LocalNetworkGatewayData DeserializeLocalNetworkGatewayData(JsonE tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -176,7 +178,7 @@ internal static LocalNetworkGatewayData DeserializeLocalNetworkGatewayData(JsonE continue; } } - return new LocalNetworkGatewayData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, localNetworkAddressSpace.Value, gatewayIpAddress.Value, fqdn.Value, bgpSettings.Value, resourceGuid.Value, Optional.ToNullable(provisioningState)); + return new LocalNetworkGatewayData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, localNetworkAddressSpace.Value, gatewayIpAddress.Value, fqdn.Value, bgpSettings.Value, resourceGuid.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NatGatewayData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NatGatewayData.Serialization.cs index 3afcd61e6ba30..727415c8fdceb 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NatGatewayData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NatGatewayData.Serialization.cs @@ -8,8 +8,8 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -33,6 +33,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -49,8 +54,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(IdleTimeoutInMinutes)) @@ -64,7 +67,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in PublicIpAddresses) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } @@ -74,7 +77,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in PublicIpPrefixes) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } @@ -87,15 +90,15 @@ internal static NatGatewayData DeserializeNatGatewayData(JsonElement element) Optional sku = default; Optional> zones = default; Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional idleTimeoutInMinutes = default; - Optional> publicIpAddresses = default; - Optional> publicIpPrefixes = default; - Optional> subnets = default; + Optional> publicIpAddresses = default; + Optional> publicIpPrefixes = default; + Optional> subnets = default; Optional resourceGuid = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) @@ -130,6 +133,11 @@ internal static NatGatewayData DeserializeNatGatewayData(JsonElement element) etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -160,11 +168,6 @@ internal static NatGatewayData DeserializeNatGatewayData(JsonElement element) tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -191,10 +194,10 @@ internal static NatGatewayData DeserializeNatGatewayData(JsonElement element) property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } publicIpAddresses = array; continue; @@ -206,10 +209,10 @@ internal static NatGatewayData DeserializeNatGatewayData(JsonElement element) property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } publicIpPrefixes = array; continue; @@ -221,10 +224,10 @@ internal static NatGatewayData DeserializeNatGatewayData(JsonElement element) property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } subnets = array; continue; @@ -248,7 +251,7 @@ internal static NatGatewayData DeserializeNatGatewayData(JsonElement element) continue; } } - return new NatGatewayData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), sku.Value, Optional.ToList(zones), etag.Value, Optional.ToNullable(idleTimeoutInMinutes), Optional.ToList(publicIpAddresses), Optional.ToList(publicIpPrefixes), Optional.ToList(subnets), resourceGuid.Value, Optional.ToNullable(provisioningState)); + return new NatGatewayData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), sku.Value, Optional.ToList(zones), etag.Value, Optional.ToNullable(idleTimeoutInMinutes), Optional.ToList(publicIpAddresses), Optional.ToList(publicIpPrefixes), Optional.ToList(subnets), resourceGuid.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkIntentPolicy.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkIntentPolicy.Serialization.cs index f6daa4df5863e..760d2d00db4af 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkIntentPolicy.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkIntentPolicy.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -17,6 +16,11 @@ public partial class NetworkIntentPolicy : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -33,19 +37,17 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WriteEndObject(); } internal static NetworkIntentPolicy DeserializeNetworkIntentPolicy(JsonElement element) { Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag")) @@ -53,6 +55,11 @@ internal static NetworkIntentPolicy DeserializeNetworkIntentPolicy(JsonElement e etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -83,13 +90,8 @@ internal static NetworkIntentPolicy DeserializeNetworkIntentPolicy(JsonElement e tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } } - return new NetworkIntentPolicy(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value); + return new NetworkIntentPolicy(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkIntentPolicy.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkIntentPolicy.cs index 5c1b3617d99aa..46b6267eb3a6a 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkIntentPolicy.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkIntentPolicy.cs @@ -18,7 +18,7 @@ public NetworkIntentPolicy() } /// Initializes a new instance of NetworkIntentPolicy. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkInterfaceAssociation.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkInterfaceAssociation.Serialization.cs index 5c7a019858825..fc1cc4ba97fa8 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkInterfaceAssociation.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkInterfaceAssociation.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network; namespace Azure.ResourceManager.Network.Models @@ -17,10 +16,15 @@ public partial class NetworkInterfaceAssociation { internal static NetworkInterfaceAssociation DeserializeNetworkInterfaceAssociation(JsonElement element) { + Optional id = default; Optional> securityRules = default; - ResourceIdentifier id = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("securityRules")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -36,13 +40,8 @@ internal static NetworkInterfaceAssociation DeserializeNetworkInterfaceAssociati securityRules = array; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } } - return new NetworkInterfaceAssociation(id, Optional.ToList(securityRules)); + return new NetworkInterfaceAssociation(id.Value, Optional.ToList(securityRules)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkInterfaceAssociation.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkInterfaceAssociation.cs index 21a0a4b363582..621df1941bfb9 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkInterfaceAssociation.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkInterfaceAssociation.cs @@ -8,12 +8,11 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { /// Network interface and its custom security rules. - public partial class NetworkInterfaceAssociation : Resources.Models.SubResource + public partial class NetworkInterfaceAssociation { /// Initializes a new instance of NetworkInterfaceAssociation. internal NetworkInterfaceAssociation() @@ -22,13 +21,16 @@ internal NetworkInterfaceAssociation() } /// Initializes a new instance of NetworkInterfaceAssociation. - /// The id. + /// Network interface ID. /// Collection of custom security rules. - internal NetworkInterfaceAssociation(string id, IReadOnlyList securityRules) : base(id) + internal NetworkInterfaceAssociation(string id, IReadOnlyList securityRules) { + Id = id; SecurityRules = securityRules; } + /// Network interface ID. + public string Id { get; } /// Collection of custom security rules. public IReadOnlyList SecurityRules { get; } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkInterfaceData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkInterfaceData.Serialization.cs index a675c394989fb..357d67fa627e7 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkInterfaceData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkInterfaceData.Serialization.cs @@ -8,8 +8,8 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -23,6 +23,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("extendedLocation"); writer.WriteObjectValue(ExtendedLocation); } + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -39,8 +44,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(NetworkSecurityGroup)) @@ -101,12 +104,12 @@ internal static NetworkInterfaceData DeserializeNetworkInterfaceData(JsonElement { Optional extendedLocation = default; Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; - Optional virtualMachine = default; + Optional virtualMachine = default; Optional networkSecurityGroup = default; Optional privateEndpoint = default; Optional> ipConfigurations = default; @@ -117,7 +120,7 @@ internal static NetworkInterfaceData DeserializeNetworkInterfaceData(JsonElement Optional enableAcceleratedNetworking = default; Optional enableIPForwarding = default; Optional> hostedWorkloads = default; - Optional dscpConfiguration = default; + Optional dscpConfiguration = default; Optional resourceGuid = default; Optional provisioningState = default; Optional workloadType = default; @@ -141,6 +144,11 @@ internal static NetworkInterfaceData DeserializeNetworkInterfaceData(JsonElement etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -171,11 +179,6 @@ internal static NetworkInterfaceData DeserializeNetworkInterfaceData(JsonElement tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -192,7 +195,7 @@ internal static NetworkInterfaceData DeserializeNetworkInterfaceData(JsonElement property0.ThrowNonNullablePropertyIsNull(); continue; } - virtualMachine = SubResource.DeserializeSubResource(property0.Value); + virtualMachine = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("networkSecurityGroup")) @@ -312,7 +315,7 @@ internal static NetworkInterfaceData DeserializeNetworkInterfaceData(JsonElement property0.ThrowNonNullablePropertyIsNull(); continue; } - dscpConfiguration = SubResource.DeserializeSubResource(property0.Value); + dscpConfiguration = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("resourceGuid")) @@ -369,7 +372,7 @@ internal static NetworkInterfaceData DeserializeNetworkInterfaceData(JsonElement continue; } } - return new NetworkInterfaceData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), extendedLocation.Value, etag.Value, virtualMachine.Value, networkSecurityGroup.Value, privateEndpoint.Value, Optional.ToList(ipConfigurations), Optional.ToList(tapConfigurations), dnsSettings.Value, macAddress.Value, Optional.ToNullable(primary), Optional.ToNullable(enableAcceleratedNetworking), Optional.ToNullable(enableIPForwarding), Optional.ToList(hostedWorkloads), dscpConfiguration.Value, resourceGuid.Value, Optional.ToNullable(provisioningState), workloadType.Value, Optional.ToNullable(nicType), privateLinkService.Value, Optional.ToNullable(migrationPhase)); + return new NetworkInterfaceData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), extendedLocation.Value, etag.Value, virtualMachine, networkSecurityGroup.Value, privateEndpoint.Value, Optional.ToList(ipConfigurations), Optional.ToList(tapConfigurations), dnsSettings.Value, macAddress.Value, Optional.ToNullable(primary), Optional.ToNullable(enableAcceleratedNetworking), Optional.ToNullable(enableIPForwarding), Optional.ToList(hostedWorkloads), dscpConfiguration, resourceGuid.Value, Optional.ToNullable(provisioningState), workloadType.Value, Optional.ToNullable(nicType), privateLinkService.Value, Optional.ToNullable(migrationPhase)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkInterfaceIPConfiguration.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkInterfaceIPConfiguration.Serialization.cs index a7a2a53d99018..c0ed03b78a218 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkInterfaceIPConfiguration.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkInterfaceIPConfiguration.Serialization.cs @@ -8,8 +8,8 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -28,14 +28,17 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("type"); writer.WriteStringValue(Type); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(GatewayLoadBalancer)) { writer.WritePropertyName("gatewayLoadBalancer"); - writer.WriteObjectValue(GatewayLoadBalancer); + JsonSerializer.Serialize(writer, GatewayLoadBalancer); } if (Optional.IsCollectionDefined(VirtualNetworkTaps)) { @@ -126,8 +129,8 @@ internal static NetworkInterfaceIPConfiguration DeserializeNetworkInterfaceIPCon Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; - Optional gatewayLoadBalancer = default; + Optional id = default; + Optional gatewayLoadBalancer = default; Optional> virtualNetworkTaps = default; Optional> applicationGatewayBackendAddressPools = default; Optional> loadBalancerBackendAddressPools = default; @@ -179,7 +182,7 @@ internal static NetworkInterfaceIPConfiguration DeserializeNetworkInterfaceIPCon property0.ThrowNonNullablePropertyIsNull(); continue; } - gatewayLoadBalancer = SubResource.DeserializeSubResource(property0.Value); + gatewayLoadBalancer = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("virtualNetworkTaps")) @@ -336,7 +339,7 @@ internal static NetworkInterfaceIPConfiguration DeserializeNetworkInterfaceIPCon continue; } } - return new NetworkInterfaceIPConfiguration(id, name.Value, etag.Value, type.Value, gatewayLoadBalancer.Value, Optional.ToList(virtualNetworkTaps), Optional.ToList(applicationGatewayBackendAddressPools), Optional.ToList(loadBalancerBackendAddressPools), Optional.ToList(loadBalancerInboundNatRules), privateIPAddress.Value, Optional.ToNullable(privateIPAllocationMethod), Optional.ToNullable(privateIPAddressVersion), subnet.Value, Optional.ToNullable(primary), publicIPAddress.Value, Optional.ToList(applicationSecurityGroups), Optional.ToNullable(provisioningState), privateLinkConnectionProperties.Value); + return new NetworkInterfaceIPConfiguration(id.Value, name.Value, etag.Value, type.Value, gatewayLoadBalancer, Optional.ToList(virtualNetworkTaps), Optional.ToList(applicationGatewayBackendAddressPools), Optional.ToList(loadBalancerBackendAddressPools), Optional.ToList(loadBalancerInboundNatRules), privateIPAddress.Value, Optional.ToNullable(privateIPAllocationMethod), Optional.ToNullable(privateIPAddressVersion), subnet.Value, Optional.ToNullable(primary), publicIPAddress.Value, Optional.ToList(applicationSecurityGroups), Optional.ToNullable(provisioningState), privateLinkConnectionProperties.Value); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkInterfaceIPConfiguration.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkInterfaceIPConfiguration.cs index 50bb56b096da8..098ddce8c1c24 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkInterfaceIPConfiguration.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkInterfaceIPConfiguration.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.Network.Models { /// IPConfiguration in a network interface. - public partial class NetworkInterfaceIPConfiguration : WritableSubResource + public partial class NetworkInterfaceIPConfiguration : SubResource { /// Initializes a new instance of NetworkInterfaceIPConfiguration. public NetworkInterfaceIPConfiguration() @@ -26,7 +26,7 @@ public NetworkInterfaceIPConfiguration() } /// Initializes a new instance of NetworkInterfaceIPConfiguration. - /// The id. + /// Resource ID. /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// Resource type. @@ -44,7 +44,7 @@ public NetworkInterfaceIPConfiguration() /// Application security groups in which the IP configuration is included. /// The provisioning state of the network interface IP configuration. /// PrivateLinkConnection properties for the network interface. - internal NetworkInterfaceIPConfiguration(string id, string name, string etag, string type, SubResource gatewayLoadBalancer, IList virtualNetworkTaps, IList applicationGatewayBackendAddressPools, IList loadBalancerBackendAddressPools, IList loadBalancerInboundNatRules, string privateIPAddress, IPAllocationMethod? privateIPAllocationMethod, IPVersion? privateIPAddressVersion, SubnetData subnet, bool? primary, PublicIPAddressData publicIPAddress, IList applicationSecurityGroups, ProvisioningState? provisioningState, NetworkInterfaceIPConfigurationPrivateLinkConnectionProperties privateLinkConnectionProperties) : base(id) + internal NetworkInterfaceIPConfiguration(string id, string name, string etag, string type, WritableSubResource gatewayLoadBalancer, IList virtualNetworkTaps, IList applicationGatewayBackendAddressPools, IList loadBalancerBackendAddressPools, IList loadBalancerInboundNatRules, string privateIPAddress, IPAllocationMethod? privateIPAllocationMethod, IPVersion? privateIPAddressVersion, SubnetData subnet, bool? primary, PublicIPAddressData publicIPAddress, IList applicationSecurityGroups, ProvisioningState? provisioningState, NetworkInterfaceIPConfigurationPrivateLinkConnectionProperties privateLinkConnectionProperties) : base(id) { Name = name; Etag = etag; @@ -72,7 +72,7 @@ internal NetworkInterfaceIPConfiguration(string id, string name, string etag, st /// Resource type. public string Type { get; set; } /// The reference to gateway load balancer frontend IP. - public SubResource GatewayLoadBalancer { get; set; } + public WritableSubResource GatewayLoadBalancer { get; set; } /// The reference to Virtual Network Taps. public IList VirtualNetworkTaps { get; } /// The reference to ApplicationGatewayBackendAddressPool resource. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkInterfaceTapConfigurationData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkInterfaceTapConfigurationData.Serialization.cs index ebbe03832c868..e84ca192d02b6 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkInterfaceTapConfigurationData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkInterfaceTapConfigurationData.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -22,8 +21,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(VirtualNetworkTap)) @@ -40,7 +42,7 @@ internal static NetworkInterfaceTapConfigurationData DeserializeNetworkInterface Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional virtualNetworkTap = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) @@ -98,7 +100,7 @@ internal static NetworkInterfaceTapConfigurationData DeserializeNetworkInterface continue; } } - return new NetworkInterfaceTapConfigurationData(id, name.Value, etag.Value, type.Value, virtualNetworkTap.Value, Optional.ToNullable(provisioningState)); + return new NetworkInterfaceTapConfigurationData(id.Value, name.Value, etag.Value, type.Value, virtualNetworkTap.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkProfileData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkProfileData.Serialization.cs index 8e9054df9898f..0e3704c33a2b9 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkProfileData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkProfileData.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -18,6 +17,11 @@ public partial class NetworkProfileData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -34,8 +38,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsCollectionDefined(ContainerNetworkInterfaceConfigurations)) @@ -55,11 +57,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static NetworkProfileData DeserializeNetworkProfileData(JsonElement element) { Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional> containerNetworkInterfaces = default; Optional> containerNetworkInterfaceConfigurations = default; Optional resourceGuid = default; @@ -71,6 +73,11 @@ internal static NetworkProfileData DeserializeNetworkProfileData(JsonElement ele etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -101,11 +108,6 @@ internal static NetworkProfileData DeserializeNetworkProfileData(JsonElement ele tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -164,7 +166,7 @@ internal static NetworkProfileData DeserializeNetworkProfileData(JsonElement ele continue; } } - return new NetworkProfileData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, Optional.ToList(containerNetworkInterfaces), Optional.ToList(containerNetworkInterfaceConfigurations), resourceGuid.Value, Optional.ToNullable(provisioningState)); + return new NetworkProfileData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, Optional.ToList(containerNetworkInterfaces), Optional.ToList(containerNetworkInterfaceConfigurations), resourceGuid.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkSecurityGroupData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkSecurityGroupData.Serialization.cs index 00cd124027103..317f05efccb07 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkSecurityGroupData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkSecurityGroupData.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -18,6 +17,11 @@ public partial class NetworkSecurityGroupData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -34,8 +38,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsCollectionDefined(SecurityRules)) @@ -55,11 +57,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static NetworkSecurityGroupData DeserializeNetworkSecurityGroupData(JsonElement element) { Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional> securityRules = default; Optional> defaultSecurityRules = default; Optional> networkInterfaces = default; @@ -74,6 +76,11 @@ internal static NetworkSecurityGroupData DeserializeNetworkSecurityGroupData(Jso etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -104,11 +111,6 @@ internal static NetworkSecurityGroupData DeserializeNetworkSecurityGroupData(Jso tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -212,7 +214,7 @@ internal static NetworkSecurityGroupData DeserializeNetworkSecurityGroupData(Jso continue; } } - return new NetworkSecurityGroupData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, Optional.ToList(securityRules), Optional.ToList(defaultSecurityRules), Optional.ToList(networkInterfaces), Optional.ToList(subnets), Optional.ToList(flowLogs), resourceGuid.Value, Optional.ToNullable(provisioningState)); + return new NetworkSecurityGroupData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, Optional.ToList(securityRules), Optional.ToList(defaultSecurityRules), Optional.ToList(networkInterfaces), Optional.ToList(subnets), Optional.ToList(flowLogs), resourceGuid.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkVirtualApplianceData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkVirtualApplianceData.Serialization.cs index 04e59866bcb7f..7b02206608efb 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkVirtualApplianceData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkVirtualApplianceData.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; using Azure.ResourceManager.Resources.Models; @@ -24,6 +23,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("identity"); JsonSerializer.Serialize(writer, Identity); } + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -40,8 +44,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(NvaSku)) @@ -62,7 +64,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(VirtualHub)) { writer.WritePropertyName("virtualHub"); - writer.WriteObjectValue(VirtualHub); + JsonSerializer.Serialize(writer, VirtualHub); } if (Optional.IsCollectionDefined(CloudInitConfigurationBlobs)) { @@ -92,21 +94,21 @@ internal static NetworkVirtualApplianceData DeserializeNetworkVirtualApplianceDa { Optional identity = default; Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional nvaSku = default; Optional addressPrefix = default; Optional> bootStrapConfigurationBlobs = default; - Optional virtualHub = default; + Optional virtualHub = default; Optional> cloudInitConfigurationBlobs = default; Optional cloudInitConfiguration = default; Optional virtualApplianceAsn = default; Optional> virtualApplianceNics = default; - Optional> virtualApplianceSites = default; - Optional> inboundSecurityRules = default; + Optional> virtualApplianceSites = default; + Optional> inboundSecurityRules = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) { @@ -125,6 +127,11 @@ internal static NetworkVirtualApplianceData DeserializeNetworkVirtualApplianceDa etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -155,11 +162,6 @@ internal static NetworkVirtualApplianceData DeserializeNetworkVirtualApplianceDa tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -206,7 +208,7 @@ internal static NetworkVirtualApplianceData DeserializeNetworkVirtualApplianceDa property0.ThrowNonNullablePropertyIsNull(); continue; } - virtualHub = Models.SubResource.DeserializeSubResource(property0.Value); + virtualHub = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("cloudInitConfigurationBlobs")) @@ -261,10 +263,10 @@ internal static NetworkVirtualApplianceData DeserializeNetworkVirtualApplianceDa property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(Models.SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } virtualApplianceSites = array; continue; @@ -276,10 +278,10 @@ internal static NetworkVirtualApplianceData DeserializeNetworkVirtualApplianceDa property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(Models.SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } inboundSecurityRules = array; continue; @@ -298,7 +300,7 @@ internal static NetworkVirtualApplianceData DeserializeNetworkVirtualApplianceDa continue; } } - return new NetworkVirtualApplianceData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity, etag.Value, nvaSku.Value, addressPrefix.Value, Optional.ToList(bootStrapConfigurationBlobs), virtualHub.Value, Optional.ToList(cloudInitConfigurationBlobs), cloudInitConfiguration.Value, Optional.ToNullable(virtualApplianceAsn), Optional.ToList(virtualApplianceNics), Optional.ToList(virtualApplianceSites), Optional.ToList(inboundSecurityRules), Optional.ToNullable(provisioningState)); + return new NetworkVirtualApplianceData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), identity, etag.Value, nvaSku.Value, addressPrefix.Value, Optional.ToList(bootStrapConfigurationBlobs), virtualHub, Optional.ToList(cloudInitConfigurationBlobs), cloudInitConfiguration.Value, Optional.ToNullable(virtualApplianceAsn), Optional.ToList(virtualApplianceNics), Optional.ToList(virtualApplianceSites), Optional.ToList(inboundSecurityRules), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkVirtualApplianceSku.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkVirtualApplianceSku.Serialization.cs index 4b6f70e5e406a..60ce0617ff4e2 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkVirtualApplianceSku.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkVirtualApplianceSku.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -17,6 +16,11 @@ public partial class NetworkVirtualApplianceSku : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -33,8 +37,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsCollectionDefined(AvailableScaleUnits)) @@ -54,11 +56,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static NetworkVirtualApplianceSku DeserializeNetworkVirtualApplianceSku(JsonElement element) { Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional vendor = default; Optional> availableVersions = default; Optional> availableScaleUnits = default; @@ -69,6 +71,11 @@ internal static NetworkVirtualApplianceSku DeserializeNetworkVirtualApplianceSku etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -99,11 +106,6 @@ internal static NetworkVirtualApplianceSku DeserializeNetworkVirtualApplianceSku tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -152,7 +154,7 @@ internal static NetworkVirtualApplianceSku DeserializeNetworkVirtualApplianceSku continue; } } - return new NetworkVirtualApplianceSku(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, vendor.Value, Optional.ToList(availableVersions), Optional.ToList(availableScaleUnits)); + return new NetworkVirtualApplianceSku(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, vendor.Value, Optional.ToList(availableVersions), Optional.ToList(availableScaleUnits)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkVirtualApplianceSku.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkVirtualApplianceSku.cs index 767d1232e5df4..fd8830cdd7130 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkVirtualApplianceSku.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkVirtualApplianceSku.cs @@ -21,7 +21,7 @@ public NetworkVirtualApplianceSku() } /// Initializes a new instance of NetworkVirtualApplianceSku. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkWatcherData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkWatcherData.Serialization.cs index 35c1c1fa7f9a4..201283086ef41 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkWatcherData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/NetworkWatcherData.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -18,6 +17,11 @@ public partial class NetworkWatcherData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -34,8 +38,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); writer.WriteEndObject(); @@ -45,11 +47,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static NetworkWatcherData DeserializeNetworkWatcherData(JsonElement element) { Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) { @@ -58,6 +60,11 @@ internal static NetworkWatcherData DeserializeNetworkWatcherData(JsonElement ele etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -88,11 +95,6 @@ internal static NetworkWatcherData DeserializeNetworkWatcherData(JsonElement ele tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -116,7 +118,7 @@ internal static NetworkWatcherData DeserializeNetworkWatcherData(JsonElement ele continue; } } - return new NetworkWatcherData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, Optional.ToNullable(provisioningState)); + return new NetworkWatcherData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/OutboundRule.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/OutboundRule.Serialization.cs index 0a391c88ede20..12eb894dc8c82 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/OutboundRule.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/OutboundRule.Serialization.cs @@ -8,7 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -22,8 +22,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(AllocatedOutboundPorts)) @@ -37,14 +40,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in FrontendIPConfigurations) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } if (Optional.IsDefined(BackendAddressPool)) { writer.WritePropertyName("backendAddressPool"); - writer.WriteObjectValue(BackendAddressPool); + JsonSerializer.Serialize(writer, BackendAddressPool); } if (Optional.IsDefined(Protocol)) { @@ -70,10 +73,10 @@ internal static OutboundRule DeserializeOutboundRule(JsonElement element) Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional allocatedOutboundPorts = default; - Optional> frontendIPConfigurations = default; - Optional backendAddressPool = default; + Optional> frontendIPConfigurations = default; + Optional backendAddressPool = default; Optional provisioningState = default; Optional protocol = default; Optional enableTcpReset = default; @@ -126,10 +129,10 @@ internal static OutboundRule DeserializeOutboundRule(JsonElement element) property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } frontendIPConfigurations = array; continue; @@ -141,7 +144,7 @@ internal static OutboundRule DeserializeOutboundRule(JsonElement element) property0.ThrowNonNullablePropertyIsNull(); continue; } - backendAddressPool = SubResource.DeserializeSubResource(property0.Value); + backendAddressPool = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("provisioningState")) @@ -188,7 +191,7 @@ internal static OutboundRule DeserializeOutboundRule(JsonElement element) continue; } } - return new OutboundRule(id, name.Value, etag.Value, type.Value, Optional.ToNullable(allocatedOutboundPorts), Optional.ToList(frontendIPConfigurations), backendAddressPool.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(protocol), Optional.ToNullable(enableTcpReset), Optional.ToNullable(idleTimeoutInMinutes)); + return new OutboundRule(id.Value, name.Value, etag.Value, type.Value, Optional.ToNullable(allocatedOutboundPorts), Optional.ToList(frontendIPConfigurations), backendAddressPool, Optional.ToNullable(provisioningState), Optional.ToNullable(protocol), Optional.ToNullable(enableTcpReset), Optional.ToNullable(idleTimeoutInMinutes)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/OutboundRule.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/OutboundRule.cs index 11fdaa91cef14..701ebda6b3411 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/OutboundRule.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/OutboundRule.cs @@ -12,16 +12,16 @@ namespace Azure.ResourceManager.Network.Models { /// Outbound rule of the load balancer. - public partial class OutboundRule : WritableSubResource + public partial class OutboundRule : SubResource { /// Initializes a new instance of OutboundRule. public OutboundRule() { - FrontendIPConfigurations = new ChangeTrackingList(); + FrontendIPConfigurations = new ChangeTrackingList(); } /// Initializes a new instance of OutboundRule. - /// The id. + /// Resource ID. /// The name of the resource that is unique within the set of outbound rules used by the load balancer. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// Type of the resource. @@ -32,7 +32,7 @@ public OutboundRule() /// The protocol for the outbound rule in load balancer. /// Receive bidirectional TCP Reset on TCP flow idle timeout or unexpected connection termination. This element is only used when the protocol is set to TCP. /// The timeout for the TCP idle connection. - internal OutboundRule(string id, string name, string etag, string type, int? allocatedOutboundPorts, IList frontendIPConfigurations, SubResource backendAddressPool, ProvisioningState? provisioningState, LoadBalancerOutboundRuleProtocol? protocol, bool? enableTcpReset, int? idleTimeoutInMinutes) : base(id) + internal OutboundRule(string id, string name, string etag, string type, int? allocatedOutboundPorts, IList frontendIPConfigurations, WritableSubResource backendAddressPool, ProvisioningState? provisioningState, LoadBalancerOutboundRuleProtocol? protocol, bool? enableTcpReset, int? idleTimeoutInMinutes) : base(id) { Name = name; Etag = etag; @@ -55,9 +55,9 @@ internal OutboundRule(string id, string name, string etag, string type, int? all /// The number of outbound ports to be used for NAT. public int? AllocatedOutboundPorts { get; set; } /// The Frontend IP addresses of the load balancer. - public IList FrontendIPConfigurations { get; } + public IList FrontendIPConfigurations { get; } /// A reference to a pool of DIPs. Outbound traffic is randomly load balanced across IPs in the backend IPs. - public SubResource BackendAddressPool { get; set; } + public WritableSubResource BackendAddressPool { get; set; } /// The provisioning state of the outbound rule resource. public ProvisioningState? ProvisioningState { get; } /// The protocol for the outbound rule in load balancer. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/P2SConnectionConfiguration.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/P2SConnectionConfiguration.Serialization.cs index f4ef7d326dbf8..51a9e0f3ec173 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/P2SConnectionConfiguration.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/P2SConnectionConfiguration.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -21,8 +20,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(VpnClientAddressPool)) @@ -48,7 +50,7 @@ internal static P2SConnectionConfiguration DeserializeP2SConnectionConfiguration { Optional name = default; Optional etag = default; - ResourceIdentifier id = default; + Optional id = default; Optional vpnClientAddressPool = default; Optional routingConfiguration = default; Optional enableInternetSecurity = default; @@ -123,7 +125,7 @@ internal static P2SConnectionConfiguration DeserializeP2SConnectionConfiguration continue; } } - return new P2SConnectionConfiguration(id, name.Value, etag.Value, vpnClientAddressPool.Value, routingConfiguration.Value, Optional.ToNullable(enableInternetSecurity), Optional.ToNullable(provisioningState)); + return new P2SConnectionConfiguration(id.Value, name.Value, etag.Value, vpnClientAddressPool.Value, routingConfiguration.Value, Optional.ToNullable(enableInternetSecurity), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/P2SConnectionConfiguration.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/P2SConnectionConfiguration.cs index 247a5a5237547..10f74c8c9ad32 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/P2SConnectionConfiguration.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/P2SConnectionConfiguration.cs @@ -5,12 +5,10 @@ #nullable disable -using Azure.ResourceManager.Resources.Models; - namespace Azure.ResourceManager.Network.Models { /// P2SConnectionConfiguration Resource. - public partial class P2SConnectionConfiguration : WritableSubResource + public partial class P2SConnectionConfiguration : SubResource { /// Initializes a new instance of P2SConnectionConfiguration. public P2SConnectionConfiguration() @@ -18,7 +16,7 @@ public P2SConnectionConfiguration() } /// Initializes a new instance of P2SConnectionConfiguration. - /// The id. + /// Resource ID. /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// The reference to the address space resource which represents Address space for P2S VpnClient. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/P2SVpnGatewayData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/P2SVpnGatewayData.Serialization.cs index 231ed62d3e482..26f649f790e99 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/P2SVpnGatewayData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/P2SVpnGatewayData.Serialization.cs @@ -8,8 +8,8 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -18,6 +18,11 @@ public partial class P2SVpnGatewayData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -34,14 +39,12 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(VirtualHub)) { writer.WritePropertyName("virtualHub"); - writer.WriteObjectValue(VirtualHub); + JsonSerializer.Serialize(writer, VirtualHub); } if (Optional.IsCollectionDefined(P2SConnectionConfigurations)) { @@ -61,7 +64,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(VpnServerConfiguration)) { writer.WritePropertyName("vpnServerConfiguration"); - writer.WriteObjectValue(VpnServerConfiguration); + JsonSerializer.Serialize(writer, VpnServerConfiguration); } if (Optional.IsCollectionDefined(CustomDnsServers)) { @@ -85,16 +88,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static P2SVpnGatewayData DeserializeP2SVpnGatewayData(JsonElement element) { Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; - Optional virtualHub = default; + Optional virtualHub = default; Optional> p2SConnectionConfigurations = default; Optional provisioningState = default; Optional vpnGatewayScaleUnit = default; - Optional vpnServerConfiguration = default; + Optional vpnServerConfiguration = default; Optional vpnClientConnectionHealth = default; Optional> customDnsServers = default; Optional isRoutingPreferenceInternet = default; @@ -105,6 +108,11 @@ internal static P2SVpnGatewayData DeserializeP2SVpnGatewayData(JsonElement eleme etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -135,11 +143,6 @@ internal static P2SVpnGatewayData DeserializeP2SVpnGatewayData(JsonElement eleme tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -156,7 +159,7 @@ internal static P2SVpnGatewayData DeserializeP2SVpnGatewayData(JsonElement eleme property0.ThrowNonNullablePropertyIsNull(); continue; } - virtualHub = SubResource.DeserializeSubResource(property0.Value); + virtualHub = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("p2SConnectionConfigurations")) @@ -201,7 +204,7 @@ internal static P2SVpnGatewayData DeserializeP2SVpnGatewayData(JsonElement eleme property0.ThrowNonNullablePropertyIsNull(); continue; } - vpnServerConfiguration = SubResource.DeserializeSubResource(property0.Value); + vpnServerConfiguration = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("vpnClientConnectionHealth")) @@ -243,7 +246,7 @@ internal static P2SVpnGatewayData DeserializeP2SVpnGatewayData(JsonElement eleme continue; } } - return new P2SVpnGatewayData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, virtualHub.Value, Optional.ToList(p2SConnectionConfigurations), Optional.ToNullable(provisioningState), Optional.ToNullable(vpnGatewayScaleUnit), vpnServerConfiguration.Value, vpnClientConnectionHealth.Value, Optional.ToList(customDnsServers), Optional.ToNullable(isRoutingPreferenceInternet)); + return new P2SVpnGatewayData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, virtualHub, Optional.ToList(p2SConnectionConfigurations), Optional.ToNullable(provisioningState), Optional.ToNullable(vpnGatewayScaleUnit), vpnServerConfiguration, vpnClientConnectionHealth.Value, Optional.ToList(customDnsServers), Optional.ToNullable(isRoutingPreferenceInternet)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PacketCaptureData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PacketCaptureData.Serialization.cs index d74ca08a1f449..899789df37a07 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PacketCaptureData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PacketCaptureData.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -18,8 +17,8 @@ public partial class PacketCaptureData internal static PacketCaptureData DeserializePacketCaptureData(JsonElement element) { Optional name = default; + Optional id = default; Optional etag = default; - ResourceIdentifier id = default; Optional target = default; Optional bytesToCapturePerPacket = default; Optional totalBytesPerSession = default; @@ -34,14 +33,14 @@ internal static PacketCaptureData DeserializePacketCaptureData(JsonElement eleme name = property.Value.GetString(); continue; } - if (property.NameEquals("etag")) + if (property.NameEquals("id")) { - etag = property.Value.GetString(); + id = property.Value.GetString(); continue; } - if (property.NameEquals("id")) + if (property.NameEquals("etag")) { - id = property.Value.GetString(); + etag = property.Value.GetString(); continue; } if (property.NameEquals("properties")) @@ -127,7 +126,7 @@ internal static PacketCaptureData DeserializePacketCaptureData(JsonElement eleme continue; } } - return new PacketCaptureData(id, name.Value, etag.Value, target.Value, Optional.ToNullable(bytesToCapturePerPacket), Optional.ToNullable(totalBytesPerSession), Optional.ToNullable(timeLimitInSeconds), storageLocation.Value, Optional.ToList(filters), Optional.ToNullable(provisioningState)); + return new PacketCaptureData(name.Value, id.Value, etag.Value, target.Value, Optional.ToNullable(bytesToCapturePerPacket), Optional.ToNullable(totalBytesPerSession), Optional.ToNullable(timeLimitInSeconds), storageLocation.Value, Optional.ToList(filters), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PacketCaptureQueryStatusResult.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PacketCaptureQueryStatusResult.Serialization.cs index 4de707158f214..c9554e796973b 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PacketCaptureQueryStatusResult.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PacketCaptureQueryStatusResult.Serialization.cs @@ -9,7 +9,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -18,11 +17,11 @@ public partial class PacketCaptureQueryStatusResult internal static PacketCaptureQueryStatusResult DeserializePacketCaptureQueryStatusResult(JsonElement element) { Optional name = default; + Optional id = default; Optional captureStartTime = default; Optional packetCaptureStatus = default; Optional stopReason = default; Optional> packetCaptureError = default; - ResourceIdentifier id = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) @@ -30,6 +29,11 @@ internal static PacketCaptureQueryStatusResult DeserializePacketCaptureQueryStat name = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("captureStartTime")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -70,13 +74,8 @@ internal static PacketCaptureQueryStatusResult DeserializePacketCaptureQueryStat packetCaptureError = array; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } } - return new PacketCaptureQueryStatusResult(id, name.Value, Optional.ToNullable(captureStartTime), Optional.ToNullable(packetCaptureStatus), stopReason.Value, Optional.ToList(packetCaptureError)); + return new PacketCaptureQueryStatusResult(name.Value, id.Value, Optional.ToNullable(captureStartTime), Optional.ToNullable(packetCaptureStatus), stopReason.Value, Optional.ToList(packetCaptureError)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PacketCaptureQueryStatusResult.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PacketCaptureQueryStatusResult.cs index ae2f8a917ddd5..6f48d058bcd9f 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PacketCaptureQueryStatusResult.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PacketCaptureQueryStatusResult.cs @@ -8,12 +8,11 @@ using System; using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { /// Status of packet capture session. - public partial class PacketCaptureQueryStatusResult : Resources.Models.SubResource + public partial class PacketCaptureQueryStatusResult { /// Initializes a new instance of PacketCaptureQueryStatusResult. internal PacketCaptureQueryStatusResult() @@ -22,15 +21,16 @@ internal PacketCaptureQueryStatusResult() } /// Initializes a new instance of PacketCaptureQueryStatusResult. - /// The id. /// The name of the packet capture resource. + /// The ID of the packet capture resource. /// The start time of the packet capture session. /// The status of the packet capture session. /// The reason the current packet capture session was stopped. /// List of errors of packet capture session. - internal PacketCaptureQueryStatusResult(string id, string name, DateTimeOffset? captureStartTime, PcStatus? packetCaptureStatus, string stopReason, IReadOnlyList packetCaptureError) : base(id) + internal PacketCaptureQueryStatusResult(string name, string id, DateTimeOffset? captureStartTime, PcStatus? packetCaptureStatus, string stopReason, IReadOnlyList packetCaptureError) { Name = name; + Id = id; CaptureStartTime = captureStartTime; PacketCaptureStatus = packetCaptureStatus; StopReason = stopReason; @@ -39,6 +39,8 @@ internal PacketCaptureQueryStatusResult(string id, string name, DateTimeOffset? /// The name of the packet capture resource. public string Name { get; } + /// The ID of the packet capture resource. + public string Id { get; } /// The start time of the packet capture session. public DateTimeOffset? CaptureStartTime { get; } /// The status of the packet capture session. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PatchRouteFilter.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PatchRouteFilter.Serialization.cs index 503c7cb2f4bac..f449b45627ccc 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PatchRouteFilter.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PatchRouteFilter.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network; namespace Azure.ResourceManager.Network.Models @@ -29,8 +28,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsCollectionDefined(Rules)) @@ -53,7 +55,7 @@ internal static PatchRouteFilter DeserializePatchRouteFilter(JsonElement element Optional etag = default; Optional type = default; Optional> tags = default; - ResourceIdentifier id = default; + Optional id = default; Optional> rules = default; Optional> peerings = default; Optional> ipv6Peerings = default; @@ -163,7 +165,7 @@ internal static PatchRouteFilter DeserializePatchRouteFilter(JsonElement element continue; } } - return new PatchRouteFilter(id, name.Value, etag.Value, type.Value, Optional.ToDictionary(tags), Optional.ToList(rules), Optional.ToList(peerings), Optional.ToList(ipv6Peerings), Optional.ToNullable(provisioningState)); + return new PatchRouteFilter(id.Value, name.Value, etag.Value, type.Value, Optional.ToDictionary(tags), Optional.ToList(rules), Optional.ToList(peerings), Optional.ToList(ipv6Peerings), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PatchRouteFilter.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PatchRouteFilter.cs index 4ccec9642289c..0914c20437719 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PatchRouteFilter.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PatchRouteFilter.cs @@ -8,12 +8,11 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { /// Route Filter Resource. - public partial class PatchRouteFilter : WritableSubResource + public partial class PatchRouteFilter : SubResource { /// Initializes a new instance of PatchRouteFilter. public PatchRouteFilter() @@ -25,7 +24,7 @@ public PatchRouteFilter() } /// Initializes a new instance of PatchRouteFilter. - /// The id. + /// Resource ID. /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// Resource type. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PatchRouteFilterRule.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PatchRouteFilterRule.Serialization.cs index 61ea96ffd7f79..4f9ecce0f43dd 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PatchRouteFilterRule.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PatchRouteFilterRule.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -17,8 +16,11 @@ public partial class PatchRouteFilterRule : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Access)) @@ -49,7 +51,7 @@ internal static PatchRouteFilterRule DeserializePatchRouteFilterRule(JsonElement { Optional name = default; Optional etag = default; - ResourceIdentifier id = default; + Optional id = default; Optional access = default; Optional routeFilterRuleType = default; Optional> communities = default; @@ -129,7 +131,7 @@ internal static PatchRouteFilterRule DeserializePatchRouteFilterRule(JsonElement continue; } } - return new PatchRouteFilterRule(id, name.Value, etag.Value, Optional.ToNullable(access), Optional.ToNullable(routeFilterRuleType), Optional.ToList(communities), Optional.ToNullable(provisioningState)); + return new PatchRouteFilterRule(id.Value, name.Value, etag.Value, Optional.ToNullable(access), Optional.ToNullable(routeFilterRuleType), Optional.ToList(communities), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PatchRouteFilterRule.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PatchRouteFilterRule.cs index 5a70cdd7c4a8f..2895d4fc2d26a 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PatchRouteFilterRule.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PatchRouteFilterRule.cs @@ -7,12 +7,11 @@ using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { /// Route Filter Rule Resource. - public partial class PatchRouteFilterRule : WritableSubResource + public partial class PatchRouteFilterRule : SubResource { /// Initializes a new instance of PatchRouteFilterRule. public PatchRouteFilterRule() @@ -21,7 +20,7 @@ public PatchRouteFilterRule() } /// Initializes a new instance of PatchRouteFilterRule. - /// The id. + /// Resource ID. /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// The access type of the rule. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PeerExpressRouteCircuitConnection.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PeerExpressRouteCircuitConnection.Serialization.cs index 7b84e0d2aacd1..f6d89a8efe6bd 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PeerExpressRouteCircuitConnection.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PeerExpressRouteCircuitConnection.Serialization.cs @@ -7,7 +7,7 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -21,19 +21,22 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(ExpressRouteCircuitPeering)) { writer.WritePropertyName("expressRouteCircuitPeering"); - writer.WriteObjectValue(ExpressRouteCircuitPeering); + JsonSerializer.Serialize(writer, ExpressRouteCircuitPeering); } if (Optional.IsDefined(PeerExpressRouteCircuitPeering)) { writer.WritePropertyName("peerExpressRouteCircuitPeering"); - writer.WriteObjectValue(PeerExpressRouteCircuitPeering); + JsonSerializer.Serialize(writer, PeerExpressRouteCircuitPeering); } if (Optional.IsDefined(AddressPrefix)) { @@ -59,9 +62,9 @@ internal static PeerExpressRouteCircuitConnection DeserializePeerExpressRouteCir Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; - Optional expressRouteCircuitPeering = default; - Optional peerExpressRouteCircuitPeering = default; + Optional id = default; + Optional expressRouteCircuitPeering = default; + Optional peerExpressRouteCircuitPeering = default; Optional addressPrefix = default; Optional circuitConnectionStatus = default; Optional connectionName = default; @@ -105,7 +108,7 @@ internal static PeerExpressRouteCircuitConnection DeserializePeerExpressRouteCir property0.ThrowNonNullablePropertyIsNull(); continue; } - expressRouteCircuitPeering = SubResource.DeserializeSubResource(property0.Value); + expressRouteCircuitPeering = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("peerExpressRouteCircuitPeering")) @@ -115,7 +118,7 @@ internal static PeerExpressRouteCircuitConnection DeserializePeerExpressRouteCir property0.ThrowNonNullablePropertyIsNull(); continue; } - peerExpressRouteCircuitPeering = SubResource.DeserializeSubResource(property0.Value); + peerExpressRouteCircuitPeering = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("addressPrefix")) @@ -157,7 +160,7 @@ internal static PeerExpressRouteCircuitConnection DeserializePeerExpressRouteCir continue; } } - return new PeerExpressRouteCircuitConnection(id, name.Value, etag.Value, type.Value, expressRouteCircuitPeering.Value, peerExpressRouteCircuitPeering.Value, addressPrefix.Value, Optional.ToNullable(circuitConnectionStatus), connectionName.Value, authResourceGuid.Value, Optional.ToNullable(provisioningState)); + return new PeerExpressRouteCircuitConnection(id.Value, name.Value, etag.Value, type.Value, expressRouteCircuitPeering, peerExpressRouteCircuitPeering, addressPrefix.Value, Optional.ToNullable(circuitConnectionStatus), connectionName.Value, authResourceGuid.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PeerExpressRouteCircuitConnection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PeerExpressRouteCircuitConnection.cs index a5d5ddef44e91..c0e0f56c12a11 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PeerExpressRouteCircuitConnection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PeerExpressRouteCircuitConnection.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.Network.Models { /// Peer Express Route Circuit Connection in an ExpressRouteCircuitPeering resource. - public partial class PeerExpressRouteCircuitConnection : WritableSubResource + public partial class PeerExpressRouteCircuitConnection : SubResource { /// Initializes a new instance of PeerExpressRouteCircuitConnection. public PeerExpressRouteCircuitConnection() @@ -18,7 +18,7 @@ public PeerExpressRouteCircuitConnection() } /// Initializes a new instance of PeerExpressRouteCircuitConnection. - /// The id. + /// Resource ID. /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// Type of the resource. @@ -29,7 +29,7 @@ public PeerExpressRouteCircuitConnection() /// The name of the express route circuit connection resource. /// The resource guid of the authorization used for the express route circuit connection. /// The provisioning state of the peer express route circuit connection resource. - internal PeerExpressRouteCircuitConnection(string id, string name, string etag, string type, SubResource expressRouteCircuitPeering, SubResource peerExpressRouteCircuitPeering, string addressPrefix, CircuitConnectionStatus? circuitConnectionStatus, string connectionName, string authResourceGuid, ProvisioningState? provisioningState) : base(id) + internal PeerExpressRouteCircuitConnection(string id, string name, string etag, string type, WritableSubResource expressRouteCircuitPeering, WritableSubResource peerExpressRouteCircuitPeering, string addressPrefix, CircuitConnectionStatus? circuitConnectionStatus, string connectionName, string authResourceGuid, ProvisioningState? provisioningState) : base(id) { Name = name; Etag = etag; @@ -50,9 +50,9 @@ internal PeerExpressRouteCircuitConnection(string id, string name, string etag, /// Type of the resource. public string Type { get; } /// Reference to Express Route Circuit Private Peering Resource of the circuit. - public SubResource ExpressRouteCircuitPeering { get; set; } + public WritableSubResource ExpressRouteCircuitPeering { get; set; } /// Reference to Express Route Circuit Private Peering Resource of the peered circuit. - public SubResource PeerExpressRouteCircuitPeering { get; set; } + public WritableSubResource PeerExpressRouteCircuitPeering { get; set; } /// /29 IP address space to carve out Customer addresses for tunnels. public string AddressPrefix { get; set; } /// Express Route Circuit connection state. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateDnsZoneGroupData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateDnsZoneGroupData.Serialization.cs index d0e77b0979ad6..4ceb41a32f830 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateDnsZoneGroupData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateDnsZoneGroupData.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -23,8 +22,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsCollectionDefined(PrivateDnsZoneConfigs)) @@ -45,7 +47,7 @@ internal static PrivateDnsZoneGroupData DeserializePrivateDnsZoneGroupData(JsonE { Optional name = default; Optional etag = default; - ResourceIdentifier id = default; + Optional id = default; Optional provisioningState = default; Optional> privateDnsZoneConfigs = default; foreach (var property in element.EnumerateObject()) @@ -103,7 +105,7 @@ internal static PrivateDnsZoneGroupData DeserializePrivateDnsZoneGroupData(JsonE continue; } } - return new PrivateDnsZoneGroupData(id, name.Value, etag.Value, Optional.ToNullable(provisioningState), Optional.ToList(privateDnsZoneConfigs)); + return new PrivateDnsZoneGroupData(id.Value, name.Value, etag.Value, Optional.ToNullable(provisioningState), Optional.ToList(privateDnsZoneConfigs)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateEndpointConnection.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateEndpointConnection.Serialization.cs index 3e61a21dec370..0f68c9cb65c84 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateEndpointConnection.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateEndpointConnection.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network; namespace Azure.ResourceManager.Network.Models @@ -22,8 +21,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(PrivateLinkServiceConnectionState)) @@ -40,7 +42,7 @@ internal static PrivateEndpointConnection DeserializePrivateEndpointConnection(J Optional name = default; Optional type = default; Optional etag = default; - ResourceIdentifier id = default; + Optional id = default; Optional privateEndpoint = default; Optional privateLinkServiceConnectionState = default; Optional provisioningState = default; @@ -115,7 +117,7 @@ internal static PrivateEndpointConnection DeserializePrivateEndpointConnection(J continue; } } - return new PrivateEndpointConnection(id, name.Value, type.Value, etag.Value, privateEndpoint.Value, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState), linkIdentifier.Value); + return new PrivateEndpointConnection(id.Value, name.Value, type.Value, etag.Value, privateEndpoint.Value, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState), linkIdentifier.Value); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateEndpointConnection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateEndpointConnection.cs index 8afdfbb8d505c..abdc20e00386e 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateEndpointConnection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateEndpointConnection.cs @@ -6,12 +6,11 @@ #nullable disable using Azure.ResourceManager.Network; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { /// PrivateEndpointConnection resource. - public partial class PrivateEndpointConnection : WritableSubResource + public partial class PrivateEndpointConnection : SubResource { /// Initializes a new instance of PrivateEndpointConnection. public PrivateEndpointConnection() @@ -19,7 +18,7 @@ public PrivateEndpointConnection() } /// Initializes a new instance of PrivateEndpointConnection. - /// The id. + /// Resource ID. /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// The resource type. /// A unique read-only string that changes whenever the resource is updated. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateEndpointData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateEndpointData.Serialization.cs index a750ae89bf220..214736805d746 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateEndpointData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateEndpointData.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -23,6 +22,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("extendedLocation"); writer.WriteObjectValue(ExtendedLocation); } + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -39,8 +43,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Subnet)) @@ -86,11 +88,11 @@ internal static PrivateEndpointData DeserializePrivateEndpointData(JsonElement e { Optional extendedLocation = default; Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional subnet = default; Optional> networkInterfaces = default; Optional provisioningState = default; @@ -114,6 +116,11 @@ internal static PrivateEndpointData DeserializePrivateEndpointData(JsonElement e etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -144,11 +151,6 @@ internal static PrivateEndpointData DeserializePrivateEndpointData(JsonElement e tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -242,7 +244,7 @@ internal static PrivateEndpointData DeserializePrivateEndpointData(JsonElement e continue; } } - return new PrivateEndpointData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), extendedLocation.Value, etag.Value, subnet.Value, Optional.ToList(networkInterfaces), Optional.ToNullable(provisioningState), Optional.ToList(privateLinkServiceConnections), Optional.ToList(manualPrivateLinkServiceConnections), Optional.ToList(customDnsConfigs)); + return new PrivateEndpointData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), extendedLocation.Value, etag.Value, subnet.Value, Optional.ToList(networkInterfaces), Optional.ToNullable(provisioningState), Optional.ToList(privateLinkServiceConnections), Optional.ToList(manualPrivateLinkServiceConnections), Optional.ToList(customDnsConfigs)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateLinkServiceConnection.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateLinkServiceConnection.Serialization.cs index 90b29fd3ad645..e0f2db215c16b 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateLinkServiceConnection.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateLinkServiceConnection.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -22,8 +21,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(PrivateLinkServiceId)) @@ -60,7 +62,7 @@ internal static PrivateLinkServiceConnection DeserializePrivateLinkServiceConnec Optional name = default; Optional type = default; Optional etag = default; - ResourceIdentifier id = default; + Optional id = default; Optional provisioningState = default; Optional privateLinkServiceId = default; Optional> groupIds = default; @@ -146,7 +148,7 @@ internal static PrivateLinkServiceConnection DeserializePrivateLinkServiceConnec continue; } } - return new PrivateLinkServiceConnection(id, name.Value, type.Value, etag.Value, Optional.ToNullable(provisioningState), privateLinkServiceId.Value, Optional.ToList(groupIds), requestMessage.Value, privateLinkServiceConnectionState.Value); + return new PrivateLinkServiceConnection(id.Value, name.Value, type.Value, etag.Value, Optional.ToNullable(provisioningState), privateLinkServiceId.Value, Optional.ToList(groupIds), requestMessage.Value, privateLinkServiceConnectionState.Value); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateLinkServiceConnection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateLinkServiceConnection.cs index af502be45eda3..4a9f3316776f1 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateLinkServiceConnection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateLinkServiceConnection.cs @@ -7,12 +7,11 @@ using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { /// PrivateLinkServiceConnection resource. - public partial class PrivateLinkServiceConnection : WritableSubResource + public partial class PrivateLinkServiceConnection : SubResource { /// Initializes a new instance of PrivateLinkServiceConnection. public PrivateLinkServiceConnection() @@ -21,7 +20,7 @@ public PrivateLinkServiceConnection() } /// Initializes a new instance of PrivateLinkServiceConnection. - /// The id. + /// Resource ID. /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// The resource type. /// A unique read-only string that changes whenever the resource is updated. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateLinkServiceData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateLinkServiceData.Serialization.cs index 1496277456d50..b8c704615640a 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateLinkServiceData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateLinkServiceData.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -23,6 +22,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("extendedLocation"); writer.WriteObjectValue(ExtendedLocation); } + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -39,8 +43,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsCollectionDefined(LoadBalancerFrontendIpConfigurations)) @@ -96,11 +98,11 @@ internal static PrivateLinkServiceData DeserializePrivateLinkServiceData(JsonEle { Optional extendedLocation = default; Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional> loadBalancerFrontendIpConfigurations = default; Optional> ipConfigurations = default; Optional> networkInterfaces = default; @@ -128,6 +130,11 @@ internal static PrivateLinkServiceData DeserializePrivateLinkServiceData(JsonEle etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -158,11 +165,6 @@ internal static PrivateLinkServiceData DeserializePrivateLinkServiceData(JsonEle tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -296,7 +298,7 @@ internal static PrivateLinkServiceData DeserializePrivateLinkServiceData(JsonEle continue; } } - return new PrivateLinkServiceData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), extendedLocation.Value, etag.Value, Optional.ToList(loadBalancerFrontendIpConfigurations), Optional.ToList(ipConfigurations), Optional.ToList(networkInterfaces), Optional.ToNullable(provisioningState), Optional.ToList(privateEndpointConnections), visibility.Value, autoApproval.Value, Optional.ToList(fqdns), @alias.Value, Optional.ToNullable(enableProxyProtocol)); + return new PrivateLinkServiceData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), extendedLocation.Value, etag.Value, Optional.ToList(loadBalancerFrontendIpConfigurations), Optional.ToList(ipConfigurations), Optional.ToList(networkInterfaces), Optional.ToNullable(provisioningState), Optional.ToList(privateEndpointConnections), visibility.Value, autoApproval.Value, Optional.ToList(fqdns), @alias.Value, Optional.ToNullable(enableProxyProtocol)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateLinkServiceIpConfiguration.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateLinkServiceIpConfiguration.Serialization.cs index 62898e0a30ef5..ea6d7dfb656cf 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateLinkServiceIpConfiguration.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateLinkServiceIpConfiguration.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network; namespace Azure.ResourceManager.Network.Models @@ -22,8 +21,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(PrivateIPAddress)) @@ -60,7 +62,7 @@ internal static PrivateLinkServiceIpConfiguration DeserializePrivateLinkServiceI Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional privateIPAddress = default; Optional privateIPAllocationMethod = default; Optional subnet = default; @@ -157,7 +159,7 @@ internal static PrivateLinkServiceIpConfiguration DeserializePrivateLinkServiceI continue; } } - return new PrivateLinkServiceIpConfiguration(id, name.Value, etag.Value, type.Value, privateIPAddress.Value, Optional.ToNullable(privateIPAllocationMethod), subnet.Value, Optional.ToNullable(primary), Optional.ToNullable(provisioningState), Optional.ToNullable(privateIPAddressVersion)); + return new PrivateLinkServiceIpConfiguration(id.Value, name.Value, etag.Value, type.Value, privateIPAddress.Value, Optional.ToNullable(privateIPAllocationMethod), subnet.Value, Optional.ToNullable(primary), Optional.ToNullable(provisioningState), Optional.ToNullable(privateIPAddressVersion)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateLinkServiceIpConfiguration.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateLinkServiceIpConfiguration.cs index 8605a390b8d25..5f28f16b8417e 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateLinkServiceIpConfiguration.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PrivateLinkServiceIpConfiguration.cs @@ -6,12 +6,11 @@ #nullable disable using Azure.ResourceManager.Network; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { /// The private link service ip configuration. - public partial class PrivateLinkServiceIpConfiguration : WritableSubResource + public partial class PrivateLinkServiceIpConfiguration : SubResource { /// Initializes a new instance of PrivateLinkServiceIpConfiguration. public PrivateLinkServiceIpConfiguration() @@ -19,7 +18,7 @@ public PrivateLinkServiceIpConfiguration() } /// Initializes a new instance of PrivateLinkServiceIpConfiguration. - /// The id. + /// Resource ID. /// The name of private link service ip configuration. /// A unique read-only string that changes whenever the resource is updated. /// The resource type. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Probe.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Probe.Serialization.cs index 429d9901d66c5..3bb913c9db16d 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Probe.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Probe.Serialization.cs @@ -8,7 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -22,8 +22,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Protocol)) @@ -60,8 +63,8 @@ internal static Probe DeserializeProbe(JsonElement element) Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; - Optional> loadBalancingRules = default; + Optional id = default; + Optional> loadBalancingRules = default; Optional protocol = default; Optional port = default; Optional intervalInSeconds = default; @@ -106,10 +109,10 @@ internal static Probe DeserializeProbe(JsonElement element) property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } loadBalancingRules = array; continue; @@ -173,7 +176,7 @@ internal static Probe DeserializeProbe(JsonElement element) continue; } } - return new Probe(id, name.Value, etag.Value, type.Value, Optional.ToList(loadBalancingRules), Optional.ToNullable(protocol), Optional.ToNullable(port), Optional.ToNullable(intervalInSeconds), Optional.ToNullable(numberOfProbes), requestPath.Value, Optional.ToNullable(provisioningState)); + return new Probe(id.Value, name.Value, etag.Value, type.Value, Optional.ToList(loadBalancingRules), Optional.ToNullable(protocol), Optional.ToNullable(port), Optional.ToNullable(intervalInSeconds), Optional.ToNullable(numberOfProbes), requestPath.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Probe.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Probe.cs index f471f60633eb8..5a168fc0ae760 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Probe.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Probe.cs @@ -12,16 +12,16 @@ namespace Azure.ResourceManager.Network.Models { /// A load balancer probe. - public partial class Probe : WritableSubResource + public partial class Probe : SubResource { /// Initializes a new instance of Probe. public Probe() { - LoadBalancingRules = new ChangeTrackingList(); + LoadBalancingRules = new ChangeTrackingList(); } /// Initializes a new instance of Probe. - /// The id. + /// Resource ID. /// The name of the resource that is unique within the set of probes used by the load balancer. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// Type of the resource. @@ -32,7 +32,7 @@ public Probe() /// The number of probes where if no response, will result in stopping further traffic from being delivered to the endpoint. This values allows endpoints to be taken out of rotation faster or slower than the typical times used in Azure. /// The URI used for requesting health status from the VM. Path is required if a protocol is set to http. Otherwise, it is not allowed. There is no default value. /// The provisioning state of the probe resource. - internal Probe(string id, string name, string etag, string type, IReadOnlyList loadBalancingRules, ProbeProtocol? protocol, int? port, int? intervalInSeconds, int? numberOfProbes, string requestPath, ProvisioningState? provisioningState) : base(id) + internal Probe(string id, string name, string etag, string type, IReadOnlyList loadBalancingRules, ProbeProtocol? protocol, int? port, int? intervalInSeconds, int? numberOfProbes, string requestPath, ProvisioningState? provisioningState) : base(id) { Name = name; Etag = etag; @@ -53,7 +53,7 @@ internal Probe(string id, string name, string etag, string type, IReadOnlyList Type of the resource. public string Type { get; } /// The load balancer rules that use this probe. - public IReadOnlyList LoadBalancingRules { get; } + public IReadOnlyList LoadBalancingRules { get; } /// The protocol of the end point. If 'Tcp' is specified, a received ACK is required for the probe to be successful. If 'Http' or 'Https' is specified, a 200 OK response from the specifies URI is required for the probe to be successful. public ProbeProtocol? Protocol { get; set; } /// The port for communicating the probe. Possible values range from 1 to 65535, inclusive. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PropagatedRouteTable.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PropagatedRouteTable.Serialization.cs index 83818dc245d86..9404dd8c26424 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PropagatedRouteTable.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PropagatedRouteTable.Serialization.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -32,7 +33,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in Ids) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } @@ -42,7 +43,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static PropagatedRouteTable DeserializePropagatedRouteTable(JsonElement element) { Optional> labels = default; - Optional> ids = default; + Optional> ids = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("labels")) @@ -67,10 +68,10 @@ internal static PropagatedRouteTable DeserializePropagatedRouteTable(JsonElement property.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } ids = array; continue; diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PropagatedRouteTable.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PropagatedRouteTable.cs index e78daec51371f..4ad498efa4c2e 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PropagatedRouteTable.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PropagatedRouteTable.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -17,13 +18,13 @@ public partial class PropagatedRouteTable public PropagatedRouteTable() { Labels = new ChangeTrackingList(); - Ids = new ChangeTrackingList(); + Ids = new ChangeTrackingList(); } /// Initializes a new instance of PropagatedRouteTable. /// The list of labels. /// The list of resource ids of all the RouteTables. - internal PropagatedRouteTable(IList labels, IList ids) + internal PropagatedRouteTable(IList labels, IList ids) { Labels = labels; Ids = ids; @@ -32,6 +33,6 @@ internal PropagatedRouteTable(IList labels, IList ids) /// The list of labels. public IList Labels { get; } /// The list of resource ids of all the RouteTables. - public IList Ids { get; } + public IList Ids { get; } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PublicIPAddressData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PublicIPAddressData.Serialization.cs index 326ca81d29641..77ca888242d1c 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PublicIPAddressData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PublicIPAddressData.Serialization.cs @@ -8,8 +8,8 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -38,6 +38,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -54,8 +59,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(PublicIPAllocationMethod)) @@ -96,7 +99,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PublicIPPrefix)) { writer.WritePropertyName("publicIPPrefix"); - writer.WriteObjectValue(PublicIPPrefix); + JsonSerializer.Serialize(writer, PublicIPPrefix); } if (Optional.IsDefined(IdleTimeoutInMinutes)) { @@ -138,11 +141,11 @@ internal static PublicIPAddressData DeserializePublicIPAddressData(JsonElement e Optional sku = default; Optional etag = default; Optional> zones = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional publicIPAllocationMethod = default; Optional publicIPAddressVersion = default; Optional ipConfiguration = default; @@ -150,7 +153,7 @@ internal static PublicIPAddressData DeserializePublicIPAddressData(JsonElement e Optional ddosSettings = default; Optional> ipTags = default; Optional ipAddress = default; - Optional publicIPPrefix = default; + Optional publicIPPrefix = default; Optional idleTimeoutInMinutes = default; Optional resourceGuid = default; Optional provisioningState = default; @@ -201,6 +204,11 @@ internal static PublicIPAddressData DeserializePublicIPAddressData(JsonElement e zones = array; continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -231,11 +239,6 @@ internal static PublicIPAddressData DeserializePublicIPAddressData(JsonElement e tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -322,7 +325,7 @@ internal static PublicIPAddressData DeserializePublicIPAddressData(JsonElement e property0.ThrowNonNullablePropertyIsNull(); continue; } - publicIPPrefix = SubResource.DeserializeSubResource(property0.Value); + publicIPPrefix = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("idleTimeoutInMinutes")) @@ -404,7 +407,7 @@ internal static PublicIPAddressData DeserializePublicIPAddressData(JsonElement e continue; } } - return new PublicIPAddressData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), extendedLocation.Value, sku.Value, etag.Value, Optional.ToList(zones), Optional.ToNullable(publicIPAllocationMethod), Optional.ToNullable(publicIPAddressVersion), ipConfiguration.Value, dnsSettings.Value, ddosSettings.Value, Optional.ToList(ipTags), ipAddress.Value, publicIPPrefix.Value, Optional.ToNullable(idleTimeoutInMinutes), resourceGuid.Value, Optional.ToNullable(provisioningState), servicePublicIPAddress.Value, natGateway.Value, Optional.ToNullable(migrationPhase), linkedPublicIPAddress.Value, Optional.ToNullable(deleteOption)); + return new PublicIPAddressData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), extendedLocation.Value, sku.Value, etag.Value, Optional.ToList(zones), Optional.ToNullable(publicIPAllocationMethod), Optional.ToNullable(publicIPAddressVersion), ipConfiguration.Value, dnsSettings.Value, ddosSettings.Value, Optional.ToList(ipTags), ipAddress.Value, publicIPPrefix, Optional.ToNullable(idleTimeoutInMinutes), resourceGuid.Value, Optional.ToNullable(provisioningState), servicePublicIPAddress.Value, natGateway.Value, Optional.ToNullable(migrationPhase), linkedPublicIPAddress.Value, Optional.ToNullable(deleteOption)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PublicIPPrefixData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PublicIPPrefixData.Serialization.cs index c16e480dc1f13..3896594b64396 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PublicIPPrefixData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/PublicIPPrefixData.Serialization.cs @@ -8,8 +8,8 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -38,6 +38,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndArray(); } + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -54,8 +59,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(PublicIPAddressVersion)) @@ -81,7 +84,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(CustomIPPrefix)) { writer.WritePropertyName("customIPPrefix"); - writer.WriteObjectValue(CustomIPPrefix); + JsonSerializer.Serialize(writer, CustomIPPrefix); } if (Optional.IsDefined(NatGateway)) { @@ -98,18 +101,18 @@ internal static PublicIPPrefixData DeserializePublicIPPrefixData(JsonElement ele Optional sku = default; Optional etag = default; Optional> zones = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional publicIPAddressVersion = default; Optional> ipTags = default; Optional prefixLength = default; Optional ipPrefix = default; - Optional> publicIPAddresses = default; - Optional loadBalancerFrontendIpConfiguration = default; - Optional customIPPrefix = default; + Optional> publicIPAddresses = default; + Optional loadBalancerFrontendIpConfiguration = default; + Optional customIPPrefix = default; Optional resourceGuid = default; Optional provisioningState = default; Optional natGateway = default; @@ -155,6 +158,11 @@ internal static PublicIPPrefixData DeserializePublicIPPrefixData(JsonElement ele zones = array; continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -185,11 +193,6 @@ internal static PublicIPPrefixData DeserializePublicIPPrefixData(JsonElement ele tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -246,10 +249,10 @@ internal static PublicIPPrefixData DeserializePublicIPPrefixData(JsonElement ele property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(ReferencedPublicIpAddress.DeserializeReferencedPublicIpAddress(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } publicIPAddresses = array; continue; @@ -261,7 +264,7 @@ internal static PublicIPPrefixData DeserializePublicIPPrefixData(JsonElement ele property0.ThrowNonNullablePropertyIsNull(); continue; } - loadBalancerFrontendIpConfiguration = SubResource.DeserializeSubResource(property0.Value); + loadBalancerFrontendIpConfiguration = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("customIPPrefix")) @@ -271,7 +274,7 @@ internal static PublicIPPrefixData DeserializePublicIPPrefixData(JsonElement ele property0.ThrowNonNullablePropertyIsNull(); continue; } - customIPPrefix = SubResource.DeserializeSubResource(property0.Value); + customIPPrefix = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("resourceGuid")) @@ -303,7 +306,7 @@ internal static PublicIPPrefixData DeserializePublicIPPrefixData(JsonElement ele continue; } } - return new PublicIPPrefixData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), extendedLocation.Value, sku.Value, etag.Value, Optional.ToList(zones), Optional.ToNullable(publicIPAddressVersion), Optional.ToList(ipTags), Optional.ToNullable(prefixLength), ipPrefix.Value, Optional.ToList(publicIPAddresses), loadBalancerFrontendIpConfiguration.Value, customIPPrefix.Value, resourceGuid.Value, Optional.ToNullable(provisioningState), natGateway.Value); + return new PublicIPPrefixData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), extendedLocation.Value, sku.Value, etag.Value, Optional.ToList(zones), Optional.ToNullable(publicIPAddressVersion), Optional.ToList(ipTags), Optional.ToNullable(prefixLength), ipPrefix.Value, Optional.ToList(publicIPAddresses), loadBalancerFrontendIpConfiguration, customIPPrefix, resourceGuid.Value, Optional.ToNullable(provisioningState), natGateway.Value); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ReferencedPublicIpAddress.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ReferencedPublicIpAddress.Serialization.cs deleted file mode 100644 index 4695c9f1df7c7..0000000000000 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ReferencedPublicIpAddress.Serialization.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Network.Models -{ - public partial class ReferencedPublicIpAddress - { - internal static ReferencedPublicIpAddress DeserializeReferencedPublicIpAddress(JsonElement element) - { - Optional id = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - } - return new ReferencedPublicIpAddress(id.Value); - } - } -} diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ReferencedPublicIpAddress.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ReferencedPublicIpAddress.cs deleted file mode 100644 index de307bce791eb..0000000000000 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ReferencedPublicIpAddress.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Network.Models -{ - /// Reference to a public IP address. - public partial class ReferencedPublicIpAddress - { - /// Initializes a new instance of ReferencedPublicIpAddress. - internal ReferencedPublicIpAddress() - { - } - - /// Initializes a new instance of ReferencedPublicIpAddress. - /// The PublicIPAddress Reference. - internal ReferencedPublicIpAddress(string id) - { - Id = id; - } - - /// The PublicIPAddress Reference. - public string Id { get; } - } -} diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Resource.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Resource.Serialization.cs index e979de53f645d..d7055b2f5c1b6 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Resource.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Resource.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -17,6 +16,11 @@ public partial class Resource : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -33,20 +37,23 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WriteEndObject(); } internal static Resource DeserializeResource(JsonElement element) { + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -77,13 +84,8 @@ internal static Resource DeserializeResource(JsonElement element) tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } } - return new Resource(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags)); + return new Resource(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Resource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Resource.cs index 419999c4ae133..e7833e9031a01 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Resource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Resource.cs @@ -7,12 +7,11 @@ using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { /// Common resource representation. - public partial class Resource : WritableSubResource + public partial class Resource { /// Initializes a new instance of Resource. public Resource() @@ -21,19 +20,22 @@ public Resource() } /// Initializes a new instance of Resource. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. /// Resource tags. - internal Resource(string id, string name, string type, string location, IDictionary tags) : base(id) + internal Resource(string id, string name, string type, string location, IDictionary tags) { + Id = id; Name = name; Type = type; Location = location; Tags = tags; } + /// Resource ID. + public string Id { get; set; } /// Resource name. public string Name { get; } /// Resource type. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ResourceNavigationLink.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ResourceNavigationLink.Serialization.cs index dc67e5a42a81e..9a888161f7490 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ResourceNavigationLink.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ResourceNavigationLink.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -21,8 +20,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(LinkedResourceType)) @@ -44,7 +46,7 @@ internal static ResourceNavigationLink DeserializeResourceNavigationLink(JsonEle Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional linkedResourceType = default; Optional link = default; Optional provisioningState = default; @@ -103,7 +105,7 @@ internal static ResourceNavigationLink DeserializeResourceNavigationLink(JsonEle continue; } } - return new ResourceNavigationLink(id, name.Value, etag.Value, type.Value, linkedResourceType.Value, link.Value, Optional.ToNullable(provisioningState)); + return new ResourceNavigationLink(id.Value, name.Value, etag.Value, type.Value, linkedResourceType.Value, link.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ResourceNavigationLink.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ResourceNavigationLink.cs index 470cd0c17687b..554815fcc4150 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ResourceNavigationLink.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ResourceNavigationLink.cs @@ -5,12 +5,10 @@ #nullable disable -using Azure.ResourceManager.Resources.Models; - namespace Azure.ResourceManager.Network.Models { /// ResourceNavigationLink resource. - public partial class ResourceNavigationLink : WritableSubResource + public partial class ResourceNavigationLink : SubResource { /// Initializes a new instance of ResourceNavigationLink. public ResourceNavigationLink() @@ -18,7 +16,7 @@ public ResourceNavigationLink() } /// Initializes a new instance of ResourceNavigationLink. - /// The id. + /// Resource ID. /// Name of the resource that is unique within a resource group. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// Resource type. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/RouteData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/RouteData.Serialization.cs index 7e314fbedb9a6..c36edafd724ac 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/RouteData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/RouteData.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -27,8 +26,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("type"); writer.WriteStringValue(Type); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(AddressPrefix)) @@ -60,7 +62,7 @@ internal static RouteData DeserializeRouteData(JsonElement element) Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional addressPrefix = default; Optional nextHopType = default; Optional nextHopIpAddress = default; @@ -141,7 +143,7 @@ internal static RouteData DeserializeRouteData(JsonElement element) continue; } } - return new RouteData(id, name.Value, etag.Value, type.Value, addressPrefix.Value, Optional.ToNullable(nextHopType), nextHopIpAddress.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(hasBgpOverride)); + return new RouteData(id.Value, name.Value, etag.Value, type.Value, addressPrefix.Value, Optional.ToNullable(nextHopType), nextHopIpAddress.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(hasBgpOverride)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/RouteFilterData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/RouteFilterData.Serialization.cs index 796688d982d81..1bef9d8a53d94 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/RouteFilterData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/RouteFilterData.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -18,6 +17,11 @@ public partial class RouteFilterData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -34,8 +38,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsCollectionDefined(Rules)) @@ -55,11 +57,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static RouteFilterData DeserializeRouteFilterData(JsonElement element) { Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional> rules = default; Optional> peerings = default; Optional> ipv6Peerings = default; @@ -71,6 +73,11 @@ internal static RouteFilterData DeserializeRouteFilterData(JsonElement element) etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -101,11 +108,6 @@ internal static RouteFilterData DeserializeRouteFilterData(JsonElement element) tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -174,7 +176,7 @@ internal static RouteFilterData DeserializeRouteFilterData(JsonElement element) continue; } } - return new RouteFilterData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, Optional.ToList(rules), Optional.ToList(peerings), Optional.ToList(ipv6Peerings), Optional.ToNullable(provisioningState)); + return new RouteFilterData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, Optional.ToList(rules), Optional.ToList(peerings), Optional.ToList(ipv6Peerings), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/RouteFilterRuleData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/RouteFilterRuleData.Serialization.cs index 7400bd1ce1896..8c6241a719605 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/RouteFilterRuleData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/RouteFilterRuleData.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -28,8 +27,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("location"); writer.WriteStringValue(Location); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Access)) @@ -61,7 +63,7 @@ internal static RouteFilterRuleData DeserializeRouteFilterRuleData(JsonElement e Optional name = default; Optional location = default; Optional etag = default; - ResourceIdentifier id = default; + Optional id = default; Optional access = default; Optional routeFilterRuleType = default; Optional> communities = default; @@ -146,7 +148,7 @@ internal static RouteFilterRuleData DeserializeRouteFilterRuleData(JsonElement e continue; } } - return new RouteFilterRuleData(id, name.Value, location.Value, etag.Value, Optional.ToNullable(access), Optional.ToNullable(routeFilterRuleType), Optional.ToList(communities), Optional.ToNullable(provisioningState)); + return new RouteFilterRuleData(id.Value, name.Value, location.Value, etag.Value, Optional.ToNullable(access), Optional.ToNullable(routeFilterRuleType), Optional.ToList(communities), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/RouteTableData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/RouteTableData.Serialization.cs index cc3f449fc21aa..b1863fe307d9f 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/RouteTableData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/RouteTableData.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -18,6 +17,11 @@ public partial class RouteTableData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -34,8 +38,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsCollectionDefined(Routes)) @@ -60,11 +62,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static RouteTableData DeserializeRouteTableData(JsonElement element) { Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional> routes = default; Optional> subnets = default; Optional disableBgpRoutePropagation = default; @@ -77,6 +79,11 @@ internal static RouteTableData DeserializeRouteTableData(JsonElement element) etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -107,11 +114,6 @@ internal static RouteTableData DeserializeRouteTableData(JsonElement element) tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -180,7 +182,7 @@ internal static RouteTableData DeserializeRouteTableData(JsonElement element) continue; } } - return new RouteTableData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, Optional.ToList(routes), Optional.ToList(subnets), Optional.ToNullable(disableBgpRoutePropagation), Optional.ToNullable(provisioningState), resourceGuid.Value); + return new RouteTableData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, Optional.ToList(routes), Optional.ToList(subnets), Optional.ToNullable(disableBgpRoutePropagation), Optional.ToNullable(provisioningState), resourceGuid.Value); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/RoutingConfiguration.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/RoutingConfiguration.Serialization.cs index a870145cb73c9..cb985458a2170 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/RoutingConfiguration.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/RoutingConfiguration.Serialization.cs @@ -7,6 +7,7 @@ using System.Text.Json; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -18,7 +19,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(AssociatedRouteTable)) { writer.WritePropertyName("associatedRouteTable"); - writer.WriteObjectValue(AssociatedRouteTable); + JsonSerializer.Serialize(writer, AssociatedRouteTable); } if (Optional.IsDefined(PropagatedRouteTables)) { @@ -35,7 +36,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static RoutingConfiguration DeserializeRoutingConfiguration(JsonElement element) { - Optional associatedRouteTable = default; + Optional associatedRouteTable = default; Optional propagatedRouteTables = default; Optional vnetRoutes = default; foreach (var property in element.EnumerateObject()) @@ -47,7 +48,7 @@ internal static RoutingConfiguration DeserializeRoutingConfiguration(JsonElement property.ThrowNonNullablePropertyIsNull(); continue; } - associatedRouteTable = SubResource.DeserializeSubResource(property.Value); + associatedRouteTable = JsonSerializer.Deserialize(property.Value.ToString()); continue; } if (property.NameEquals("propagatedRouteTables")) @@ -71,7 +72,7 @@ internal static RoutingConfiguration DeserializeRoutingConfiguration(JsonElement continue; } } - return new RoutingConfiguration(associatedRouteTable.Value, propagatedRouteTables.Value, vnetRoutes.Value); + return new RoutingConfiguration(associatedRouteTable, propagatedRouteTables.Value, vnetRoutes.Value); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/RoutingConfiguration.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/RoutingConfiguration.cs index b7ddc4f13d6cd..9fac408acc5f5 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/RoutingConfiguration.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/RoutingConfiguration.cs @@ -5,6 +5,8 @@ #nullable disable +using Azure.ResourceManager.Resources.Models; + namespace Azure.ResourceManager.Network.Models { /// Routing Configuration indicating the associated and propagated route tables for this connection. @@ -19,7 +21,7 @@ public RoutingConfiguration() /// The resource id RouteTable associated with this RoutingConfiguration. /// The list of RouteTables to advertise the routes to. /// List of routes that control routing from VirtualHub into a virtual network connection. - internal RoutingConfiguration(SubResource associatedRouteTable, PropagatedRouteTable propagatedRouteTables, VnetRoute vnetRoutes) + internal RoutingConfiguration(WritableSubResource associatedRouteTable, PropagatedRouteTable propagatedRouteTables, VnetRoute vnetRoutes) { AssociatedRouteTable = associatedRouteTable; PropagatedRouteTables = propagatedRouteTables; @@ -27,7 +29,7 @@ internal RoutingConfiguration(SubResource associatedRouteTable, PropagatedRouteT } /// The resource id RouteTable associated with this RoutingConfiguration. - public SubResource AssociatedRouteTable { get; set; } + public WritableSubResource AssociatedRouteTable { get; set; } /// The list of RouteTables to advertise the routes to. public PropagatedRouteTable PropagatedRouteTables { get; set; } /// List of routes that control routing from VirtualHub into a virtual network connection. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/SecurityGroupNetworkInterface.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/SecurityGroupNetworkInterface.Serialization.cs index 49ac31136e5a5..76ee112c2e16c 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/SecurityGroupNetworkInterface.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/SecurityGroupNetworkInterface.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -15,10 +14,15 @@ public partial class SecurityGroupNetworkInterface { internal static SecurityGroupNetworkInterface DeserializeSecurityGroupNetworkInterface(JsonElement element) { + Optional id = default; Optional securityRuleAssociations = default; - ResourceIdentifier id = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("securityRuleAssociations")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -29,13 +33,8 @@ internal static SecurityGroupNetworkInterface DeserializeSecurityGroupNetworkInt securityRuleAssociations = SecurityRuleAssociations.DeserializeSecurityRuleAssociations(property.Value); continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } } - return new SecurityGroupNetworkInterface(id, securityRuleAssociations.Value); + return new SecurityGroupNetworkInterface(id.Value, securityRuleAssociations.Value); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/SecurityGroupNetworkInterface.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/SecurityGroupNetworkInterface.cs index 184bb47d38e44..968ece45586da 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/SecurityGroupNetworkInterface.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/SecurityGroupNetworkInterface.cs @@ -5,12 +5,10 @@ #nullable disable -using Azure.ResourceManager.Resources.Models; - namespace Azure.ResourceManager.Network.Models { /// Network interface and all its associated security rules. - public partial class SecurityGroupNetworkInterface : Resources.Models.SubResource + public partial class SecurityGroupNetworkInterface { /// Initializes a new instance of SecurityGroupNetworkInterface. internal SecurityGroupNetworkInterface() @@ -18,13 +16,16 @@ internal SecurityGroupNetworkInterface() } /// Initializes a new instance of SecurityGroupNetworkInterface. - /// The id. + /// ID of the network interface. /// All security rules associated with the network interface. - internal SecurityGroupNetworkInterface(string id, SecurityRuleAssociations securityRuleAssociations) : base(id) + internal SecurityGroupNetworkInterface(string id, SecurityRuleAssociations securityRuleAssociations) { + Id = id; SecurityRuleAssociations = securityRuleAssociations; } + /// ID of the network interface. + public string Id { get; } /// All security rules associated with the network interface. public SecurityRuleAssociations SecurityRuleAssociations { get; } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/SecurityPartnerProviderData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/SecurityPartnerProviderData.Serialization.cs index 472e8d6f711e9..83641aa17b10d 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/SecurityPartnerProviderData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/SecurityPartnerProviderData.Serialization.cs @@ -8,8 +8,8 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -18,6 +18,11 @@ public partial class SecurityPartnerProviderData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -34,8 +39,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(SecurityProviderName)) @@ -46,7 +49,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(VirtualHub)) { writer.WritePropertyName("virtualHub"); - writer.WriteObjectValue(VirtualHub); + JsonSerializer.Serialize(writer, VirtualHub); } writer.WriteEndObject(); writer.WriteEndObject(); @@ -55,15 +58,15 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static SecurityPartnerProviderData DeserializeSecurityPartnerProviderData(JsonElement element) { Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional provisioningState = default; Optional securityProviderName = default; Optional connectionStatus = default; - Optional virtualHub = default; + Optional virtualHub = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag")) @@ -71,6 +74,11 @@ internal static SecurityPartnerProviderData DeserializeSecurityPartnerProviderDa etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -101,11 +109,6 @@ internal static SecurityPartnerProviderData DeserializeSecurityPartnerProviderDa tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -152,14 +155,14 @@ internal static SecurityPartnerProviderData DeserializeSecurityPartnerProviderDa property0.ThrowNonNullablePropertyIsNull(); continue; } - virtualHub = SubResource.DeserializeSubResource(property0.Value); + virtualHub = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } } continue; } } - return new SecurityPartnerProviderData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(securityProviderName), Optional.ToNullable(connectionStatus), virtualHub.Value); + return new SecurityPartnerProviderData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(securityProviderName), Optional.ToNullable(connectionStatus), virtualHub); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/SecurityRuleData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/SecurityRuleData.Serialization.cs index 35dcf0cf05b58..a53d5033fdd7e 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/SecurityRuleData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/SecurityRuleData.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -28,8 +27,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("type"); writer.WriteStringValue(Type); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Description)) @@ -146,7 +148,7 @@ internal static SecurityRuleData DeserializeSecurityRuleData(JsonElement element Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional description = default; Optional protocol = default; Optional sourcePortRange = default; @@ -363,7 +365,7 @@ internal static SecurityRuleData DeserializeSecurityRuleData(JsonElement element continue; } } - return new SecurityRuleData(id, name.Value, etag.Value, type.Value, description.Value, Optional.ToNullable(protocol), sourcePortRange.Value, destinationPortRange.Value, sourceAddressPrefix.Value, Optional.ToList(sourceAddressPrefixes), Optional.ToList(sourceApplicationSecurityGroups), destinationAddressPrefix.Value, Optional.ToList(destinationAddressPrefixes), Optional.ToList(destinationApplicationSecurityGroups), Optional.ToList(sourcePortRanges), Optional.ToList(destinationPortRanges), Optional.ToNullable(access), Optional.ToNullable(priority), Optional.ToNullable(direction), Optional.ToNullable(provisioningState)); + return new SecurityRuleData(id.Value, name.Value, etag.Value, type.Value, description.Value, Optional.ToNullable(protocol), sourcePortRange.Value, destinationPortRange.Value, sourceAddressPrefix.Value, Optional.ToList(sourceAddressPrefixes), Optional.ToList(sourceApplicationSecurityGroups), destinationAddressPrefix.Value, Optional.ToList(destinationAddressPrefixes), Optional.ToList(destinationApplicationSecurityGroups), Optional.ToList(sourcePortRanges), Optional.ToList(destinationPortRanges), Optional.ToNullable(access), Optional.ToNullable(priority), Optional.ToNullable(direction), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ServiceAssociationLink.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ServiceAssociationLink.Serialization.cs index f6e53e2dd6361..23a92f67d2b55 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ServiceAssociationLink.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ServiceAssociationLink.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -22,8 +21,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(LinkedResourceType)) @@ -60,7 +62,7 @@ internal static ServiceAssociationLink DeserializeServiceAssociationLink(JsonEle Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional linkedResourceType = default; Optional link = default; Optional provisioningState = default; @@ -146,7 +148,7 @@ internal static ServiceAssociationLink DeserializeServiceAssociationLink(JsonEle continue; } } - return new ServiceAssociationLink(id, name.Value, etag.Value, type.Value, linkedResourceType.Value, link.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(allowDelete), Optional.ToList(locations)); + return new ServiceAssociationLink(id.Value, name.Value, etag.Value, type.Value, linkedResourceType.Value, link.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(allowDelete), Optional.ToList(locations)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ServiceAssociationLink.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ServiceAssociationLink.cs index bcb94e49b4044..a8470cb4b33db 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ServiceAssociationLink.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ServiceAssociationLink.cs @@ -7,12 +7,11 @@ using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { /// ServiceAssociationLink resource. - public partial class ServiceAssociationLink : WritableSubResource + public partial class ServiceAssociationLink : SubResource { /// Initializes a new instance of ServiceAssociationLink. public ServiceAssociationLink() @@ -21,7 +20,7 @@ public ServiceAssociationLink() } /// Initializes a new instance of ServiceAssociationLink. - /// The id. + /// Resource ID. /// Name of the resource that is unique within a resource group. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// Resource type. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ServiceEndpointPolicyData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ServiceEndpointPolicyData.Serialization.cs index b89b06044471f..5767d4f73db3b 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ServiceEndpointPolicyData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ServiceEndpointPolicyData.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -18,6 +17,11 @@ public partial class ServiceEndpointPolicyData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -34,8 +38,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsCollectionDefined(ServiceEndpointPolicyDefinitions)) @@ -56,11 +58,11 @@ internal static ServiceEndpointPolicyData DeserializeServiceEndpointPolicyData(J { Optional etag = default; Optional kind = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional> serviceEndpointPolicyDefinitions = default; Optional> subnets = default; Optional resourceGuid = default; @@ -77,6 +79,11 @@ internal static ServiceEndpointPolicyData DeserializeServiceEndpointPolicyData(J kind = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -107,11 +114,6 @@ internal static ServiceEndpointPolicyData DeserializeServiceEndpointPolicyData(J tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -170,7 +172,7 @@ internal static ServiceEndpointPolicyData DeserializeServiceEndpointPolicyData(J continue; } } - return new ServiceEndpointPolicyData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, kind.Value, Optional.ToList(serviceEndpointPolicyDefinitions), Optional.ToList(subnets), resourceGuid.Value, Optional.ToNullable(provisioningState)); + return new ServiceEndpointPolicyData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, kind.Value, Optional.ToList(serviceEndpointPolicyDefinitions), Optional.ToList(subnets), resourceGuid.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ServiceEndpointPolicyDefinitionData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ServiceEndpointPolicyDefinitionData.Serialization.cs index 0149bb19f428c..ceff2f5ccca18 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ServiceEndpointPolicyDefinitionData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ServiceEndpointPolicyDefinitionData.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -23,8 +22,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Description)) @@ -55,7 +57,7 @@ internal static ServiceEndpointPolicyDefinitionData DeserializeServiceEndpointPo { Optional name = default; Optional etag = default; - ResourceIdentifier id = default; + Optional id = default; Optional description = default; Optional service = default; Optional> serviceResources = default; @@ -125,7 +127,7 @@ internal static ServiceEndpointPolicyDefinitionData DeserializeServiceEndpointPo continue; } } - return new ServiceEndpointPolicyDefinitionData(id, name.Value, etag.Value, description.Value, service.Value, Optional.ToList(serviceResources), Optional.ToNullable(provisioningState)); + return new ServiceEndpointPolicyDefinitionData(id.Value, name.Value, etag.Value, description.Value, service.Value, Optional.ToList(serviceResources), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ServiceTagInformation.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ServiceTagInformation.Serialization.cs index a76650ff5efbf..38303d5091680 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ServiceTagInformation.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ServiceTagInformation.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -17,7 +16,7 @@ internal static ServiceTagInformation DeserializeServiceTagInformation(JsonEleme { Optional properties = default; Optional name = default; - ResourceIdentifier id = default; + Optional id = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("properties")) @@ -41,7 +40,7 @@ internal static ServiceTagInformation DeserializeServiceTagInformation(JsonEleme continue; } } - return new ServiceTagInformation(id, properties.Value, name.Value); + return new ServiceTagInformation(properties.Value, name.Value, id.Value); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ServiceTagInformation.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ServiceTagInformation.cs index 3b6ea9b0cb480..66cd56019662a 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ServiceTagInformation.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/ServiceTagInformation.cs @@ -5,12 +5,10 @@ #nullable disable -using Azure.ResourceManager.Resources.Models; - namespace Azure.ResourceManager.Network.Models { /// The service tag information. - public partial class ServiceTagInformation : Resources.Models.SubResource + public partial class ServiceTagInformation { /// Initializes a new instance of ServiceTagInformation. internal ServiceTagInformation() @@ -18,18 +16,21 @@ internal ServiceTagInformation() } /// Initializes a new instance of ServiceTagInformation. - /// The id. /// Properties of the service tag information. /// The name of service tag. - internal ServiceTagInformation(string id, ServiceTagInformationPropertiesFormat properties, string name) : base(id) + /// The ID of service tag. + internal ServiceTagInformation(ServiceTagInformationPropertiesFormat properties, string name, string id) { Properties = properties; Name = name; + Id = id; } /// Properties of the service tag information. public ServiceTagInformationPropertiesFormat Properties { get; } /// The name of service tag. public string Name { get; } + /// The ID of service tag. + public string Id { get; } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/SubnetAssociation.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/SubnetAssociation.Serialization.cs index 9692f25894e17..06606e13f5206 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/SubnetAssociation.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/SubnetAssociation.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network; namespace Azure.ResourceManager.Network.Models @@ -17,10 +16,15 @@ public partial class SubnetAssociation { internal static SubnetAssociation DeserializeSubnetAssociation(JsonElement element) { + Optional id = default; Optional> securityRules = default; - ResourceIdentifier id = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("securityRules")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -36,13 +40,8 @@ internal static SubnetAssociation DeserializeSubnetAssociation(JsonElement eleme securityRules = array; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } } - return new SubnetAssociation(id, Optional.ToList(securityRules)); + return new SubnetAssociation(id.Value, Optional.ToList(securityRules)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/SubnetAssociation.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/SubnetAssociation.cs index 24573840c8c21..77047aaf95997 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/SubnetAssociation.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/SubnetAssociation.cs @@ -8,12 +8,11 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { /// Subnet and it's custom security rules. - public partial class SubnetAssociation : Resources.Models.SubResource + public partial class SubnetAssociation { /// Initializes a new instance of SubnetAssociation. internal SubnetAssociation() @@ -22,13 +21,16 @@ internal SubnetAssociation() } /// Initializes a new instance of SubnetAssociation. - /// The id. + /// Subnet ID. /// Collection of custom security rules. - internal SubnetAssociation(string id, IReadOnlyList securityRules) : base(id) + internal SubnetAssociation(string id, IReadOnlyList securityRules) { + Id = id; SecurityRules = securityRules; } + /// Subnet ID. + public string Id { get; } /// Collection of custom security rules. public IReadOnlyList SecurityRules { get; } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/SubnetData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/SubnetData.Serialization.cs index 2b9aa0378427d..4d696c0fce915 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/SubnetData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/SubnetData.Serialization.cs @@ -8,8 +8,8 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -28,8 +28,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("type"); writer.WriteStringValue(Type); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(AddressPrefix)) @@ -60,7 +63,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(NatGateway)) { writer.WritePropertyName("natGateway"); - writer.WriteObjectValue(NatGateway); + JsonSerializer.Serialize(writer, NatGateway); } if (Optional.IsCollectionDefined(ServiceEndpoints)) { @@ -88,7 +91,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in IpAllocations) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } @@ -131,18 +134,18 @@ internal static SubnetData DeserializeSubnetData(JsonElement element) Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional addressPrefix = default; Optional> addressPrefixes = default; Optional networkSecurityGroup = default; Optional routeTable = default; - Optional natGateway = default; + Optional natGateway = default; Optional> serviceEndpoints = default; Optional> serviceEndpointPolicies = default; Optional> privateEndpoints = default; Optional> ipConfigurations = default; Optional> ipConfigurationProfiles = default; - Optional> ipAllocations = default; + Optional> ipAllocations = default; Optional> resourceNavigationLinks = default; Optional> serviceAssociationLinks = default; Optional> delegations = default; @@ -229,7 +232,7 @@ internal static SubnetData DeserializeSubnetData(JsonElement element) property0.ThrowNonNullablePropertyIsNull(); continue; } - natGateway = SubResource.DeserializeSubResource(property0.Value); + natGateway = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("serviceEndpoints")) @@ -314,10 +317,10 @@ internal static SubnetData DeserializeSubnetData(JsonElement element) property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } ipAllocations = array; continue; @@ -421,7 +424,7 @@ internal static SubnetData DeserializeSubnetData(JsonElement element) continue; } } - return new SubnetData(id, name.Value, etag.Value, type.Value, addressPrefix.Value, Optional.ToList(addressPrefixes), networkSecurityGroup.Value, routeTable.Value, natGateway.Value, Optional.ToList(serviceEndpoints), Optional.ToList(serviceEndpointPolicies), Optional.ToList(privateEndpoints), Optional.ToList(ipConfigurations), Optional.ToList(ipConfigurationProfiles), Optional.ToList(ipAllocations), Optional.ToList(resourceNavigationLinks), Optional.ToList(serviceAssociationLinks), Optional.ToList(delegations), purpose.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(privateEndpointNetworkPolicies), Optional.ToNullable(privateLinkServiceNetworkPolicies), Optional.ToList(applicationGatewayIpConfigurations)); + return new SubnetData(id.Value, name.Value, etag.Value, type.Value, addressPrefix.Value, Optional.ToList(addressPrefixes), networkSecurityGroup.Value, routeTable.Value, natGateway, Optional.ToList(serviceEndpoints), Optional.ToList(serviceEndpointPolicies), Optional.ToList(privateEndpoints), Optional.ToList(ipConfigurations), Optional.ToList(ipConfigurationProfiles), Optional.ToList(ipAllocations), Optional.ToList(resourceNavigationLinks), Optional.ToList(serviceAssociationLinks), Optional.ToList(delegations), purpose.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(privateEndpointNetworkPolicies), Optional.ToNullable(privateLinkServiceNetworkPolicies), Optional.ToList(applicationGatewayIpConfigurations)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Topology.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Topology.Serialization.cs index bf48be01c3965..c584df2f5f6cc 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Topology.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Topology.Serialization.cs @@ -9,7 +9,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -17,12 +16,17 @@ public partial class Topology { internal static Topology DeserializeTopology(JsonElement element) { + Optional id = default; Optional createdDateTime = default; Optional lastModified = default; Optional> resources = default; - ResourceIdentifier id = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("createdDateTime")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -58,13 +62,8 @@ internal static Topology DeserializeTopology(JsonElement element) resources = array; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } } - return new Topology(id, Optional.ToNullable(createdDateTime), Optional.ToNullable(lastModified), Optional.ToList(resources)); + return new Topology(id.Value, Optional.ToNullable(createdDateTime), Optional.ToNullable(lastModified), Optional.ToList(resources)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Topology.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Topology.cs index 1c2e9974ece40..60ff251b1462e 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Topology.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Topology.cs @@ -8,12 +8,11 @@ using System; using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { /// Topology of the specified resource group. - public partial class Topology : Resources.Models.SubResource + public partial class Topology { /// Initializes a new instance of Topology. internal Topology() @@ -22,17 +21,20 @@ internal Topology() } /// Initializes a new instance of Topology. - /// The id. + /// GUID representing the operation id. /// The datetime when the topology was initially created for the resource group. /// The datetime when the topology was last modified. /// A list of topology resources. - internal Topology(string id, DateTimeOffset? createdDateTime, DateTimeOffset? lastModified, IReadOnlyList resources) : base(id) + internal Topology(string id, DateTimeOffset? createdDateTime, DateTimeOffset? lastModified, IReadOnlyList resources) { + Id = id; CreatedDateTime = createdDateTime; LastModified = lastModified; Resources = resources; } + /// GUID representing the operation id. + public string Id { get; } /// The datetime when the topology was initially created for the resource group. public DateTimeOffset? CreatedDateTime { get; } /// The datetime when the topology was last modified. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/TopologyParameters.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/TopologyParameters.Serialization.cs index fdc82e161d40d..6584f35e9e639 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/TopologyParameters.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/TopologyParameters.Serialization.cs @@ -23,12 +23,12 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(TargetVirtualNetwork)) { writer.WritePropertyName("targetVirtualNetwork"); - writer.WriteObjectValue(TargetVirtualNetwork); + JsonSerializer.Serialize(writer, TargetVirtualNetwork); } if (Optional.IsDefined(TargetSubnet)) { writer.WritePropertyName("targetSubnet"); - writer.WriteObjectValue(TargetSubnet); + JsonSerializer.Serialize(writer, TargetSubnet); } writer.WriteEndObject(); } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/TopologyParameters.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/TopologyParameters.cs index 162d1ecbbd613..d397681ff00ae 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/TopologyParameters.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/TopologyParameters.cs @@ -5,6 +5,8 @@ #nullable disable +using Azure.ResourceManager.Resources.Models; + namespace Azure.ResourceManager.Network.Models { /// Parameters that define the representation of topology. @@ -18,8 +20,8 @@ public TopologyParameters() /// The name of the target resource group to perform topology on. public string TargetResourceGroupName { get; set; } /// The reference to the Virtual Network resource. - public SubResource TargetVirtualNetwork { get; set; } + public WritableSubResource TargetVirtualNetwork { get; set; } /// The reference to the Subnet resource. - public SubResource TargetSubnet { get; set; } + public WritableSubResource TargetSubnet { get; set; } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/TopologyResource.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/TopologyResource.Serialization.cs index ec7a28029c437..5434be5d52df1 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/TopologyResource.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/TopologyResource.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -17,9 +16,9 @@ public partial class TopologyResource internal static TopologyResource DeserializeTopologyResource(JsonElement element) { Optional name = default; + Optional id = default; Optional location = default; Optional> associations = default; - ResourceIdentifier id = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) @@ -27,6 +26,11 @@ internal static TopologyResource DeserializeTopologyResource(JsonElement element name = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("location")) { location = property.Value.GetString(); @@ -47,13 +51,8 @@ internal static TopologyResource DeserializeTopologyResource(JsonElement element associations = array; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } } - return new TopologyResource(id, name.Value, location.Value, Optional.ToList(associations)); + return new TopologyResource(name.Value, id.Value, location.Value, Optional.ToList(associations)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/TopologyResource.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/TopologyResource.cs index da77f621919f9..40c8b362a8938 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/TopologyResource.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/TopologyResource.cs @@ -7,12 +7,11 @@ using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { /// The network resource topology information for the given resource group. - public partial class TopologyResource : Resources.Models.SubResource + public partial class TopologyResource { /// Initializes a new instance of TopologyResource. internal TopologyResource() @@ -21,19 +20,22 @@ internal TopologyResource() } /// Initializes a new instance of TopologyResource. - /// The id. /// Name of the resource. + /// ID of the resource. /// Resource location. /// Holds the associations the resource has with other resources in the resource group. - internal TopologyResource(string id, string name, string location, IReadOnlyList associations) : base(id) + internal TopologyResource(string name, string id, string location, IReadOnlyList associations) { Name = name; + Id = id; Location = location; Associations = associations; } /// Name of the resource. public string Name { get; } + /// ID of the resource. + public string Id { get; } /// Resource location. public string Location { get; } /// Holds the associations the resource has with other resources in the resource group. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/TroubleshootingDetails.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/TroubleshootingDetails.Serialization.cs index 495a633d1b875..71ce87068550c 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/TroubleshootingDetails.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/TroubleshootingDetails.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -16,13 +15,18 @@ public partial class TroubleshootingDetails { internal static TroubleshootingDetails DeserializeTroubleshootingDetails(JsonElement element) { + Optional id = default; Optional reasonType = default; Optional summary = default; Optional detail = default; Optional> recommendedActions = default; - ResourceIdentifier id = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("reasonType")) { reasonType = property.Value.GetString(); @@ -53,13 +57,8 @@ internal static TroubleshootingDetails DeserializeTroubleshootingDetails(JsonEle recommendedActions = array; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } } - return new TroubleshootingDetails(id, reasonType.Value, summary.Value, detail.Value, Optional.ToList(recommendedActions)); + return new TroubleshootingDetails(id.Value, reasonType.Value, summary.Value, detail.Value, Optional.ToList(recommendedActions)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/TroubleshootingDetails.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/TroubleshootingDetails.cs index 86578e6ed2a67..f24e41766a20a 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/TroubleshootingDetails.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/TroubleshootingDetails.cs @@ -7,12 +7,11 @@ using System.Collections.Generic; using Azure.Core; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { /// Information gained from troubleshooting of specified resource. - public partial class TroubleshootingDetails : Resources.Models.SubResource + public partial class TroubleshootingDetails { /// Initializes a new instance of TroubleshootingDetails. internal TroubleshootingDetails() @@ -21,19 +20,22 @@ internal TroubleshootingDetails() } /// Initializes a new instance of TroubleshootingDetails. - /// The id. + /// The id of the get troubleshoot operation. /// Reason type of failure. /// A summary of troubleshooting. /// Details on troubleshooting results. /// List of recommended actions. - internal TroubleshootingDetails(string id, string reasonType, string summary, string detail, IReadOnlyList recommendedActions) : base(id) + internal TroubleshootingDetails(string id, string reasonType, string summary, string detail, IReadOnlyList recommendedActions) { + Id = id; ReasonType = reasonType; Summary = summary; Detail = detail; RecommendedActions = recommendedActions; } + /// The id of the get troubleshoot operation. + public string Id { get; } /// Reason type of failure. public string ReasonType { get; } /// A summary of troubleshooting. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Usage.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Usage.Serialization.cs index cda62c1f843b2..0bd9e1529259d 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Usage.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Usage.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -15,13 +14,18 @@ public partial class Usage { internal static Usage DeserializeUsage(JsonElement element) { + Optional id = default; UsageUnit unit = default; long currentValue = default; long limit = default; UsageName name = default; - ResourceIdentifier id = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("unit")) { unit = new UsageUnit(property.Value.GetString()); @@ -42,13 +46,8 @@ internal static Usage DeserializeUsage(JsonElement element) name = UsageName.DeserializeUsageName(property.Value); continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } } - return new Usage(id, unit, currentValue, limit, name); + return new Usage(id.Value, unit, currentValue, limit, name); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Usage.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Usage.cs index 44cb5bd1577e2..29175b8728033 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Usage.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/Usage.cs @@ -6,12 +6,11 @@ #nullable disable using System; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { /// The network resource usage. - public partial class Usage : Resources.Models.SubResource + public partial class Usage { /// Initializes a new instance of Usage. /// An enum describing the unit of measurement. @@ -33,19 +32,22 @@ internal Usage(UsageUnit unit, long currentValue, long limit, UsageName name) } /// Initializes a new instance of Usage. - /// The id. + /// Resource identifier. /// An enum describing the unit of measurement. /// The current value of the usage. /// The limit of usage. /// The name of the type of usage. - internal Usage(string id, UsageUnit unit, long currentValue, long limit, UsageName name) : base(id) + internal Usage(string id, UsageUnit unit, long currentValue, long limit, UsageName name) { + Id = id; Unit = unit; CurrentValue = currentValue; Limit = limit; Name = name; } + /// Resource identifier. + public string Id { get; } /// An enum describing the unit of measurement. public UsageUnit Unit { get; } /// The current value of the usage. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VM.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VM.Serialization.cs index 4aa4a63e89205..b0b92877f3a1d 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VM.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VM.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -17,6 +16,11 @@ public partial class VM : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -33,20 +37,23 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WriteEndObject(); } internal static VM DeserializeVM(JsonElement element) { + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -77,13 +84,8 @@ internal static VM DeserializeVM(JsonElement element) tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } } - return new VM(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags)); + return new VM(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VM.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VM.cs index 1542b3448224d..303db72f7b24c 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VM.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VM.cs @@ -18,7 +18,7 @@ public VM() } /// Initializes a new instance of VM. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualApplianceSiteData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualApplianceSiteData.Serialization.cs index ba5ef1a324c7d..7a62c2eda9261 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualApplianceSiteData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualApplianceSiteData.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -22,8 +21,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(AddressPrefix)) @@ -45,7 +47,7 @@ internal static VirtualApplianceSiteData DeserializeVirtualApplianceSiteData(Jso Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional addressPrefix = default; Optional o365Policy = default; Optional provisioningState = default; @@ -109,7 +111,7 @@ internal static VirtualApplianceSiteData DeserializeVirtualApplianceSiteData(Jso continue; } } - return new VirtualApplianceSiteData(id, name.Value, etag.Value, type.Value, addressPrefix.Value, o365Policy.Value, Optional.ToNullable(provisioningState)); + return new VirtualApplianceSiteData(id.Value, name.Value, etag.Value, type.Value, addressPrefix.Value, o365Policy.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualHubData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualHubData.Serialization.cs index 35784b6117176..9c4569170c6ce 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualHubData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualHubData.Serialization.cs @@ -8,8 +8,8 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -18,6 +18,11 @@ public partial class VirtualHubData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -34,39 +39,37 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(VirtualWan)) { writer.WritePropertyName("virtualWan"); - writer.WriteObjectValue(VirtualWan); + JsonSerializer.Serialize(writer, VirtualWan); } if (Optional.IsDefined(VpnGateway)) { writer.WritePropertyName("vpnGateway"); - writer.WriteObjectValue(VpnGateway); + JsonSerializer.Serialize(writer, VpnGateway); } if (Optional.IsDefined(P2SVpnGateway)) { writer.WritePropertyName("p2SVpnGateway"); - writer.WriteObjectValue(P2SVpnGateway); + JsonSerializer.Serialize(writer, P2SVpnGateway); } if (Optional.IsDefined(ExpressRouteGateway)) { writer.WritePropertyName("expressRouteGateway"); - writer.WriteObjectValue(ExpressRouteGateway); + JsonSerializer.Serialize(writer, ExpressRouteGateway); } if (Optional.IsDefined(AzureFirewall)) { writer.WritePropertyName("azureFirewall"); - writer.WriteObjectValue(AzureFirewall); + JsonSerializer.Serialize(writer, AzureFirewall); } if (Optional.IsDefined(SecurityPartnerProvider)) { writer.WritePropertyName("securityPartnerProvider"); - writer.WriteObjectValue(SecurityPartnerProvider); + JsonSerializer.Serialize(writer, SecurityPartnerProvider); } if (Optional.IsDefined(AddressPrefix)) { @@ -130,17 +133,17 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static VirtualHubData DeserializeVirtualHubData(JsonElement element) { Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; - Optional virtualWan = default; - Optional vpnGateway = default; - Optional p2SVpnGateway = default; - Optional expressRouteGateway = default; - Optional azureFirewall = default; - Optional securityPartnerProvider = default; + Optional virtualWan = default; + Optional vpnGateway = default; + Optional p2SVpnGateway = default; + Optional expressRouteGateway = default; + Optional azureFirewall = default; + Optional securityPartnerProvider = default; Optional addressPrefix = default; Optional routeTable = default; Optional provisioningState = default; @@ -148,8 +151,8 @@ internal static VirtualHubData DeserializeVirtualHubData(JsonElement element) Optional> virtualHubRouteTableV2s = default; Optional sku = default; Optional routingState = default; - Optional> bgpConnections = default; - Optional> ipConfigurations = default; + Optional> bgpConnections = default; + Optional> ipConfigurations = default; Optional virtualRouterAsn = default; Optional> virtualRouterIps = default; Optional allowBranchToBranchTraffic = default; @@ -161,6 +164,11 @@ internal static VirtualHubData DeserializeVirtualHubData(JsonElement element) etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -191,11 +199,6 @@ internal static VirtualHubData DeserializeVirtualHubData(JsonElement element) tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -212,7 +215,7 @@ internal static VirtualHubData DeserializeVirtualHubData(JsonElement element) property0.ThrowNonNullablePropertyIsNull(); continue; } - virtualWan = SubResource.DeserializeSubResource(property0.Value); + virtualWan = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("vpnGateway")) @@ -222,7 +225,7 @@ internal static VirtualHubData DeserializeVirtualHubData(JsonElement element) property0.ThrowNonNullablePropertyIsNull(); continue; } - vpnGateway = SubResource.DeserializeSubResource(property0.Value); + vpnGateway = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("p2SVpnGateway")) @@ -232,7 +235,7 @@ internal static VirtualHubData DeserializeVirtualHubData(JsonElement element) property0.ThrowNonNullablePropertyIsNull(); continue; } - p2SVpnGateway = SubResource.DeserializeSubResource(property0.Value); + p2SVpnGateway = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("expressRouteGateway")) @@ -242,7 +245,7 @@ internal static VirtualHubData DeserializeVirtualHubData(JsonElement element) property0.ThrowNonNullablePropertyIsNull(); continue; } - expressRouteGateway = SubResource.DeserializeSubResource(property0.Value); + expressRouteGateway = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("azureFirewall")) @@ -252,7 +255,7 @@ internal static VirtualHubData DeserializeVirtualHubData(JsonElement element) property0.ThrowNonNullablePropertyIsNull(); continue; } - azureFirewall = SubResource.DeserializeSubResource(property0.Value); + azureFirewall = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("securityPartnerProvider")) @@ -262,7 +265,7 @@ internal static VirtualHubData DeserializeVirtualHubData(JsonElement element) property0.ThrowNonNullablePropertyIsNull(); continue; } - securityPartnerProvider = SubResource.DeserializeSubResource(property0.Value); + securityPartnerProvider = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("addressPrefix")) @@ -332,10 +335,10 @@ internal static VirtualHubData DeserializeVirtualHubData(JsonElement element) property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } bgpConnections = array; continue; @@ -347,10 +350,10 @@ internal static VirtualHubData DeserializeVirtualHubData(JsonElement element) property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } ipConfigurations = array; continue; @@ -404,7 +407,7 @@ internal static VirtualHubData DeserializeVirtualHubData(JsonElement element) continue; } } - return new VirtualHubData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, virtualWan.Value, vpnGateway.Value, p2SVpnGateway.Value, expressRouteGateway.Value, azureFirewall.Value, securityPartnerProvider.Value, addressPrefix.Value, routeTable.Value, Optional.ToNullable(provisioningState), securityProviderName.Value, Optional.ToList(virtualHubRouteTableV2s), sku.Value, Optional.ToNullable(routingState), Optional.ToList(bgpConnections), Optional.ToList(ipConfigurations), Optional.ToNullable(virtualRouterAsn), Optional.ToList(virtualRouterIps), Optional.ToNullable(allowBranchToBranchTraffic), Optional.ToNullable(preferredRoutingGateway)); + return new VirtualHubData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, virtualWan, vpnGateway, p2SVpnGateway, expressRouteGateway, azureFirewall, securityPartnerProvider, addressPrefix.Value, routeTable.Value, Optional.ToNullable(provisioningState), securityProviderName.Value, Optional.ToList(virtualHubRouteTableV2s), sku.Value, Optional.ToNullable(routingState), Optional.ToList(bgpConnections), Optional.ToList(ipConfigurations), Optional.ToNullable(virtualRouterAsn), Optional.ToList(virtualRouterIps), Optional.ToNullable(allowBranchToBranchTraffic), Optional.ToNullable(preferredRoutingGateway)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualHubId.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualHubId.Serialization.cs deleted file mode 100644 index 171b0a966e792..0000000000000 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualHubId.Serialization.cs +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Network.Models -{ - public partial class VirtualHubId : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(Id)) - { - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); - } - writer.WriteEndObject(); - } - - internal static VirtualHubId DeserializeVirtualHubId(JsonElement element) - { - Optional id = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - } - return new VirtualHubId(id.Value); - } - } -} diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualHubId.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualHubId.cs deleted file mode 100644 index 4e10abee68244..0000000000000 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualHubId.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Network.Models -{ - /// Virtual Hub identifier. - public partial class VirtualHubId - { - /// Initializes a new instance of VirtualHubId. - public VirtualHubId() - { - } - - /// Initializes a new instance of VirtualHubId. - /// The resource URI for the Virtual Hub where the ExpressRoute gateway is or will be deployed. The Virtual Hub resource and the ExpressRoute gateway resource reside in the same subscription. - internal VirtualHubId(string id) - { - Id = id; - } - - /// The resource URI for the Virtual Hub where the ExpressRoute gateway is or will be deployed. The Virtual Hub resource and the ExpressRoute gateway resource reside in the same subscription. - public string Id { get; set; } - } -} diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualHubRouteTableV2Data.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualHubRouteTableV2Data.Serialization.cs index b7a5c158a1871..f20c78722fbba 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualHubRouteTableV2Data.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualHubRouteTableV2Data.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -23,8 +22,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsCollectionDefined(Routes)) @@ -55,7 +57,7 @@ internal static VirtualHubRouteTableV2Data DeserializeVirtualHubRouteTableV2Data { Optional name = default; Optional etag = default; - ResourceIdentifier id = default; + Optional id = default; Optional> routes = default; Optional> attachedConnections = default; Optional provisioningState = default; @@ -129,7 +131,7 @@ internal static VirtualHubRouteTableV2Data DeserializeVirtualHubRouteTableV2Data continue; } } - return new VirtualHubRouteTableV2Data(id, name.Value, etag.Value, Optional.ToList(routes), Optional.ToList(attachedConnections), Optional.ToNullable(provisioningState)); + return new VirtualHubRouteTableV2Data(id.Value, name.Value, etag.Value, Optional.ToList(routes), Optional.ToList(attachedConnections), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkConnectionGatewayReference.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkConnectionGatewayReference.Serialization.cs deleted file mode 100644 index e3c6ecaba759b..0000000000000 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkConnectionGatewayReference.Serialization.cs +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Network.Models -{ - public partial class VirtualNetworkConnectionGatewayReference : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); - writer.WriteEndObject(); - } - - internal static VirtualNetworkConnectionGatewayReference DeserializeVirtualNetworkConnectionGatewayReference(JsonElement element) - { - string id = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - } - return new VirtualNetworkConnectionGatewayReference(id); - } - } -} diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkConnectionGatewayReference.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkConnectionGatewayReference.cs deleted file mode 100644 index a0f7c88fc32a7..0000000000000 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkConnectionGatewayReference.cs +++ /dev/null @@ -1,31 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; - -namespace Azure.ResourceManager.Network.Models -{ - /// A reference to VirtualNetworkGateway or LocalNetworkGateway resource. - public partial class VirtualNetworkConnectionGatewayReference - { - /// Initializes a new instance of VirtualNetworkConnectionGatewayReference. - /// The ID of VirtualNetworkGateway or LocalNetworkGateway resource. - /// is null. - public VirtualNetworkConnectionGatewayReference(string id) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - - Id = id; - } - - /// The ID of VirtualNetworkGateway or LocalNetworkGateway resource. - public string Id { get; set; } - } -} diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkData.Serialization.cs index d81f6d756c6b9..a1e4d893bd877 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkData.Serialization.cs @@ -8,8 +8,8 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -23,6 +23,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("extendedLocation"); writer.WriteObjectValue(ExtendedLocation); } + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -39,8 +44,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(AddressSpace)) @@ -91,7 +94,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(DdosProtectionPlan)) { writer.WritePropertyName("ddosProtectionPlan"); - writer.WriteObjectValue(DdosProtectionPlan); + JsonSerializer.Serialize(writer, DdosProtectionPlan); } if (Optional.IsDefined(BgpCommunities)) { @@ -104,7 +107,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in IpAllocations) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } @@ -116,11 +119,11 @@ internal static VirtualNetworkData DeserializeVirtualNetworkData(JsonElement ele { Optional extendedLocation = default; Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional addressSpace = default; Optional dhcpOptions = default; Optional flowTimeoutInMinutes = default; @@ -130,9 +133,9 @@ internal static VirtualNetworkData DeserializeVirtualNetworkData(JsonElement ele Optional provisioningState = default; Optional enableDdosProtection = default; Optional enableVmProtection = default; - Optional ddosProtectionPlan = default; + Optional ddosProtectionPlan = default; Optional bgpCommunities = default; - Optional> ipAllocations = default; + Optional> ipAllocations = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("extendedLocation")) @@ -150,6 +153,11 @@ internal static VirtualNetworkData DeserializeVirtualNetworkData(JsonElement ele etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -180,11 +188,6 @@ internal static VirtualNetworkData DeserializeVirtualNetworkData(JsonElement ele tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -296,7 +299,7 @@ internal static VirtualNetworkData DeserializeVirtualNetworkData(JsonElement ele property0.ThrowNonNullablePropertyIsNull(); continue; } - ddosProtectionPlan = SubResource.DeserializeSubResource(property0.Value); + ddosProtectionPlan = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("bgpCommunities")) @@ -316,10 +319,10 @@ internal static VirtualNetworkData DeserializeVirtualNetworkData(JsonElement ele property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } ipAllocations = array; continue; @@ -328,7 +331,7 @@ internal static VirtualNetworkData DeserializeVirtualNetworkData(JsonElement ele continue; } } - return new VirtualNetworkData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), extendedLocation.Value, etag.Value, addressSpace.Value, dhcpOptions.Value, Optional.ToNullable(flowTimeoutInMinutes), Optional.ToList(subnets), Optional.ToList(virtualNetworkPeerings), resourceGuid.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(enableDdosProtection), Optional.ToNullable(enableVmProtection), ddosProtectionPlan.Value, bgpCommunities.Value, Optional.ToList(ipAllocations)); + return new VirtualNetworkData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), extendedLocation.Value, etag.Value, addressSpace.Value, dhcpOptions.Value, Optional.ToNullable(flowTimeoutInMinutes), Optional.ToList(subnets), Optional.ToList(virtualNetworkPeerings), resourceGuid.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(enableDdosProtection), Optional.ToNullable(enableVmProtection), ddosProtectionPlan, bgpCommunities.Value, Optional.ToList(ipAllocations)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkGatewayConnectionData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkGatewayConnectionData.Serialization.cs index 073c261f50181..fed72033da2ce 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkGatewayConnectionData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkGatewayConnectionData.Serialization.cs @@ -8,8 +8,8 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -18,6 +18,11 @@ public partial class VirtualNetworkGatewayConnectionData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -34,8 +39,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(AuthorizationKey)) @@ -61,7 +64,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in IngressNatRules) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } @@ -71,7 +74,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in EgressNatRules) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } @@ -105,7 +108,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Peer)) { writer.WritePropertyName("peer"); - writer.WriteObjectValue(Peer); + JsonSerializer.Serialize(writer, Peer); } if (Optional.IsDefined(EnableBgp)) { @@ -154,17 +157,17 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static VirtualNetworkGatewayConnectionData DeserializeVirtualNetworkGatewayConnectionData(JsonElement element) { Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional authorizationKey = default; VirtualNetworkGatewayData virtualNetworkGateway1 = default; Optional virtualNetworkGateway2 = default; Optional localNetworkGateway2 = default; - Optional> ingressNatRules = default; - Optional> egressNatRules = default; + Optional> ingressNatRules = default; + Optional> egressNatRules = default; VirtualNetworkGatewayConnectionType connectionType = default; Optional connectionProtocol = default; Optional routingWeight = default; @@ -175,7 +178,7 @@ internal static VirtualNetworkGatewayConnectionData DeserializeVirtualNetworkGat Optional> tunnelConnectionStatus = default; Optional egressBytesTransferred = default; Optional ingressBytesTransferred = default; - Optional peer = default; + Optional peer = default; Optional enableBgp = default; Optional useLocalAzureIpAddress = default; Optional usePolicyBasedTrafficSelectors = default; @@ -191,6 +194,11 @@ internal static VirtualNetworkGatewayConnectionData DeserializeVirtualNetworkGat etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -221,11 +229,6 @@ internal static VirtualNetworkGatewayConnectionData DeserializeVirtualNetworkGat tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -272,10 +275,10 @@ internal static VirtualNetworkGatewayConnectionData DeserializeVirtualNetworkGat property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } ingressNatRules = array; continue; @@ -287,10 +290,10 @@ internal static VirtualNetworkGatewayConnectionData DeserializeVirtualNetworkGat property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } egressNatRules = array; continue; @@ -397,7 +400,7 @@ internal static VirtualNetworkGatewayConnectionData DeserializeVirtualNetworkGat property0.ThrowNonNullablePropertyIsNull(); continue; } - peer = SubResource.DeserializeSubResource(property0.Value); + peer = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("enableBgp")) @@ -489,7 +492,7 @@ internal static VirtualNetworkGatewayConnectionData DeserializeVirtualNetworkGat continue; } } - return new VirtualNetworkGatewayConnectionData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, authorizationKey.Value, virtualNetworkGateway1, virtualNetworkGateway2.Value, localNetworkGateway2.Value, Optional.ToList(ingressNatRules), Optional.ToList(egressNatRules), connectionType, Optional.ToNullable(connectionProtocol), Optional.ToNullable(routingWeight), Optional.ToNullable(dpdTimeoutSeconds), Optional.ToNullable(connectionMode), sharedKey.Value, Optional.ToNullable(connectionStatus), Optional.ToList(tunnelConnectionStatus), Optional.ToNullable(egressBytesTransferred), Optional.ToNullable(ingressBytesTransferred), peer.Value, Optional.ToNullable(enableBgp), Optional.ToNullable(useLocalAzureIpAddress), Optional.ToNullable(usePolicyBasedTrafficSelectors), Optional.ToList(ipsecPolicies), Optional.ToList(trafficSelectorPolicies), resourceGuid.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(expressRouteGatewayBypass)); + return new VirtualNetworkGatewayConnectionData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, authorizationKey.Value, virtualNetworkGateway1, virtualNetworkGateway2.Value, localNetworkGateway2.Value, Optional.ToList(ingressNatRules), Optional.ToList(egressNatRules), connectionType, Optional.ToNullable(connectionProtocol), Optional.ToNullable(routingWeight), Optional.ToNullable(dpdTimeoutSeconds), Optional.ToNullable(connectionMode), sharedKey.Value, Optional.ToNullable(connectionStatus), Optional.ToList(tunnelConnectionStatus), Optional.ToNullable(egressBytesTransferred), Optional.ToNullable(ingressBytesTransferred), peer, Optional.ToNullable(enableBgp), Optional.ToNullable(useLocalAzureIpAddress), Optional.ToNullable(usePolicyBasedTrafficSelectors), Optional.ToList(ipsecPolicies), Optional.ToList(trafficSelectorPolicies), resourceGuid.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(expressRouteGatewayBypass)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkGatewayConnectionListEntity.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkGatewayConnectionListEntity.Serialization.cs index 2294c9cc8cca2..9a087a10542ea 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkGatewayConnectionListEntity.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkGatewayConnectionListEntity.Serialization.cs @@ -8,7 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -17,6 +17,11 @@ public partial class VirtualNetworkGatewayConnectionListEntity : IUtf8JsonSerial void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -33,8 +38,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(AuthorizationKey)) @@ -43,16 +46,15 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStringValue(AuthorizationKey); } writer.WritePropertyName("virtualNetworkGateway1"); - writer.WriteObjectValue(VirtualNetworkGateway1); - if (Optional.IsDefined(VirtualNetworkGateway2)) + JsonSerializer.Serialize(writer, VirtualNetworkGateway1); if (Optional.IsDefined(VirtualNetworkGateway2)) { writer.WritePropertyName("virtualNetworkGateway2"); - writer.WriteObjectValue(VirtualNetworkGateway2); + JsonSerializer.Serialize(writer, VirtualNetworkGateway2); } if (Optional.IsDefined(LocalNetworkGateway2)) { writer.WritePropertyName("localNetworkGateway2"); - writer.WriteObjectValue(LocalNetworkGateway2); + JsonSerializer.Serialize(writer, LocalNetworkGateway2); } writer.WritePropertyName("connectionType"); writer.WriteStringValue(ConnectionType.ToString()); @@ -79,7 +81,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Peer)) { writer.WritePropertyName("peer"); - writer.WriteObjectValue(Peer); + JsonSerializer.Serialize(writer, Peer); } if (Optional.IsDefined(EnableBgp)) { @@ -123,15 +125,15 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static VirtualNetworkGatewayConnectionListEntity DeserializeVirtualNetworkGatewayConnectionListEntity(JsonElement element) { Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional authorizationKey = default; - VirtualNetworkConnectionGatewayReference virtualNetworkGateway1 = default; - Optional virtualNetworkGateway2 = default; - Optional localNetworkGateway2 = default; + WritableSubResource virtualNetworkGateway1 = default; + Optional virtualNetworkGateway2 = default; + Optional localNetworkGateway2 = default; VirtualNetworkGatewayConnectionType connectionType = default; Optional connectionProtocol = default; Optional routingWeight = default; @@ -141,7 +143,7 @@ internal static VirtualNetworkGatewayConnectionListEntity DeserializeVirtualNetw Optional> tunnelConnectionStatus = default; Optional egressBytesTransferred = default; Optional ingressBytesTransferred = default; - Optional peer = default; + Optional peer = default; Optional enableBgp = default; Optional usePolicyBasedTrafficSelectors = default; Optional> ipsecPolicies = default; @@ -156,6 +158,11 @@ internal static VirtualNetworkGatewayConnectionListEntity DeserializeVirtualNetw etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -186,11 +193,6 @@ internal static VirtualNetworkGatewayConnectionListEntity DeserializeVirtualNetw tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -207,7 +209,7 @@ internal static VirtualNetworkGatewayConnectionListEntity DeserializeVirtualNetw } if (property0.NameEquals("virtualNetworkGateway1")) { - virtualNetworkGateway1 = VirtualNetworkConnectionGatewayReference.DeserializeVirtualNetworkConnectionGatewayReference(property0.Value); + virtualNetworkGateway1 = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("virtualNetworkGateway2")) @@ -217,7 +219,7 @@ internal static VirtualNetworkGatewayConnectionListEntity DeserializeVirtualNetw property0.ThrowNonNullablePropertyIsNull(); continue; } - virtualNetworkGateway2 = VirtualNetworkConnectionGatewayReference.DeserializeVirtualNetworkConnectionGatewayReference(property0.Value); + virtualNetworkGateway2 = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("localNetworkGateway2")) @@ -227,7 +229,7 @@ internal static VirtualNetworkGatewayConnectionListEntity DeserializeVirtualNetw property0.ThrowNonNullablePropertyIsNull(); continue; } - localNetworkGateway2 = VirtualNetworkConnectionGatewayReference.DeserializeVirtualNetworkConnectionGatewayReference(property0.Value); + localNetworkGateway2 = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("connectionType")) @@ -322,7 +324,7 @@ internal static VirtualNetworkGatewayConnectionListEntity DeserializeVirtualNetw property0.ThrowNonNullablePropertyIsNull(); continue; } - peer = SubResource.DeserializeSubResource(property0.Value); + peer = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("enableBgp")) @@ -404,7 +406,7 @@ internal static VirtualNetworkGatewayConnectionListEntity DeserializeVirtualNetw continue; } } - return new VirtualNetworkGatewayConnectionListEntity(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, authorizationKey.Value, virtualNetworkGateway1, virtualNetworkGateway2.Value, localNetworkGateway2.Value, connectionType, Optional.ToNullable(connectionProtocol), Optional.ToNullable(routingWeight), Optional.ToNullable(connectionMode), sharedKey.Value, Optional.ToNullable(connectionStatus), Optional.ToList(tunnelConnectionStatus), Optional.ToNullable(egressBytesTransferred), Optional.ToNullable(ingressBytesTransferred), peer.Value, Optional.ToNullable(enableBgp), Optional.ToNullable(usePolicyBasedTrafficSelectors), Optional.ToList(ipsecPolicies), Optional.ToList(trafficSelectorPolicies), resourceGuid.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(expressRouteGatewayBypass)); + return new VirtualNetworkGatewayConnectionListEntity(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, authorizationKey.Value, virtualNetworkGateway1, virtualNetworkGateway2, localNetworkGateway2, connectionType, Optional.ToNullable(connectionProtocol), Optional.ToNullable(routingWeight), Optional.ToNullable(connectionMode), sharedKey.Value, Optional.ToNullable(connectionStatus), Optional.ToList(tunnelConnectionStatus), Optional.ToNullable(egressBytesTransferred), Optional.ToNullable(ingressBytesTransferred), peer, Optional.ToNullable(enableBgp), Optional.ToNullable(usePolicyBasedTrafficSelectors), Optional.ToList(ipsecPolicies), Optional.ToList(trafficSelectorPolicies), resourceGuid.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(expressRouteGatewayBypass)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkGatewayConnectionListEntity.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkGatewayConnectionListEntity.cs index d171526b29f78..be51609b1e562 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkGatewayConnectionListEntity.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkGatewayConnectionListEntity.cs @@ -8,6 +8,7 @@ using System; using System.Collections.Generic; using Azure.Core; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -18,7 +19,7 @@ public partial class VirtualNetworkGatewayConnectionListEntity : Resource /// The reference to virtual network gateway resource. /// Gateway connection type. /// is null. - public VirtualNetworkGatewayConnectionListEntity(VirtualNetworkConnectionGatewayReference virtualNetworkGateway1, VirtualNetworkGatewayConnectionType connectionType) + public VirtualNetworkGatewayConnectionListEntity(WritableSubResource virtualNetworkGateway1, VirtualNetworkGatewayConnectionType connectionType) { if (virtualNetworkGateway1 == null) { @@ -33,7 +34,7 @@ public VirtualNetworkGatewayConnectionListEntity(VirtualNetworkConnectionGateway } /// Initializes a new instance of VirtualNetworkGatewayConnectionListEntity. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. @@ -60,7 +61,7 @@ public VirtualNetworkGatewayConnectionListEntity(VirtualNetworkConnectionGateway /// The resource GUID property of the virtual network gateway connection resource. /// The provisioning state of the virtual network gateway connection resource. /// Bypass ExpressRoute Gateway for data forwarding. - internal VirtualNetworkGatewayConnectionListEntity(string id, string name, string type, string location, IDictionary tags, string etag, string authorizationKey, VirtualNetworkConnectionGatewayReference virtualNetworkGateway1, VirtualNetworkConnectionGatewayReference virtualNetworkGateway2, VirtualNetworkConnectionGatewayReference localNetworkGateway2, VirtualNetworkGatewayConnectionType connectionType, VirtualNetworkGatewayConnectionProtocol? connectionProtocol, int? routingWeight, VirtualNetworkGatewayConnectionMode? connectionMode, string sharedKey, VirtualNetworkGatewayConnectionStatus? connectionStatus, IReadOnlyList tunnelConnectionStatus, long? egressBytesTransferred, long? ingressBytesTransferred, SubResource peer, bool? enableBgp, bool? usePolicyBasedTrafficSelectors, IList ipsecPolicies, IList trafficSelectorPolicies, string resourceGuid, ProvisioningState? provisioningState, bool? expressRouteGatewayBypass) : base(id, name, type, location, tags) + internal VirtualNetworkGatewayConnectionListEntity(string id, string name, string type, string location, IDictionary tags, string etag, string authorizationKey, WritableSubResource virtualNetworkGateway1, WritableSubResource virtualNetworkGateway2, WritableSubResource localNetworkGateway2, VirtualNetworkGatewayConnectionType connectionType, VirtualNetworkGatewayConnectionProtocol? connectionProtocol, int? routingWeight, VirtualNetworkGatewayConnectionMode? connectionMode, string sharedKey, VirtualNetworkGatewayConnectionStatus? connectionStatus, IReadOnlyList tunnelConnectionStatus, long? egressBytesTransferred, long? ingressBytesTransferred, WritableSubResource peer, bool? enableBgp, bool? usePolicyBasedTrafficSelectors, IList ipsecPolicies, IList trafficSelectorPolicies, string resourceGuid, ProvisioningState? provisioningState, bool? expressRouteGatewayBypass) : base(id, name, type, location, tags) { Etag = etag; AuthorizationKey = authorizationKey; @@ -91,11 +92,11 @@ internal VirtualNetworkGatewayConnectionListEntity(string id, string name, strin /// The authorizationKey. public string AuthorizationKey { get; set; } /// The reference to virtual network gateway resource. - public VirtualNetworkConnectionGatewayReference VirtualNetworkGateway1 { get; set; } + public WritableSubResource VirtualNetworkGateway1 { get; set; } /// The reference to virtual network gateway resource. - public VirtualNetworkConnectionGatewayReference VirtualNetworkGateway2 { get; set; } + public WritableSubResource VirtualNetworkGateway2 { get; set; } /// The reference to local network gateway resource. - public VirtualNetworkConnectionGatewayReference LocalNetworkGateway2 { get; set; } + public WritableSubResource LocalNetworkGateway2 { get; set; } /// Gateway connection type. public VirtualNetworkGatewayConnectionType ConnectionType { get; set; } /// Connection protocol used for this connection. @@ -115,7 +116,7 @@ internal VirtualNetworkGatewayConnectionListEntity(string id, string name, strin /// The ingress bytes transferred in this connection. public long? IngressBytesTransferred { get; } /// The reference to peerings resource. - public SubResource Peer { get; set; } + public WritableSubResource Peer { get; set; } /// EnableBgp flag. public bool? EnableBgp { get; set; } /// Enable policy-based traffic selectors. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkGatewayData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkGatewayData.Serialization.cs index e02fd0a4ccbca..5b0755cf36e07 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkGatewayData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkGatewayData.Serialization.cs @@ -8,8 +8,8 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -23,6 +23,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("extendedLocation"); writer.WriteObjectValue(ExtendedLocation); } + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -39,8 +44,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsCollectionDefined(IpConfigurations)) @@ -86,7 +89,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(GatewayDefaultSite)) { writer.WritePropertyName("gatewayDefaultSite"); - writer.WriteObjectValue(GatewayDefaultSite); + JsonSerializer.Serialize(writer, GatewayDefaultSite); } if (Optional.IsDefined(Sku)) { @@ -141,11 +144,11 @@ internal static VirtualNetworkGatewayData DeserializeVirtualNetworkGatewayData(J { Optional extendedLocation = default; Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional> ipConfigurations = default; Optional gatewayType = default; Optional vpnType = default; @@ -153,7 +156,7 @@ internal static VirtualNetworkGatewayData DeserializeVirtualNetworkGatewayData(J Optional enableBgp = default; Optional enablePrivateIpAddress = default; Optional activeActive = default; - Optional gatewayDefaultSite = default; + Optional gatewayDefaultSite = default; Optional sku = default; Optional vpnClientConfiguration = default; Optional bgpSettings = default; @@ -182,6 +185,11 @@ internal static VirtualNetworkGatewayData DeserializeVirtualNetworkGatewayData(J etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -212,11 +220,6 @@ internal static VirtualNetworkGatewayData DeserializeVirtualNetworkGatewayData(J tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -308,7 +311,7 @@ internal static VirtualNetworkGatewayData DeserializeVirtualNetworkGatewayData(J property0.ThrowNonNullablePropertyIsNull(); continue; } - gatewayDefaultSite = SubResource.DeserializeSubResource(property0.Value); + gatewayDefaultSite = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("sku")) @@ -415,7 +418,7 @@ internal static VirtualNetworkGatewayData DeserializeVirtualNetworkGatewayData(J continue; } } - return new VirtualNetworkGatewayData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), extendedLocation.Value, etag.Value, Optional.ToList(ipConfigurations), Optional.ToNullable(gatewayType), Optional.ToNullable(vpnType), Optional.ToNullable(vpnGatewayGeneration), Optional.ToNullable(enableBgp), Optional.ToNullable(enablePrivateIpAddress), Optional.ToNullable(activeActive), gatewayDefaultSite.Value, sku.Value, vpnClientConfiguration.Value, bgpSettings.Value, customRoutes.Value, resourceGuid.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(enableDnsForwarding), inboundDnsForwardingEndpoint.Value, vNetExtendedLocationResourceId.Value, Optional.ToList(natRules), Optional.ToNullable(enableBgpRouteTranslationForNat)); + return new VirtualNetworkGatewayData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), extendedLocation.Value, etag.Value, Optional.ToList(ipConfigurations), Optional.ToNullable(gatewayType), Optional.ToNullable(vpnType), Optional.ToNullable(vpnGatewayGeneration), Optional.ToNullable(enableBgp), Optional.ToNullable(enablePrivateIpAddress), Optional.ToNullable(activeActive), gatewayDefaultSite, sku.Value, vpnClientConfiguration.Value, bgpSettings.Value, customRoutes.Value, resourceGuid.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(enableDnsForwarding), inboundDnsForwardingEndpoint.Value, vNetExtendedLocationResourceId.Value, Optional.ToList(natRules), Optional.ToNullable(enableBgpRouteTranslationForNat)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkGatewayIPConfiguration.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkGatewayIPConfiguration.Serialization.cs index 537af090af87e..6e49160910fb2 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkGatewayIPConfiguration.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkGatewayIPConfiguration.Serialization.cs @@ -7,7 +7,7 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -21,8 +21,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(PrivateIPAllocationMethod)) @@ -33,12 +36,12 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(Subnet)) { writer.WritePropertyName("subnet"); - writer.WriteObjectValue(Subnet); + JsonSerializer.Serialize(writer, Subnet); } if (Optional.IsDefined(PublicIPAddress)) { writer.WritePropertyName("publicIPAddress"); - writer.WriteObjectValue(PublicIPAddress); + JsonSerializer.Serialize(writer, PublicIPAddress); } writer.WriteEndObject(); writer.WriteEndObject(); @@ -48,10 +51,10 @@ internal static VirtualNetworkGatewayIPConfiguration DeserializeVirtualNetworkGa { Optional name = default; Optional etag = default; - ResourceIdentifier id = default; + Optional id = default; Optional privateIPAllocationMethod = default; - Optional subnet = default; - Optional publicIPAddress = default; + Optional subnet = default; + Optional publicIPAddress = default; Optional privateIPAddress = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) @@ -97,7 +100,7 @@ internal static VirtualNetworkGatewayIPConfiguration DeserializeVirtualNetworkGa property0.ThrowNonNullablePropertyIsNull(); continue; } - subnet = SubResource.DeserializeSubResource(property0.Value); + subnet = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("publicIPAddress")) @@ -107,7 +110,7 @@ internal static VirtualNetworkGatewayIPConfiguration DeserializeVirtualNetworkGa property0.ThrowNonNullablePropertyIsNull(); continue; } - publicIPAddress = SubResource.DeserializeSubResource(property0.Value); + publicIPAddress = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("privateIPAddress")) @@ -129,7 +132,7 @@ internal static VirtualNetworkGatewayIPConfiguration DeserializeVirtualNetworkGa continue; } } - return new VirtualNetworkGatewayIPConfiguration(id, name.Value, etag.Value, Optional.ToNullable(privateIPAllocationMethod), subnet.Value, publicIPAddress.Value, privateIPAddress.Value, Optional.ToNullable(provisioningState)); + return new VirtualNetworkGatewayIPConfiguration(id.Value, name.Value, etag.Value, Optional.ToNullable(privateIPAllocationMethod), subnet, publicIPAddress, privateIPAddress.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkGatewayIPConfiguration.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkGatewayIPConfiguration.cs index da08746866fc2..7b756d9c38168 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkGatewayIPConfiguration.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkGatewayIPConfiguration.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.Network.Models { /// IP configuration for virtual network gateway. - public partial class VirtualNetworkGatewayIPConfiguration : WritableSubResource + public partial class VirtualNetworkGatewayIPConfiguration : SubResource { /// Initializes a new instance of VirtualNetworkGatewayIPConfiguration. public VirtualNetworkGatewayIPConfiguration() @@ -18,7 +18,7 @@ public VirtualNetworkGatewayIPConfiguration() } /// Initializes a new instance of VirtualNetworkGatewayIPConfiguration. - /// The id. + /// Resource ID. /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// The private IP address allocation method. @@ -26,7 +26,7 @@ public VirtualNetworkGatewayIPConfiguration() /// The reference to the public IP resource. /// Private IP Address for this gateway. /// The provisioning state of the virtual network gateway IP configuration resource. - internal VirtualNetworkGatewayIPConfiguration(string id, string name, string etag, IPAllocationMethod? privateIPAllocationMethod, SubResource subnet, SubResource publicIPAddress, string privateIPAddress, ProvisioningState? provisioningState) : base(id) + internal VirtualNetworkGatewayIPConfiguration(string id, string name, string etag, IPAllocationMethod? privateIPAllocationMethod, WritableSubResource subnet, WritableSubResource publicIPAddress, string privateIPAddress, ProvisioningState? provisioningState) : base(id) { Name = name; Etag = etag; @@ -44,9 +44,9 @@ internal VirtualNetworkGatewayIPConfiguration(string id, string name, string eta /// The private IP address allocation method. public IPAllocationMethod? PrivateIPAllocationMethod { get; set; } /// The reference to the subnet resource. - public SubResource Subnet { get; set; } + public WritableSubResource Subnet { get; set; } /// The reference to the public IP resource. - public SubResource PublicIPAddress { get; set; } + public WritableSubResource PublicIPAddress { get; set; } /// Private IP Address for this gateway. public string PrivateIPAddress { get; } /// The provisioning state of the virtual network gateway IP configuration resource. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkGatewayNatRuleData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkGatewayNatRuleData.Serialization.cs index 32afb80f044a1..3df824602328b 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkGatewayNatRuleData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkGatewayNatRuleData.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -23,8 +22,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(TypePropertiesType)) @@ -71,7 +73,7 @@ internal static VirtualNetworkGatewayNatRuleData DeserializeVirtualNetworkGatewa Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional provisioningState = default; Optional type0 = default; Optional mode = default; @@ -178,7 +180,7 @@ internal static VirtualNetworkGatewayNatRuleData DeserializeVirtualNetworkGatewa continue; } } - return new VirtualNetworkGatewayNatRuleData(id, name.Value, etag.Value, type.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(type0), Optional.ToNullable(mode), Optional.ToList(internalMappings), Optional.ToList(externalMappings), ipConfigurationId.Value); + return new VirtualNetworkGatewayNatRuleData(id.Value, name.Value, etag.Value, type.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(type0), Optional.ToNullable(mode), Optional.ToList(internalMappings), Optional.ToList(externalMappings), ipConfigurationId.Value); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkPeeringData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkPeeringData.Serialization.cs index 1591af587d62e..d5b44b33d0b7f 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkPeeringData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkPeeringData.Serialization.cs @@ -7,8 +7,8 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -27,8 +27,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("type"); writer.WriteStringValue(Type); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(AllowVirtualNetworkAccess)) @@ -54,7 +57,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(RemoteVirtualNetwork)) { writer.WritePropertyName("remoteVirtualNetwork"); - writer.WriteObjectValue(RemoteVirtualNetwork); + JsonSerializer.Serialize(writer, RemoteVirtualNetwork); } if (Optional.IsDefined(RemoteAddressSpace)) { @@ -95,12 +98,12 @@ internal static VirtualNetworkPeeringData DeserializeVirtualNetworkPeeringData(J Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional allowVirtualNetworkAccess = default; Optional allowForwardedTraffic = default; Optional allowGatewayTransit = default; Optional useRemoteGateways = default; - Optional remoteVirtualNetwork = default; + Optional remoteVirtualNetwork = default; Optional remoteAddressSpace = default; Optional remoteVirtualNetworkAddressSpace = default; Optional remoteBgpCommunities = default; @@ -187,7 +190,7 @@ internal static VirtualNetworkPeeringData DeserializeVirtualNetworkPeeringData(J property0.ThrowNonNullablePropertyIsNull(); continue; } - remoteVirtualNetwork = SubResource.DeserializeSubResource(property0.Value); + remoteVirtualNetwork = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("remoteAddressSpace")) @@ -269,7 +272,7 @@ internal static VirtualNetworkPeeringData DeserializeVirtualNetworkPeeringData(J continue; } } - return new VirtualNetworkPeeringData(id, name.Value, etag.Value, type.Value, Optional.ToNullable(allowVirtualNetworkAccess), Optional.ToNullable(allowForwardedTraffic), Optional.ToNullable(allowGatewayTransit), Optional.ToNullable(useRemoteGateways), remoteVirtualNetwork.Value, remoteAddressSpace.Value, remoteVirtualNetworkAddressSpace.Value, remoteBgpCommunities.Value, Optional.ToNullable(peeringState), Optional.ToNullable(peeringSyncLevel), Optional.ToNullable(provisioningState), Optional.ToNullable(doNotVerifyRemoteGateways), resourceGuid.Value); + return new VirtualNetworkPeeringData(id.Value, name.Value, etag.Value, type.Value, Optional.ToNullable(allowVirtualNetworkAccess), Optional.ToNullable(allowForwardedTraffic), Optional.ToNullable(allowGatewayTransit), Optional.ToNullable(useRemoteGateways), remoteVirtualNetwork, remoteAddressSpace.Value, remoteVirtualNetworkAddressSpace.Value, remoteBgpCommunities.Value, Optional.ToNullable(peeringState), Optional.ToNullable(peeringSyncLevel), Optional.ToNullable(provisioningState), Optional.ToNullable(doNotVerifyRemoteGateways), resourceGuid.Value); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkTapData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkTapData.Serialization.cs index 2caa2c8b1ba47..adb7123738b90 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkTapData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkTapData.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -18,6 +17,11 @@ public partial class VirtualNetworkTapData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -34,8 +38,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(DestinationNetworkInterfaceIPConfiguration)) @@ -60,11 +62,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static VirtualNetworkTapData DeserializeVirtualNetworkTapData(JsonElement element) { Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional> networkInterfaceTapConfigurations = default; Optional resourceGuid = default; Optional provisioningState = default; @@ -78,6 +80,11 @@ internal static VirtualNetworkTapData DeserializeVirtualNetworkTapData(JsonEleme etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -108,11 +115,6 @@ internal static VirtualNetworkTapData DeserializeVirtualNetworkTapData(JsonEleme tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -186,7 +188,7 @@ internal static VirtualNetworkTapData DeserializeVirtualNetworkTapData(JsonEleme continue; } } - return new VirtualNetworkTapData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, Optional.ToList(networkInterfaceTapConfigurations), resourceGuid.Value, Optional.ToNullable(provisioningState), destinationNetworkInterfaceIPConfiguration.Value, destinationLoadBalancerFrontEndIPConfiguration.Value, Optional.ToNullable(destinationPort)); + return new VirtualNetworkTapData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, Optional.ToList(networkInterfaceTapConfigurations), resourceGuid.Value, Optional.ToNullable(provisioningState), destinationNetworkInterfaceIPConfiguration.Value, destinationLoadBalancerFrontEndIPConfiguration.Value, Optional.ToNullable(destinationPort)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkUsage.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkUsage.Serialization.cs index ba585500c47fa..726c2b301c07a 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkUsage.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkUsage.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -16,10 +15,10 @@ public partial class VirtualNetworkUsage internal static VirtualNetworkUsage DeserializeVirtualNetworkUsage(JsonElement element) { Optional currentValue = default; + Optional id = default; Optional limit = default; Optional name = default; Optional unit = default; - ResourceIdentifier id = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("currentValue")) @@ -32,6 +31,11 @@ internal static VirtualNetworkUsage DeserializeVirtualNetworkUsage(JsonElement e currentValue = property.Value.GetDouble(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("limit")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -57,13 +61,8 @@ internal static VirtualNetworkUsage DeserializeVirtualNetworkUsage(JsonElement e unit = property.Value.GetString(); continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } } - return new VirtualNetworkUsage(id, Optional.ToNullable(currentValue), Optional.ToNullable(limit), name.Value, unit.Value); + return new VirtualNetworkUsage(Optional.ToNullable(currentValue), id.Value, Optional.ToNullable(limit), name.Value, unit.Value); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkUsage.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkUsage.cs index d737ae8cc8da5..ad6966ab83f4b 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkUsage.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualNetworkUsage.cs @@ -5,12 +5,10 @@ #nullable disable -using Azure.ResourceManager.Resources.Models; - namespace Azure.ResourceManager.Network.Models { /// Usage details for subnet. - public partial class VirtualNetworkUsage : Resources.Models.SubResource + public partial class VirtualNetworkUsage { /// Initializes a new instance of VirtualNetworkUsage. internal VirtualNetworkUsage() @@ -18,14 +16,15 @@ internal VirtualNetworkUsage() } /// Initializes a new instance of VirtualNetworkUsage. - /// The id. /// Indicates number of IPs used from the Subnet. + /// Subnet identifier. /// Indicates the size of the subnet. /// The name containing common and localized value for usage. /// Usage units. Returns 'Count'. - internal VirtualNetworkUsage(string id, double? currentValue, double? limit, VirtualNetworkUsageName name, string unit) : base(id) + internal VirtualNetworkUsage(double? currentValue, string id, double? limit, VirtualNetworkUsageName name, string unit) { CurrentValue = currentValue; + Id = id; Limit = limit; Name = name; Unit = unit; @@ -33,6 +32,8 @@ internal VirtualNetworkUsage(string id, double? currentValue, double? limit, Vir /// Indicates number of IPs used from the Subnet. public double? CurrentValue { get; } + /// Subnet identifier. + public string Id { get; } /// Indicates the size of the subnet. public double? Limit { get; } /// The name containing common and localized value for usage. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualRouterData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualRouterData.Serialization.cs index d02d53ab79246..d2c9d25e6fa6f 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualRouterData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualRouterData.Serialization.cs @@ -8,8 +8,8 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -18,6 +18,11 @@ public partial class VirtualRouterData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -34,8 +39,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(VirtualRouterAsn)) @@ -56,12 +59,12 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(HostedSubnet)) { writer.WritePropertyName("hostedSubnet"); - writer.WriteObjectValue(HostedSubnet); + JsonSerializer.Serialize(writer, HostedSubnet); } if (Optional.IsDefined(HostedGateway)) { writer.WritePropertyName("hostedGateway"); - writer.WriteObjectValue(HostedGateway); + JsonSerializer.Serialize(writer, HostedGateway); } writer.WriteEndObject(); writer.WriteEndObject(); @@ -70,16 +73,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static VirtualRouterData DeserializeVirtualRouterData(JsonElement element) { Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional virtualRouterAsn = default; Optional> virtualRouterIps = default; - Optional hostedSubnet = default; - Optional hostedGateway = default; - Optional> peerings = default; + Optional hostedSubnet = default; + Optional hostedGateway = default; + Optional> peerings = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) { @@ -88,6 +91,11 @@ internal static VirtualRouterData DeserializeVirtualRouterData(JsonElement eleme etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -118,11 +126,6 @@ internal static VirtualRouterData DeserializeVirtualRouterData(JsonElement eleme tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -164,7 +167,7 @@ internal static VirtualRouterData DeserializeVirtualRouterData(JsonElement eleme property0.ThrowNonNullablePropertyIsNull(); continue; } - hostedSubnet = SubResource.DeserializeSubResource(property0.Value); + hostedSubnet = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("hostedGateway")) @@ -174,7 +177,7 @@ internal static VirtualRouterData DeserializeVirtualRouterData(JsonElement eleme property0.ThrowNonNullablePropertyIsNull(); continue; } - hostedGateway = SubResource.DeserializeSubResource(property0.Value); + hostedGateway = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("peerings")) @@ -184,10 +187,10 @@ internal static VirtualRouterData DeserializeVirtualRouterData(JsonElement eleme property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } peerings = array; continue; @@ -206,7 +209,7 @@ internal static VirtualRouterData DeserializeVirtualRouterData(JsonElement eleme continue; } } - return new VirtualRouterData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, Optional.ToNullable(virtualRouterAsn), Optional.ToList(virtualRouterIps), hostedSubnet.Value, hostedGateway.Value, Optional.ToList(peerings), Optional.ToNullable(provisioningState)); + return new VirtualRouterData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, Optional.ToNullable(virtualRouterAsn), Optional.ToList(virtualRouterIps), hostedSubnet, hostedGateway, Optional.ToList(peerings), Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualRouterPeeringData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualRouterPeeringData.Serialization.cs index fada0a706b287..6fff46f36a434 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualRouterPeeringData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualRouterPeeringData.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -22,8 +21,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(PeerAsn)) @@ -45,7 +47,7 @@ internal static VirtualRouterPeeringData DeserializeVirtualRouterPeeringData(Jso Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional peerAsn = default; Optional peerIp = default; Optional provisioningState = default; @@ -109,7 +111,7 @@ internal static VirtualRouterPeeringData DeserializeVirtualRouterPeeringData(Jso continue; } } - return new VirtualRouterPeeringData(id, name.Value, etag.Value, type.Value, Optional.ToNullable(peerAsn), peerIp.Value, Optional.ToNullable(provisioningState)); + return new VirtualRouterPeeringData(id.Value, name.Value, etag.Value, type.Value, Optional.ToNullable(peerAsn), peerIp.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualWANData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualWANData.Serialization.cs index 419dec88e3bb0..f06e01c961348 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualWANData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VirtualWANData.Serialization.cs @@ -8,8 +8,8 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -18,6 +18,11 @@ public partial class VirtualWANData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -34,8 +39,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(DisableVpnEncryption)) @@ -65,14 +68,14 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static VirtualWANData DeserializeVirtualWANData(JsonElement element) { Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional disableVpnEncryption = default; - Optional> virtualHubs = default; - Optional> vpnSites = default; + Optional> virtualHubs = default; + Optional> vpnSites = default; Optional allowBranchToBranchTraffic = default; Optional allowVnetToVnetTraffic = default; Optional office365LocalBreakoutCategory = default; @@ -85,6 +88,11 @@ internal static VirtualWANData DeserializeVirtualWANData(JsonElement element) etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -115,11 +123,6 @@ internal static VirtualWANData DeserializeVirtualWANData(JsonElement element) tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -146,10 +149,10 @@ internal static VirtualWANData DeserializeVirtualWANData(JsonElement element) property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } virtualHubs = array; continue; @@ -161,10 +164,10 @@ internal static VirtualWANData DeserializeVirtualWANData(JsonElement element) property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } vpnSites = array; continue; @@ -218,7 +221,7 @@ internal static VirtualWANData DeserializeVirtualWANData(JsonElement element) continue; } } - return new VirtualWANData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, Optional.ToNullable(disableVpnEncryption), Optional.ToList(virtualHubs), Optional.ToList(vpnSites), Optional.ToNullable(allowBranchToBranchTraffic), Optional.ToNullable(allowVnetToVnetTraffic), Optional.ToNullable(office365LocalBreakoutCategory), Optional.ToNullable(provisioningState), type0.Value); + return new VirtualWANData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, Optional.ToNullable(disableVpnEncryption), Optional.ToList(virtualHubs), Optional.ToList(vpnSites), Optional.ToNullable(allowBranchToBranchTraffic), Optional.ToNullable(allowVnetToVnetTraffic), Optional.ToNullable(office365LocalBreakoutCategory), Optional.ToNullable(provisioningState), type0.Value); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnClientRevokedCertificate.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnClientRevokedCertificate.Serialization.cs index 6f11d0d6e87b5..bff64b260f958 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnClientRevokedCertificate.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnClientRevokedCertificate.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -21,8 +20,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(Thumbprint)) @@ -38,7 +40,7 @@ internal static VpnClientRevokedCertificate DeserializeVpnClientRevokedCertifica { Optional name = default; Optional etag = default; - ResourceIdentifier id = default; + Optional id = default; Optional thumbprint = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) @@ -86,7 +88,7 @@ internal static VpnClientRevokedCertificate DeserializeVpnClientRevokedCertifica continue; } } - return new VpnClientRevokedCertificate(id, name.Value, etag.Value, thumbprint.Value, Optional.ToNullable(provisioningState)); + return new VpnClientRevokedCertificate(id.Value, name.Value, etag.Value, thumbprint.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnClientRevokedCertificate.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnClientRevokedCertificate.cs index 829ff23e1154f..4482e4360d219 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnClientRevokedCertificate.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnClientRevokedCertificate.cs @@ -5,12 +5,10 @@ #nullable disable -using Azure.ResourceManager.Resources.Models; - namespace Azure.ResourceManager.Network.Models { /// VPN client revoked certificate of virtual network gateway. - public partial class VpnClientRevokedCertificate : WritableSubResource + public partial class VpnClientRevokedCertificate : SubResource { /// Initializes a new instance of VpnClientRevokedCertificate. public VpnClientRevokedCertificate() @@ -18,7 +16,7 @@ public VpnClientRevokedCertificate() } /// Initializes a new instance of VpnClientRevokedCertificate. - /// The id. + /// Resource ID. /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// The revoked VPN client certificate thumbprint. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnClientRootCertificate.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnClientRootCertificate.Serialization.cs index 603ee5293f4b3..65912559ff7b4 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnClientRootCertificate.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnClientRootCertificate.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -21,8 +20,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); writer.WritePropertyName("publicCertData"); @@ -35,7 +37,7 @@ internal static VpnClientRootCertificate DeserializeVpnClientRootCertificate(Jso { Optional name = default; Optional etag = default; - ResourceIdentifier id = default; + Optional id = default; string publicCertData = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) @@ -83,7 +85,7 @@ internal static VpnClientRootCertificate DeserializeVpnClientRootCertificate(Jso continue; } } - return new VpnClientRootCertificate(id, name.Value, etag.Value, publicCertData, Optional.ToNullable(provisioningState)); + return new VpnClientRootCertificate(id.Value, name.Value, etag.Value, publicCertData, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnClientRootCertificate.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnClientRootCertificate.cs index df6a16ff64611..073de71096cdd 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnClientRootCertificate.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnClientRootCertificate.cs @@ -6,12 +6,11 @@ #nullable disable using System; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { /// VPN client root certificate of virtual network gateway. - public partial class VpnClientRootCertificate : WritableSubResource + public partial class VpnClientRootCertificate : SubResource { /// Initializes a new instance of VpnClientRootCertificate. /// The certificate public data. @@ -27,7 +26,7 @@ public VpnClientRootCertificate(string publicCertData) } /// Initializes a new instance of VpnClientRootCertificate. - /// The id. + /// Resource ID. /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// The certificate public data. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnConnectionData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnConnectionData.Serialization.cs index 498a50b4c8b24..ea038ef5488c6 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnConnectionData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnConnectionData.Serialization.cs @@ -8,8 +8,8 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -23,14 +23,17 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(RemoteVpnSite)) { writer.WritePropertyName("remoteVpnSite"); - writer.WriteObjectValue(RemoteVpnSite); + JsonSerializer.Serialize(writer, RemoteVpnSite); } if (Optional.IsDefined(RoutingWeight)) { @@ -125,8 +128,8 @@ internal static VpnConnectionData DeserializeVpnConnectionData(JsonElement eleme { Optional name = default; Optional etag = default; - ResourceIdentifier id = default; - Optional remoteVpnSite = default; + Optional id = default; + Optional remoteVpnSite = default; Optional routingWeight = default; Optional dpdTimeoutSeconds = default; Optional connectionStatus = default; @@ -178,7 +181,7 @@ internal static VpnConnectionData DeserializeVpnConnectionData(JsonElement eleme property0.ThrowNonNullablePropertyIsNull(); continue; } - remoteVpnSite = SubResource.DeserializeSubResource(property0.Value); + remoteVpnSite = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("routingWeight")) @@ -375,7 +378,7 @@ internal static VpnConnectionData DeserializeVpnConnectionData(JsonElement eleme continue; } } - return new VpnConnectionData(id, name.Value, etag.Value, remoteVpnSite.Value, Optional.ToNullable(routingWeight), Optional.ToNullable(dpdTimeoutSeconds), Optional.ToNullable(connectionStatus), Optional.ToNullable(vpnConnectionProtocolType), Optional.ToNullable(ingressBytesTransferred), Optional.ToNullable(egressBytesTransferred), Optional.ToNullable(connectionBandwidth), sharedKey.Value, Optional.ToNullable(enableBgp), Optional.ToNullable(usePolicyBasedTrafficSelectors), Optional.ToList(ipsecPolicies), Optional.ToList(trafficSelectorPolicies), Optional.ToNullable(enableRateLimiting), Optional.ToNullable(enableInternetSecurity), Optional.ToNullable(useLocalAzureIpAddress), Optional.ToNullable(provisioningState), Optional.ToList(vpnLinkConnections), routingConfiguration.Value); + return new VpnConnectionData(id.Value, name.Value, etag.Value, remoteVpnSite, Optional.ToNullable(routingWeight), Optional.ToNullable(dpdTimeoutSeconds), Optional.ToNullable(connectionStatus), Optional.ToNullable(vpnConnectionProtocolType), Optional.ToNullable(ingressBytesTransferred), Optional.ToNullable(egressBytesTransferred), Optional.ToNullable(connectionBandwidth), sharedKey.Value, Optional.ToNullable(enableBgp), Optional.ToNullable(usePolicyBasedTrafficSelectors), Optional.ToList(ipsecPolicies), Optional.ToList(trafficSelectorPolicies), Optional.ToNullable(enableRateLimiting), Optional.ToNullable(enableInternetSecurity), Optional.ToNullable(useLocalAzureIpAddress), Optional.ToNullable(provisioningState), Optional.ToList(vpnLinkConnections), routingConfiguration.Value); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnGatewayData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnGatewayData.Serialization.cs index d28ec8c505ce9..d4be18d191aba 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnGatewayData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnGatewayData.Serialization.cs @@ -8,8 +8,8 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -18,6 +18,11 @@ public partial class VpnGatewayData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -34,14 +39,12 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(VirtualHub)) { writer.WritePropertyName("virtualHub"); - writer.WriteObjectValue(VirtualHub); + JsonSerializer.Serialize(writer, VirtualHub); } if (Optional.IsCollectionDefined(Connections)) { @@ -85,12 +88,12 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static VpnGatewayData DeserializeVpnGatewayData(JsonElement element) { Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; - Optional virtualHub = default; + Optional virtualHub = default; Optional> connections = default; Optional bgpSettings = default; Optional provisioningState = default; @@ -105,6 +108,11 @@ internal static VpnGatewayData DeserializeVpnGatewayData(JsonElement element) etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -135,11 +143,6 @@ internal static VpnGatewayData DeserializeVpnGatewayData(JsonElement element) tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -156,7 +159,7 @@ internal static VpnGatewayData DeserializeVpnGatewayData(JsonElement element) property0.ThrowNonNullablePropertyIsNull(); continue; } - virtualHub = SubResource.DeserializeSubResource(property0.Value); + virtualHub = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("connections")) @@ -248,7 +251,7 @@ internal static VpnGatewayData DeserializeVpnGatewayData(JsonElement element) continue; } } - return new VpnGatewayData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, virtualHub.Value, Optional.ToList(connections), bgpSettings.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(vpnGatewayScaleUnit), Optional.ToList(ipConfigurations), Optional.ToNullable(isRoutingPreferenceInternet), Optional.ToList(natRules)); + return new VpnGatewayData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, virtualHub, Optional.ToList(connections), bgpSettings.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(vpnGatewayScaleUnit), Optional.ToList(ipConfigurations), Optional.ToNullable(isRoutingPreferenceInternet), Optional.ToList(natRules)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnGatewayIpConfiguration.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnGatewayIpConfiguration.Serialization.cs index e6ebeefbbe072..82c3ccc8d0882 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnGatewayIpConfiguration.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnGatewayIpConfiguration.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -15,11 +14,16 @@ public partial class VpnGatewayIpConfiguration { internal static VpnGatewayIpConfiguration DeserializeVpnGatewayIpConfiguration(JsonElement element) { + Optional id = default; Optional publicIpAddress = default; Optional privateIpAddress = default; - ResourceIdentifier id = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("publicIpAddress")) { publicIpAddress = property.Value.GetString(); @@ -30,13 +34,8 @@ internal static VpnGatewayIpConfiguration DeserializeVpnGatewayIpConfiguration(J privateIpAddress = property.Value.GetString(); continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } } - return new VpnGatewayIpConfiguration(id, publicIpAddress.Value, privateIpAddress.Value); + return new VpnGatewayIpConfiguration(id.Value, publicIpAddress.Value, privateIpAddress.Value); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnGatewayIpConfiguration.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnGatewayIpConfiguration.cs index 35f782882418c..a0c034192e147 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnGatewayIpConfiguration.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnGatewayIpConfiguration.cs @@ -5,12 +5,10 @@ #nullable disable -using Azure.ResourceManager.Resources.Models; - namespace Azure.ResourceManager.Network.Models { /// IP Configuration of a VPN Gateway Resource. - public partial class VpnGatewayIpConfiguration : Resources.Models.SubResource + public partial class VpnGatewayIpConfiguration { /// Initializes a new instance of VpnGatewayIpConfiguration. internal VpnGatewayIpConfiguration() @@ -18,15 +16,18 @@ internal VpnGatewayIpConfiguration() } /// Initializes a new instance of VpnGatewayIpConfiguration. - /// The id. + /// The identifier of the IP configuration for a VPN Gateway. /// The public IP address of this IP configuration. /// The private IP address of this IP configuration. - internal VpnGatewayIpConfiguration(string id, string publicIpAddress, string privateIpAddress) : base(id) + internal VpnGatewayIpConfiguration(string id, string publicIpAddress, string privateIpAddress) { + Id = id; PublicIpAddress = publicIpAddress; PrivateIpAddress = privateIpAddress; } + /// The identifier of the IP configuration for a VPN Gateway. + public string Id { get; } /// The public IP address of this IP configuration. public string PublicIpAddress { get; } /// The private IP address of this IP configuration. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnGatewayNatRuleData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnGatewayNatRuleData.Serialization.cs index d868432773327..13bd9b02053d9 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnGatewayNatRuleData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnGatewayNatRuleData.Serialization.cs @@ -8,8 +8,8 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -23,8 +23,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(TypePropertiesType)) @@ -71,15 +74,15 @@ internal static VpnGatewayNatRuleData DeserializeVpnGatewayNatRuleData(JsonEleme Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional provisioningState = default; Optional type0 = default; Optional mode = default; Optional> internalMappings = default; Optional> externalMappings = default; Optional ipConfigurationId = default; - Optional> egressVpnSiteLinkConnections = default; - Optional> ingressVpnSiteLinkConnections = default; + Optional> egressVpnSiteLinkConnections = default; + Optional> ingressVpnSiteLinkConnections = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) @@ -183,10 +186,10 @@ internal static VpnGatewayNatRuleData DeserializeVpnGatewayNatRuleData(JsonEleme property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } egressVpnSiteLinkConnections = array; continue; @@ -198,10 +201,10 @@ internal static VpnGatewayNatRuleData DeserializeVpnGatewayNatRuleData(JsonEleme property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } ingressVpnSiteLinkConnections = array; continue; @@ -210,7 +213,7 @@ internal static VpnGatewayNatRuleData DeserializeVpnGatewayNatRuleData(JsonEleme continue; } } - return new VpnGatewayNatRuleData(id, name.Value, etag.Value, type.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(type0), Optional.ToNullable(mode), Optional.ToList(internalMappings), Optional.ToList(externalMappings), ipConfigurationId.Value, Optional.ToList(egressVpnSiteLinkConnections), Optional.ToList(ingressVpnSiteLinkConnections)); + return new VpnGatewayNatRuleData(id.Value, name.Value, etag.Value, type.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(type0), Optional.ToNullable(mode), Optional.ToList(internalMappings), Optional.ToList(externalMappings), ipConfigurationId.Value, Optional.ToList(egressVpnSiteLinkConnections), Optional.ToList(ingressVpnSiteLinkConnections)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnServerConfigurationData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnServerConfigurationData.Serialization.cs index 3aa9dd6b7c025..1944ccd528488 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnServerConfigurationData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnServerConfigurationData.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; namespace Azure.ResourceManager.Network @@ -18,6 +17,11 @@ public partial class VpnServerConfigurationData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -34,8 +38,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(NamePropertiesName)) @@ -145,11 +147,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static VpnServerConfigurationData DeserializeVpnServerConfigurationData(JsonElement element) { Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional name0 = default; Optional> vpnProtocols = default; Optional> vpnAuthenticationTypes = default; @@ -172,6 +174,11 @@ internal static VpnServerConfigurationData DeserializeVpnServerConfigurationData etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -202,11 +209,6 @@ internal static VpnServerConfigurationData DeserializeVpnServerConfigurationData tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -390,7 +392,7 @@ internal static VpnServerConfigurationData DeserializeVpnServerConfigurationData continue; } } - return new VpnServerConfigurationData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, name0.Value, Optional.ToList(vpnProtocols), Optional.ToList(vpnAuthenticationTypes), Optional.ToList(vpnClientRootCertificates), Optional.ToList(vpnClientRevokedCertificates), Optional.ToList(radiusServerRootCertificates), Optional.ToList(radiusClientRootCertificates), Optional.ToList(vpnClientIpsecPolicies), radiusServerAddress.Value, radiusServerSecret.Value, Optional.ToList(radiusServers), aadAuthenticationParameters.Value, provisioningState.Value, Optional.ToList(p2SVpnGateways), etag0.Value); + return new VpnServerConfigurationData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, name0.Value, Optional.ToList(vpnProtocols), Optional.ToList(vpnAuthenticationTypes), Optional.ToList(vpnClientRootCertificates), Optional.ToList(vpnClientRevokedCertificates), Optional.ToList(radiusServerRootCertificates), Optional.ToList(radiusClientRootCertificates), Optional.ToList(vpnClientIpsecPolicies), radiusServerAddress.Value, radiusServerSecret.Value, Optional.ToList(radiusServers), aadAuthenticationParameters.Value, provisioningState.Value, Optional.ToList(p2SVpnGateways), etag0.Value); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnSiteData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnSiteData.Serialization.cs index b64cb3b67c3da..84a9774cfdb32 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnSiteData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnSiteData.Serialization.cs @@ -8,8 +8,8 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -18,6 +18,11 @@ public partial class VpnSiteData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -34,14 +39,12 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(VirtualWan)) { writer.WritePropertyName("virtualWan"); - writer.WriteObjectValue(VirtualWan); + JsonSerializer.Serialize(writer, VirtualWan); } if (Optional.IsDefined(DeviceProperties)) { @@ -95,12 +98,12 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static VpnSiteData DeserializeVpnSiteData(JsonElement element) { Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; - Optional virtualWan = default; + Optional virtualWan = default; Optional deviceProperties = default; Optional ipAddress = default; Optional siteKey = default; @@ -117,6 +120,11 @@ internal static VpnSiteData DeserializeVpnSiteData(JsonElement element) etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -147,11 +155,6 @@ internal static VpnSiteData DeserializeVpnSiteData(JsonElement element) tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -168,7 +171,7 @@ internal static VpnSiteData DeserializeVpnSiteData(JsonElement element) property0.ThrowNonNullablePropertyIsNull(); continue; } - virtualWan = SubResource.DeserializeSubResource(property0.Value); + virtualWan = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("deviceProperties")) @@ -260,7 +263,7 @@ internal static VpnSiteData DeserializeVpnSiteData(JsonElement element) continue; } } - return new VpnSiteData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, virtualWan.Value, deviceProperties.Value, ipAddress.Value, siteKey.Value, addressSpace.Value, bgpProperties.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(isSecuritySite), Optional.ToList(vpnSiteLinks), o365Policy.Value); + return new VpnSiteData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, virtualWan, deviceProperties.Value, ipAddress.Value, siteKey.Value, addressSpace.Value, bgpProperties.Value, Optional.ToNullable(provisioningState), Optional.ToNullable(isSecuritySite), Optional.ToList(vpnSiteLinks), o365Policy.Value); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnSiteLink.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnSiteLink.Serialization.cs index 2838db09a8748..9978f6d00a49a 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnSiteLink.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnSiteLink.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Network.Models { @@ -21,8 +20,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(LinkProperties)) @@ -54,7 +56,7 @@ internal static VpnSiteLink DeserializeVpnSiteLink(JsonElement element) Optional etag = default; Optional name = default; Optional type = default; - ResourceIdentifier id = default; + Optional id = default; Optional linkProperties = default; Optional ipAddress = default; Optional fqdn = default; @@ -135,7 +137,7 @@ internal static VpnSiteLink DeserializeVpnSiteLink(JsonElement element) continue; } } - return new VpnSiteLink(id, etag.Value, name.Value, type.Value, linkProperties.Value, ipAddress.Value, fqdn.Value, bgpProperties.Value, Optional.ToNullable(provisioningState)); + return new VpnSiteLink(id.Value, etag.Value, name.Value, type.Value, linkProperties.Value, ipAddress.Value, fqdn.Value, bgpProperties.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnSiteLink.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnSiteLink.cs index b6b9333a4590e..ed78f9f5039d1 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnSiteLink.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnSiteLink.cs @@ -5,12 +5,10 @@ #nullable disable -using Azure.ResourceManager.Resources.Models; - namespace Azure.ResourceManager.Network.Models { /// VpnSiteLink Resource. - public partial class VpnSiteLink : WritableSubResource + public partial class VpnSiteLink : SubResource { /// Initializes a new instance of VpnSiteLink. public VpnSiteLink() @@ -18,7 +16,7 @@ public VpnSiteLink() } /// Initializes a new instance of VpnSiteLink. - /// The id. + /// Resource ID. /// A unique read-only string that changes whenever the resource is updated. /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// Resource type. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnSiteLinkConnection.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnSiteLinkConnection.Serialization.cs index 02233cb9cb827..84d0ef99ccdb0 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnSiteLinkConnection.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnSiteLinkConnection.Serialization.cs @@ -8,7 +8,7 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network.Models { @@ -22,14 +22,17 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("name"); writer.WriteStringValue(Name); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(VpnSiteLink)) { writer.WritePropertyName("vpnSiteLink"); - writer.WriteObjectValue(VpnSiteLink); + JsonSerializer.Serialize(writer, VpnSiteLink); } if (Optional.IsDefined(RoutingWeight)) { @@ -92,7 +95,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in IngressNatRules) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } @@ -102,7 +105,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WriteStartArray(); foreach (var item in EgressNatRules) { - writer.WriteObjectValue(item); + JsonSerializer.Serialize(writer, item); } writer.WriteEndArray(); } @@ -115,8 +118,8 @@ internal static VpnSiteLinkConnection DeserializeVpnSiteLinkConnection(JsonEleme Optional name = default; Optional etag = default; Optional type = default; - ResourceIdentifier id = default; - Optional vpnSiteLink = default; + Optional id = default; + Optional vpnSiteLink = default; Optional routingWeight = default; Optional vpnLinkConnectionMode = default; Optional connectionStatus = default; @@ -131,8 +134,8 @@ internal static VpnSiteLinkConnection DeserializeVpnSiteLinkConnection(JsonEleme Optional enableRateLimiting = default; Optional useLocalAzureIpAddress = default; Optional provisioningState = default; - Optional> ingressNatRules = default; - Optional> egressNatRules = default; + Optional> ingressNatRules = default; + Optional> egressNatRules = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("name")) @@ -171,7 +174,7 @@ internal static VpnSiteLinkConnection DeserializeVpnSiteLinkConnection(JsonEleme property0.ThrowNonNullablePropertyIsNull(); continue; } - vpnSiteLink = SubResource.DeserializeSubResource(property0.Value); + vpnSiteLink = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("routingWeight")) @@ -321,10 +324,10 @@ internal static VpnSiteLinkConnection DeserializeVpnSiteLinkConnection(JsonEleme property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } ingressNatRules = array; continue; @@ -336,10 +339,10 @@ internal static VpnSiteLinkConnection DeserializeVpnSiteLinkConnection(JsonEleme property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } egressNatRules = array; continue; @@ -348,7 +351,7 @@ internal static VpnSiteLinkConnection DeserializeVpnSiteLinkConnection(JsonEleme continue; } } - return new VpnSiteLinkConnection(id, name.Value, etag.Value, type.Value, vpnSiteLink.Value, Optional.ToNullable(routingWeight), Optional.ToNullable(vpnLinkConnectionMode), Optional.ToNullable(connectionStatus), Optional.ToNullable(vpnConnectionProtocolType), Optional.ToNullable(ingressBytesTransferred), Optional.ToNullable(egressBytesTransferred), Optional.ToNullable(connectionBandwidth), sharedKey.Value, Optional.ToNullable(enableBgp), Optional.ToNullable(usePolicyBasedTrafficSelectors), Optional.ToList(ipsecPolicies), Optional.ToNullable(enableRateLimiting), Optional.ToNullable(useLocalAzureIpAddress), Optional.ToNullable(provisioningState), Optional.ToList(ingressNatRules), Optional.ToList(egressNatRules)); + return new VpnSiteLinkConnection(id.Value, name.Value, etag.Value, type.Value, vpnSiteLink, Optional.ToNullable(routingWeight), Optional.ToNullable(vpnLinkConnectionMode), Optional.ToNullable(connectionStatus), Optional.ToNullable(vpnConnectionProtocolType), Optional.ToNullable(ingressBytesTransferred), Optional.ToNullable(egressBytesTransferred), Optional.ToNullable(connectionBandwidth), sharedKey.Value, Optional.ToNullable(enableBgp), Optional.ToNullable(usePolicyBasedTrafficSelectors), Optional.ToList(ipsecPolicies), Optional.ToNullable(enableRateLimiting), Optional.ToNullable(useLocalAzureIpAddress), Optional.ToNullable(provisioningState), Optional.ToList(ingressNatRules), Optional.ToList(egressNatRules)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnSiteLinkConnection.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnSiteLinkConnection.cs index 636bc640feb24..2697c535428a0 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnSiteLinkConnection.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/VpnSiteLinkConnection.cs @@ -12,18 +12,18 @@ namespace Azure.ResourceManager.Network.Models { /// VpnSiteLinkConnection Resource. - public partial class VpnSiteLinkConnection : WritableSubResource + public partial class VpnSiteLinkConnection : SubResource { /// Initializes a new instance of VpnSiteLinkConnection. public VpnSiteLinkConnection() { IpsecPolicies = new ChangeTrackingList(); - IngressNatRules = new ChangeTrackingList(); - EgressNatRules = new ChangeTrackingList(); + IngressNatRules = new ChangeTrackingList(); + EgressNatRules = new ChangeTrackingList(); } /// Initializes a new instance of VpnSiteLinkConnection. - /// The id. + /// Resource ID. /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// Resource type. @@ -44,7 +44,7 @@ public VpnSiteLinkConnection() /// The provisioning state of the VPN site link connection resource. /// List of ingress NatRules. /// List of egress NatRules. - internal VpnSiteLinkConnection(string id, string name, string etag, string type, SubResource vpnSiteLink, int? routingWeight, VpnLinkConnectionMode? vpnLinkConnectionMode, VpnConnectionStatus? connectionStatus, VirtualNetworkGatewayConnectionProtocol? vpnConnectionProtocolType, long? ingressBytesTransferred, long? egressBytesTransferred, int? connectionBandwidth, string sharedKey, bool? enableBgp, bool? usePolicyBasedTrafficSelectors, IList ipsecPolicies, bool? enableRateLimiting, bool? useLocalAzureIpAddress, ProvisioningState? provisioningState, IList ingressNatRules, IList egressNatRules) : base(id) + internal VpnSiteLinkConnection(string id, string name, string etag, string type, WritableSubResource vpnSiteLink, int? routingWeight, VpnLinkConnectionMode? vpnLinkConnectionMode, VpnConnectionStatus? connectionStatus, VirtualNetworkGatewayConnectionProtocol? vpnConnectionProtocolType, long? ingressBytesTransferred, long? egressBytesTransferred, int? connectionBandwidth, string sharedKey, bool? enableBgp, bool? usePolicyBasedTrafficSelectors, IList ipsecPolicies, bool? enableRateLimiting, bool? useLocalAzureIpAddress, ProvisioningState? provisioningState, IList ingressNatRules, IList egressNatRules) : base(id) { Name = name; Etag = etag; @@ -75,7 +75,7 @@ internal VpnSiteLinkConnection(string id, string name, string etag, string type, /// Resource type. public string Type { get; } /// Id of the connected vpn site link. - public SubResource VpnSiteLink { get; set; } + public WritableSubResource VpnSiteLink { get; set; } /// Routing weight for vpn connection. public int? RoutingWeight { get; set; } /// Vpn link connection mode. @@ -105,8 +105,8 @@ internal VpnSiteLinkConnection(string id, string name, string etag, string type, /// The provisioning state of the VPN site link connection resource. public ProvisioningState? ProvisioningState { get; } /// List of ingress NatRules. - public IList IngressNatRules { get; } + public IList IngressNatRules { get; } /// List of egress NatRules. - public IList EgressNatRules { get; } + public IList EgressNatRules { get; } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/WebApplicationFirewallPolicyData.Serialization.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/WebApplicationFirewallPolicyData.Serialization.cs index 4c1943ba6761a..f81aa5d154275 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/WebApplicationFirewallPolicyData.Serialization.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/Models/WebApplicationFirewallPolicyData.Serialization.cs @@ -8,8 +8,8 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -18,6 +18,11 @@ public partial class WebApplicationFirewallPolicyData : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(Location)) { writer.WritePropertyName("location"); @@ -34,8 +39,6 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) } writer.WriteEndObject(); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WritePropertyName("properties"); writer.WriteStartObject(); if (Optional.IsDefined(PolicySettings)) @@ -65,19 +68,19 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) internal static WebApplicationFirewallPolicyData DeserializeWebApplicationFirewallPolicyData(JsonElement element) { Optional etag = default; + Optional id = default; Optional name = default; Optional type = default; Optional location = default; Optional> tags = default; - ResourceIdentifier id = default; Optional policySettings = default; Optional> customRules = default; Optional> applicationGateways = default; Optional provisioningState = default; Optional resourceState = default; Optional managedRules = default; - Optional> httpListeners = default; - Optional> pathBasedRules = default; + Optional> httpListeners = default; + Optional> pathBasedRules = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("etag")) @@ -85,6 +88,11 @@ internal static WebApplicationFirewallPolicyData DeserializeWebApplicationFirewa etag = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("name")) { name = property.Value.GetString(); @@ -115,11 +123,6 @@ internal static WebApplicationFirewallPolicyData DeserializeWebApplicationFirewa tags = dictionary; continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } if (property.NameEquals("properties")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -206,10 +209,10 @@ internal static WebApplicationFirewallPolicyData DeserializeWebApplicationFirewa property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } httpListeners = array; continue; @@ -221,10 +224,10 @@ internal static WebApplicationFirewallPolicyData DeserializeWebApplicationFirewa property0.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property0.Value.EnumerateArray()) { - array.Add(SubResource.DeserializeSubResource(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } pathBasedRules = array; continue; @@ -233,7 +236,7 @@ internal static WebApplicationFirewallPolicyData DeserializeWebApplicationFirewa continue; } } - return new WebApplicationFirewallPolicyData(id, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, policySettings.Value, Optional.ToList(customRules), Optional.ToList(applicationGateways), Optional.ToNullable(provisioningState), Optional.ToNullable(resourceState), managedRules.Value, Optional.ToList(httpListeners), Optional.ToList(pathBasedRules)); + return new WebApplicationFirewallPolicyData(id.Value, name.Value, type.Value, location.Value, Optional.ToDictionary(tags), etag.Value, policySettings.Value, Optional.ToList(customRules), Optional.ToList(applicationGateways), Optional.ToNullable(provisioningState), Optional.ToNullable(resourceState), managedRules.Value, Optional.ToList(httpListeners), Optional.ToList(pathBasedRules)); } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NatGatewayData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NatGatewayData.cs index c9d99aebdea8f..a2cf5e9077601 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NatGatewayData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NatGatewayData.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -18,13 +19,13 @@ public partial class NatGatewayData : Resource public NatGatewayData() { Zones = new ChangeTrackingList(); - PublicIpAddresses = new ChangeTrackingList(); - PublicIpPrefixes = new ChangeTrackingList(); - Subnets = new ChangeTrackingList(); + PublicIpAddresses = new ChangeTrackingList(); + PublicIpPrefixes = new ChangeTrackingList(); + Subnets = new ChangeTrackingList(); } /// Initializes a new instance of NatGatewayData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. @@ -38,7 +39,7 @@ public NatGatewayData() /// An array of references to the subnets using this nat gateway resource. /// The resource GUID property of the NAT gateway resource. /// The provisioning state of the NAT gateway resource. - internal NatGatewayData(string id, string name, string type, string location, IDictionary tags, NatGatewaySku sku, IList zones, string etag, int? idleTimeoutInMinutes, IList publicIpAddresses, IList publicIpPrefixes, IReadOnlyList subnets, string resourceGuid, ProvisioningState? provisioningState) : base(id, name, type, location, tags) + internal NatGatewayData(string id, string name, string type, string location, IDictionary tags, NatGatewaySku sku, IList zones, string etag, int? idleTimeoutInMinutes, IList publicIpAddresses, IList publicIpPrefixes, IReadOnlyList subnets, string resourceGuid, ProvisioningState? provisioningState) : base(id, name, type, location, tags) { Sku = sku; Zones = zones; @@ -60,11 +61,11 @@ internal NatGatewayData(string id, string name, string type, string location, ID /// The idle timeout of the nat gateway. public int? IdleTimeoutInMinutes { get; set; } /// An array of public ip addresses associated with the nat gateway resource. - public IList PublicIpAddresses { get; } + public IList PublicIpAddresses { get; } /// An array of public ip prefixes associated with the nat gateway resource. - public IList PublicIpPrefixes { get; } + public IList PublicIpPrefixes { get; } /// An array of references to the subnets using this nat gateway resource. - public IReadOnlyList Subnets { get; } + public IReadOnlyList Subnets { get; } /// The resource GUID property of the NAT gateway resource. public string ResourceGuid { get; } /// The provisioning state of the NAT gateway resource. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceData.cs index db4688c0ecf76..f73cf4e826864 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceData.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -23,7 +24,7 @@ public NetworkInterfaceData() } /// Initializes a new instance of NetworkInterfaceData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. @@ -48,7 +49,7 @@ public NetworkInterfaceData() /// Type of Network Interface resource. /// Privatelinkservice of the network interface resource. /// Migration phase of Network Interface resource. - internal NetworkInterfaceData(string id, string name, string type, string location, IDictionary tags, ExtendedLocation extendedLocation, string etag, SubResource virtualMachine, NetworkSecurityGroupData networkSecurityGroup, PrivateEndpointData privateEndpoint, IList ipConfigurations, IReadOnlyList tapConfigurations, NetworkInterfaceDnsSettings dnsSettings, string macAddress, bool? primary, bool? enableAcceleratedNetworking, bool? enableIPForwarding, IReadOnlyList hostedWorkloads, SubResource dscpConfiguration, string resourceGuid, ProvisioningState? provisioningState, string workloadType, NetworkInterfaceNicType? nicType, PrivateLinkServiceData privateLinkService, NetworkInterfaceMigrationPhase? migrationPhase) : base(id, name, type, location, tags) + internal NetworkInterfaceData(string id, string name, string type, string location, IDictionary tags, ExtendedLocation extendedLocation, string etag, WritableSubResource virtualMachine, NetworkSecurityGroupData networkSecurityGroup, PrivateEndpointData privateEndpoint, IList ipConfigurations, IReadOnlyList tapConfigurations, NetworkInterfaceDnsSettings dnsSettings, string macAddress, bool? primary, bool? enableAcceleratedNetworking, bool? enableIPForwarding, IReadOnlyList hostedWorkloads, WritableSubResource dscpConfiguration, string resourceGuid, ProvisioningState? provisioningState, string workloadType, NetworkInterfaceNicType? nicType, PrivateLinkServiceData privateLinkService, NetworkInterfaceMigrationPhase? migrationPhase) : base(id, name, type, location, tags) { ExtendedLocation = extendedLocation; Etag = etag; @@ -77,7 +78,7 @@ internal NetworkInterfaceData(string id, string name, string type, string locati /// A unique read-only string that changes whenever the resource is updated. public string Etag { get; } /// The reference to a virtual machine. - public SubResource VirtualMachine { get; } + public WritableSubResource VirtualMachine { get; } /// The reference to the NetworkSecurityGroup resource. public NetworkSecurityGroupData NetworkSecurityGroup { get; set; } /// A reference to the private endpoint to which the network interface is linked. @@ -99,7 +100,7 @@ internal NetworkInterfaceData(string id, string name, string type, string locati /// A list of references to linked BareMetal resources. public IReadOnlyList HostedWorkloads { get; } /// A reference to the dscp configuration to which the network interface is linked. - public SubResource DscpConfiguration { get; } + public WritableSubResource DscpConfiguration { get; } /// The resource GUID property of the network interface resource. public string ResourceGuid { get; } /// The provisioning state of the network interface resource. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceTapConfigurationData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceTapConfigurationData.cs index d72ffb21d5cc4..3e8e45b93b72c 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceTapConfigurationData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkInterfaceTapConfigurationData.cs @@ -6,12 +6,11 @@ #nullable disable using Azure.ResourceManager.Network.Models; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { /// A class representing the NetworkInterfaceTapConfiguration data model. - public partial class NetworkInterfaceTapConfigurationData : WritableSubResource + public partial class NetworkInterfaceTapConfigurationData : SubResource { /// Initializes a new instance of NetworkInterfaceTapConfigurationData. public NetworkInterfaceTapConfigurationData() @@ -19,7 +18,7 @@ public NetworkInterfaceTapConfigurationData() } /// Initializes a new instance of NetworkInterfaceTapConfigurationData. - /// The id. + /// Resource ID. /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// Sub Resource type. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkProfileData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkProfileData.cs index 7fa2324da043d..d44a12a488376 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkProfileData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkProfileData.cs @@ -22,7 +22,7 @@ public NetworkProfileData() } /// Initializes a new instance of NetworkProfileData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkSecurityGroupData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkSecurityGroupData.cs index 6447e02af7830..a8e9696eb3bfb 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkSecurityGroupData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkSecurityGroupData.cs @@ -25,7 +25,7 @@ public NetworkSecurityGroupData() } /// Initializes a new instance of NetworkSecurityGroupData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkVirtualApplianceData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkVirtualApplianceData.cs index 2007f84b63488..1709e93983e3a 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkVirtualApplianceData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkVirtualApplianceData.cs @@ -21,12 +21,12 @@ public NetworkVirtualApplianceData() BootStrapConfigurationBlobs = new ChangeTrackingList(); CloudInitConfigurationBlobs = new ChangeTrackingList(); VirtualApplianceNics = new ChangeTrackingList(); - VirtualApplianceSites = new ChangeTrackingList(); - InboundSecurityRules = new ChangeTrackingList(); + VirtualApplianceSites = new ChangeTrackingList(); + InboundSecurityRules = new ChangeTrackingList(); } /// Initializes a new instance of NetworkVirtualApplianceData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. @@ -44,7 +44,7 @@ public NetworkVirtualApplianceData() /// List of references to VirtualApplianceSite. /// List of references to InboundSecurityRules. /// The provisioning state of the resource. - internal NetworkVirtualApplianceData(string id, string name, string type, string location, IDictionary tags, ResourceIdentity identity, string etag, VirtualApplianceSkuProperties nvaSku, string addressPrefix, IList bootStrapConfigurationBlobs, Models.SubResource virtualHub, IList cloudInitConfigurationBlobs, string cloudInitConfiguration, long? virtualApplianceAsn, IReadOnlyList virtualApplianceNics, IReadOnlyList virtualApplianceSites, IReadOnlyList inboundSecurityRules, ProvisioningState? provisioningState) : base(id, name, type, location, tags) + internal NetworkVirtualApplianceData(string id, string name, string type, string location, IDictionary tags, ResourceIdentity identity, string etag, VirtualApplianceSkuProperties nvaSku, string addressPrefix, IList bootStrapConfigurationBlobs, WritableSubResource virtualHub, IList cloudInitConfigurationBlobs, string cloudInitConfiguration, long? virtualApplianceAsn, IReadOnlyList virtualApplianceNics, IReadOnlyList virtualApplianceSites, IReadOnlyList inboundSecurityRules, ProvisioningState? provisioningState) : base(id, name, type, location, tags) { Identity = identity; Etag = etag; @@ -72,7 +72,7 @@ internal NetworkVirtualApplianceData(string id, string name, string type, string /// BootStrapConfigurationBlobs storage URLs. public IList BootStrapConfigurationBlobs { get; } /// The Virtual Hub where Network Virtual Appliance is being deployed. - public Models.SubResource VirtualHub { get; set; } + public WritableSubResource VirtualHub { get; set; } /// CloudInitConfigurationBlob storage URLs. public IList CloudInitConfigurationBlobs { get; } /// CloudInitConfiguration string in plain text. @@ -82,9 +82,9 @@ internal NetworkVirtualApplianceData(string id, string name, string type, string /// List of Virtual Appliance Network Interfaces. public IReadOnlyList VirtualApplianceNics { get; } /// List of references to VirtualApplianceSite. - public IReadOnlyList VirtualApplianceSites { get; } + public IReadOnlyList VirtualApplianceSites { get; } /// List of references to InboundSecurityRules. - public IReadOnlyList InboundSecurityRules { get; } + public IReadOnlyList InboundSecurityRules { get; } /// The provisioning state of the resource. public ProvisioningState? ProvisioningState { get; } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkWatcherData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkWatcherData.cs index 8bd5010851c21..678518caa8adb 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkWatcherData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/NetworkWatcherData.cs @@ -19,7 +19,7 @@ public NetworkWatcherData() } /// Initializes a new instance of NetworkWatcherData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/P2SVpnGatewayData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/P2SVpnGatewayData.cs index 6ba316ad54863..358e6478fff20 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/P2SVpnGatewayData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/P2SVpnGatewayData.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -22,7 +23,7 @@ public P2SVpnGatewayData() } /// Initializes a new instance of P2SVpnGatewayData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. @@ -36,7 +37,7 @@ public P2SVpnGatewayData() /// All P2S VPN clients' connection health status. /// List of all customer specified DNS servers IP addresses. /// Enable Routing Preference property for the Public IP Interface of the P2SVpnGateway. - internal P2SVpnGatewayData(string id, string name, string type, string location, IDictionary tags, string etag, SubResource virtualHub, IList p2SConnectionConfigurations, ProvisioningState? provisioningState, int? vpnGatewayScaleUnit, SubResource vpnServerConfiguration, VpnClientConnectionHealth vpnClientConnectionHealth, IList customDnsServers, bool? isRoutingPreferenceInternet) : base(id, name, type, location, tags) + internal P2SVpnGatewayData(string id, string name, string type, string location, IDictionary tags, string etag, WritableSubResource virtualHub, IList p2SConnectionConfigurations, ProvisioningState? provisioningState, int? vpnGatewayScaleUnit, WritableSubResource vpnServerConfiguration, VpnClientConnectionHealth vpnClientConnectionHealth, IList customDnsServers, bool? isRoutingPreferenceInternet) : base(id, name, type, location, tags) { Etag = etag; VirtualHub = virtualHub; @@ -52,7 +53,7 @@ internal P2SVpnGatewayData(string id, string name, string type, string location, /// A unique read-only string that changes whenever the resource is updated. public string Etag { get; } /// The VirtualHub to which the gateway belongs. - public SubResource VirtualHub { get; set; } + public WritableSubResource VirtualHub { get; set; } /// List of all p2s connection configurations of the gateway. public IList P2SConnectionConfigurations { get; } /// The provisioning state of the P2S VPN gateway resource. @@ -60,7 +61,7 @@ internal P2SVpnGatewayData(string id, string name, string type, string location, /// The scale unit for this p2s vpn gateway. public int? VpnGatewayScaleUnit { get; set; } /// The VpnServerConfiguration to which the p2sVpnGateway is attached to. - public SubResource VpnServerConfiguration { get; set; } + public WritableSubResource VpnServerConfiguration { get; set; } /// All P2S VPN clients' connection health status. public VpnClientConnectionHealth VpnClientConnectionHealth { get; } /// List of all customer specified DNS servers IP addresses. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/PacketCaptureData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/PacketCaptureData.cs index bc7493d7e4061..85693c07c56bf 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/PacketCaptureData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/PacketCaptureData.cs @@ -8,12 +8,11 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network.Models; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { /// A class representing the PacketCapture data model. - public partial class PacketCaptureData : Resources.Models.SubResource + public partial class PacketCaptureData { /// Initializes a new instance of PacketCaptureData. internal PacketCaptureData() @@ -22,8 +21,8 @@ internal PacketCaptureData() } /// Initializes a new instance of PacketCaptureData. - /// The id. /// Name of the packet capture session. + /// ID of the packet capture operation. /// A unique read-only string that changes whenever the resource is updated. /// The ID of the targeted resource, only VM is currently supported. /// Number of bytes captured per packet, the remaining bytes are truncated. @@ -32,9 +31,10 @@ internal PacketCaptureData() /// The storage location for a packet capture session. /// A list of packet capture filters. /// The provisioning state of the packet capture session. - internal PacketCaptureData(string id, string name, string etag, string target, long? bytesToCapturePerPacket, long? totalBytesPerSession, int? timeLimitInSeconds, PacketCaptureStorageLocation storageLocation, IReadOnlyList filters, ProvisioningState? provisioningState) : base(id) + internal PacketCaptureData(string name, string id, string etag, string target, long? bytesToCapturePerPacket, long? totalBytesPerSession, int? timeLimitInSeconds, PacketCaptureStorageLocation storageLocation, IReadOnlyList filters, ProvisioningState? provisioningState) { Name = name; + Id = id; Etag = etag; Target = target; BytesToCapturePerPacket = bytesToCapturePerPacket; @@ -47,6 +47,8 @@ internal PacketCaptureData(string id, string name, string etag, string target, l /// Name of the packet capture session. public string Name { get; } + /// ID of the packet capture operation. + public string Id { get; } /// A unique read-only string that changes whenever the resource is updated. public string Etag { get; } /// The ID of the targeted resource, only VM is currently supported. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateDnsZoneGroupData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateDnsZoneGroupData.cs index dba3ad5bd8ed4..dc9edcfb6a55d 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateDnsZoneGroupData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateDnsZoneGroupData.cs @@ -8,12 +8,11 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network.Models; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { /// A class representing the PrivateDnsZoneGroup data model. - public partial class PrivateDnsZoneGroupData : WritableSubResource + public partial class PrivateDnsZoneGroupData : SubResource { /// Initializes a new instance of PrivateDnsZoneGroupData. public PrivateDnsZoneGroupData() @@ -22,7 +21,7 @@ public PrivateDnsZoneGroupData() } /// Initializes a new instance of PrivateDnsZoneGroupData. - /// The id. + /// Resource ID. /// Name of the resource that is unique within a resource group. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// The provisioning state of the private dns zone group resource. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateEndpointData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateEndpointData.cs index 8323936a90964..2f187e6b1eb3e 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateEndpointData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateEndpointData.cs @@ -24,7 +24,7 @@ public PrivateEndpointData() } /// Initializes a new instance of PrivateEndpointData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateLinkServiceData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateLinkServiceData.cs index a515e67217a08..4373e75a2a04f 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateLinkServiceData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/PrivateLinkServiceData.cs @@ -25,7 +25,7 @@ public PrivateLinkServiceData() } /// Initializes a new instance of PrivateLinkServiceData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/PublicIPAddressData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/PublicIPAddressData.cs index 1b228cae16ce9..e916de8830d91 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/PublicIPAddressData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/PublicIPAddressData.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -22,7 +23,7 @@ public PublicIPAddressData() } /// Initializes a new instance of PublicIPAddressData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. @@ -47,7 +48,7 @@ public PublicIPAddressData() /// Migration phase of Public IP Address. /// The linked public IP address of the public IP address resource. /// Specify what happens to the public IP address when the VM using it is deleted. - internal PublicIPAddressData(string id, string name, string type, string location, IDictionary tags, ExtendedLocation extendedLocation, PublicIPAddressSku sku, string etag, IList zones, IPAllocationMethod? publicIPAllocationMethod, IPVersion? publicIPAddressVersion, IPConfiguration ipConfiguration, PublicIPAddressDnsSettings dnsSettings, DdosSettings ddosSettings, IList ipTags, string ipAddress, SubResource publicIPPrefix, int? idleTimeoutInMinutes, string resourceGuid, ProvisioningState? provisioningState, PublicIPAddressData servicePublicIPAddress, NatGatewayData natGateway, PublicIPAddressMigrationPhase? migrationPhase, PublicIPAddressData linkedPublicIPAddress, DeleteOptions? deleteOption) : base(id, name, type, location, tags) + internal PublicIPAddressData(string id, string name, string type, string location, IDictionary tags, ExtendedLocation extendedLocation, PublicIPAddressSku sku, string etag, IList zones, IPAllocationMethod? publicIPAllocationMethod, IPVersion? publicIPAddressVersion, IPConfiguration ipConfiguration, PublicIPAddressDnsSettings dnsSettings, DdosSettings ddosSettings, IList ipTags, string ipAddress, WritableSubResource publicIPPrefix, int? idleTimeoutInMinutes, string resourceGuid, ProvisioningState? provisioningState, PublicIPAddressData servicePublicIPAddress, NatGatewayData natGateway, PublicIPAddressMigrationPhase? migrationPhase, PublicIPAddressData linkedPublicIPAddress, DeleteOptions? deleteOption) : base(id, name, type, location, tags) { ExtendedLocation = extendedLocation; Sku = sku; @@ -94,7 +95,7 @@ internal PublicIPAddressData(string id, string name, string type, string locatio /// The IP address associated with the public IP address resource. public string IpAddress { get; set; } /// The Public IP Prefix this Public IP Address should be allocated from. - public SubResource PublicIPPrefix { get; set; } + public WritableSubResource PublicIPPrefix { get; set; } /// The idle timeout of the public IP address. public int? IdleTimeoutInMinutes { get; set; } /// The resource GUID property of the public IP address resource. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/PublicIPPrefixData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/PublicIPPrefixData.cs index 6220cde40404e..0eb04994e6abb 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/PublicIPPrefixData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/PublicIPPrefixData.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -19,11 +20,11 @@ public PublicIPPrefixData() { Zones = new ChangeTrackingList(); IpTags = new ChangeTrackingList(); - PublicIPAddresses = new ChangeTrackingList(); + PublicIPAddresses = new ChangeTrackingList(); } /// Initializes a new instance of PublicIPPrefixData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. @@ -42,7 +43,7 @@ public PublicIPPrefixData() /// The resource GUID property of the public IP prefix resource. /// The provisioning state of the public IP prefix resource. /// NatGateway of Public IP Prefix. - internal PublicIPPrefixData(string id, string name, string type, string location, IDictionary tags, ExtendedLocation extendedLocation, PublicIPPrefixSku sku, string etag, IList zones, IPVersion? publicIPAddressVersion, IList ipTags, int? prefixLength, string ipPrefix, IReadOnlyList publicIPAddresses, SubResource loadBalancerFrontendIpConfiguration, SubResource customIPPrefix, string resourceGuid, ProvisioningState? provisioningState, NatGatewayData natGateway) : base(id, name, type, location, tags) + internal PublicIPPrefixData(string id, string name, string type, string location, IDictionary tags, ExtendedLocation extendedLocation, PublicIPPrefixSku sku, string etag, IList zones, IPVersion? publicIPAddressVersion, IList ipTags, int? prefixLength, string ipPrefix, IReadOnlyList publicIPAddresses, WritableSubResource loadBalancerFrontendIpConfiguration, WritableSubResource customIPPrefix, string resourceGuid, ProvisioningState? provisioningState, NatGatewayData natGateway) : base(id, name, type, location, tags) { ExtendedLocation = extendedLocation; Sku = sku; @@ -77,11 +78,11 @@ internal PublicIPPrefixData(string id, string name, string type, string location /// The allocated Prefix. public string IpPrefix { get; } /// The list of all referenced PublicIPAddresses. - public IReadOnlyList PublicIPAddresses { get; } + public IReadOnlyList PublicIPAddresses { get; } /// The reference to load balancer frontend IP configuration associated with the public IP prefix. - public SubResource LoadBalancerFrontendIpConfiguration { get; } + public WritableSubResource LoadBalancerFrontendIpConfiguration { get; } /// The customIpPrefix that this prefix is associated with. - public SubResource CustomIPPrefix { get; set; } + public WritableSubResource CustomIPPrefix { get; set; } /// The resource GUID property of the public IP prefix resource. public string ResourceGuid { get; } /// The provisioning state of the public IP prefix resource. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteData.cs index 1dffef7a0fc73..4d4f88e434285 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteData.cs @@ -6,12 +6,11 @@ #nullable disable using Azure.ResourceManager.Network.Models; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { /// A class representing the Route data model. - public partial class RouteData : WritableSubResource + public partial class RouteData : SubResource { /// Initializes a new instance of RouteData. public RouteData() @@ -19,7 +18,7 @@ public RouteData() } /// Initializes a new instance of RouteData. - /// The id. + /// Resource ID. /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// The type of the resource. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteFilterData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteFilterData.cs index fd4d91819db9b..565ca97f07573 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteFilterData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteFilterData.cs @@ -23,7 +23,7 @@ public RouteFilterData() } /// Initializes a new instance of RouteFilterData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteFilterRuleData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteFilterRuleData.cs index 9d4048f0cf8b3..2faddac2d8585 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteFilterRuleData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteFilterRuleData.cs @@ -8,12 +8,11 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network.Models; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { /// A class representing the RouteFilterRule data model. - public partial class RouteFilterRuleData : WritableSubResource + public partial class RouteFilterRuleData : SubResource { /// Initializes a new instance of RouteFilterRuleData. public RouteFilterRuleData() @@ -22,7 +21,7 @@ public RouteFilterRuleData() } /// Initializes a new instance of RouteFilterRuleData. - /// The id. + /// Resource ID. /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// Resource location. /// A unique read-only string that changes whenever the resource is updated. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteTableData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteTableData.cs index 257b59ce24497..91f51e814a9a7 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteTableData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/RouteTableData.cs @@ -22,7 +22,7 @@ public RouteTableData() } /// Initializes a new instance of RouteTableData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityPartnerProviderData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityPartnerProviderData.cs index 2aaefca3e9511..d56a951eb4f94 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityPartnerProviderData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityPartnerProviderData.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -19,7 +20,7 @@ public SecurityPartnerProviderData() } /// Initializes a new instance of SecurityPartnerProviderData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. @@ -29,7 +30,7 @@ public SecurityPartnerProviderData() /// The security provider name. /// The connection status with the Security Partner Provider. /// The virtualHub to which the Security Partner Provider belongs. - internal SecurityPartnerProviderData(string id, string name, string type, string location, IDictionary tags, string etag, ProvisioningState? provisioningState, SecurityProviderName? securityProviderName, SecurityPartnerProviderConnectionStatus? connectionStatus, SubResource virtualHub) : base(id, name, type, location, tags) + internal SecurityPartnerProviderData(string id, string name, string type, string location, IDictionary tags, string etag, ProvisioningState? provisioningState, SecurityProviderName? securityProviderName, SecurityPartnerProviderConnectionStatus? connectionStatus, WritableSubResource virtualHub) : base(id, name, type, location, tags) { Etag = etag; ProvisioningState = provisioningState; @@ -47,6 +48,6 @@ internal SecurityPartnerProviderData(string id, string name, string type, string /// The connection status with the Security Partner Provider. public SecurityPartnerProviderConnectionStatus? ConnectionStatus { get; } /// The virtualHub to which the Security Partner Provider belongs. - public SubResource VirtualHub { get; set; } + public WritableSubResource VirtualHub { get; set; } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityRuleData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityRuleData.cs index 3cffc72f30082..717003888ba6e 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityRuleData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/SecurityRuleData.cs @@ -8,12 +8,11 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network.Models; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { /// A class representing the SecurityRule data model. - public partial class SecurityRuleData : WritableSubResource + public partial class SecurityRuleData : SubResource { /// Initializes a new instance of SecurityRuleData. public SecurityRuleData() @@ -27,7 +26,7 @@ public SecurityRuleData() } /// Initializes a new instance of SecurityRuleData. - /// The id. + /// Resource ID. /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// The type of the resource. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ServiceEndpointPolicyData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ServiceEndpointPolicyData.cs index da6ceb9abe319..b7f2aa70e7420 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ServiceEndpointPolicyData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ServiceEndpointPolicyData.cs @@ -22,7 +22,7 @@ public ServiceEndpointPolicyData() } /// Initializes a new instance of ServiceEndpointPolicyData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/ServiceEndpointPolicyDefinitionData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/ServiceEndpointPolicyDefinitionData.cs index a5a53b66a8e27..eded2cc5187fe 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/ServiceEndpointPolicyDefinitionData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/ServiceEndpointPolicyDefinitionData.cs @@ -8,12 +8,11 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network.Models; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { /// A class representing the ServiceEndpointPolicyDefinition data model. - public partial class ServiceEndpointPolicyDefinitionData : WritableSubResource + public partial class ServiceEndpointPolicyDefinitionData : SubResource { /// Initializes a new instance of ServiceEndpointPolicyDefinitionData. public ServiceEndpointPolicyDefinitionData() @@ -22,7 +21,7 @@ public ServiceEndpointPolicyDefinitionData() } /// Initializes a new instance of ServiceEndpointPolicyDefinitionData. - /// The id. + /// Resource ID. /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// A description for this rule. Restricted to 140 chars. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/SubnetData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/SubnetData.cs index b5a101166a57e..7ab5d39f40d4c 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/SubnetData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/SubnetData.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.Network { /// A class representing the Subnet data model. - public partial class SubnetData : WritableSubResource + public partial class SubnetData : Models.SubResource { /// Initializes a new instance of SubnetData. public SubnetData() @@ -24,7 +24,7 @@ public SubnetData() PrivateEndpoints = new ChangeTrackingList(); IpConfigurations = new ChangeTrackingList(); IpConfigurationProfiles = new ChangeTrackingList(); - IpAllocations = new ChangeTrackingList(); + IpAllocations = new ChangeTrackingList(); ResourceNavigationLinks = new ChangeTrackingList(); ServiceAssociationLinks = new ChangeTrackingList(); Delegations = new ChangeTrackingList(); @@ -32,7 +32,7 @@ public SubnetData() } /// Initializes a new instance of SubnetData. - /// The id. + /// Resource ID. /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// Resource type. @@ -55,7 +55,7 @@ public SubnetData() /// Enable or Disable apply network policies on private end point in the subnet. /// Enable or Disable apply network policies on private link service in the subnet. /// Application gateway IP configurations of virtual network resource. - internal SubnetData(string id, string name, string etag, string type, string addressPrefix, IList addressPrefixes, NetworkSecurityGroupData networkSecurityGroup, RouteTableData routeTable, Models.SubResource natGateway, IList serviceEndpoints, IList serviceEndpointPolicies, IReadOnlyList privateEndpoints, IReadOnlyList ipConfigurations, IReadOnlyList ipConfigurationProfiles, IList ipAllocations, IReadOnlyList resourceNavigationLinks, IReadOnlyList serviceAssociationLinks, IList delegations, string purpose, ProvisioningState? provisioningState, VirtualNetworkPrivateEndpointNetworkPolicies? privateEndpointNetworkPolicies, VirtualNetworkPrivateLinkServiceNetworkPolicies? privateLinkServiceNetworkPolicies, IList applicationGatewayIpConfigurations) : base(id) + internal SubnetData(string id, string name, string etag, string type, string addressPrefix, IList addressPrefixes, NetworkSecurityGroupData networkSecurityGroup, RouteTableData routeTable, WritableSubResource natGateway, IList serviceEndpoints, IList serviceEndpointPolicies, IReadOnlyList privateEndpoints, IReadOnlyList ipConfigurations, IReadOnlyList ipConfigurationProfiles, IList ipAllocations, IReadOnlyList resourceNavigationLinks, IReadOnlyList serviceAssociationLinks, IList delegations, string purpose, ProvisioningState? provisioningState, VirtualNetworkPrivateEndpointNetworkPolicies? privateEndpointNetworkPolicies, VirtualNetworkPrivateLinkServiceNetworkPolicies? privateLinkServiceNetworkPolicies, IList applicationGatewayIpConfigurations) : base(id) { Name = name; Etag = etag; @@ -96,7 +96,7 @@ internal SubnetData(string id, string name, string etag, string type, string add /// The reference to the RouteTable resource. public RouteTableData RouteTable { get; set; } /// Nat gateway associated with this subnet. - public Models.SubResource NatGateway { get; set; } + public WritableSubResource NatGateway { get; set; } /// An array of service endpoints. public IList ServiceEndpoints { get; } /// An array of service endpoint policies. @@ -108,7 +108,7 @@ internal SubnetData(string id, string name, string etag, string type, string add /// Array of IP configuration profiles which reference this subnet. public IReadOnlyList IpConfigurationProfiles { get; } /// Array of IpAllocation which reference this subnet. - public IList IpAllocations { get; } + public IList IpAllocations { get; } /// An array of references to the external resources using subnet. public IReadOnlyList ResourceNavigationLinks { get; } /// An array of references to services injecting into this subnet. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualApplianceSiteData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualApplianceSiteData.cs index 15e98784463c0..dd1f7e27eaed0 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualApplianceSiteData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualApplianceSiteData.cs @@ -6,12 +6,11 @@ #nullable disable using Azure.ResourceManager.Network.Models; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { /// A class representing the VirtualApplianceSite data model. - public partial class VirtualApplianceSiteData : WritableSubResource + public partial class VirtualApplianceSiteData : SubResource { /// Initializes a new instance of VirtualApplianceSiteData. public VirtualApplianceSiteData() @@ -19,7 +18,7 @@ public VirtualApplianceSiteData() } /// Initializes a new instance of VirtualApplianceSiteData. - /// The id. + /// Resource ID. /// Name of the virtual appliance site. /// A unique read-only string that changes whenever the resource is updated. /// Site type. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualHubData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualHubData.cs index e3d0fb3fd2ed0..e1f6dc5e2f3f8 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualHubData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualHubData.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -18,13 +19,13 @@ public partial class VirtualHubData : Resource public VirtualHubData() { VirtualHubRouteTableV2S = new ChangeTrackingList(); - BgpConnections = new ChangeTrackingList(); - IpConfigurations = new ChangeTrackingList(); + BgpConnections = new ChangeTrackingList(); + IpConfigurations = new ChangeTrackingList(); VirtualRouterIps = new ChangeTrackingList(); } /// Initializes a new instance of VirtualHubData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. @@ -49,7 +50,7 @@ public VirtualHubData() /// VirtualRouter IPs. /// Flag to control transit for VirtualRouter hub. /// The preferred gateway to route on-prem traffic. - internal VirtualHubData(string id, string name, string type, string location, IDictionary tags, string etag, SubResource virtualWan, SubResource vpnGateway, SubResource p2SVpnGateway, SubResource expressRouteGateway, SubResource azureFirewall, SubResource securityPartnerProvider, string addressPrefix, VirtualHubRouteTable routeTable, ProvisioningState? provisioningState, string securityProviderName, IList virtualHubRouteTableV2S, string sku, RoutingState? routingState, IReadOnlyList bgpConnections, IReadOnlyList ipConfigurations, long? virtualRouterAsn, IList virtualRouterIps, bool? allowBranchToBranchTraffic, PreferredRoutingGateway? preferredRoutingGateway) : base(id, name, type, location, tags) + internal VirtualHubData(string id, string name, string type, string location, IDictionary tags, string etag, WritableSubResource virtualWan, WritableSubResource vpnGateway, WritableSubResource p2SVpnGateway, WritableSubResource expressRouteGateway, WritableSubResource azureFirewall, WritableSubResource securityPartnerProvider, string addressPrefix, VirtualHubRouteTable routeTable, ProvisioningState? provisioningState, string securityProviderName, IList virtualHubRouteTableV2S, string sku, RoutingState? routingState, IReadOnlyList bgpConnections, IReadOnlyList ipConfigurations, long? virtualRouterAsn, IList virtualRouterIps, bool? allowBranchToBranchTraffic, PreferredRoutingGateway? preferredRoutingGateway) : base(id, name, type, location, tags) { Etag = etag; VirtualWan = virtualWan; @@ -76,17 +77,17 @@ internal VirtualHubData(string id, string name, string type, string location, ID /// A unique read-only string that changes whenever the resource is updated. public string Etag { get; } /// The VirtualWAN to which the VirtualHub belongs. - public SubResource VirtualWan { get; set; } + public WritableSubResource VirtualWan { get; set; } /// The VpnGateway associated with this VirtualHub. - public SubResource VpnGateway { get; set; } + public WritableSubResource VpnGateway { get; set; } /// The P2SVpnGateway associated with this VirtualHub. - public SubResource P2SVpnGateway { get; set; } + public WritableSubResource P2SVpnGateway { get; set; } /// The expressRouteGateway associated with this VirtualHub. - public SubResource ExpressRouteGateway { get; set; } + public WritableSubResource ExpressRouteGateway { get; set; } /// The azureFirewall associated with this VirtualHub. - public SubResource AzureFirewall { get; set; } + public WritableSubResource AzureFirewall { get; set; } /// The securityPartnerProvider associated with this VirtualHub. - public SubResource SecurityPartnerProvider { get; set; } + public WritableSubResource SecurityPartnerProvider { get; set; } /// Address-prefix for this VirtualHub. public string AddressPrefix { get; set; } /// The routeTable associated with this virtual hub. @@ -102,9 +103,9 @@ internal VirtualHubData(string id, string name, string type, string location, ID /// The routing state. public RoutingState? RoutingState { get; } /// List of references to Bgp Connections. - public IReadOnlyList BgpConnections { get; } + public IReadOnlyList BgpConnections { get; } /// List of references to IpConfigurations. - public IReadOnlyList IpConfigurations { get; } + public IReadOnlyList IpConfigurations { get; } /// VirtualRouter ASN. public long? VirtualRouterAsn { get; set; } /// VirtualRouter IPs. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualHubRouteTableV2Data.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualHubRouteTableV2Data.cs index 30c6663c3c3a5..9f5e6f02f5652 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualHubRouteTableV2Data.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualHubRouteTableV2Data.cs @@ -8,12 +8,11 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network.Models; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { /// A class representing the VirtualHubRouteTableV2 data model. - public partial class VirtualHubRouteTableV2Data : WritableSubResource + public partial class VirtualHubRouteTableV2Data : SubResource { /// Initializes a new instance of VirtualHubRouteTableV2Data. public VirtualHubRouteTableV2Data() @@ -23,7 +22,7 @@ public VirtualHubRouteTableV2Data() } /// Initializes a new instance of VirtualHubRouteTableV2Data. - /// The id. + /// Resource ID. /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// List of all routes. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkData.cs index 630375e10616a..6109322975633 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkData.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -19,11 +20,11 @@ public VirtualNetworkData() { Subnets = new ChangeTrackingList(); VirtualNetworkPeerings = new ChangeTrackingList(); - IpAllocations = new ChangeTrackingList(); + IpAllocations = new ChangeTrackingList(); } /// Initializes a new instance of VirtualNetworkData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. @@ -42,7 +43,7 @@ public VirtualNetworkData() /// The DDoS protection plan associated with the virtual network. /// Bgp Communities sent over ExpressRoute with each route corresponding to a prefix in this VNET. /// Array of IpAllocation which reference this VNET. - internal VirtualNetworkData(string id, string name, string type, string location, IDictionary tags, ExtendedLocation extendedLocation, string etag, AddressSpace addressSpace, DhcpOptions dhcpOptions, int? flowTimeoutInMinutes, IList subnets, IList virtualNetworkPeerings, string resourceGuid, ProvisioningState? provisioningState, bool? enableDdosProtection, bool? enableVmProtection, SubResource ddosProtectionPlan, VirtualNetworkBgpCommunities bgpCommunities, IList ipAllocations) : base(id, name, type, location, tags) + internal VirtualNetworkData(string id, string name, string type, string location, IDictionary tags, ExtendedLocation extendedLocation, string etag, AddressSpace addressSpace, DhcpOptions dhcpOptions, int? flowTimeoutInMinutes, IList subnets, IList virtualNetworkPeerings, string resourceGuid, ProvisioningState? provisioningState, bool? enableDdosProtection, bool? enableVmProtection, WritableSubResource ddosProtectionPlan, VirtualNetworkBgpCommunities bgpCommunities, IList ipAllocations) : base(id, name, type, location, tags) { ExtendedLocation = extendedLocation; Etag = etag; @@ -83,10 +84,10 @@ internal VirtualNetworkData(string id, string name, string type, string location /// Indicates if VM protection is enabled for all the subnets in the virtual network. public bool? EnableVmProtection { get; set; } /// The DDoS protection plan associated with the virtual network. - public SubResource DdosProtectionPlan { get; set; } + public WritableSubResource DdosProtectionPlan { get; set; } /// Bgp Communities sent over ExpressRoute with each route corresponding to a prefix in this VNET. public VirtualNetworkBgpCommunities BgpCommunities { get; set; } /// Array of IpAllocation which reference this VNET. - public IList IpAllocations { get; } + public IList IpAllocations { get; } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayConnectionData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayConnectionData.cs index d9807b934adb8..735b12ecb4af7 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayConnectionData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayConnectionData.cs @@ -9,6 +9,7 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -27,8 +28,8 @@ public VirtualNetworkGatewayConnectionData(VirtualNetworkGatewayData virtualNetw } VirtualNetworkGateway1 = virtualNetworkGateway1; - IngressNatRules = new ChangeTrackingList(); - EgressNatRules = new ChangeTrackingList(); + IngressNatRules = new ChangeTrackingList(); + EgressNatRules = new ChangeTrackingList(); ConnectionType = connectionType; TunnelConnectionStatus = new ChangeTrackingList(); IpsecPolicies = new ChangeTrackingList(); @@ -36,7 +37,7 @@ public VirtualNetworkGatewayConnectionData(VirtualNetworkGatewayData virtualNetw } /// Initializes a new instance of VirtualNetworkGatewayConnectionData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. @@ -67,7 +68,7 @@ public VirtualNetworkGatewayConnectionData(VirtualNetworkGatewayData virtualNetw /// The resource GUID property of the virtual network gateway connection resource. /// The provisioning state of the virtual network gateway connection resource. /// Bypass ExpressRoute Gateway for data forwarding. - internal VirtualNetworkGatewayConnectionData(string id, string name, string type, string location, IDictionary tags, string etag, string authorizationKey, VirtualNetworkGatewayData virtualNetworkGateway1, VirtualNetworkGatewayData virtualNetworkGateway2, LocalNetworkGatewayData localNetworkGateway2, IList ingressNatRules, IList egressNatRules, VirtualNetworkGatewayConnectionType connectionType, VirtualNetworkGatewayConnectionProtocol? connectionProtocol, int? routingWeight, int? dpdTimeoutSeconds, VirtualNetworkGatewayConnectionMode? connectionMode, string sharedKey, VirtualNetworkGatewayConnectionStatus? connectionStatus, IReadOnlyList tunnelConnectionStatus, long? egressBytesTransferred, long? ingressBytesTransferred, SubResource peer, bool? enableBgp, bool? useLocalAzureIpAddress, bool? usePolicyBasedTrafficSelectors, IList ipsecPolicies, IList trafficSelectorPolicies, string resourceGuid, ProvisioningState? provisioningState, bool? expressRouteGatewayBypass) : base(id, name, type, location, tags) + internal VirtualNetworkGatewayConnectionData(string id, string name, string type, string location, IDictionary tags, string etag, string authorizationKey, VirtualNetworkGatewayData virtualNetworkGateway1, VirtualNetworkGatewayData virtualNetworkGateway2, LocalNetworkGatewayData localNetworkGateway2, IList ingressNatRules, IList egressNatRules, VirtualNetworkGatewayConnectionType connectionType, VirtualNetworkGatewayConnectionProtocol? connectionProtocol, int? routingWeight, int? dpdTimeoutSeconds, VirtualNetworkGatewayConnectionMode? connectionMode, string sharedKey, VirtualNetworkGatewayConnectionStatus? connectionStatus, IReadOnlyList tunnelConnectionStatus, long? egressBytesTransferred, long? ingressBytesTransferred, WritableSubResource peer, bool? enableBgp, bool? useLocalAzureIpAddress, bool? usePolicyBasedTrafficSelectors, IList ipsecPolicies, IList trafficSelectorPolicies, string resourceGuid, ProvisioningState? provisioningState, bool? expressRouteGatewayBypass) : base(id, name, type, location, tags) { Etag = etag; AuthorizationKey = authorizationKey; @@ -108,9 +109,9 @@ internal VirtualNetworkGatewayConnectionData(string id, string name, string type /// The reference to local network gateway resource. public LocalNetworkGatewayData LocalNetworkGateway2 { get; set; } /// List of ingress NatRules. - public IList IngressNatRules { get; } + public IList IngressNatRules { get; } /// List of egress NatRules. - public IList EgressNatRules { get; } + public IList EgressNatRules { get; } /// Gateway connection type. public VirtualNetworkGatewayConnectionType ConnectionType { get; set; } /// Connection protocol used for this connection. @@ -132,7 +133,7 @@ internal VirtualNetworkGatewayConnectionData(string id, string name, string type /// The ingress bytes transferred in this connection. public long? IngressBytesTransferred { get; } /// The reference to peerings resource. - public SubResource Peer { get; set; } + public WritableSubResource Peer { get; set; } /// EnableBgp flag. public bool? EnableBgp { get; set; } /// Use private local Azure IP for the connection. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayData.cs index 7af5221e08161..b741080d02812 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayData.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -22,7 +23,7 @@ public VirtualNetworkGatewayData() } /// Initializes a new instance of VirtualNetworkGatewayData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. @@ -48,7 +49,7 @@ public VirtualNetworkGatewayData() /// Customer vnet resource id. VirtualNetworkGateway of type local gateway is associated with the customer vnet. /// NatRules for virtual network gateway. /// EnableBgpRouteTranslationForNat flag. - internal VirtualNetworkGatewayData(string id, string name, string type, string location, IDictionary tags, ExtendedLocation extendedLocation, string etag, IList ipConfigurations, VirtualNetworkGatewayType? gatewayType, VpnType? vpnType, VpnGatewayGeneration? vpnGatewayGeneration, bool? enableBgp, bool? enablePrivateIpAddress, bool? active, SubResource gatewayDefaultSite, VirtualNetworkGatewaySku sku, VpnClientConfiguration vpnClientConfiguration, BgpSettings bgpSettings, AddressSpace customRoutes, string resourceGuid, ProvisioningState? provisioningState, bool? enableDnsForwarding, string inboundDnsForwardingEndpoint, string vNetExtendedLocationResourceId, IList natRules, bool? enableBgpRouteTranslationForNat) : base(id, name, type, location, tags) + internal VirtualNetworkGatewayData(string id, string name, string type, string location, IDictionary tags, ExtendedLocation extendedLocation, string etag, IList ipConfigurations, VirtualNetworkGatewayType? gatewayType, VpnType? vpnType, VpnGatewayGeneration? vpnGatewayGeneration, bool? enableBgp, bool? enablePrivateIpAddress, bool? active, WritableSubResource gatewayDefaultSite, VirtualNetworkGatewaySku sku, VpnClientConfiguration vpnClientConfiguration, BgpSettings bgpSettings, AddressSpace customRoutes, string resourceGuid, ProvisioningState? provisioningState, bool? enableDnsForwarding, string inboundDnsForwardingEndpoint, string vNetExtendedLocationResourceId, IList natRules, bool? enableBgpRouteTranslationForNat) : base(id, name, type, location, tags) { ExtendedLocation = extendedLocation; Etag = etag; @@ -92,7 +93,7 @@ internal VirtualNetworkGatewayData(string id, string name, string type, string l /// ActiveActive flag. public bool? Active { get; set; } /// The reference to the LocalNetworkGateway resource which represents local network site having default routes. Assign Null value in case of removing existing default site setting. - public SubResource GatewayDefaultSite { get; set; } + public WritableSubResource GatewayDefaultSite { get; set; } /// The reference to the VirtualNetworkGatewaySku resource which represents the SKU selected for Virtual network gateway. public VirtualNetworkGatewaySku Sku { get; set; } /// The reference to the VpnClientConfiguration resource which represents the P2S VpnClient configurations. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayNatRuleData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayNatRuleData.cs index 11ee4cb337980..f4e08b8678f39 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayNatRuleData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkGatewayNatRuleData.cs @@ -8,12 +8,11 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network.Models; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { /// A class representing the VirtualNetworkGatewayNatRule data model. - public partial class VirtualNetworkGatewayNatRuleData : WritableSubResource + public partial class VirtualNetworkGatewayNatRuleData : SubResource { /// Initializes a new instance of VirtualNetworkGatewayNatRuleData. public VirtualNetworkGatewayNatRuleData() @@ -23,7 +22,7 @@ public VirtualNetworkGatewayNatRuleData() } /// Initializes a new instance of VirtualNetworkGatewayNatRuleData. - /// The id. + /// Resource ID. /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// Resource type. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkPeeringData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkPeeringData.cs index 8bbac599567f9..133bf275984b8 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkPeeringData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkPeeringData.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Network { /// A class representing the VirtualNetworkPeering data model. - public partial class VirtualNetworkPeeringData : WritableSubResource + public partial class VirtualNetworkPeeringData : Models.SubResource { /// Initializes a new instance of VirtualNetworkPeeringData. public VirtualNetworkPeeringData() @@ -19,7 +19,7 @@ public VirtualNetworkPeeringData() } /// Initializes a new instance of VirtualNetworkPeeringData. - /// The id. + /// Resource ID. /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// Resource type. @@ -36,7 +36,7 @@ public VirtualNetworkPeeringData() /// The provisioning state of the virtual network peering resource. /// If we need to verify the provisioning state of the remote gateway. /// The resourceGuid property of the Virtual Network peering resource. - internal VirtualNetworkPeeringData(string id, string name, string etag, string type, bool? allowVirtualNetworkAccess, bool? allowForwardedTraffic, bool? allowGatewayTransit, bool? useRemoteGateways, Models.SubResource remoteVirtualNetwork, AddressSpace remoteAddressSpace, AddressSpace remoteVirtualNetworkAddressSpace, VirtualNetworkBgpCommunities remoteBgpCommunities, VirtualNetworkPeeringState? peeringState, VirtualNetworkPeeringLevel? peeringSyncLevel, ProvisioningState? provisioningState, bool? doNotVerifyRemoteGateways, string resourceGuid) : base(id) + internal VirtualNetworkPeeringData(string id, string name, string etag, string type, bool? allowVirtualNetworkAccess, bool? allowForwardedTraffic, bool? allowGatewayTransit, bool? useRemoteGateways, WritableSubResource remoteVirtualNetwork, AddressSpace remoteAddressSpace, AddressSpace remoteVirtualNetworkAddressSpace, VirtualNetworkBgpCommunities remoteBgpCommunities, VirtualNetworkPeeringState? peeringState, VirtualNetworkPeeringLevel? peeringSyncLevel, ProvisioningState? provisioningState, bool? doNotVerifyRemoteGateways, string resourceGuid) : base(id) { Name = name; Etag = etag; @@ -71,7 +71,7 @@ internal VirtualNetworkPeeringData(string id, string name, string etag, string t /// If remote gateways can be used on this virtual network. If the flag is set to true, and allowGatewayTransit on remote peering is also true, virtual network will use gateways of remote virtual network for transit. Only one peering can have this flag set to true. This flag cannot be set if virtual network already has a gateway. public bool? UseRemoteGateways { get; set; } /// The reference to the remote virtual network. The remote virtual network can be in the same or different region (preview). See here to register for the preview and learn more (https://docs.microsoft.com/en-us/azure/virtual-network/virtual-network-create-peering). - public Models.SubResource RemoteVirtualNetwork { get; set; } + public WritableSubResource RemoteVirtualNetwork { get; set; } /// The reference to the address space peered with the remote virtual network. public AddressSpace RemoteAddressSpace { get; set; } /// The reference to the current address space of the remote virtual network. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkTapData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkTapData.cs index 945abd5a8be55..fe8fc0ba95f7c 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkTapData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualNetworkTapData.cs @@ -21,7 +21,7 @@ public VirtualNetworkTapData() } /// Initializes a new instance of VirtualNetworkTapData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualRouterData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualRouterData.cs index 34d341193280d..66ec57e1fb4f2 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualRouterData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualRouterData.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -18,11 +19,11 @@ public partial class VirtualRouterData : Resource public VirtualRouterData() { VirtualRouterIps = new ChangeTrackingList(); - Peerings = new ChangeTrackingList(); + Peerings = new ChangeTrackingList(); } /// Initializes a new instance of VirtualRouterData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. @@ -34,7 +35,7 @@ public VirtualRouterData() /// The Gateway on which VirtualRouter is hosted. /// List of references to VirtualRouterPeerings. /// The provisioning state of the resource. - internal VirtualRouterData(string id, string name, string type, string location, IDictionary tags, string etag, long? virtualRouterAsn, IList virtualRouterIps, SubResource hostedSubnet, SubResource hostedGateway, IReadOnlyList peerings, ProvisioningState? provisioningState) : base(id, name, type, location, tags) + internal VirtualRouterData(string id, string name, string type, string location, IDictionary tags, string etag, long? virtualRouterAsn, IList virtualRouterIps, WritableSubResource hostedSubnet, WritableSubResource hostedGateway, IReadOnlyList peerings, ProvisioningState? provisioningState) : base(id, name, type, location, tags) { Etag = etag; VirtualRouterAsn = virtualRouterAsn; @@ -52,11 +53,11 @@ internal VirtualRouterData(string id, string name, string type, string location, /// VirtualRouter IPs. public IList VirtualRouterIps { get; } /// The Subnet on which VirtualRouter is hosted. - public SubResource HostedSubnet { get; set; } + public WritableSubResource HostedSubnet { get; set; } /// The Gateway on which VirtualRouter is hosted. - public SubResource HostedGateway { get; set; } + public WritableSubResource HostedGateway { get; set; } /// List of references to VirtualRouterPeerings. - public IReadOnlyList Peerings { get; } + public IReadOnlyList Peerings { get; } /// The provisioning state of the resource. public ProvisioningState? ProvisioningState { get; } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualRouterPeeringData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualRouterPeeringData.cs index 7f908b4ddfa0c..e659268b67518 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualRouterPeeringData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualRouterPeeringData.cs @@ -6,12 +6,11 @@ #nullable disable using Azure.ResourceManager.Network.Models; -using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { /// A class representing the VirtualRouterPeering data model. - public partial class VirtualRouterPeeringData : WritableSubResource + public partial class VirtualRouterPeeringData : SubResource { /// Initializes a new instance of VirtualRouterPeeringData. public VirtualRouterPeeringData() @@ -19,7 +18,7 @@ public VirtualRouterPeeringData() } /// Initializes a new instance of VirtualRouterPeeringData. - /// The id. + /// Resource ID. /// Name of the virtual router peering that is unique within a virtual router. /// A unique read-only string that changes whenever the resource is updated. /// Peering type. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualWANData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualWANData.cs index 184c836b19ff6..d33b1324be992 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualWANData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VirtualWANData.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -17,12 +18,12 @@ public partial class VirtualWANData : Resource /// Initializes a new instance of VirtualWANData. public VirtualWANData() { - VirtualHubs = new ChangeTrackingList(); - VpnSites = new ChangeTrackingList(); + VirtualHubs = new ChangeTrackingList(); + VpnSites = new ChangeTrackingList(); } /// Initializes a new instance of VirtualWANData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. @@ -36,7 +37,7 @@ public VirtualWANData() /// The office local breakout category. /// The provisioning state of the virtual WAN resource. /// The type of the VirtualWAN. - internal VirtualWANData(string id, string name, string type, string location, IDictionary tags, string etag, bool? disableVpnEncryption, IReadOnlyList virtualHubs, IReadOnlyList vpnSites, bool? allowBranchToBranchTraffic, bool? allowVnetToVnetTraffic, OfficeTrafficCategory? office365LocalBreakoutCategory, ProvisioningState? provisioningState, string typePropertiesType) : base(id, name, type, location, tags) + internal VirtualWANData(string id, string name, string type, string location, IDictionary tags, string etag, bool? disableVpnEncryption, IReadOnlyList virtualHubs, IReadOnlyList vpnSites, bool? allowBranchToBranchTraffic, bool? allowVnetToVnetTraffic, OfficeTrafficCategory? office365LocalBreakoutCategory, ProvisioningState? provisioningState, string typePropertiesType) : base(id, name, type, location, tags) { Etag = etag; DisableVpnEncryption = disableVpnEncryption; @@ -54,9 +55,9 @@ internal VirtualWANData(string id, string name, string type, string location, ID /// Vpn encryption to be disabled or not. public bool? DisableVpnEncryption { get; set; } /// List of VirtualHubs in the VirtualWAN. - public IReadOnlyList VirtualHubs { get; } + public IReadOnlyList VirtualHubs { get; } /// List of VpnSites in the VirtualWAN. - public IReadOnlyList VpnSites { get; } + public IReadOnlyList VpnSites { get; } /// True if branch to branch traffic is allowed. public bool? AllowBranchToBranchTraffic { get; set; } /// True if Vnet to Vnet traffic is allowed. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnConnectionData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnConnectionData.cs index bb945db1aa79c..e280e8da45075 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnConnectionData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnConnectionData.cs @@ -13,7 +13,7 @@ namespace Azure.ResourceManager.Network { /// A class representing the VpnConnection data model. - public partial class VpnConnectionData : WritableSubResource + public partial class VpnConnectionData : Models.SubResource { /// Initializes a new instance of VpnConnectionData. public VpnConnectionData() @@ -24,7 +24,7 @@ public VpnConnectionData() } /// Initializes a new instance of VpnConnectionData. - /// The id. + /// Resource ID. /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// Id of the connected vpn site. @@ -46,7 +46,7 @@ public VpnConnectionData() /// The provisioning state of the VPN connection resource. /// List of all vpn site link connections to the gateway. /// The Routing Configuration indicating the associated and propagated route tables on this connection. - internal VpnConnectionData(string id, string name, string etag, Models.SubResource remoteVpnSite, int? routingWeight, int? dpdTimeoutSeconds, VpnConnectionStatus? connectionStatus, VirtualNetworkGatewayConnectionProtocol? vpnConnectionProtocolType, long? ingressBytesTransferred, long? egressBytesTransferred, int? connectionBandwidth, string sharedKey, bool? enableBgp, bool? usePolicyBasedTrafficSelectors, IList ipsecPolicies, IList trafficSelectorPolicies, bool? enableRateLimiting, bool? enableInternetSecurity, bool? useLocalAzureIpAddress, ProvisioningState? provisioningState, IList vpnLinkConnections, RoutingConfiguration routingConfiguration) : base(id) + internal VpnConnectionData(string id, string name, string etag, WritableSubResource remoteVpnSite, int? routingWeight, int? dpdTimeoutSeconds, VpnConnectionStatus? connectionStatus, VirtualNetworkGatewayConnectionProtocol? vpnConnectionProtocolType, long? ingressBytesTransferred, long? egressBytesTransferred, int? connectionBandwidth, string sharedKey, bool? enableBgp, bool? usePolicyBasedTrafficSelectors, IList ipsecPolicies, IList trafficSelectorPolicies, bool? enableRateLimiting, bool? enableInternetSecurity, bool? useLocalAzureIpAddress, ProvisioningState? provisioningState, IList vpnLinkConnections, RoutingConfiguration routingConfiguration) : base(id) { Name = name; Etag = etag; @@ -76,7 +76,7 @@ internal VpnConnectionData(string id, string name, string etag, Models.SubResour /// A unique read-only string that changes whenever the resource is updated. public string Etag { get; } /// Id of the connected vpn site. - public Models.SubResource RemoteVpnSite { get; set; } + public WritableSubResource RemoteVpnSite { get; set; } /// Routing weight for vpn connection. public int? RoutingWeight { get; set; } /// DPD timeout in seconds for vpn connection. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnGatewayData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnGatewayData.cs index e30429921a73a..6acbcd29576bb 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnGatewayData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnGatewayData.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -23,7 +24,7 @@ public VpnGatewayData() } /// Initializes a new instance of VpnGatewayData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. @@ -37,7 +38,7 @@ public VpnGatewayData() /// List of all IPs configured on the gateway. /// Enable Routing Preference property for the Public IP Interface of the VpnGateway. /// List of all the nat Rules associated with the gateway. - internal VpnGatewayData(string id, string name, string type, string location, IDictionary tags, string etag, SubResource virtualHub, IList connections, BgpSettings bgpSettings, ProvisioningState? provisioningState, int? vpnGatewayScaleUnit, IReadOnlyList ipConfigurations, bool? isRoutingPreferenceInternet, IList natRules) : base(id, name, type, location, tags) + internal VpnGatewayData(string id, string name, string type, string location, IDictionary tags, string etag, WritableSubResource virtualHub, IList connections, BgpSettings bgpSettings, ProvisioningState? provisioningState, int? vpnGatewayScaleUnit, IReadOnlyList ipConfigurations, bool? isRoutingPreferenceInternet, IList natRules) : base(id, name, type, location, tags) { Etag = etag; VirtualHub = virtualHub; @@ -53,7 +54,7 @@ internal VpnGatewayData(string id, string name, string type, string location, ID /// A unique read-only string that changes whenever the resource is updated. public string Etag { get; } /// The VirtualHub to which the gateway belongs. - public SubResource VirtualHub { get; set; } + public WritableSubResource VirtualHub { get; set; } /// List of all vpn connections to the gateway. public IList Connections { get; } /// Local network gateway's BGP speaker settings. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnGatewayNatRuleData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnGatewayNatRuleData.cs index 513401349f4b9..206b1ae9bdaa6 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnGatewayNatRuleData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnGatewayNatRuleData.cs @@ -13,19 +13,19 @@ namespace Azure.ResourceManager.Network { /// A class representing the VpnGatewayNatRule data model. - public partial class VpnGatewayNatRuleData : WritableSubResource + public partial class VpnGatewayNatRuleData : Models.SubResource { /// Initializes a new instance of VpnGatewayNatRuleData. public VpnGatewayNatRuleData() { InternalMappings = new ChangeTrackingList(); ExternalMappings = new ChangeTrackingList(); - EgressVpnSiteLinkConnections = new ChangeTrackingList(); - IngressVpnSiteLinkConnections = new ChangeTrackingList(); + EgressVpnSiteLinkConnections = new ChangeTrackingList(); + IngressVpnSiteLinkConnections = new ChangeTrackingList(); } /// Initializes a new instance of VpnGatewayNatRuleData. - /// The id. + /// Resource ID. /// The name of the resource that is unique within a resource group. This name can be used to access the resource. /// A unique read-only string that changes whenever the resource is updated. /// Resource type. @@ -37,7 +37,7 @@ public VpnGatewayNatRuleData() /// The IP Configuration ID this NAT rule applies to. /// List of egress VpnSiteLinkConnections. /// List of ingress VpnSiteLinkConnections. - internal VpnGatewayNatRuleData(string id, string name, string etag, string type, ProvisioningState? provisioningState, VpnNatRuleType? typePropertiesType, VpnNatRuleMode? mode, IList internalMappings, IList externalMappings, string ipConfigurationId, IReadOnlyList egressVpnSiteLinkConnections, IReadOnlyList ingressVpnSiteLinkConnections) : base(id) + internal VpnGatewayNatRuleData(string id, string name, string etag, string type, ProvisioningState? provisioningState, VpnNatRuleType? typePropertiesType, VpnNatRuleMode? mode, IList internalMappings, IList externalMappings, string ipConfigurationId, IReadOnlyList egressVpnSiteLinkConnections, IReadOnlyList ingressVpnSiteLinkConnections) : base(id) { Name = name; Etag = etag; @@ -71,8 +71,8 @@ internal VpnGatewayNatRuleData(string id, string name, string etag, string type, /// The IP Configuration ID this NAT rule applies to. public string IpConfigurationId { get; set; } /// List of egress VpnSiteLinkConnections. - public IReadOnlyList EgressVpnSiteLinkConnections { get; } + public IReadOnlyList EgressVpnSiteLinkConnections { get; } /// List of ingress VpnSiteLinkConnections. - public IReadOnlyList IngressVpnSiteLinkConnections { get; } + public IReadOnlyList IngressVpnSiteLinkConnections { get; } } } diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnServerConfigurationData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnServerConfigurationData.cs index 20ad49ceeb8fe..04195f867bbd2 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnServerConfigurationData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnServerConfigurationData.cs @@ -29,7 +29,7 @@ public VpnServerConfigurationData() } /// Initializes a new instance of VpnServerConfigurationData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnSiteData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnSiteData.cs index 255498b499c58..8f339e2ad2818 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnSiteData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/VpnSiteData.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -21,7 +22,7 @@ public VpnSiteData() } /// Initializes a new instance of VpnSiteData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. @@ -37,7 +38,7 @@ public VpnSiteData() /// IsSecuritySite flag. /// List of all vpn site links. /// Office365 Policy. - internal VpnSiteData(string id, string name, string type, string location, IDictionary tags, string etag, SubResource virtualWan, DeviceProperties deviceProperties, string ipAddress, string siteKey, AddressSpace addressSpace, BgpSettings bgpProperties, ProvisioningState? provisioningState, bool? isSecuritySite, IList vpnSiteLinks, O365PolicyProperties o365Policy) : base(id, name, type, location, tags) + internal VpnSiteData(string id, string name, string type, string location, IDictionary tags, string etag, WritableSubResource virtualWan, DeviceProperties deviceProperties, string ipAddress, string siteKey, AddressSpace addressSpace, BgpSettings bgpProperties, ProvisioningState? provisioningState, bool? isSecuritySite, IList vpnSiteLinks, O365PolicyProperties o365Policy) : base(id, name, type, location, tags) { Etag = etag; VirtualWan = virtualWan; @@ -55,7 +56,7 @@ internal VpnSiteData(string id, string name, string type, string location, IDict /// A unique read-only string that changes whenever the resource is updated. public string Etag { get; } /// The VirtualWAN to which the vpnSite belongs. - public SubResource VirtualWan { get; set; } + public WritableSubResource VirtualWan { get; set; } /// The device properties. public DeviceProperties DeviceProperties { get; set; } /// The ip-address for the vpn-site. diff --git a/sdk/network/Azure.ResourceManager.Network/src/Generated/WebApplicationFirewallPolicyData.cs b/sdk/network/Azure.ResourceManager.Network/src/Generated/WebApplicationFirewallPolicyData.cs index e79cc5cf22e9c..02ccc6db08a67 100644 --- a/sdk/network/Azure.ResourceManager.Network/src/Generated/WebApplicationFirewallPolicyData.cs +++ b/sdk/network/Azure.ResourceManager.Network/src/Generated/WebApplicationFirewallPolicyData.cs @@ -8,6 +8,7 @@ using System.Collections.Generic; using Azure.Core; using Azure.ResourceManager.Network.Models; +using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Network { @@ -19,12 +20,12 @@ public WebApplicationFirewallPolicyData() { CustomRules = new ChangeTrackingList(); ApplicationGateways = new ChangeTrackingList(); - HttpListeners = new ChangeTrackingList(); - PathBasedRules = new ChangeTrackingList(); + HttpListeners = new ChangeTrackingList(); + PathBasedRules = new ChangeTrackingList(); } /// Initializes a new instance of WebApplicationFirewallPolicyData. - /// The id. + /// Resource ID. /// Resource name. /// Resource type. /// Resource location. @@ -38,7 +39,7 @@ public WebApplicationFirewallPolicyData() /// Describes the managedRules structure. /// A collection of references to application gateway http listeners. /// A collection of references to application gateway path rules. - internal WebApplicationFirewallPolicyData(string id, string name, string type, string location, IDictionary tags, string etag, PolicySettings policySettings, IList customRules, IReadOnlyList applicationGateways, ProvisioningState? provisioningState, WebApplicationFirewallPolicyResourceState? resourceState, ManagedRulesDefinition managedRules, IReadOnlyList httpListeners, IReadOnlyList pathBasedRules) : base(id, name, type, location, tags) + internal WebApplicationFirewallPolicyData(string id, string name, string type, string location, IDictionary tags, string etag, PolicySettings policySettings, IList customRules, IReadOnlyList applicationGateways, ProvisioningState? provisioningState, WebApplicationFirewallPolicyResourceState? resourceState, ManagedRulesDefinition managedRules, IReadOnlyList httpListeners, IReadOnlyList pathBasedRules) : base(id, name, type, location, tags) { Etag = etag; PolicySettings = policySettings; @@ -66,8 +67,8 @@ internal WebApplicationFirewallPolicyData(string id, string name, string type, s /// Describes the managedRules structure. public ManagedRulesDefinition ManagedRules { get; set; } /// A collection of references to application gateway http listeners. - public IReadOnlyList HttpListeners { get; } + public IReadOnlyList HttpListeners { get; } /// A collection of references to application gateway path rules. - public IReadOnlyList PathBasedRules { get; } + public IReadOnlyList PathBasedRules { get; } } } diff --git a/sdk/network/Azure.ResourceManager.Network/tests/Tests/ApplicationGatewayTests.cs b/sdk/network/Azure.ResourceManager.Network/tests/Tests/ApplicationGatewayTests.cs index b58cad63897a0..96420fd3817ea 100644 --- a/sdk/network/Azure.ResourceManager.Network/tests/Tests/ApplicationGatewayTests.cs +++ b/sdk/network/Azure.ResourceManager.Network/tests/Tests/ApplicationGatewayTests.cs @@ -16,6 +16,7 @@ namespace Azure.ResourceManager.Network.Tests { + [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/24577")] public class ApplicationGatewayTests : NetworkServiceClientTestBase { public ApplicationGatewayTests(bool isAsync) : base(isAsync) @@ -116,7 +117,7 @@ private ApplicationGatewayData CreateApplicationGateway(string location, Subnet new ApplicationGatewayIPConfiguration() { Name = gatewayIPConfigName, - Subnet = new SubResource() + Subnet = new WritableSubResource() { Id = subnet.Id } @@ -127,7 +128,7 @@ private ApplicationGatewayData CreateApplicationGateway(string location, Subnet { Name = frontendIPConfigName, PrivateIPAllocationMethod = IPAllocationMethod.Dynamic, - Subnet = new SubResource() + Subnet = new WritableSubResource() { Id = subnet.Id } @@ -200,7 +201,7 @@ private ApplicationGatewayData CreateApplicationGateway(string location, Subnet Protocol = ApplicationGatewayProtocol.Http, CookieBasedAffinity = ApplicationGatewayCookieBasedAffinity.Disabled, RequestTimeout = 69, - Probe = new SubResource() + Probe = new WritableSubResource() { Id = GetChildAppGwResourceId(subscriptionId, resourceGroupName, appGwName, "probes", probeName) @@ -217,7 +218,7 @@ private ApplicationGatewayData CreateApplicationGateway(string location, Subnet CookieBasedAffinity = ApplicationGatewayCookieBasedAffinity.Enabled, AuthenticationCertificates = { - new SubResource() + new WritableSubResource() { Id = GetChildAppGwResourceId(subscriptionId, resourceGroupName, appGwName, "authenticationCertificates", authCertName) @@ -229,12 +230,12 @@ private ApplicationGatewayData CreateApplicationGateway(string location, Subnet new ApplicationGatewayHttpListener() { Name = httpListener1Name, - FrontendPort = new SubResource() + FrontendPort = new WritableSubResource() { Id = GetChildAppGwResourceId(subscriptionId, resourceGroupName, appGwName, "frontendPorts", frontendPort1Name) }, - FrontendIPConfiguration = new SubResource() + FrontendIPConfiguration = new WritableSubResource() { Id = GetChildAppGwResourceId(subscriptionId, resourceGroupName, appGwName, "frontendIPConfigurations", frontendIPConfigName) @@ -245,17 +246,17 @@ private ApplicationGatewayData CreateApplicationGateway(string location, Subnet new ApplicationGatewayHttpListener() { Name = httpListener2Name, - FrontendPort = new SubResource() + FrontendPort = new WritableSubResource() { Id = GetChildAppGwResourceId(subscriptionId, resourceGroupName, appGwName, "frontendPorts", frontendPort2Name) }, - FrontendIPConfiguration = new SubResource() + FrontendIPConfiguration = new WritableSubResource() { Id = GetChildAppGwResourceId(subscriptionId, resourceGroupName, appGwName, "frontendIPConfigurations", frontendIPConfigName) }, - SslCertificate = new SubResource() + SslCertificate = new WritableSubResource() { Id = GetChildAppGwResourceId(subscriptionId, resourceGroupName, appGwName, "sslCertificates", sslCertName) @@ -265,17 +266,17 @@ private ApplicationGatewayData CreateApplicationGateway(string location, Subnet new ApplicationGatewayHttpListener() { Name = httpListener3Name, - FrontendPort = new SubResource() + FrontendPort = new WritableSubResource() { Id = GetChildAppGwResourceId(subscriptionId, resourceGroupName, appGwName, "frontendPorts", frontendPort3Name) }, - FrontendIPConfiguration = new SubResource() + FrontendIPConfiguration = new WritableSubResource() { Id = GetChildAppGwResourceId(subscriptionId, resourceGroupName, appGwName, "frontendIPConfigurations", frontendIPConfigName) }, - SslCertificate = new SubResource() + SslCertificate = new WritableSubResource() { Id = GetChildAppGwResourceId(subscriptionId, resourceGroupName, appGwName, "sslCertificates", sslCertName) @@ -285,17 +286,17 @@ private ApplicationGatewayData CreateApplicationGateway(string location, Subnet new ApplicationGatewayHttpListener() { Name = httpListener4Name, - FrontendPort = new SubResource() + FrontendPort = new WritableSubResource() { Id = GetChildAppGwResourceId(subscriptionId, resourceGroupName, appGwName, "frontendPorts", frontendPort4Name) }, - FrontendIPConfiguration = new SubResource() + FrontendIPConfiguration = new WritableSubResource() { Id = GetChildAppGwResourceId(subscriptionId, resourceGroupName, appGwName, "frontendIPConfigurations", frontendIPConfigName) }, - SslCertificate = new SubResource() + SslCertificate = new WritableSubResource() { Id = GetChildAppGwResourceId(subscriptionId, resourceGroupName, appGwName, "sslCertificates", sslCertName) @@ -306,7 +307,7 @@ private ApplicationGatewayData CreateApplicationGateway(string location, Subnet UrlPathMaps = { new ApplicationGatewayUrlPathMap{ Name = urlPathMapName, - DefaultRedirectConfiguration = new SubResource + DefaultRedirectConfiguration = new WritableSubResource { Id = GetChildAppGwResourceId(subscriptionId, resourceGroupName, appGwName, "redirectConfigurations", redirectConfiguration2Name) @@ -315,12 +316,12 @@ private ApplicationGatewayData CreateApplicationGateway(string location, Subnet new ApplicationGatewayPathRule{ Name = pathRuleName, Paths = {"/paa"}, - BackendAddressPool = new SubResource() + BackendAddressPool = new WritableSubResource() { Id = GetChildAppGwResourceId(subscriptionId, resourceGroupName, appGwName, "backendAddressPools", backendAddressPoolName) }, - BackendHttpSettings = new SubResource() + BackendHttpSettings = new WritableSubResource() { Id = GetChildAppGwResourceId(subscriptionId, resourceGroupName, appGwName, "backendHttpSettingsCollection", backendHttpSettings1Name) @@ -334,17 +335,17 @@ private ApplicationGatewayData CreateApplicationGateway(string location, Subnet { Name = requestRoutingRule1Name, RuleType = ApplicationGatewayRequestRoutingRuleType.Basic, - HttpListener = new SubResource() + HttpListener = new WritableSubResource() { Id = GetChildAppGwResourceId(subscriptionId, resourceGroupName, appGwName, "httpListeners", httpListener1Name) }, - BackendAddressPool = new SubResource() + BackendAddressPool = new WritableSubResource() { Id = GetChildAppGwResourceId(subscriptionId, resourceGroupName, appGwName, "backendAddressPools", backendAddressPoolName) }, - BackendHttpSettings = new SubResource() + BackendHttpSettings = new WritableSubResource() { Id = GetChildAppGwResourceId(subscriptionId, resourceGroupName, appGwName, "backendHttpSettingsCollection", backendHttpSettings1Name) @@ -354,12 +355,12 @@ private ApplicationGatewayData CreateApplicationGateway(string location, Subnet { Name = requestRoutingRule2Name, RuleType = ApplicationGatewayRequestRoutingRuleType.Basic, - HttpListener = new SubResource() + HttpListener = new WritableSubResource() { Id = GetChildAppGwResourceId(subscriptionId, resourceGroupName, appGwName, "httpListeners", httpListener2Name) }, - RedirectConfiguration = new SubResource() + RedirectConfiguration = new WritableSubResource() { Id = GetChildAppGwResourceId(subscriptionId, resourceGroupName, appGwName, "redirectConfigurations", redirectConfiguration1Name) @@ -369,12 +370,12 @@ private ApplicationGatewayData CreateApplicationGateway(string location, Subnet { Name = requestRoutingRule3Name, RuleType = ApplicationGatewayRequestRoutingRuleType.PathBasedRouting, - HttpListener = new SubResource() + HttpListener = new WritableSubResource() { Id = GetChildAppGwResourceId(subscriptionId, resourceGroupName, appGwName, "httpListeners", httpListener3Name) }, - UrlPathMap = new SubResource() + UrlPathMap = new WritableSubResource() { Id = GetChildAppGwResourceId(subscriptionId, resourceGroupName, appGwName, "urlPathMaps", urlPathMapName) @@ -384,17 +385,17 @@ private ApplicationGatewayData CreateApplicationGateway(string location, Subnet { Name = requestRoutingRule4Name, RuleType = ApplicationGatewayRequestRoutingRuleType.Basic, - HttpListener = new SubResource() + HttpListener = new WritableSubResource() { Id = GetChildAppGwResourceId(subscriptionId, resourceGroupName, appGwName, "httpListeners", httpListener4Name) }, - BackendAddressPool = new SubResource() + BackendAddressPool = new WritableSubResource() { Id = GetChildAppGwResourceId(subscriptionId, resourceGroupName, appGwName, "backendAddressPools", nicBackendAddressPoolName) }, - BackendHttpSettings = new SubResource() + BackendHttpSettings = new WritableSubResource() { Id = GetChildAppGwResourceId(subscriptionId, resourceGroupName, appGwName, "backendHttpSettingsCollection", backendHttpSettings2Name) @@ -424,7 +425,7 @@ private ApplicationGatewayData CreateApplicationGateway(string location, Subnet { Name = redirectConfiguration1Name, RedirectType = ApplicationGatewayRedirectType.Permanent, - TargetListener = new SubResource() + TargetListener = new WritableSubResource() { Id = GetChildAppGwResourceId(subscriptionId, resourceGroupName, appGwName, "httpListeners", httpListener1Name) @@ -466,7 +467,7 @@ private ApplicationGatewayData CreateApplicationGatewayWithoutSsl(string locatio new ApplicationGatewayIPConfiguration() { Name = gatewayIPConfigName, - Subnet = new SubResource() + Subnet = new WritableSubResource() { Id = subnet.Id } @@ -477,7 +478,7 @@ private ApplicationGatewayData CreateApplicationGatewayWithoutSsl(string locatio { Name = frontendIPConfigName, PrivateIPAllocationMethod = IPAllocationMethod.Dynamic, - Subnet = new SubResource() + Subnet = new WritableSubResource() { Id = subnet.Id } @@ -526,12 +527,12 @@ private ApplicationGatewayData CreateApplicationGatewayWithoutSsl(string locatio new ApplicationGatewayHttpListener() { Name = httpListener1Name, - FrontendPort = new SubResource() + FrontendPort = new WritableSubResource() { Id = GetChildAppGwResourceId(subscriptionId, resourceGroupName, appGwName, "frontendPorts", frontendPort1Name) }, - FrontendIPConfiguration = new SubResource() + FrontendIPConfiguration = new WritableSubResource() { Id = GetChildAppGwResourceId(subscriptionId, resourceGroupName, appGwName, "frontendIPConfigurations", frontendIPConfigName) @@ -547,17 +548,17 @@ private ApplicationGatewayData CreateApplicationGatewayWithoutSsl(string locatio { Name = requestRoutingRule1Name, RuleType = ApplicationGatewayRequestRoutingRuleType.Basic, - HttpListener = new SubResource() + HttpListener = new WritableSubResource() { Id = GetChildAppGwResourceId(subscriptionId, resourceGroupName, appGwName, "httpListeners", httpListener1Name) }, - BackendAddressPool = new SubResource() + BackendAddressPool = new WritableSubResource() { Id = GetChildAppGwResourceId(subscriptionId, resourceGroupName, appGwName, "backendAddressPools", backendAddressPoolName) }, - BackendHttpSettings = new SubResource() + BackendHttpSettings = new WritableSubResource() { Id = GetChildAppGwResourceId(subscriptionId, resourceGroupName, appGwName, "backendHttpSettingsCollection", backendHttpSettings1Name) diff --git a/sdk/network/Azure.ResourceManager.Network/tests/Tests/ApplicationSecurityGroupTests.cs b/sdk/network/Azure.ResourceManager.Network/tests/Tests/ApplicationSecurityGroupTests.cs index bf802f12e5827..3e11b42182d74 100644 --- a/sdk/network/Azure.ResourceManager.Network/tests/Tests/ApplicationSecurityGroupTests.cs +++ b/sdk/network/Azure.ResourceManager.Network/tests/Tests/ApplicationSecurityGroupTests.cs @@ -13,6 +13,7 @@ namespace Azure.ResourceManager.Network.Tests { + [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/24577")] public class ApplicationSecurityGroupTests : NetworkServiceClientTestBase { diff --git a/sdk/network/Azure.ResourceManager.Network/tests/Tests/BastionHostContainerTests.cs b/sdk/network/Azure.ResourceManager.Network/tests/Tests/BastionHostContainerTests.cs index 82addd013faec..97103fbfd3abc 100644 --- a/sdk/network/Azure.ResourceManager.Network/tests/Tests/BastionHostContainerTests.cs +++ b/sdk/network/Azure.ResourceManager.Network/tests/Tests/BastionHostContainerTests.cs @@ -12,6 +12,7 @@ namespace Azure.ResourceManager.Network.Tests { + [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/24577")] internal class BastionHostContainerTests : NetworkServiceClientTestBase { private ResourceGroup _resourceGroup; @@ -81,9 +82,9 @@ private async Task CreateBastionHost(string bastionName) data.Location = TestEnvironment.Location; BastionHostIPConfiguration ipConfig = new BastionHostIPConfiguration(); ipConfig.Name = Recording.GenerateAssetName("bastionIPConfig-"); - ipConfig.Subnet = new Models.SubResource(); + ipConfig.Subnet = new WritableSubResource(); ipConfig.Subnet.Id = _subnet.Id; - ipConfig.PublicIPAddress = new Models.SubResource(); + ipConfig.PublicIPAddress = new WritableSubResource(); ipConfig.PublicIPAddress.Id = _publicIPAddress.Id; data.IpConfigurations.Add(ipConfig); var bastionLro = await _resourceGroup.GetBastionHosts().CreateOrUpdateAsync(bastionName, data); diff --git a/sdk/network/Azure.ResourceManager.Network/tests/Tests/ExpandResourceTests.cs b/sdk/network/Azure.ResourceManager.Network/tests/Tests/ExpandResourceTests.cs index d4cd2d35124f2..24d0b132a9652 100644 --- a/sdk/network/Azure.ResourceManager.Network/tests/Tests/ExpandResourceTests.cs +++ b/sdk/network/Azure.ResourceManager.Network/tests/Tests/ExpandResourceTests.cs @@ -14,6 +14,7 @@ namespace Azure.ResourceManager.Network.Tests { + [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/24577")] public class ExpandResourceTests : NetworkServiceClientTestBase { public ExpandResourceTests(bool isAsync) : base(isAsync) @@ -115,7 +116,7 @@ public async Task ExpandResourceTest() new LoadBalancingRule() { Name = loadBalancingRuleName, - FrontendIPConfiguration = new SubResource() + FrontendIPConfiguration = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "FrontendIPConfigurations", frontendIpConfigName) @@ -125,12 +126,12 @@ public async Task ExpandResourceTest() BackendPort = 80, EnableFloatingIP = false, IdleTimeoutInMinutes = 15, - BackendAddressPool = new SubResource() + BackendAddressPool = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "backendAddressPools", backEndAddressPoolName) }, - Probe = new SubResource() + Probe = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "probes", probeName) @@ -152,7 +153,7 @@ public async Task ExpandResourceTest() new InboundNatRuleData() { Name = inboundNatRule1Name, - FrontendIPConfiguration = new SubResource() + FrontendIPConfiguration = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "FrontendIPConfigurations", frontendIpConfigName) @@ -166,7 +167,7 @@ public async Task ExpandResourceTest() new InboundNatRuleData() { Name = inboundNatRule2Name, - FrontendIPConfiguration = new SubResource() + FrontendIPConfiguration = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "FrontendIPConfigurations", frontendIpConfigName) diff --git a/sdk/network/Azure.ResourceManager.Network/tests/Tests/FirewallPolicyTests.cs b/sdk/network/Azure.ResourceManager.Network/tests/Tests/FirewallPolicyTests.cs index e1714962bf2de..429fd070ab5a4 100644 --- a/sdk/network/Azure.ResourceManager.Network/tests/Tests/FirewallPolicyTests.cs +++ b/sdk/network/Azure.ResourceManager.Network/tests/Tests/FirewallPolicyTests.cs @@ -11,6 +11,7 @@ namespace Azure.ResourceManager.Network.Tests { + [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/24577")] public class FirewallPolicyTests : NetworkServiceClientTestBase { private ResourceGroup _resourceGroup; @@ -65,8 +66,8 @@ public async Task GlobalSetUp() firewallData.IpConfigurations.Add(new AzureFirewallIPConfiguration() { Name = "fwpip", - PublicIPAddress = new Models.SubResource() { Id = _publicIPAddressIdentifier }, - Subnet = new Models.SubResource() { Id = _networkIdentifier.ToString() + "/subnets/AzureFirewallSubnet" }, + PublicIPAddress = new WritableSubResource() { Id = _publicIPAddressIdentifier }, + Subnet = new WritableSubResource() { Id = _networkIdentifier.ToString() + "/subnets/AzureFirewallSubnet" }, }); var firewallLro = await rg.GetAzureFirewalls().CreateOrUpdateAsync(SessionRecording.GenerateAssetName("firewall-"), firewallData); _firewall = firewallLro.Value; diff --git a/sdk/network/Azure.ResourceManager.Network/tests/Tests/FirewallTests.cs b/sdk/network/Azure.ResourceManager.Network/tests/Tests/FirewallTests.cs index ab25168c6ea67..4a82e62084d82 100644 --- a/sdk/network/Azure.ResourceManager.Network/tests/Tests/FirewallTests.cs +++ b/sdk/network/Azure.ResourceManager.Network/tests/Tests/FirewallTests.cs @@ -13,6 +13,7 @@ namespace Azure.ResourceManager.Network.Tests { + [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/24577")] public class FirewallTests : NetworkServiceClientTestBase { private ResourceGroup _resourceGroup; @@ -97,8 +98,8 @@ public async Task CreateFirewall() firewallData.IpConfigurations.Add(new AzureFirewallIPConfiguration() { Name = "fwpip", - PublicIPAddress = new Models.SubResource() { Id = _publicIPAddressIdentifier }, - Subnet = new Models.SubResource() { Id = _networkIdentifier.ToString() + "/subnets/AzureFirewallSubnet" }, + PublicIPAddress = new WritableSubResource() { Id = _publicIPAddressIdentifier }, + Subnet = new WritableSubResource() { Id = _networkIdentifier.ToString() + "/subnets/AzureFirewallSubnet" }, }); var firewallLro = await (await _resourceGroup.GetAzureFirewalls().CreateOrUpdateAsync(_firewallName, firewallData)).WaitForCompletionAsync(); return firewallLro.Value; diff --git a/sdk/network/Azure.ResourceManager.Network/tests/Tests/GatewayOperationsTests.cs b/sdk/network/Azure.ResourceManager.Network/tests/Tests/GatewayOperationsTests.cs index bab75fc1f63fa..c66abece79c10 100644 --- a/sdk/network/Azure.ResourceManager.Network/tests/Tests/GatewayOperationsTests.cs +++ b/sdk/network/Azure.ResourceManager.Network/tests/Tests/GatewayOperationsTests.cs @@ -17,6 +17,7 @@ namespace Azure.ResourceManager.Network.Tests { + [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/24577")] public class GatewayOperationsTests : NetworkServiceClientTestBase { public GatewayOperationsTests(bool isAsync) : base(isAsync) @@ -83,11 +84,11 @@ public async Task VnetGatewayBaseTest() { Name = ipConfigName, PrivateIPAllocationMethod = IPAllocationMethod.Dynamic, - PublicIPAddress = new SubResource() + PublicIPAddress = new WritableSubResource() { Id = nic1publicIp.Id }, - Subnet = new SubResource() + Subnet = new WritableSubResource() { Id = getSubnetResponse.Value.Id } @@ -167,7 +168,7 @@ public async Task VnetGatewayConnectionSiteToSiteTest() Location = location, Tags = { { "key", "value" } }, EnableBgp = false, - GatewayDefaultSite = new SubResource() + GatewayDefaultSite = new WritableSubResource() { Id = getLocalNetworkGatewayResponse.Value.Id }, @@ -179,11 +180,11 @@ public async Task VnetGatewayConnectionSiteToSiteTest() { Name = ipConfigName, PrivateIPAllocationMethod = IPAllocationMethod.Dynamic, - PublicIPAddress = new SubResource() + PublicIPAddress = new WritableSubResource() { Id = nic1publicIp.Id }, - Subnet = new SubResource() + Subnet = new WritableSubResource() { Id = getSubnetResponse.Value.Id } @@ -304,11 +305,11 @@ public async Task VnetGatewayConnectionVnetToVnetTest() { Name = ipConfigName1, PrivateIPAllocationMethod = IPAllocationMethod.Dynamic, - PublicIPAddress = new SubResource() + PublicIPAddress = new WritableSubResource() { Id = nic1publicIp1.Id }, - Subnet = new SubResource() + Subnet = new WritableSubResource() { Id = getSubnetResponse1.Value.Id } @@ -362,11 +363,11 @@ public async Task VnetGatewayConnectionVnetToVnetTest() { Name = ipConfigName2, PrivateIPAllocationMethod = IPAllocationMethod.Dynamic, - PublicIPAddress = new SubResource() + PublicIPAddress = new WritableSubResource() { Id = nic2publicIp2.Id }, - Subnet = new SubResource() + Subnet = new WritableSubResource() { Id = getSubnetResponse2.Value.Id } @@ -466,11 +467,11 @@ public async Task VirtualNetworkGatewayOperationsApisTest() { Name = ipConfigName, PrivateIPAllocationMethod = IPAllocationMethod.Dynamic, - PublicIPAddress = new SubResource() + PublicIPAddress = new WritableSubResource() { Id = nic1publicIp.Id }, - Subnet = new SubResource() + Subnet = new WritableSubResource() { Id = getSubnetResponse.Value.Id } @@ -687,11 +688,11 @@ public async Task VirtualNetworkGatewayConnectionWithBgpTest() { Name = ipConfigName, PrivateIPAllocationMethod = IPAllocationMethod.Dynamic, - PublicIPAddress = new SubResource() + PublicIPAddress = new WritableSubResource() { Id = nic1publicIp.Id }, - Subnet = new SubResource() + Subnet = new WritableSubResource() { Id = getSubnetResponse.Value.Id } @@ -838,11 +839,11 @@ public async Task VirtualNetworkGatewayConnectionWithIpsecPoliciesTest() { Name = ipConfigName, PrivateIPAllocationMethod = IPAllocationMethod.Dynamic, - PublicIPAddress = new SubResource() + PublicIPAddress = new WritableSubResource() { Id = nic1publicIp.Id }, - Subnet = new SubResource() + Subnet = new WritableSubResource() { Id = getSubnetResponse.Value.Id } @@ -1033,7 +1034,7 @@ public async Task VirtualNetworkGatewayConnectionOperationsApisTest() Location = location, Tags = { { "key", "value" } }, EnableBgp = false, - GatewayDefaultSite = new SubResource() + GatewayDefaultSite = new WritableSubResource() { Id = getLocalNetworkGatewayResponse.Value.Id }, @@ -1045,11 +1046,11 @@ public async Task VirtualNetworkGatewayConnectionOperationsApisTest() { Name = ipConfigName, PrivateIPAllocationMethod = IPAllocationMethod.Dynamic, - PublicIPAddress = new SubResource() + PublicIPAddress = new WritableSubResource() { Id = nic1publicIp.Id }, - Subnet = new SubResource() + Subnet = new WritableSubResource() { Id = getSubnetResponse.Value.Id } @@ -1200,11 +1201,11 @@ public async Task VirtualNetworkGatewayConnectionSharedKeyOperationsApisTest() { Name = ipConfigName, PrivateIPAllocationMethod = IPAllocationMethod.Dynamic, - PublicIPAddress = new SubResource() + PublicIPAddress = new WritableSubResource() { Id = nic1publicIp.Id }, - Subnet = new SubResource() + Subnet = new WritableSubResource() { Id = getSubnetResponse.Value.Id } @@ -1343,7 +1344,7 @@ public async Task VirtualNetworkGatewayP2SOperationsApisTest() Name = VirtualNetworkGatewaySkuName.Basic, Tier = VirtualNetworkGatewaySkuTier.Basic, }, - GatewayDefaultSite = new SubResource() { Id = getLocalNetworkGatewayResponse.Value.Id }, + GatewayDefaultSite = new WritableSubResource() { Id = getLocalNetworkGatewayResponse.Value.Id }, GatewayType = VirtualNetworkGatewayType.Vpn, VpnType = VpnType.RouteBased, IpConfigurations = @@ -1352,8 +1353,8 @@ public async Task VirtualNetworkGatewayP2SOperationsApisTest() { Name = ipConfigName, PrivateIPAllocationMethod = IPAllocationMethod.Dynamic, - PublicIPAddress = new SubResource() { Id = nic1publicIp.Id }, - Subnet = new SubResource() { Id = getSubnetResponse.Value.Id } + PublicIPAddress = new WritableSubResource() { Id = nic1publicIp.Id }, + Subnet = new WritableSubResource() { Id = getSubnetResponse.Value.Id } } }, VpnClientConfiguration = new VpnClientConfiguration() @@ -1509,8 +1510,8 @@ public async Task VirtualNetworkGatewayActiveActiveFeatureTest() { Name = ipConfigName1, PrivateIPAllocationMethod = IPAllocationMethod.Dynamic, - PublicIPAddress = new SubResource() { Id = nic1publicIp1.Id }, - Subnet = new SubResource() { Id = getSubnetResponse.Value.Id } + PublicIPAddress = new WritableSubResource() { Id = nic1publicIp1.Id }, + Subnet = new WritableSubResource() { Id = getSubnetResponse.Value.Id } }; string ipConfigName2 = Recording.GenerateAssetName("azsmnet"); @@ -1518,8 +1519,8 @@ public async Task VirtualNetworkGatewayActiveActiveFeatureTest() { Name = ipConfigName2, PrivateIPAllocationMethod = IPAllocationMethod.Dynamic, - PublicIPAddress = new SubResource() { Id = nic1publicIp2.Id }, - Subnet = new SubResource() { Id = getSubnetResponse.Value.Id } + PublicIPAddress = new WritableSubResource() { Id = nic1publicIp2.Id }, + Subnet = new WritableSubResource() { Id = getSubnetResponse.Value.Id } }; var virtualNetworkGateway = new VirtualNetworkGatewayData() @@ -1616,8 +1617,8 @@ public async Task VirtualNetworkGatewayBgpRouteApiTest() { Name = gw1IpConfigName, PrivateIPAllocationMethod = IPAllocationMethod.Dynamic, - PublicIPAddress = new SubResource() { Id = publicIPAddress.Id }, - Subnet = new SubResource() { Id = gw1Subnet.Value.Id } + PublicIPAddress = new WritableSubResource() { Id = publicIPAddress.Id }, + Subnet = new WritableSubResource() { Id = gw1Subnet.Value.Id } }; var gw1 = new VirtualNetworkGatewayData() { @@ -1643,8 +1644,8 @@ public async Task VirtualNetworkGatewayBgpRouteApiTest() { Name = gw2IpConfigName, PrivateIPAllocationMethod = IPAllocationMethod.Dynamic, - PublicIPAddress = new SubResource() { Id = gw2Ip.Id }, - Subnet = new SubResource() { Id = gw2Subnet.Value.Id } + PublicIPAddress = new WritableSubResource() { Id = gw2Ip.Id }, + Subnet = new WritableSubResource() { Id = gw2Subnet.Value.Id } }; var gw2 = new VirtualNetworkGatewayData() { @@ -1777,8 +1778,8 @@ public async Task VirtualNetworkGatewayGenerateVpnProfileTest() { Name = ipConfigName, PrivateIPAllocationMethod = IPAllocationMethod.Dynamic, - PublicIPAddress = new SubResource() { Id = nic1publicIp.Id }, - Subnet = new SubResource() { Id = getSubnetResponse.Value.Id } + PublicIPAddress = new WritableSubResource() { Id = nic1publicIp.Id }, + Subnet = new WritableSubResource() { Id = getSubnetResponse.Value.Id } } }, VpnClientConfiguration = new VpnClientConfiguration() @@ -1925,8 +1926,8 @@ public async Task VirtualNetworkGatewayVpnDeviceConfigurationApisTest() { Name = ipConfigName, PrivateIPAllocationMethod = IPAllocationMethod.Dynamic, - PublicIPAddress = new SubResource() { Id = nic1publicIp.Id }, - Subnet = new SubResource() { Id = getSubnetResponse.Value.Id } + PublicIPAddress = new WritableSubResource() { Id = nic1publicIp.Id }, + Subnet = new WritableSubResource() { Id = getSubnetResponse.Value.Id } } }, Sku = new VirtualNetworkGatewaySku() diff --git a/sdk/network/Azure.ResourceManager.Network/tests/Tests/IpGroupTests.cs b/sdk/network/Azure.ResourceManager.Network/tests/Tests/IpGroupTests.cs index 2fdcb52ebe8f9..89afecf440255 100644 --- a/sdk/network/Azure.ResourceManager.Network/tests/Tests/IpGroupTests.cs +++ b/sdk/network/Azure.ResourceManager.Network/tests/Tests/IpGroupTests.cs @@ -13,6 +13,7 @@ namespace Azure.ResourceManager.Network.Tests { + [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/24577")] public class IpGroupTests : NetworkServiceClientTestBase { private ResourceGroup _resourceGroup; diff --git a/sdk/network/Azure.ResourceManager.Network/tests/Tests/LoadBalancerTests.cs b/sdk/network/Azure.ResourceManager.Network/tests/Tests/LoadBalancerTests.cs index e77b7377c73c8..00c180f8bc3b9 100644 --- a/sdk/network/Azure.ResourceManager.Network/tests/Tests/LoadBalancerTests.cs +++ b/sdk/network/Azure.ResourceManager.Network/tests/Tests/LoadBalancerTests.cs @@ -14,6 +14,7 @@ namespace Azure.ResourceManager.Network.Tests { + [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/24577")] public class LoadBalancerTests : NetworkServiceClientTestBase { public LoadBalancerTests(bool isAsync) : base(isAsync) @@ -82,7 +83,7 @@ public async Task LoadBalancerApiTest() new LoadBalancingRule() { Name = loadBalancingRuleName, - FrontendIPConfiguration = new SubResource() + FrontendIPConfiguration = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "frontendIPConfigurations", frontendIpConfigName) @@ -92,12 +93,12 @@ public async Task LoadBalancerApiTest() BackendPort = 80, EnableFloatingIP = false, IdleTimeoutInMinutes = 15, - BackendAddressPool = new SubResource() + BackendAddressPool = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "backendAddressPools", backEndAddressPoolName) }, - Probe = new SubResource() + Probe = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "probes", probeName) @@ -119,7 +120,7 @@ public async Task LoadBalancerApiTest() new InboundNatRuleData() { Name = inboundNatRule1Name, - FrontendIPConfiguration = new SubResource() + FrontendIPConfiguration = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "frontendIPConfigurations", frontendIpConfigName) @@ -133,7 +134,7 @@ public async Task LoadBalancerApiTest() new InboundNatRuleData() { Name = inboundNatRule2Name, - FrontendIPConfiguration = new SubResource() + FrontendIPConfiguration = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "frontendIPConfigurations", frontendIpConfigName) @@ -253,7 +254,7 @@ public async Task LoadBalancerApiTest() // Prepare the third InboundNatRule var inboundNatRule3Params = new InboundNatRuleData() { - FrontendIPConfiguration = new SubResource() + FrontendIPConfiguration = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "frontendIPConfigurations", frontendIpConfigName) @@ -357,7 +358,7 @@ public async Task LoadBalancerApiTestWithDynamicIp() new LoadBalancingRule() { Name = loadBalancingRuleName, - FrontendIPConfiguration = new SubResource() + FrontendIPConfiguration = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "frontendIPConfigurations", frontendIpConfigName) @@ -367,12 +368,12 @@ public async Task LoadBalancerApiTestWithDynamicIp() BackendPort = 80, EnableFloatingIP = false, IdleTimeoutInMinutes = 15, - BackendAddressPool = new SubResource() + BackendAddressPool = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "backendAddressPools", backEndAddressPoolName) }, - Probe = new SubResource() + Probe = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "probes", probeName) @@ -394,7 +395,7 @@ public async Task LoadBalancerApiTestWithDynamicIp() new InboundNatRuleData() { Name = inboundNatRule1Name, - FrontendIPConfiguration = new SubResource() + FrontendIPConfiguration = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "frontendIPConfigurations", frontendIpConfigName) @@ -408,7 +409,7 @@ public async Task LoadBalancerApiTestWithDynamicIp() new InboundNatRuleData() { Name = inboundNatRule2Name, - FrontendIPConfiguration = new SubResource() + FrontendIPConfiguration = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "frontendIPConfigurations", frontendIpConfigName) @@ -526,7 +527,7 @@ public async Task LoadBalancerApiTestWithStaticIp() new LoadBalancingRule() { Name = loadBalancingRuleName, - FrontendIPConfiguration = new SubResource() + FrontendIPConfiguration = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "frontendIPConfigurations", frontendIpConfigName) @@ -535,12 +536,12 @@ public async Task LoadBalancerApiTestWithStaticIp() FrontendPort = 80, BackendPort = 80, EnableFloatingIP = false, - BackendAddressPool = new SubResource() + BackendAddressPool = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "backendAddressPools", backEndAddressPoolName) }, - Probe = new SubResource() + Probe = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "probes", probeName) @@ -562,7 +563,7 @@ public async Task LoadBalancerApiTestWithStaticIp() new InboundNatRuleData() { Name = inboundNatRule1Name, - FrontendIPConfiguration = new SubResource() + FrontendIPConfiguration = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "frontendIPConfigurations", frontendIpConfigName) @@ -575,7 +576,7 @@ public async Task LoadBalancerApiTestWithStaticIp() new InboundNatRuleData() { Name = inboundNatRule2Name, - FrontendIPConfiguration = new SubResource() + FrontendIPConfiguration = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "frontendIPConfigurations", frontendIpConfigName) @@ -698,7 +699,7 @@ public async Task LoadBalancerApiTestWithDistributionPolicy() new LoadBalancingRule() { Name = loadBalancingRuleName, - FrontendIPConfiguration = new SubResource() + FrontendIPConfiguration = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "frontendIPConfigurations", frontendIpConfigName) @@ -707,12 +708,12 @@ public async Task LoadBalancerApiTestWithDistributionPolicy() FrontendPort = 80, BackendPort = 80, EnableFloatingIP = false, - BackendAddressPool = new SubResource() + BackendAddressPool = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "backendAddressPools", backEndAddressPoolName) }, - Probe = new SubResource() + Probe = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "probes", probeName) @@ -734,7 +735,7 @@ public async Task LoadBalancerApiTestWithDistributionPolicy() new InboundNatRuleData() { Name = inboundNatRule1Name, - FrontendIPConfiguration = new SubResource() + FrontendIPConfiguration = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "frontendIPConfigurations", frontendIpConfigName) @@ -747,7 +748,7 @@ public async Task LoadBalancerApiTestWithDistributionPolicy() new InboundNatRuleData() { Name = inboundNatRule2Name, - FrontendIPConfiguration = new SubResource() + FrontendIPConfiguration = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "frontendIPConfigurations", frontendIpConfigName) @@ -911,7 +912,7 @@ public async Task UpdateLoadBalancerRule() new LoadBalancingRule() { Name = loadBalancingRuleName, - FrontendIPConfiguration = new SubResource() + FrontendIPConfiguration = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbname, "frontendIPConfigurations", frontendIpConfigName) @@ -920,7 +921,7 @@ public async Task UpdateLoadBalancerRule() FrontendPort = 80, BackendPort = 80, EnableFloatingIP = false, - BackendAddressPool = new SubResource() + BackendAddressPool = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbname, "backendAddressPools", backEndAddressPoolName) @@ -956,7 +957,7 @@ public async Task UpdateLoadBalancerRule() } ); - getLoadBalancer.Value.Data.LoadBalancingRules[0].Probe = new SubResource() + getLoadBalancer.Value.Data.LoadBalancingRules[0].Probe = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbname, "probes", probeName) }; @@ -1053,7 +1054,7 @@ public async Task LoadBalancerApiNicAssociationTest() new LoadBalancingRule() { Name = loadBalancingRuleName, - FrontendIPConfiguration = new SubResource() + FrontendIPConfiguration = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "frontendIPConfigurations", frontendIpConfigName) @@ -1063,12 +1064,12 @@ public async Task LoadBalancerApiNicAssociationTest() BackendPort = 80, EnableFloatingIP = false, IdleTimeoutInMinutes = 15, - BackendAddressPool = new SubResource() + BackendAddressPool = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "backendAddressPools", backEndAddressPoolName) }, - Probe = new SubResource() + Probe = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "probes", probeName) @@ -1090,7 +1091,7 @@ public async Task LoadBalancerApiNicAssociationTest() new InboundNatRuleData() { Name = inboundNatRule1Name, - FrontendIPConfiguration = new SubResource() + FrontendIPConfiguration = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "frontendIPConfigurations", frontendIpConfigName) @@ -1104,7 +1105,7 @@ public async Task LoadBalancerApiNicAssociationTest() new InboundNatRuleData() { Name = inboundNatRule2Name, - FrontendIPConfiguration = new SubResource() + FrontendIPConfiguration = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "frontendIPConfigurations", frontendIpConfigName) @@ -1218,7 +1219,7 @@ public async Task LoadBalancerNatPoolTest() BackendPort = 81, FrontendPortRangeStart = 100, FrontendPortRangeEnd = 105, - FrontendIPConfiguration = new SubResource() + FrontendIPConfiguration = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "frontendIPConfigurations", frontendIpConfigName) @@ -1256,7 +1257,7 @@ public async Task LoadBalancerNatPoolTest() BackendPort = 81, FrontendPortRangeStart = 107, FrontendPortRangeEnd = 110, - FrontendIPConfiguration = new SubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "frontendIPConfigurations", frontendIpConfigName) }, + FrontendIPConfiguration = new WritableSubResource() { Id = GetChildLbResourceId(TestEnvironment.SubscriptionId, resourceGroupName, lbName, "frontendIPConfigurations", frontendIpConfigName) }, Protocol = TransportProtocol.Tcp }; getLoadBalancer.Value.Data.InboundNatPools.Add(natpool2); diff --git a/sdk/network/Azure.ResourceManager.Network/tests/Tests/NetworkInterfaceTests.cs b/sdk/network/Azure.ResourceManager.Network/tests/Tests/NetworkInterfaceTests.cs index b379de30a1c32..4d137a0e15dbc 100644 --- a/sdk/network/Azure.ResourceManager.Network/tests/Tests/NetworkInterfaceTests.cs +++ b/sdk/network/Azure.ResourceManager.Network/tests/Tests/NetworkInterfaceTests.cs @@ -14,6 +14,7 @@ namespace Azure.ResourceManager.Network.Tests { + [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/24577")] public class NetworkInterfaceTests : NetworkServiceClientTestBase { public NetworkInterfaceTests(bool isAsync) : base(isAsync) diff --git a/sdk/network/Azure.ResourceManager.Network/tests/Tests/NetworkSecurityGroupTests.cs b/sdk/network/Azure.ResourceManager.Network/tests/Tests/NetworkSecurityGroupTests.cs index d290d2e8046c2..de8f292ec0a4b 100644 --- a/sdk/network/Azure.ResourceManager.Network/tests/Tests/NetworkSecurityGroupTests.cs +++ b/sdk/network/Azure.ResourceManager.Network/tests/Tests/NetworkSecurityGroupTests.cs @@ -13,6 +13,7 @@ namespace Azure.ResourceManager.Network.Tests { + [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/24577")] public class NetworkSecurityGroupTests : NetworkServiceClientTestBase { public NetworkSecurityGroupTests(bool isAsync) : base(isAsync) diff --git a/sdk/network/Azure.ResourceManager.Network/tests/Tests/NetworkWatcherTests.cs b/sdk/network/Azure.ResourceManager.Network/tests/Tests/NetworkWatcherTests.cs index 6a44847135a4a..c83f7a8cacec2 100644 --- a/sdk/network/Azure.ResourceManager.Network/tests/Tests/NetworkWatcherTests.cs +++ b/sdk/network/Azure.ResourceManager.Network/tests/Tests/NetworkWatcherTests.cs @@ -13,6 +13,7 @@ namespace Azure.ResourceManager.Network.Tests { + [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/24577")] public class NetworkWatcherTests : NetworkServiceClientTestBase { public NetworkWatcherTests(bool isAsync) : base(isAsync) diff --git a/sdk/network/Azure.ResourceManager.Network/tests/Tests/PublicIpAddressTests.cs b/sdk/network/Azure.ResourceManager.Network/tests/Tests/PublicIpAddressTests.cs index dc9a42eee7aeb..162af9892ad9a 100644 --- a/sdk/network/Azure.ResourceManager.Network/tests/Tests/PublicIpAddressTests.cs +++ b/sdk/network/Azure.ResourceManager.Network/tests/Tests/PublicIpAddressTests.cs @@ -13,6 +13,7 @@ namespace Azure.ResourceManager.Network.Tests { + [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/24577")] public class PublicIpAddressTests : NetworkServiceClientTestBase { public PublicIpAddressTests(bool isAsync) : base(isAsync) diff --git a/sdk/network/Azure.ResourceManager.Network/tests/Tests/PublicIpPrefixTests.cs b/sdk/network/Azure.ResourceManager.Network/tests/Tests/PublicIpPrefixTests.cs index c44736f5321ca..3639c8736acc7 100644 --- a/sdk/network/Azure.ResourceManager.Network/tests/Tests/PublicIpPrefixTests.cs +++ b/sdk/network/Azure.ResourceManager.Network/tests/Tests/PublicIpPrefixTests.cs @@ -13,8 +13,8 @@ namespace Azure.ResourceManager.Network.Tests { - public class PublicIpPrefixTests - : NetworkServiceClientTestBase + [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/24577")] + public class PublicIpPrefixTests : NetworkServiceClientTestBase { public PublicIpPrefixTests(bool isAsync) : base(isAsync) { diff --git a/sdk/network/Azure.ResourceManager.Network/tests/Tests/RouteFilterTests.cs b/sdk/network/Azure.ResourceManager.Network/tests/Tests/RouteFilterTests.cs index d8029141be518..99dcc0b771033 100644 --- a/sdk/network/Azure.ResourceManager.Network/tests/Tests/RouteFilterTests.cs +++ b/sdk/network/Azure.ResourceManager.Network/tests/Tests/RouteFilterTests.cs @@ -15,6 +15,7 @@ namespace Azure.ResourceManager.Network.Tests { + [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/24577")] public class RouteFilterTests : NetworkServiceClientTestBase { public RouteFilterTests(bool isAsync) : base(isAsync) diff --git a/sdk/network/Azure.ResourceManager.Network/tests/Tests/RouteTableTests.cs b/sdk/network/Azure.ResourceManager.Network/tests/Tests/RouteTableTests.cs index 12829cda55a0d..679502e67ffff 100644 --- a/sdk/network/Azure.ResourceManager.Network/tests/Tests/RouteTableTests.cs +++ b/sdk/network/Azure.ResourceManager.Network/tests/Tests/RouteTableTests.cs @@ -12,6 +12,7 @@ namespace Azure.ResourceManager.Network.Tests { + [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/24577")] public class RouteTableTests : NetworkServiceClientTestBase { public RouteTableTests(bool isAsync) : base(isAsync) diff --git a/sdk/network/Azure.ResourceManager.Network/tests/Tests/RouteTests.cs b/sdk/network/Azure.ResourceManager.Network/tests/Tests/RouteTests.cs index 5308e93f0d156..40ead83e28185 100644 --- a/sdk/network/Azure.ResourceManager.Network/tests/Tests/RouteTests.cs +++ b/sdk/network/Azure.ResourceManager.Network/tests/Tests/RouteTests.cs @@ -12,6 +12,7 @@ namespace Azure.ResourceManager.Network.Tests { + [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/24577")] public class RouteTests : NetworkServiceClientTestBase { public RouteTests(bool isAsync) : base(isAsync) diff --git a/sdk/network/Azure.ResourceManager.Network/tests/Tests/SecurityRuleTests.cs b/sdk/network/Azure.ResourceManager.Network/tests/Tests/SecurityRuleTests.cs index cb0486071fcd8..02ecd6197845b 100644 --- a/sdk/network/Azure.ResourceManager.Network/tests/Tests/SecurityRuleTests.cs +++ b/sdk/network/Azure.ResourceManager.Network/tests/Tests/SecurityRuleTests.cs @@ -12,6 +12,7 @@ namespace Azure.ResourceManager.Network.Tests { + [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/24577")] public class SecurityRuleTests : NetworkServiceClientTestBase { public SecurityRuleTests(bool isAsync) : base(isAsync) diff --git a/sdk/network/Azure.ResourceManager.Network/tests/Tests/SubnetTests.cs b/sdk/network/Azure.ResourceManager.Network/tests/Tests/SubnetTests.cs index 1cd8e8a4b3201..40fdd57193f0d 100644 --- a/sdk/network/Azure.ResourceManager.Network/tests/Tests/SubnetTests.cs +++ b/sdk/network/Azure.ResourceManager.Network/tests/Tests/SubnetTests.cs @@ -12,6 +12,7 @@ namespace Azure.ResourceManager.Network.Tests { + [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/24577")] public class SubnetTests : NetworkServiceClientTestBase { public SubnetTests(bool isAsync) : base(isAsync) diff --git a/sdk/network/Azure.ResourceManager.Network/tests/Tests/UsageTests.cs b/sdk/network/Azure.ResourceManager.Network/tests/Tests/UsageTests.cs index 63ae225bb05a9..4bf8d3e697360 100644 --- a/sdk/network/Azure.ResourceManager.Network/tests/Tests/UsageTests.cs +++ b/sdk/network/Azure.ResourceManager.Network/tests/Tests/UsageTests.cs @@ -12,6 +12,7 @@ namespace Azure.ResourceManager.Network.Tests { + [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/24577")] public class UsageTests : NetworkServiceClientTestBase { public UsageTests(bool isAsync) : base(isAsync) diff --git a/sdk/network/Azure.ResourceManager.Network/tests/Tests/VirtualNetworkPeeringTests.cs b/sdk/network/Azure.ResourceManager.Network/tests/Tests/VirtualNetworkPeeringTests.cs index 7dc5055692a20..d1e061abb5020 100644 --- a/sdk/network/Azure.ResourceManager.Network/tests/Tests/VirtualNetworkPeeringTests.cs +++ b/sdk/network/Azure.ResourceManager.Network/tests/Tests/VirtualNetworkPeeringTests.cs @@ -13,6 +13,7 @@ namespace Azure.ResourceManager.Network.Tests { + [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/24577")] public class VirtualNetworkPeeringTests : NetworkServiceClientTestBase { public VirtualNetworkPeeringTests(bool isAsync) : base(isAsync) @@ -87,7 +88,7 @@ public async Task VirtualNetworkPeeringApiTest() var peering = new VirtualNetworkPeeringData { Name = vnetPeeringName, - RemoteVirtualNetwork = new SubResource + RemoteVirtualNetwork = new WritableSubResource { Id = remoteVirtualNetwork.Value.Id }, diff --git a/sdk/network/Azure.ResourceManager.Network/tests/Tests/VirtualNetworkTests.cs b/sdk/network/Azure.ResourceManager.Network/tests/Tests/VirtualNetworkTests.cs index cb62ac56cc061..a0b51b98a6c49 100644 --- a/sdk/network/Azure.ResourceManager.Network/tests/Tests/VirtualNetworkTests.cs +++ b/sdk/network/Azure.ResourceManager.Network/tests/Tests/VirtualNetworkTests.cs @@ -13,6 +13,7 @@ namespace Azure.ResourceManager.Network.Tests { + [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/24577")] public class VirtualNetworkTests : NetworkServiceClientTestBase { public VirtualNetworkTests(bool isAsync) : base(isAsync) @@ -230,7 +231,7 @@ public async Task VirtualNetworkPeeringTest() var peering = new VirtualNetworkPeeringData() { AllowForwardedTraffic = true, - RemoteVirtualNetwork = new SubResource { Id = putVnet2.Value.Id } + RemoteVirtualNetwork = new WritableSubResource { Id = putVnet2.Value.Id } }; // Create Peering diff --git a/sdk/purview/Azure.Analytics.Purview.Account/api/Azure.Analytics.Purview.Account.netstandard2.0.cs b/sdk/purview/Azure.Analytics.Purview.Account/api/Azure.Analytics.Purview.Account.netstandard2.0.cs index 82db3b11bd1ea..57422bf223444 100644 --- a/sdk/purview/Azure.Analytics.Purview.Account/api/Azure.Analytics.Purview.Account.netstandard2.0.cs +++ b/sdk/purview/Azure.Analytics.Purview.Account/api/Azure.Analytics.Purview.Account.netstandard2.0.cs @@ -5,16 +5,16 @@ public partial class PurviewAccountClient protected PurviewAccountClient() { } public PurviewAccountClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Analytics.Purview.Account.PurviewAccountClientOptions options = null) { } public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } - public virtual Azure.Response GetAccessKeys(Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetAccessKeysAsync(Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetAccountProperties(Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetAccountPropertiesAsync(Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response GetAccessKeys(Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetAccessKeysAsync(Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetAccountProperties(Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetAccountPropertiesAsync(Azure.RequestOptions options) { throw null; } public virtual Azure.Analytics.Purview.Account.PurviewCollection GetCollectionClient(string collectionName) { throw null; } - public virtual Azure.Response GetCollections(string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetCollectionsAsync(string skipToken = null, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Pageable GetCollections(Azure.RequestOptions options, string skipToken = null) { throw null; } + public virtual Azure.AsyncPageable GetCollectionsAsync(Azure.RequestOptions options, string skipToken = null) { throw null; } public virtual Azure.Analytics.Purview.Account.PurviewResourceSetRule GetResourceSetRuleClient() { throw null; } - public virtual Azure.Response GetResourceSetRules(string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetResourceSetRulesAsync(string skipToken = null, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Pageable GetResourceSetRules(Azure.RequestOptions options, string skipToken = null) { throw null; } + public virtual Azure.AsyncPageable GetResourceSetRulesAsync(Azure.RequestOptions options, string skipToken = null) { throw null; } public virtual Azure.Response RegenerateAccessKey(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task RegenerateAccessKeyAsync(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual Azure.Response UpdateAccountProperties(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } @@ -36,12 +36,12 @@ protected PurviewCollection() { } public virtual System.Threading.Tasks.Task CreateOrUpdateCollectionAsync(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual Azure.Response DeleteCollection(Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task DeleteCollectionAsync(Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetCollection(Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetCollectionAsync(Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetCollectionPath(Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetCollectionPathAsync(Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response ListChildCollectionNames(string skipToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task ListChildCollectionNamesAsync(string skipToken = null, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response GetCollection(Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetCollectionAsync(Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetCollectionPath(Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetCollectionPathAsync(Azure.RequestOptions options) { throw null; } + public virtual Azure.Pageable ListChildCollectionNames(Azure.RequestOptions options, string skipToken = null) { throw null; } + public virtual Azure.AsyncPageable ListChildCollectionNamesAsync(Azure.RequestOptions options, string skipToken = null) { throw null; } } public partial class PurviewResourceSetRule { @@ -51,7 +51,7 @@ protected PurviewResourceSetRule() { } public virtual System.Threading.Tasks.Task CreateOrUpdateResourceSetRuleAsync(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual Azure.Response DeleteResourceSetRule(Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task DeleteResourceSetRuleAsync(Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetResourceSetRule(Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetResourceSetRuleAsync(Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response GetResourceSetRule(Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetResourceSetRuleAsync(Azure.RequestOptions options) { throw null; } } } diff --git a/sdk/purview/Azure.Analytics.Purview.Account/src/Azure.Analytics.Purview.Account.csproj b/sdk/purview/Azure.Analytics.Purview.Account/src/Azure.Analytics.Purview.Account.csproj index 147be72eac6e3..cd1c62d2b3e65 100644 --- a/sdk/purview/Azure.Analytics.Purview.Account/src/Azure.Analytics.Purview.Account.csproj +++ b/sdk/purview/Azure.Analytics.Purview.Account/src/Azure.Analytics.Purview.Account.csproj @@ -6,6 +6,7 @@ Azure Purview $(RequiredTargetFrameworks) $(NoWarn);CS0169 + $(DefineConstants);EXPERIMENTAL diff --git a/sdk/purview/Azure.Analytics.Purview.Account/src/Customizations/PurviewAccountClient.cs b/sdk/purview/Azure.Analytics.Purview.Account/src/Customizations/PurviewAccountClient.cs index 2bf6346f38a81..093586ce4f84b 100644 --- a/sdk/purview/Azure.Analytics.Purview.Account/src/Customizations/PurviewAccountClient.cs +++ b/sdk/purview/Azure.Analytics.Purview.Account/src/Customizations/PurviewAccountClient.cs @@ -21,7 +21,7 @@ public virtual PurviewCollection GetCollectionClient(string collectionName) throw new ArgumentNullException(nameof(collectionName)); } - return new PurviewCollection(Pipeline, _tokenCredential, endpoint, collectionName, apiVersion, _clientDiagnostics); + return new PurviewCollection(Pipeline, _tokenCredential, _endpoint, collectionName, _apiVersion, _clientDiagnostics); } /// @@ -30,7 +30,7 @@ public virtual PurviewCollection GetCollectionClient(string collectionName) /// A service client for interacting with a resource set rule. public virtual PurviewResourceSetRule GetResourceSetRuleClient() { - return new PurviewResourceSetRule(Pipeline, _tokenCredential, endpoint, apiVersion, _clientDiagnostics); + return new PurviewResourceSetRule(Pipeline, _tokenCredential, _endpoint, _apiVersion, _clientDiagnostics); } } } diff --git a/sdk/purview/Azure.Analytics.Purview.Account/src/Customizations/PurviewCollection.cs b/sdk/purview/Azure.Analytics.Purview.Account/src/Customizations/PurviewCollection.cs index 38f2ae010f6a3..87f3ae8c0af25 100644 --- a/sdk/purview/Azure.Analytics.Purview.Account/src/Customizations/PurviewCollection.cs +++ b/sdk/purview/Azure.Analytics.Purview.Account/src/Customizations/PurviewCollection.cs @@ -15,9 +15,9 @@ internal PurviewCollection(HttpPipeline pipeline, TokenCredential tokenCredentia { _pipeline = pipeline; _tokenCredential = tokenCredential; - this.endpoint = endpoint; - this.collectionName = collectionName; - this.apiVersion = apiVersion; + _endpoint = endpoint; + _collectionName = collectionName; + _apiVersion = apiVersion; _clientDiagnostics = clientDiagnostics; } } diff --git a/sdk/purview/Azure.Analytics.Purview.Account/src/Customizations/PurviewResourceSetRule.cs b/sdk/purview/Azure.Analytics.Purview.Account/src/Customizations/PurviewResourceSetRule.cs index 0009eeb1601cc..9501660db6928 100644 --- a/sdk/purview/Azure.Analytics.Purview.Account/src/Customizations/PurviewResourceSetRule.cs +++ b/sdk/purview/Azure.Analytics.Purview.Account/src/Customizations/PurviewResourceSetRule.cs @@ -15,8 +15,8 @@ internal PurviewResourceSetRule(HttpPipeline pipeline, TokenCredential tokenCred { _pipeline = pipeline; _tokenCredential = tokenCredential; - this.endpoint = endpoint; - this.apiVersion = apiVersion; + _endpoint = endpoint; + _apiVersion = apiVersion; _clientDiagnostics = clientDiagnostics; } } diff --git a/sdk/purview/Azure.Analytics.Purview.Account/src/Generated/PurviewAccountClient.cs b/sdk/purview/Azure.Analytics.Purview.Account/src/Generated/PurviewAccountClient.cs index 7208d03ed6f6a..ad9cb58ae86d0 100644 --- a/sdk/purview/Azure.Analytics.Purview.Account/src/Generated/PurviewAccountClient.cs +++ b/sdk/purview/Azure.Analytics.Purview.Account/src/Generated/PurviewAccountClient.cs @@ -6,6 +6,9 @@ #nullable disable using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; @@ -16,14 +19,16 @@ namespace Azure.Analytics.Purview.Account /// The PurviewAccount service client. public partial class PurviewAccountClient { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of PurviewAccountClient for mocking. protected PurviewAccountClient() @@ -34,6 +39,7 @@ protected PurviewAccountClient() /// The account endpoint of your Purview account. Example: https://{accountName}.purview.azure.com/account/. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. + /// or is null. public PurviewAccountClient(Uri endpoint, TokenCredential credential, PurviewAccountClientOptions options = null) { if (endpoint == null) @@ -46,15 +52,16 @@ public PurviewAccountClient(Uri endpoint, TokenCredential credential, PurviewAcc } options ??= new PurviewAccountClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); _tokenCredential = credential; - var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); - _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { authPolicy }, new ResponseClassifier()); - this.endpoint = endpoint; - apiVersion = options.Version; + _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; } /// Get an account. + /// The request options. /// /// Schema for Response Body: /// { @@ -122,7 +129,6 @@ public PurviewAccountClient(Uri endpoint, TokenCredential credential, PurviewAcc /// type: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -142,33 +148,16 @@ public PurviewAccountClient(Uri endpoint, TokenCredential credential, PurviewAcc /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetAccountPropertiesAsync(RequestOptions options = null) + public virtual async Task GetAccountPropertiesAsync(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetAccountPropertiesRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewAccountClient.GetAccountProperties"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetAccountPropertiesRequest(); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -178,6 +167,7 @@ public virtual async Task GetAccountPropertiesAsync(RequestOptions opt } /// Get an account. + /// The request options. /// /// Schema for Response Body: /// { @@ -245,7 +235,6 @@ public virtual async Task GetAccountPropertiesAsync(RequestOptions opt /// type: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -265,33 +254,16 @@ public virtual async Task GetAccountPropertiesAsync(RequestOptions opt /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetAccountProperties(RequestOptions options = null) + public virtual Response GetAccountProperties(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetAccountPropertiesRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewAccountClient.GetAccountProperties"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetAccountPropertiesRequest(); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -300,28 +272,16 @@ public virtual Response GetAccountProperties(RequestOptions options = null) } } - private HttpMessage CreateGetAccountPropertiesRequest() - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Updates an account. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { /// friendlyName: string /// } /// - /// /// Schema for Response Body: /// { /// id: string, @@ -388,7 +348,6 @@ private HttpMessage CreateGetAccountPropertiesRequest() /// type: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -408,34 +367,16 @@ private HttpMessage CreateGetAccountPropertiesRequest() /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task UpdateAccountPropertiesAsync(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateUpdateAccountPropertiesRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewAccountClient.UpdateAccountProperties"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateUpdateAccountPropertiesRequest(content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -445,13 +386,15 @@ public virtual async Task UpdateAccountPropertiesAsync(RequestContent } /// Updates an account. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { /// friendlyName: string /// } /// - /// /// Schema for Response Body: /// { /// id: string, @@ -518,7 +461,6 @@ public virtual async Task UpdateAccountPropertiesAsync(RequestContent /// type: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -538,34 +480,16 @@ public virtual async Task UpdateAccountPropertiesAsync(RequestContent /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response UpdateAccountProperties(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateUpdateAccountPropertiesRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewAccountClient.UpdateAccountProperties"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateUpdateAccountPropertiesRequest(content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -574,23 +498,8 @@ public virtual Response UpdateAccountProperties(RequestContent content, RequestO } } - private HttpMessage CreateUpdateAccountPropertiesRequest(RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/", 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; - } - /// List the authorization keys associated with this account. + /// The request options. /// /// Schema for Response Body: /// { @@ -598,7 +507,6 @@ private HttpMessage CreateUpdateAccountPropertiesRequest(RequestContent content) /// atlasKafkaSecondaryEndpoint: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -618,33 +526,16 @@ private HttpMessage CreateUpdateAccountPropertiesRequest(RequestContent content) /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetAccessKeysAsync(RequestOptions options = null) + public virtual async Task GetAccessKeysAsync(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetAccessKeysRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewAccountClient.GetAccessKeys"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetAccessKeysRequest(); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -654,6 +545,7 @@ public virtual async Task GetAccessKeysAsync(RequestOptions options = } /// List the authorization keys associated with this account. + /// The request options. /// /// Schema for Response Body: /// { @@ -661,7 +553,6 @@ public virtual async Task GetAccessKeysAsync(RequestOptions options = /// atlasKafkaSecondaryEndpoint: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -681,33 +572,16 @@ public virtual async Task GetAccessKeysAsync(RequestOptions options = /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetAccessKeys(RequestOptions options = null) + public virtual Response GetAccessKeys(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetAccessKeysRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewAccountClient.GetAccessKeys"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetAccessKeysRequest(); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -716,35 +590,22 @@ public virtual Response GetAccessKeys(RequestOptions options = null) } } - private HttpMessage CreateGetAccessKeysRequest() - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/listkeys", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Regenerate the authorization keys associated with this data catalog. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { /// keyType: "PrimaryAtlasKafkaKey" | "SecondaryAtlasKafkaKey" /// } /// - /// /// Schema for Response Body: /// { /// atlasKafkaPrimaryEndpoint: string, /// atlasKafkaSecondaryEndpoint: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -764,34 +625,16 @@ private HttpMessage CreateGetAccessKeysRequest() /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task RegenerateAccessKeyAsync(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateRegenerateAccessKeyRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewAccountClient.RegenerateAccessKey"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateRegenerateAccessKeyRequest(content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -801,20 +644,21 @@ public virtual async Task RegenerateAccessKeyAsync(RequestContent cont } /// Regenerate the authorization keys associated with this data catalog. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { /// keyType: "PrimaryAtlasKafkaKey" | "SecondaryAtlasKafkaKey" /// } /// - /// /// Schema for Response Body: /// { /// atlasKafkaPrimaryEndpoint: string, /// atlasKafkaSecondaryEndpoint: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -834,34 +678,16 @@ public virtual async Task RegenerateAccessKeyAsync(RequestContent cont /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response RegenerateAccessKey(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateRegenerateAccessKeyRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewAccountClient.RegenerateAccessKey"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateRegenerateAccessKeyRequest(content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -870,23 +696,9 @@ public virtual Response RegenerateAccessKey(RequestContent content, RequestOptio } } - private HttpMessage CreateRegenerateAccessKeyRequest(RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/regeneratekeys", 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; - } - /// List the collections in the account. + /// The request options. + /// The String to use. /// /// Schema for Response Body: /// { @@ -914,7 +726,6 @@ private HttpMessage CreateRegenerateAccessKeyRequest(RequestContent content) /// ] /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -934,43 +745,28 @@ private HttpMessage CreateRegenerateAccessKeyRequest(RequestContent content) /// /// /// - /// The String to use. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetCollectionsAsync(string skipToken = null, RequestOptions options = null) + public virtual AsyncPageable GetCollectionsAsync(RequestOptions options, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetCollectionsRequest(skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewAccountClient.GetCollections"); - scope.Start(); - try + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "PurviewAccountClient.GetCollections"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) + do { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetCollectionsRequest(skipToken) + : CreateGetCollectionsNextPageRequest(nextLink, skipToken); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } /// List the collections in the account. + /// The request options. + /// The String to use. /// /// Schema for Response Body: /// { @@ -998,7 +794,6 @@ public virtual async Task GetCollectionsAsync(string skipToken = null, /// ] /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1018,61 +813,28 @@ public virtual async Task GetCollectionsAsync(string skipToken = null, /// /// /// - /// The String to use. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetCollections(string skipToken = null, RequestOptions options = null) + public virtual Pageable GetCollections(RequestOptions options, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetCollectionsRequest(skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewAccountClient.GetCollections"); - scope.Start(); - try + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "PurviewAccountClient.GetCollections"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else + do { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetCollectionsRequest(skipToken) + : CreateGetCollectionsNextPageRequest(nextLink, skipToken); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - private HttpMessage CreateGetCollectionsRequest(string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/collections", false); - uri.AppendQuery("api-version", apiVersion, true); - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Get a resource set config service model. + /// The request options. + /// The String to use. /// /// Schema for Response Body: /// { @@ -1174,7 +936,6 @@ private HttpMessage CreateGetCollectionsRequest(string skipToken) /// ] /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1194,43 +955,28 @@ private HttpMessage CreateGetCollectionsRequest(string skipToken) /// /// /// - /// The String to use. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetResourceSetRulesAsync(string skipToken = null, RequestOptions options = null) + public virtual AsyncPageable GetResourceSetRulesAsync(RequestOptions options, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetResourceSetRulesRequest(skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewAccountClient.GetResourceSetRules"); - scope.Start(); - try + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "PurviewAccountClient.GetResourceSetRules"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) + do { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetResourceSetRulesRequest(skipToken) + : CreateGetResourceSetRulesNextPageRequest(nextLink, skipToken); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } /// Get a resource set config service model. + /// The request options. + /// The String to use. /// /// Schema for Response Body: /// { @@ -1332,7 +1078,6 @@ public virtual async Task GetResourceSetRulesAsync(string skipToken = /// ] /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1352,58 +1097,167 @@ public virtual async Task GetResourceSetRulesAsync(string skipToken = /// /// /// - /// The String to use. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetResourceSetRules(string skipToken = null, RequestOptions options = null) + public virtual Pageable GetResourceSetRules(RequestOptions options, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetResourceSetRulesRequest(skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewAccountClient.GetResourceSetRules"); - scope.Start(); - try + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "PurviewAccountClient.GetResourceSetRules"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else + do { - return message.Response; - } + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetResourceSetRulesRequest(skipToken) + : CreateGetResourceSetRulesNextPageRequest(nextLink, skipToken); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } - catch (Exception e) + } + + internal HttpMessage CreateGetAccountPropertiesRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateUpdateAccountPropertiesRequest(RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Patch; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/", 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; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetAccessKeysRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/listkeys", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateRegenerateAccessKeyRequest(RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/regeneratekeys", 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; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetCollectionsRequest(string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/collections", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (skipToken != null) { - scope.Failed(e); - throw; + uri.AppendQuery("$skipToken", skipToken, true); } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; } - private HttpMessage CreateGetResourceSetRulesRequest(string skipToken) + internal HttpMessage CreateGetResourceSetRulesRequest(string skipToken) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); + uri.Reset(_endpoint); uri.AppendPath("/resourceSetRuleConfigs", false); - uri.AppendQuery("api-version", apiVersion, true); + uri.AppendQuery("api-version", _apiVersion, true); if (skipToken != null) { uri.AppendQuery("$skipToken", skipToken, true); } request.Uri = uri; request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetCollectionsNextPageRequest(string nextLink, string skipToken) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; return message; } + + internal HttpMessage CreateGetResourceSetRulesNextPageRequest(string nextLink, string skipToken) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } } } diff --git a/sdk/purview/Azure.Analytics.Purview.Account/src/Generated/PurviewCollection.cs b/sdk/purview/Azure.Analytics.Purview.Account/src/Generated/PurviewCollection.cs index 00b42b4f67f46..53b532de4be2c 100644 --- a/sdk/purview/Azure.Analytics.Purview.Account/src/Generated/PurviewCollection.cs +++ b/sdk/purview/Azure.Analytics.Purview.Account/src/Generated/PurviewCollection.cs @@ -6,6 +6,9 @@ #nullable disable using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; @@ -16,15 +19,17 @@ namespace Azure.Analytics.Purview.Account /// The PurviewCollection service client. public partial class PurviewCollection { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private string collectionName; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _collectionName; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of PurviewCollection for mocking. protected PurviewCollection() @@ -32,6 +37,7 @@ protected PurviewCollection() } /// Get a collection. + /// The request options. /// /// Schema for Response Body: /// { @@ -53,7 +59,6 @@ protected PurviewCollection() /// } /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -73,33 +78,16 @@ protected PurviewCollection() /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetCollectionAsync(RequestOptions options = null) + public virtual async Task GetCollectionAsync(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetCollectionRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewCollection.GetCollection"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetCollectionRequest(); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -109,6 +97,7 @@ public virtual async Task GetCollectionAsync(RequestOptions options = } /// Get a collection. + /// The request options. /// /// Schema for Response Body: /// { @@ -130,7 +119,6 @@ public virtual async Task GetCollectionAsync(RequestOptions options = /// } /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -150,33 +138,16 @@ public virtual async Task GetCollectionAsync(RequestOptions options = /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetCollection(RequestOptions options = null) + public virtual Response GetCollection(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetCollectionRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewCollection.GetCollection"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetCollectionRequest(); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -185,22 +156,10 @@ public virtual Response GetCollection(RequestOptions options = null) } } - private HttpMessage CreateGetCollectionRequest() - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/collections/", false); - uri.AppendPath(collectionName, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Creates or updates a collection entity. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -222,7 +181,6 @@ private HttpMessage CreateGetCollectionRequest() /// } /// } /// - /// /// Schema for Response Body: /// { /// collectionProvisioningState: "Unknown" | "Creating" | "Moving" | "Deleting" | "Failed" | "Succeeded", @@ -243,7 +201,6 @@ private HttpMessage CreateGetCollectionRequest() /// } /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -263,34 +220,16 @@ private HttpMessage CreateGetCollectionRequest() /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task CreateOrUpdateCollectionAsync(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateCollectionRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewCollection.CreateOrUpdateCollection"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateCollectionRequest(content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -300,6 +239,9 @@ public virtual async Task CreateOrUpdateCollectionAsync(RequestContent } /// Creates or updates a collection entity. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -321,7 +263,6 @@ public virtual async Task CreateOrUpdateCollectionAsync(RequestContent /// } /// } /// - /// /// Schema for Response Body: /// { /// collectionProvisioningState: "Unknown" | "Creating" | "Moving" | "Deleting" | "Failed" | "Succeeded", @@ -342,7 +283,6 @@ public virtual async Task CreateOrUpdateCollectionAsync(RequestContent /// } /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -362,34 +302,16 @@ public virtual async Task CreateOrUpdateCollectionAsync(RequestContent /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response CreateOrUpdateCollection(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateCollectionRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewCollection.CreateOrUpdateCollection"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateCollectionRequest(content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -398,24 +320,8 @@ public virtual Response CreateOrUpdateCollection(RequestContent content, Request } } - private HttpMessage CreateCreateOrUpdateCollectionRequest(RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/collections/", false); - uri.AppendPath(collectionName, 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; - } - /// Deletes a Collection entity. + /// The request options. /// /// Schema for Response Error: /// { @@ -436,33 +342,16 @@ private HttpMessage CreateCreateOrUpdateCollectionRequest(RequestContent content /// /// /// - /// The request options. #pragma warning disable AZC0002 public virtual async Task DeleteCollectionAsync(RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteCollectionRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewCollection.DeleteCollection"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteCollectionRequest(); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -472,6 +361,7 @@ public virtual async Task DeleteCollectionAsync(RequestOptions options } /// Deletes a Collection entity. + /// The request options. /// /// Schema for Response Error: /// { @@ -492,33 +382,16 @@ public virtual async Task DeleteCollectionAsync(RequestOptions options /// /// /// - /// The request options. #pragma warning disable AZC0002 public virtual Response DeleteCollection(RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteCollectionRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewCollection.DeleteCollection"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteCollectionRequest(); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -527,36 +400,15 @@ public virtual Response DeleteCollection(RequestOptions options = null) } } - private HttpMessage CreateDeleteCollectionRequest() - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/collections/", false); - uri.AppendPath(collectionName, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the child collections names in the collection. + /// Gets the parent name and parent friendly name chains that represent the collection path. + /// The request options. /// /// Schema for Response Body: /// { - /// count: number, - /// nextLink: string, - /// value: [ - /// { - /// friendlyName: string, - /// name: string - /// } - /// ] + /// parentFriendlyNameChain: [string], + /// parentNameChain: [string] /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -576,34 +428,16 @@ private HttpMessage CreateDeleteCollectionRequest() /// /// /// - /// The String to use. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task ListChildCollectionNamesAsync(string skipToken = null, RequestOptions options = null) + public virtual async Task GetCollectionPathAsync(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListChildCollectionNamesRequest(skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewCollection.ListChildCollectionNames"); + using var scope = _clientDiagnostics.CreateScope("PurviewCollection.GetCollectionPath"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetCollectionPathRequest(); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -612,21 +446,15 @@ public virtual async Task ListChildCollectionNamesAsync(string skipTok } } - /// Lists the child collections names in the collection. + /// Gets the parent name and parent friendly name chains that represent the collection path. + /// The request options. /// /// Schema for Response Body: /// { - /// count: number, - /// nextLink: string, - /// value: [ - /// { - /// friendlyName: string, - /// name: string - /// } - /// ] + /// parentFriendlyNameChain: [string], + /// parentNameChain: [string] /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -646,34 +474,16 @@ public virtual async Task ListChildCollectionNamesAsync(string skipTok /// /// /// - /// The String to use. - /// The request options. #pragma warning disable AZC0002 - public virtual Response ListChildCollectionNames(string skipToken = null, RequestOptions options = null) + public virtual Response GetCollectionPath(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListChildCollectionNamesRequest(skipToken); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewCollection.ListChildCollectionNames"); + using var scope = _clientDiagnostics.CreateScope("PurviewCollection.GetCollectionPath"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetCollectionPathRequest(); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -682,35 +492,22 @@ public virtual Response ListChildCollectionNames(string skipToken = null, Reques } } - private HttpMessage CreateListChildCollectionNamesRequest(string skipToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/collections/", false); - uri.AppendPath(collectionName, true); - uri.AppendPath("/getChildCollectionNames", false); - uri.AppendQuery("api-version", apiVersion, true); - if (skipToken != null) - { - uri.AppendQuery("$skipToken", skipToken, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets the parent name and parent friendly name chains that represent the collection path. + /// Lists the child collections names in the collection. + /// The request options. + /// The String to use. /// /// Schema for Response Body: /// { - /// parentFriendlyNameChain: [string], - /// parentNameChain: [string] + /// count: number, + /// nextLink: string, + /// value: [ + /// { + /// friendlyName: string, + /// name: string + /// } + /// ] /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -730,50 +527,41 @@ private HttpMessage CreateListChildCollectionNamesRequest(string skipToken) /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetCollectionPathAsync(RequestOptions options = null) + public virtual AsyncPageable ListChildCollectionNamesAsync(RequestOptions options, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetCollectionPathRequest(); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewCollection.GetCollectionPath"); - scope.Start(); - try + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "PurviewCollection.ListChildCollectionNames"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) + do { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; + var message = string.IsNullOrEmpty(nextLink) + ? CreateListChildCollectionNamesRequest(skipToken) + : CreateListChildCollectionNamesNextPageRequest(nextLink, skipToken); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - /// Gets the parent name and parent friendly name chains that represent the collection path. + /// Lists the child collections names in the collection. + /// The request options. + /// The String to use. /// /// Schema for Response Body: /// { - /// parentFriendlyNameChain: [string], - /// parentNameChain: [string] + /// count: number, + /// nextLink: string, + /// value: [ + /// { + /// friendlyName: string, + /// name: string + /// } + /// ] /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -793,55 +581,152 @@ public virtual async Task GetCollectionPathAsync(RequestOptions option /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetCollectionPath(RequestOptions options = null) + public virtual Pageable ListChildCollectionNames(RequestOptions options, string skipToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetCollectionPathRequest(); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewCollection.GetCollectionPath"); - scope.Start(); - try + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "PurviewCollection.ListChildCollectionNames"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) + do { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + var message = string.IsNullOrEmpty(nextLink) + ? CreateListChildCollectionNamesRequest(skipToken) + : CreateListChildCollectionNamesNextPageRequest(nextLink, skipToken); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } - catch (Exception e) + } + + internal HttpMessage CreateGetCollectionRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/collections/", false); + uri.AppendPath(_collectionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateOrUpdateCollectionRequest(RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/collections/", false); + uri.AppendPath(_collectionName, 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; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateDeleteCollectionRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/collections/", false); + uri.AppendPath(_collectionName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier204.Instance; + return message; + } + + internal HttpMessage CreateListChildCollectionNamesRequest(string skipToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/collections/", false); + uri.AppendPath(_collectionName, true); + uri.AppendPath("/getChildCollectionNames", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (skipToken != null) { - scope.Failed(e); - throw; + uri.AppendQuery("$skipToken", skipToken, true); } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; } - private HttpMessage CreateGetCollectionPathRequest() + internal HttpMessage CreateGetCollectionPathRequest() { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); + uri.Reset(_endpoint); uri.AppendPath("/collections/", false); - uri.AppendPath(collectionName, true); + uri.AppendPath(_collectionName, true); uri.AppendPath("/getCollectionPath", false); - uri.AppendQuery("api-version", apiVersion, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateListChildCollectionNamesNextPageRequest(string nextLink, string skipToken) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; return message; } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier204 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier204(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 204 => false, + _ => true + }; + } + } } } diff --git a/sdk/purview/Azure.Analytics.Purview.Account/src/Generated/PurviewResourceSetRule.cs b/sdk/purview/Azure.Analytics.Purview.Account/src/Generated/PurviewResourceSetRule.cs index 9b4de7edcb9a6..999642c328b69 100644 --- a/sdk/purview/Azure.Analytics.Purview.Account/src/Generated/PurviewResourceSetRule.cs +++ b/sdk/purview/Azure.Analytics.Purview.Account/src/Generated/PurviewResourceSetRule.cs @@ -16,14 +16,16 @@ namespace Azure.Analytics.Purview.Account /// The PurviewResourceSetRule service client. public partial class PurviewResourceSetRule { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of PurviewResourceSetRule for mocking. protected PurviewResourceSetRule() @@ -31,6 +33,7 @@ protected PurviewResourceSetRule() } /// Get a resource set config service model. + /// The request options. /// /// Schema for Response Body: /// { @@ -126,7 +129,6 @@ protected PurviewResourceSetRule() /// } /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -146,33 +148,16 @@ protected PurviewResourceSetRule() /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetResourceSetRuleAsync(RequestOptions options = null) + public virtual async Task GetResourceSetRuleAsync(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetResourceSetRuleRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewResourceSetRule.GetResourceSetRule"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetResourceSetRuleRequest(); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -182,6 +167,7 @@ public virtual async Task GetResourceSetRuleAsync(RequestOptions optio } /// Get a resource set config service model. + /// The request options. /// /// Schema for Response Body: /// { @@ -277,7 +263,6 @@ public virtual async Task GetResourceSetRuleAsync(RequestOptions optio /// } /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -297,33 +282,16 @@ public virtual async Task GetResourceSetRuleAsync(RequestOptions optio /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetResourceSetRule(RequestOptions options = null) + public virtual Response GetResourceSetRule(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetResourceSetRuleRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewResourceSetRule.GetResourceSetRule"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetResourceSetRuleRequest(); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -332,21 +300,10 @@ public virtual Response GetResourceSetRule(RequestOptions options = null) } } - private HttpMessage CreateGetResourceSetRuleRequest() - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/resourceSetRuleConfigs/defaultResourceSetRuleConfig", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Creates or updates an resource set config. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -442,7 +399,6 @@ private HttpMessage CreateGetResourceSetRuleRequest() /// } /// } /// - /// /// Schema for Response Body: /// { /// advancedResourceSet: { @@ -537,7 +493,6 @@ private HttpMessage CreateGetResourceSetRuleRequest() /// } /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -557,34 +512,16 @@ private HttpMessage CreateGetResourceSetRuleRequest() /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task CreateOrUpdateResourceSetRuleAsync(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateResourceSetRuleRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewResourceSetRule.CreateOrUpdateResourceSetRule"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateResourceSetRuleRequest(content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -594,6 +531,9 @@ public virtual async Task CreateOrUpdateResourceSetRuleAsync(RequestCo } /// Creates or updates an resource set config. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -689,7 +629,6 @@ public virtual async Task CreateOrUpdateResourceSetRuleAsync(RequestCo /// } /// } /// - /// /// Schema for Response Body: /// { /// advancedResourceSet: { @@ -784,7 +723,6 @@ public virtual async Task CreateOrUpdateResourceSetRuleAsync(RequestCo /// } /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -804,34 +742,16 @@ public virtual async Task CreateOrUpdateResourceSetRuleAsync(RequestCo /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response CreateOrUpdateResourceSetRule(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateResourceSetRuleRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewResourceSetRule.CreateOrUpdateResourceSetRule"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateResourceSetRuleRequest(content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -840,23 +760,8 @@ public virtual Response CreateOrUpdateResourceSetRule(RequestContent content, Re } } - private HttpMessage CreateCreateOrUpdateResourceSetRuleRequest(RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/resourceSetRuleConfigs/defaultResourceSetRuleConfig", 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; - } - /// Deletes a ResourceSetRuleConfig resource. + /// The request options. /// /// Schema for Response Error: /// { @@ -877,34 +782,16 @@ private HttpMessage CreateCreateOrUpdateResourceSetRuleRequest(RequestContent co /// /// /// - /// The request options. #pragma warning disable AZC0002 public virtual async Task DeleteResourceSetRuleAsync(RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteResourceSetRuleRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewResourceSetRule.DeleteResourceSetRule"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteResourceSetRuleRequest(); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -914,6 +801,7 @@ public virtual async Task DeleteResourceSetRuleAsync(RequestOptions op } /// Deletes a ResourceSetRuleConfig resource. + /// The request options. /// /// Schema for Response Error: /// { @@ -934,34 +822,16 @@ public virtual async Task DeleteResourceSetRuleAsync(RequestOptions op /// /// /// - /// The request options. #pragma warning disable AZC0002 public virtual Response DeleteResourceSetRule(RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteResourceSetRuleRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewResourceSetRule.DeleteResourceSetRule"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteResourceSetRuleRequest(); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -970,18 +840,79 @@ public virtual Response DeleteResourceSetRule(RequestOptions options = null) } } - private HttpMessage CreateDeleteResourceSetRuleRequest() + internal HttpMessage CreateGetResourceSetRuleRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/resourceSetRuleConfigs/defaultResourceSetRuleConfig", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateOrUpdateResourceSetRuleRequest(RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/resourceSetRuleConfigs/defaultResourceSetRuleConfig", 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; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateDeleteResourceSetRuleRequest() { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); + uri.Reset(_endpoint); uri.AppendPath("/resourceSetRuleConfigs/defaultResourceSetRuleConfig", false); - uri.AppendQuery("api-version", apiVersion, true); + uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200204.Instance; return message; } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier200204 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200204(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + 204 => false, + _ => true + }; + } + } } } diff --git a/sdk/purview/Azure.Analytics.Purview.Account/tests/AccountsClientTest.cs b/sdk/purview/Azure.Analytics.Purview.Account/tests/AccountsClientTest.cs index 6380813846d88..2afad7b0a550c 100644 --- a/sdk/purview/Azure.Analytics.Purview.Account/tests/AccountsClientTest.cs +++ b/sdk/purview/Azure.Analytics.Purview.Account/tests/AccountsClientTest.cs @@ -22,7 +22,7 @@ public AccountsClientTest(bool isAsync) : base(isAsync) public async Task GetTask() { PurviewAccountClient client = GetAccountClient(); - Response fetchResponse = await client.GetAccountPropertiesAsync(); + Response fetchResponse = await client.GetAccountPropertiesAsync(new()); JsonElement fetchBodyJson = JsonDocument.Parse(GetContentFromResponse(fetchResponse)).RootElement; Assert.AreEqual("dotnetLLCPurviewAccount", fetchBodyJson.GetProperty("name").GetString()); } @@ -68,7 +68,7 @@ public async Task ListKeysTask() Response genResponse = await client.RegenerateAccessKeyAsync(RequestContent.Create(data)); JsonElement genKeyBodyJson = JsonDocument.Parse(GetContentFromResponse(genResponse)).RootElement; Assert.AreEqual(genResponse.Status, 200); - Response listKeysResponse = await client.GetAccessKeysAsync(); + Response listKeysResponse = await client.GetAccessKeysAsync(new()); JsonElement listKeyBodyJson = JsonDocument.Parse(GetContentFromResponse(listKeysResponse)).RootElement; Assert.AreEqual(listKeysResponse.Status, 200); } diff --git a/sdk/purview/Azure.Analytics.Purview.Account/tests/CollectionsClientTest.cs b/sdk/purview/Azure.Analytics.Purview.Account/tests/CollectionsClientTest.cs index 46903bab7e464..504451a7e391e 100644 --- a/sdk/purview/Azure.Analytics.Purview.Account/tests/CollectionsClientTest.cs +++ b/sdk/purview/Azure.Analytics.Purview.Account/tests/CollectionsClientTest.cs @@ -38,7 +38,7 @@ public async Task CreateOrUpdateTask() while (true) { System.Threading.Thread.Sleep(1000); - Response getResponse = await client.GetCollectionAsync(); + Response getResponse = await client.GetCollectionAsync(new()); JsonElement getBodyJson = JsonDocument.Parse(GetContentFromResponse(getResponse)).RootElement; if (getBodyJson.GetProperty("collectionProvisioningState").GetString() == "Succeeded") break; @@ -61,13 +61,13 @@ public async Task GetTask() }, }; Response createResponse = await client.CreateOrUpdateCollectionAsync(RequestContent.Create(data), default); - Response getResponse = await client.GetCollectionAsync(); + Response getResponse = await client.GetCollectionAsync(new()); JsonElement getBodyJson = JsonDocument.Parse(GetContentFromResponse(getResponse)).RootElement; Assert.AreEqual("myCollection1", getBodyJson.GetProperty("name").GetString()); while (true) { System.Threading.Thread.Sleep(1000); - Response getRes = await client.GetCollectionAsync(); + Response getRes = await client.GetCollectionAsync(new()); JsonElement getJson = JsonDocument.Parse(GetContentFromResponse(getRes)).RootElement; if (getJson.GetProperty("collectionProvisioningState").GetString() == "Succeeded") break; diff --git a/sdk/purview/Azure.Analytics.Purview.Catalog/api/Azure.Analytics.Purview.Catalog.netstandard2.0.cs b/sdk/purview/Azure.Analytics.Purview.Catalog/api/Azure.Analytics.Purview.Catalog.netstandard2.0.cs index f5bfc60c7ffaa..c0144b8f66a8f 100644 --- a/sdk/purview/Azure.Analytics.Purview.Catalog/api/Azure.Analytics.Purview.Catalog.netstandard2.0.cs +++ b/sdk/purview/Azure.Analytics.Purview.Catalog/api/Azure.Analytics.Purview.Catalog.netstandard2.0.cs @@ -11,10 +11,10 @@ public PurviewCatalogClient(System.Uri endpoint, Azure.Core.TokenCredential cred public Azure.Analytics.Purview.Catalog.PurviewTypes Types { get { throw null; } } public virtual Azure.Response AutoComplete(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task AutoCompleteAsync(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetLineageGraph(string guid, string direction, int? depth = default(int?), int? width = default(int?), bool? includeParent = default(bool?), bool? getDerivedLineage = default(bool?), Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetLineageGraphAsync(string guid, string direction, int? depth = default(int?), int? width = default(int?), bool? includeParent = default(bool?), bool? getDerivedLineage = default(bool?), Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response NextPageLineage(string guid, string direction, bool? getDerivedLineage = default(bool?), int? offset = default(int?), int? limit = default(int?), Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task NextPageLineageAsync(string guid, string direction, bool? getDerivedLineage = default(bool?), int? offset = default(int?), int? limit = default(int?), Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response GetLineageGraph(string guid, string direction, Azure.RequestOptions options, int? depth = default(int?), int? width = default(int?), bool? includeParent = default(bool?), bool? getDerivedLineage = default(bool?)) { throw null; } + public virtual System.Threading.Tasks.Task GetLineageGraphAsync(string guid, string direction, Azure.RequestOptions options, int? depth = default(int?), int? width = default(int?), bool? includeParent = default(bool?), bool? getDerivedLineage = default(bool?)) { throw null; } + public virtual Azure.Response NextPageLineage(string guid, string direction, Azure.RequestOptions options, bool? getDerivedLineage = default(bool?), int? offset = default(int?), int? limit = default(int?)) { throw null; } + public virtual System.Threading.Tasks.Task NextPageLineageAsync(string guid, string direction, Azure.RequestOptions options, bool? getDerivedLineage = default(bool?), int? offset = default(int?), int? limit = default(int?)) { throw null; } public virtual Azure.Response Search(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task SearchAsync(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual Azure.Response Suggest(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } @@ -52,20 +52,20 @@ protected PurviewEntities() { } public virtual System.Threading.Tasks.Task DeleteClassificationAsync(string guid, string classificationName, Azure.RequestOptions options = null) { throw null; } public virtual Azure.Response DeleteClassificationByUniqueAttribute(string typeName, string classificationName, string attrQualifiedName = null, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task DeleteClassificationByUniqueAttributeAsync(string typeName, string classificationName, string attrQualifiedName = null, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetByGuid(string guid, bool? minExtInfo = default(bool?), bool? ignoreRelationships = default(bool?), Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetByGuidAsync(string guid, bool? minExtInfo = default(bool?), bool? ignoreRelationships = default(bool?), Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetByGuids(System.Collections.Generic.IEnumerable guids, bool? minExtInfo = default(bool?), bool? ignoreRelationships = default(bool?), System.Collections.Generic.IEnumerable excludeRelationshipTypes = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetByGuidsAsync(System.Collections.Generic.IEnumerable guids, bool? minExtInfo = default(bool?), bool? ignoreRelationships = default(bool?), System.Collections.Generic.IEnumerable excludeRelationshipTypes = null, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetByUniqueAttributes(string typeName, bool? minExtInfo = default(bool?), bool? ignoreRelationships = default(bool?), string attrQualifiedName = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetByUniqueAttributesAsync(string typeName, bool? minExtInfo = default(bool?), bool? ignoreRelationships = default(bool?), string attrQualifiedName = null, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetClassification(string guid, string classificationName, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetClassificationAsync(string guid, string classificationName, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetClassifications(string guid, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetClassificationsAsync(string guid, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetEntitiesByUniqueAttributes(string typeName, bool? minExtInfo = default(bool?), bool? ignoreRelationships = default(bool?), string attrNQualifiedName = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetEntitiesByUniqueAttributesAsync(string typeName, bool? minExtInfo = default(bool?), bool? ignoreRelationships = default(bool?), string attrNQualifiedName = null, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetHeader(string guid, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetHeaderAsync(string guid, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response GetByGuid(string guid, Azure.RequestOptions options, bool? minExtInfo = default(bool?), bool? ignoreRelationships = default(bool?)) { throw null; } + public virtual System.Threading.Tasks.Task GetByGuidAsync(string guid, Azure.RequestOptions options, bool? minExtInfo = default(bool?), bool? ignoreRelationships = default(bool?)) { throw null; } + public virtual Azure.Response GetByGuids(System.Collections.Generic.IEnumerable guids, Azure.RequestOptions options, bool? minExtInfo = default(bool?), bool? ignoreRelationships = default(bool?), System.Collections.Generic.IEnumerable excludeRelationshipTypes = null) { throw null; } + public virtual System.Threading.Tasks.Task GetByGuidsAsync(System.Collections.Generic.IEnumerable guids, Azure.RequestOptions options, bool? minExtInfo = default(bool?), bool? ignoreRelationships = default(bool?), System.Collections.Generic.IEnumerable excludeRelationshipTypes = null) { throw null; } + public virtual Azure.Response GetByUniqueAttributes(string typeName, Azure.RequestOptions options, bool? minExtInfo = default(bool?), bool? ignoreRelationships = default(bool?), string attrQualifiedName = null) { throw null; } + public virtual System.Threading.Tasks.Task GetByUniqueAttributesAsync(string typeName, Azure.RequestOptions options, bool? minExtInfo = default(bool?), bool? ignoreRelationships = default(bool?), string attrQualifiedName = null) { throw null; } + public virtual Azure.Response GetClassification(string guid, string classificationName, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetClassificationAsync(string guid, string classificationName, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetClassifications(string guid, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetClassificationsAsync(string guid, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetEntitiesByUniqueAttributes(string typeName, Azure.RequestOptions options, bool? minExtInfo = default(bool?), bool? ignoreRelationships = default(bool?), string attrNQualifiedName = null) { throw null; } + public virtual System.Threading.Tasks.Task GetEntitiesByUniqueAttributesAsync(string typeName, Azure.RequestOptions options, bool? minExtInfo = default(bool?), bool? ignoreRelationships = default(bool?), string attrNQualifiedName = null) { throw null; } + public virtual Azure.Response GetHeader(string guid, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetHeaderAsync(string guid, Azure.RequestOptions options) { throw null; } public virtual Azure.Response PartialUpdateEntityAttributeByGuid(string guid, string name, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task PartialUpdateEntityAttributeByGuidAsync(string guid, string name, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual Azure.Response PartialUpdateEntityByUniqueAttributes(string typeName, Azure.Core.RequestContent content, string attrQualifiedName = null, Azure.RequestOptions options = null) { throw null; } @@ -103,36 +103,36 @@ protected PurviewGlossaries() { } public virtual System.Threading.Tasks.Task DeleteTermAssignmentFromEntitiesAsync(string termGuid, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual Azure.Response ExportGlossaryTermsAsCsv(string glossaryGuid, Azure.Core.RequestContent content, bool? includeTermHierarchy = default(bool?), Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task ExportGlossaryTermsAsCsvAsync(string glossaryGuid, Azure.Core.RequestContent content, bool? includeTermHierarchy = default(bool?), Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetCategoryTerms(string categoryGuid, int? limit = default(int?), int? offset = default(int?), string sort = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetCategoryTermsAsync(string categoryGuid, int? limit = default(int?), int? offset = default(int?), string sort = null, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetDetailedGlossary(string glossaryGuid, bool? includeTermHierarchy = default(bool?), Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetDetailedGlossaryAsync(string glossaryGuid, bool? includeTermHierarchy = default(bool?), Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetEntitiesAssignedWithTerm(string termGuid, int? limit = default(int?), int? offset = default(int?), string sort = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetEntitiesAssignedWithTermAsync(string termGuid, int? limit = default(int?), int? offset = default(int?), string sort = null, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetGlossaries(int? limit = default(int?), int? offset = default(int?), string sort = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetGlossariesAsync(int? limit = default(int?), int? offset = default(int?), string sort = null, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetGlossary(string glossaryGuid, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetGlossaryAsync(string glossaryGuid, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetGlossaryCategories(string glossaryGuid, int? limit = default(int?), int? offset = default(int?), string sort = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetGlossaryCategoriesAsync(string glossaryGuid, int? limit = default(int?), int? offset = default(int?), string sort = null, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetGlossaryCategoriesHeaders(string glossaryGuid, int? limit = default(int?), int? offset = default(int?), string sort = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetGlossaryCategoriesHeadersAsync(string glossaryGuid, int? limit = default(int?), int? offset = default(int?), string sort = null, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetGlossaryCategory(string categoryGuid, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetGlossaryCategoryAsync(string categoryGuid, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetGlossaryTerm(string termGuid, bool? includeTermHierarchy = default(bool?), Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetGlossaryTermAsync(string termGuid, bool? includeTermHierarchy = default(bool?), Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetGlossaryTermHeaders(string glossaryGuid, int? limit = default(int?), int? offset = default(int?), string sort = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetGlossaryTermHeadersAsync(string glossaryGuid, int? limit = default(int?), int? offset = default(int?), string sort = null, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetGlossaryTerms(string glossaryGuid, bool? includeTermHierarchy = default(bool?), int? limit = default(int?), int? offset = default(int?), string sort = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetGlossaryTermsAsync(string glossaryGuid, bool? includeTermHierarchy = default(bool?), int? limit = default(int?), int? offset = default(int?), string sort = null, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetImportCsvOperationStatus(string operationGuid, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetImportCsvOperationStatusAsync(string operationGuid, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetRelatedCategories(string categoryGuid, int? limit = default(int?), int? offset = default(int?), string sort = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetRelatedCategoriesAsync(string categoryGuid, int? limit = default(int?), int? offset = default(int?), string sort = null, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetRelatedTerms(string termGuid, int? limit = default(int?), int? offset = default(int?), string sort = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetRelatedTermsAsync(string termGuid, int? limit = default(int?), int? offset = default(int?), string sort = null, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetTermsByGlossaryName(string glossaryName, int? limit = default(int?), int? offset = default(int?), bool? includeTermHierarchy = default(bool?), Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetTermsByGlossaryNameAsync(string glossaryName, int? limit = default(int?), int? offset = default(int?), bool? includeTermHierarchy = default(bool?), Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response GetCategoryTerms(string categoryGuid, Azure.RequestOptions options, int? limit = default(int?), int? offset = default(int?), string sort = null) { throw null; } + public virtual System.Threading.Tasks.Task GetCategoryTermsAsync(string categoryGuid, Azure.RequestOptions options, int? limit = default(int?), int? offset = default(int?), string sort = null) { throw null; } + public virtual Azure.Response GetDetailedGlossary(string glossaryGuid, Azure.RequestOptions options, bool? includeTermHierarchy = default(bool?)) { throw null; } + public virtual System.Threading.Tasks.Task GetDetailedGlossaryAsync(string glossaryGuid, Azure.RequestOptions options, bool? includeTermHierarchy = default(bool?)) { throw null; } + public virtual Azure.Response GetEntitiesAssignedWithTerm(string termGuid, Azure.RequestOptions options, int? limit = default(int?), int? offset = default(int?), string sort = null) { throw null; } + public virtual System.Threading.Tasks.Task GetEntitiesAssignedWithTermAsync(string termGuid, Azure.RequestOptions options, int? limit = default(int?), int? offset = default(int?), string sort = null) { throw null; } + public virtual Azure.Response GetGlossaries(Azure.RequestOptions options, int? limit = default(int?), int? offset = default(int?), string sort = null) { throw null; } + public virtual System.Threading.Tasks.Task GetGlossariesAsync(Azure.RequestOptions options, int? limit = default(int?), int? offset = default(int?), string sort = null) { throw null; } + public virtual Azure.Response GetGlossary(string glossaryGuid, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetGlossaryAsync(string glossaryGuid, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetGlossaryCategories(string glossaryGuid, Azure.RequestOptions options, int? limit = default(int?), int? offset = default(int?), string sort = null) { throw null; } + public virtual System.Threading.Tasks.Task GetGlossaryCategoriesAsync(string glossaryGuid, Azure.RequestOptions options, int? limit = default(int?), int? offset = default(int?), string sort = null) { throw null; } + public virtual Azure.Response GetGlossaryCategoriesHeaders(string glossaryGuid, Azure.RequestOptions options, int? limit = default(int?), int? offset = default(int?), string sort = null) { throw null; } + public virtual System.Threading.Tasks.Task GetGlossaryCategoriesHeadersAsync(string glossaryGuid, Azure.RequestOptions options, int? limit = default(int?), int? offset = default(int?), string sort = null) { throw null; } + public virtual Azure.Response GetGlossaryCategory(string categoryGuid, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetGlossaryCategoryAsync(string categoryGuid, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetGlossaryTerm(string termGuid, Azure.RequestOptions options, bool? includeTermHierarchy = default(bool?)) { throw null; } + public virtual System.Threading.Tasks.Task GetGlossaryTermAsync(string termGuid, Azure.RequestOptions options, bool? includeTermHierarchy = default(bool?)) { throw null; } + public virtual Azure.Response GetGlossaryTermHeaders(string glossaryGuid, Azure.RequestOptions options, int? limit = default(int?), int? offset = default(int?), string sort = null) { throw null; } + public virtual System.Threading.Tasks.Task GetGlossaryTermHeadersAsync(string glossaryGuid, Azure.RequestOptions options, int? limit = default(int?), int? offset = default(int?), string sort = null) { throw null; } + public virtual Azure.Response GetGlossaryTerms(string glossaryGuid, Azure.RequestOptions options, bool? includeTermHierarchy = default(bool?), int? limit = default(int?), int? offset = default(int?), string sort = null) { throw null; } + public virtual System.Threading.Tasks.Task GetGlossaryTermsAsync(string glossaryGuid, Azure.RequestOptions options, bool? includeTermHierarchy = default(bool?), int? limit = default(int?), int? offset = default(int?), string sort = null) { throw null; } + public virtual Azure.Response GetImportCsvOperationStatus(string operationGuid, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetImportCsvOperationStatusAsync(string operationGuid, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetRelatedCategories(string categoryGuid, Azure.RequestOptions options, int? limit = default(int?), int? offset = default(int?), string sort = null) { throw null; } + public virtual System.Threading.Tasks.Task GetRelatedCategoriesAsync(string categoryGuid, Azure.RequestOptions options, int? limit = default(int?), int? offset = default(int?), string sort = null) { throw null; } + public virtual Azure.Response GetRelatedTerms(string termGuid, Azure.RequestOptions options, int? limit = default(int?), int? offset = default(int?), string sort = null) { throw null; } + public virtual System.Threading.Tasks.Task GetRelatedTermsAsync(string termGuid, Azure.RequestOptions options, int? limit = default(int?), int? offset = default(int?), string sort = null) { throw null; } + public virtual Azure.Response GetTermsByGlossaryName(string glossaryName, Azure.RequestOptions options, int? limit = default(int?), int? offset = default(int?), bool? includeTermHierarchy = default(bool?)) { throw null; } + public virtual System.Threading.Tasks.Task GetTermsByGlossaryNameAsync(string glossaryName, Azure.RequestOptions options, int? limit = default(int?), int? offset = default(int?), bool? includeTermHierarchy = default(bool?)) { throw null; } public virtual Azure.Operation ImportGlossaryTermsViaCsv(string glossaryGuid, Azure.Core.RequestContent content, bool? includeTermHierarchy = default(bool?), Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task> ImportGlossaryTermsViaCsvAsync(string glossaryGuid, Azure.Core.RequestContent content, bool? includeTermHierarchy = default(bool?), Azure.RequestOptions options = null) { throw null; } public virtual Azure.Operation ImportGlossaryTermsViaCsvByGlossaryName(string glossaryName, Azure.Core.RequestContent content, bool? includeTermHierarchy = default(bool?), Azure.RequestOptions options = null) { throw null; } @@ -160,8 +160,8 @@ protected PurviewRelationships() { } public virtual System.Threading.Tasks.Task CreateAsync(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual Azure.Response Delete(string guid, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task DeleteAsync(string guid, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response Get(string guid, bool? extendedInfo = default(bool?), Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetAsync(string guid, bool? extendedInfo = default(bool?), Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response Get(string guid, Azure.RequestOptions options, bool? extendedInfo = default(bool?)) { throw null; } + public virtual System.Threading.Tasks.Task GetAsync(string guid, Azure.RequestOptions options, bool? extendedInfo = default(bool?)) { throw null; } public virtual Azure.Response Update(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task UpdateAsync(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } } @@ -175,38 +175,38 @@ protected PurviewTypes() { } public virtual System.Threading.Tasks.Task DeleteTypeByNameAsync(string name, Azure.RequestOptions options = null) { throw null; } public virtual Azure.Response DeleteTypeDefinitions(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task DeleteTypeDefinitionsAsync(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetAllTypeDefinitions(bool? includeTermTemplate = default(bool?), string type = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetAllTypeDefinitionsAsync(bool? includeTermTemplate = default(bool?), string type = null, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetClassificationDefByGuid(string guid, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetClassificationDefByGuidAsync(string guid, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetClassificationDefByName(string name, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetClassificationDefByNameAsync(string name, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetEntityDefinitionByGuid(string guid, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetEntityDefinitionByGuidAsync(string guid, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetEntityDefinitionByName(string name, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetEntityDefinitionByNameAsync(string name, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetEnumDefByGuid(string guid, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetEnumDefByGuidAsync(string guid, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetEnumDefByName(string name, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetEnumDefByNameAsync(string name, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetRelationshipDefByGuid(string guid, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetRelationshipDefByGuidAsync(string guid, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetRelationshipDefByName(string name, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetRelationshipDefByNameAsync(string name, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetStructDefByGuid(string guid, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetStructDefByGuidAsync(string guid, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetStructDefByName(string name, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetStructDefByNameAsync(string name, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetTermTemplateDefByGuid(string guid, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetTermTemplateDefByGuidAsync(string guid, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetTermTemplateDefByName(string name, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetTermTemplateDefByNameAsync(string name, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetTypeDefinitionByGuid(string guid, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetTypeDefinitionByGuidAsync(string guid, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetTypeDefinitionByName(string name, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetTypeDefinitionByNameAsync(string name, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetTypeDefinitionHeaders(bool? includeTermTemplate = default(bool?), string type = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetTypeDefinitionHeadersAsync(bool? includeTermTemplate = default(bool?), string type = null, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response GetAllTypeDefinitions(Azure.RequestOptions options, bool? includeTermTemplate = default(bool?), string type = null) { throw null; } + public virtual System.Threading.Tasks.Task GetAllTypeDefinitionsAsync(Azure.RequestOptions options, bool? includeTermTemplate = default(bool?), string type = null) { throw null; } + public virtual Azure.Response GetClassificationDefByGuid(string guid, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetClassificationDefByGuidAsync(string guid, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetClassificationDefByName(string name, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetClassificationDefByNameAsync(string name, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetEntityDefinitionByGuid(string guid, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetEntityDefinitionByGuidAsync(string guid, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetEntityDefinitionByName(string name, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetEntityDefinitionByNameAsync(string name, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetEnumDefByGuid(string guid, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetEnumDefByGuidAsync(string guid, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetEnumDefByName(string name, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetEnumDefByNameAsync(string name, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetRelationshipDefByGuid(string guid, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetRelationshipDefByGuidAsync(string guid, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetRelationshipDefByName(string name, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetRelationshipDefByNameAsync(string name, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetStructDefByGuid(string guid, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetStructDefByGuidAsync(string guid, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetStructDefByName(string name, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetStructDefByNameAsync(string name, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetTermTemplateDefByGuid(string guid, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetTermTemplateDefByGuidAsync(string guid, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetTermTemplateDefByName(string name, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetTermTemplateDefByNameAsync(string name, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetTypeDefinitionByGuid(string guid, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetTypeDefinitionByGuidAsync(string guid, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetTypeDefinitionByName(string name, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetTypeDefinitionByNameAsync(string name, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetTypeDefinitionHeaders(Azure.RequestOptions options, bool? includeTermTemplate = default(bool?), string type = null) { throw null; } + public virtual System.Threading.Tasks.Task GetTypeDefinitionHeadersAsync(Azure.RequestOptions options, bool? includeTermTemplate = default(bool?), string type = null) { throw null; } public virtual Azure.Response UpdateAtlasTypeDefinitions(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task UpdateAtlasTypeDefinitionsAsync(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } } diff --git a/sdk/purview/Azure.Analytics.Purview.Catalog/src/Azure.Analytics.Purview.Catalog.csproj b/sdk/purview/Azure.Analytics.Purview.Catalog/src/Azure.Analytics.Purview.Catalog.csproj index ada368e1826a0..b751888383337 100644 --- a/sdk/purview/Azure.Analytics.Purview.Catalog/src/Azure.Analytics.Purview.Catalog.csproj +++ b/sdk/purview/Azure.Analytics.Purview.Catalog/src/Azure.Analytics.Purview.Catalog.csproj @@ -6,6 +6,7 @@ Azure Purview $(RequiredTargetFrameworks) $(NoWarn);CS0169 + $(DefineConstants);EXPERIMENTAL diff --git a/sdk/purview/Azure.Analytics.Purview.Catalog/src/Customizations/PurviewCatalogClient.cs b/sdk/purview/Azure.Analytics.Purview.Catalog/src/Customizations/PurviewCatalogClient.cs index 4041336ab0862..ec10b171f0a8a 100644 --- a/sdk/purview/Azure.Analytics.Purview.Catalog/src/Customizations/PurviewCatalogClient.cs +++ b/sdk/purview/Azure.Analytics.Purview.Catalog/src/Customizations/PurviewCatalogClient.cs @@ -13,21 +13,21 @@ public partial class PurviewCatalogClient /// /// Provides access to operations which interact with entities in the catalog. /// - public PurviewEntities Entities { get => purviewEntities ??= new PurviewEntities(Pipeline, _clientDiagnostics, endpoint, apiVersion); } + public PurviewEntities Entities { get => purviewEntities ??= new PurviewEntities(Pipeline, _clientDiagnostics, _endpoint); } /// /// Provides access to operations which interact with glossaries in the catalog. /// - public PurviewGlossaries Glossaries { get => purviewGlossaries ??= new PurviewGlossaries(Pipeline, _clientDiagnostics, endpoint, apiVersion); } + public PurviewGlossaries Glossaries { get => purviewGlossaries ??= new PurviewGlossaries(Pipeline, _clientDiagnostics, _endpoint, _apiVersion); } /// /// Provides access to operations which interact with glossaries in the catalog. /// - public PurviewRelationships Relationships { get => purviewRelationships ??= new PurviewRelationships(Pipeline, _clientDiagnostics, endpoint, apiVersion); } + public PurviewRelationships Relationships { get => purviewRelationships ??= new PurviewRelationships(Pipeline, _clientDiagnostics, _endpoint); } /// /// Provides access to operations which interact with types in the catalog. /// - public PurviewTypes Types { get => purviewTypes ??= new PurviewTypes(Pipeline, _clientDiagnostics, endpoint, apiVersion); } + public PurviewTypes Types { get => purviewTypes ??= new PurviewTypes(Pipeline, _clientDiagnostics, _endpoint, _apiVersion); } } } diff --git a/sdk/purview/Azure.Analytics.Purview.Catalog/src/Customizations/PurviewEntities.cs b/sdk/purview/Azure.Analytics.Purview.Catalog/src/Customizations/PurviewEntities.cs index 777e30117ebe7..7c82f0bfb47a3 100644 --- a/sdk/purview/Azure.Analytics.Purview.Catalog/src/Customizations/PurviewEntities.cs +++ b/sdk/purview/Azure.Analytics.Purview.Catalog/src/Customizations/PurviewEntities.cs @@ -11,12 +11,11 @@ namespace Azure.Analytics.Purview.Catalog [CodeGenSuppress("PurviewEntities", typeof(Uri), typeof(TokenCredential), typeof(PurviewCatalogClientOptions))] public partial class PurviewEntities { - internal PurviewEntities(HttpPipeline pipeline, ClientDiagnostics clientDiagnostics, Uri endpoint, string apiVersion) + internal PurviewEntities(HttpPipeline pipeline, ClientDiagnostics clientDiagnostics, Uri endpoint) { _pipeline = pipeline; _clientDiagnostics = clientDiagnostics; - this.endpoint = endpoint; - this.apiVersion = apiVersion; + _endpoint = endpoint; } } } diff --git a/sdk/purview/Azure.Analytics.Purview.Catalog/src/Customizations/PurviewGlossaries.cs b/sdk/purview/Azure.Analytics.Purview.Catalog/src/Customizations/PurviewGlossaries.cs index 2fefb93c790f7..ddaa936e0d3c7 100644 --- a/sdk/purview/Azure.Analytics.Purview.Catalog/src/Customizations/PurviewGlossaries.cs +++ b/sdk/purview/Azure.Analytics.Purview.Catalog/src/Customizations/PurviewGlossaries.cs @@ -15,8 +15,8 @@ internal PurviewGlossaries(HttpPipeline pipeline, ClientDiagnostics clientDiagno { _pipeline = pipeline; _clientDiagnostics = clientDiagnostics; - this.endpoint = endpoint; - this.apiVersion = apiVersion; + _endpoint = endpoint; + _apiVersion = apiVersion; } } } diff --git a/sdk/purview/Azure.Analytics.Purview.Catalog/src/Customizations/PurviewRelatonships.cs b/sdk/purview/Azure.Analytics.Purview.Catalog/src/Customizations/PurviewRelatonships.cs index 51eb278fc4243..87eb10484d6d4 100644 --- a/sdk/purview/Azure.Analytics.Purview.Catalog/src/Customizations/PurviewRelatonships.cs +++ b/sdk/purview/Azure.Analytics.Purview.Catalog/src/Customizations/PurviewRelatonships.cs @@ -11,12 +11,11 @@ namespace Azure.Analytics.Purview.Catalog [CodeGenSuppress("PurviewRelationships", typeof(Uri), typeof(TokenCredential), typeof(PurviewCatalogClientOptions))] public partial class PurviewRelationships { - internal PurviewRelationships(HttpPipeline pipeline, ClientDiagnostics clientDiagnostics, Uri endpoint, string apiVersion) + internal PurviewRelationships(HttpPipeline pipeline, ClientDiagnostics clientDiagnostics, Uri endpoint) { _pipeline = pipeline; _clientDiagnostics = clientDiagnostics; - this.endpoint = endpoint; - this.apiVersion = apiVersion; + _endpoint = endpoint; } } } diff --git a/sdk/purview/Azure.Analytics.Purview.Catalog/src/Customizations/PurviewTypes.cs b/sdk/purview/Azure.Analytics.Purview.Catalog/src/Customizations/PurviewTypes.cs index 89246f9afca99..e046548d7dc0a 100644 --- a/sdk/purview/Azure.Analytics.Purview.Catalog/src/Customizations/PurviewTypes.cs +++ b/sdk/purview/Azure.Analytics.Purview.Catalog/src/Customizations/PurviewTypes.cs @@ -15,8 +15,8 @@ internal PurviewTypes(HttpPipeline pipeline, ClientDiagnostics clientDiagnostics { _pipeline = pipeline; _clientDiagnostics = clientDiagnostics; - this.endpoint = endpoint; - this.apiVersion = apiVersion; + _endpoint = endpoint; + _apiVersion = apiVersion; } } } diff --git a/sdk/purview/Azure.Analytics.Purview.Catalog/src/Generated/PurviewCatalogClient.cs b/sdk/purview/Azure.Analytics.Purview.Catalog/src/Generated/PurviewCatalogClient.cs index 835e9773ac7dd..5872f3118986f 100644 --- a/sdk/purview/Azure.Analytics.Purview.Catalog/src/Generated/PurviewCatalogClient.cs +++ b/sdk/purview/Azure.Analytics.Purview.Catalog/src/Generated/PurviewCatalogClient.cs @@ -16,14 +16,16 @@ namespace Azure.Analytics.Purview.Catalog /// The PurviewCatalog service client. public partial class PurviewCatalogClient { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of PurviewCatalogClient for mocking. protected PurviewCatalogClient() @@ -34,6 +36,7 @@ protected PurviewCatalogClient() /// The catalog endpoint of your Purview account. Example: https://{accountName}.catalog.purview.azure.com. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. + /// or is null. public PurviewCatalogClient(Uri endpoint, TokenCredential credential, PurviewCatalogClientOptions options = null) { if (endpoint == null) @@ -46,15 +49,18 @@ public PurviewCatalogClient(Uri endpoint, TokenCredential credential, PurviewCat } options ??= new PurviewCatalogClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); _tokenCredential = credential; - var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); - _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { authPolicy }, new ResponseClassifier()); - this.endpoint = endpoint; - apiVersion = options.Version; + _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; } /// Gets data using search. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -75,7 +81,6 @@ public PurviewCatalogClient(Uri endpoint, TokenCredential credential, PurviewCat /// } /// } /// - /// /// Schema for Response Body: /// { /// @search.count: number, @@ -98,34 +103,16 @@ public PurviewCatalogClient(Uri endpoint, TokenCredential credential, PurviewCat /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task SearchAsync(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateSearchRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewCatalogClient.Search"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateSearchRequest(content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -135,6 +122,9 @@ public virtual async Task SearchAsync(RequestContent content, RequestO } /// Gets data using search. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -155,7 +145,6 @@ public virtual async Task SearchAsync(RequestContent content, RequestO /// } /// } /// - /// /// Schema for Response Body: /// { /// @search.count: number, @@ -178,34 +167,16 @@ public virtual async Task SearchAsync(RequestContent content, RequestO /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response Search(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateSearchRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewCatalogClient.Search"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateSearchRequest(content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -214,24 +185,10 @@ public virtual Response Search(RequestContent content, RequestOptions options = } } - private HttpMessage CreateSearchRequest(RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/search/query", 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; - } - /// Get search suggestions by query criteria. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -240,7 +197,6 @@ private HttpMessage CreateSearchRequest(RequestContent content) /// filter: AnyObject /// } /// - /// /// Schema for Response Body: /// { /// value: [SuggestResultValue] @@ -248,34 +204,16 @@ private HttpMessage CreateSearchRequest(RequestContent content) /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task SuggestAsync(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateSuggestRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewCatalogClient.Suggest"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateSuggestRequest(content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -285,6 +223,9 @@ public virtual async Task SuggestAsync(RequestContent content, Request } /// Get search suggestions by query criteria. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -293,7 +234,6 @@ public virtual async Task SuggestAsync(RequestContent content, Request /// filter: AnyObject /// } /// - /// /// Schema for Response Body: /// { /// value: [SuggestResultValue] @@ -301,34 +241,16 @@ public virtual async Task SuggestAsync(RequestContent content, Request /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response Suggest(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateSuggestRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewCatalogClient.Suggest"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateSuggestRequest(content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -337,24 +259,10 @@ public virtual Response Suggest(RequestContent content, RequestOptions options = } } - private HttpMessage CreateSuggestRequest(RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/search/suggest", 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; - } - /// Get auto complete options. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -363,7 +271,6 @@ private HttpMessage CreateSuggestRequest(RequestContent content) /// filter: AnyObject /// } /// - /// /// Schema for Response Body: /// { /// value: [AutoCompleteResultValue] @@ -371,34 +278,16 @@ private HttpMessage CreateSuggestRequest(RequestContent content) /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task AutoCompleteAsync(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateAutoCompleteRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewCatalogClient.AutoComplete"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateAutoCompleteRequest(content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -408,6 +297,9 @@ public virtual async Task AutoCompleteAsync(RequestContent content, Re } /// Get auto complete options. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -416,7 +308,6 @@ public virtual async Task AutoCompleteAsync(RequestContent content, Re /// filter: AnyObject /// } /// - /// /// Schema for Response Body: /// { /// value: [AutoCompleteResultValue] @@ -424,34 +315,16 @@ public virtual async Task AutoCompleteAsync(RequestContent content, Re /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response AutoComplete(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateAutoCompleteRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewCatalogClient.AutoComplete"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateAutoCompleteRequest(content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -460,24 +333,15 @@ public virtual Response AutoComplete(RequestContent content, RequestOptions opti } } - private HttpMessage CreateAutoCompleteRequest(RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/search/autocomplete", 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; - } - /// Get lineage info of the entity specified by GUID. + /// The globally unique identifier of the entity. + /// The direction of the lineage, which could be INPUT, OUTPUT or BOTH. Allowed values: "BOTH" | "INPUT" | "OUTPUT". + /// The request options. + /// The number of hops for lineage. + /// The number of max expanding width in lineage. + /// True to include the parent chain in the response. + /// True to include derived lineage in the response. + /// or is null. /// /// Schema for Response Body: /// { @@ -507,39 +371,16 @@ private HttpMessage CreateAutoCompleteRequest(RequestContent content) /// /// /// - /// The globally unique identifier of the entity. - /// The direction of the lineage, which could be INPUT, OUTPUT or BOTH. - /// The number of hops for lineage. - /// The number of max expanding width in lineage. - /// True to include the parent chain in the response. - /// True to include derived lineage in the response. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetLineageGraphAsync(string guid, string direction, int? depth = null, int? width = null, bool? includeParent = null, bool? getDerivedLineage = null, RequestOptions options = null) + public virtual async Task GetLineageGraphAsync(string guid, string direction, RequestOptions options, int? depth = null, int? width = null, bool? includeParent = null, bool? getDerivedLineage = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetLineageGraphRequest(guid, direction, depth, width, includeParent, getDerivedLineage); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewCatalogClient.GetLineageGraph"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetLineageGraphRequest(guid, direction, depth, width, includeParent, getDerivedLineage); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -549,6 +390,14 @@ public virtual async Task GetLineageGraphAsync(string guid, string dir } /// Get lineage info of the entity specified by GUID. + /// The globally unique identifier of the entity. + /// The direction of the lineage, which could be INPUT, OUTPUT or BOTH. Allowed values: "BOTH" | "INPUT" | "OUTPUT". + /// The request options. + /// The number of hops for lineage. + /// The number of max expanding width in lineage. + /// True to include the parent chain in the response. + /// True to include derived lineage in the response. + /// or is null. /// /// Schema for Response Body: /// { @@ -578,39 +427,16 @@ public virtual async Task GetLineageGraphAsync(string guid, string dir /// /// /// - /// The globally unique identifier of the entity. - /// The direction of the lineage, which could be INPUT, OUTPUT or BOTH. - /// The number of hops for lineage. - /// The number of max expanding width in lineage. - /// True to include the parent chain in the response. - /// True to include derived lineage in the response. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetLineageGraph(string guid, string direction, int? depth = null, int? width = null, bool? includeParent = null, bool? getDerivedLineage = null, RequestOptions options = null) + public virtual Response GetLineageGraph(string guid, string direction, RequestOptions options, int? depth = null, int? width = null, bool? includeParent = null, bool? getDerivedLineage = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetLineageGraphRequest(guid, direction, depth, width, includeParent, getDerivedLineage); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewCatalogClient.GetLineageGraph"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetLineageGraphRequest(guid, direction, depth, width, includeParent, getDerivedLineage); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -619,39 +445,14 @@ public virtual Response GetLineageGraph(string guid, string direction, int? dept } } - private HttpMessage CreateGetLineageGraphRequest(string guid, string direction, int? depth, int? width, bool? includeParent, bool? getDerivedLineage) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/lineage/", false); - uri.AppendPath(guid, true); - if (depth != null) - { - uri.AppendQuery("depth", depth.Value, true); - } - if (width != null) - { - uri.AppendQuery("width", width.Value, true); - } - uri.AppendQuery("direction", direction, true); - if (includeParent != null) - { - uri.AppendQuery("includeParent", includeParent.Value, true); - } - if (getDerivedLineage != null) - { - uri.AppendQuery("getDerivedLineage", getDerivedLineage.Value, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Return immediate next page lineage info about entity with pagination. + /// The globally unique identifier of the entity. + /// The direction of the lineage, which could be INPUT, OUTPUT or BOTH. Allowed values: "BOTH" | "INPUT" | "OUTPUT". + /// The request options. + /// True to include derived lineage in the response. + /// The offset for pagination purpose. + /// The page size - by default there is no paging. + /// or is null. /// /// Schema for Response Body: /// { @@ -681,38 +482,16 @@ private HttpMessage CreateGetLineageGraphRequest(string guid, string direction, /// /// /// - /// The globally unique identifier of the entity. - /// The direction of the lineage, which could be INPUT, OUTPUT or BOTH. - /// True to include derived lineage in the response. - /// The offset for pagination purpose. - /// The page size - by default there is no paging. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task NextPageLineageAsync(string guid, string direction, bool? getDerivedLineage = null, int? offset = null, int? limit = null, RequestOptions options = null) + public virtual async Task NextPageLineageAsync(string guid, string direction, RequestOptions options, bool? getDerivedLineage = null, int? offset = null, int? limit = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateNextPageLineageRequest(guid, direction, getDerivedLineage, offset, limit); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewCatalogClient.NextPageLineage"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateNextPageLineageRequest(guid, direction, getDerivedLineage, offset, limit); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -722,6 +501,13 @@ public virtual async Task NextPageLineageAsync(string guid, string dir } /// Return immediate next page lineage info about entity with pagination. + /// The globally unique identifier of the entity. + /// The direction of the lineage, which could be INPUT, OUTPUT or BOTH. Allowed values: "BOTH" | "INPUT" | "OUTPUT". + /// The request options. + /// True to include derived lineage in the response. + /// The offset for pagination purpose. + /// The page size - by default there is no paging. + /// or is null. /// /// Schema for Response Body: /// { @@ -751,38 +537,16 @@ public virtual async Task NextPageLineageAsync(string guid, string dir /// /// /// - /// The globally unique identifier of the entity. - /// The direction of the lineage, which could be INPUT, OUTPUT or BOTH. - /// True to include derived lineage in the response. - /// The offset for pagination purpose. - /// The page size - by default there is no paging. - /// The request options. #pragma warning disable AZC0002 - public virtual Response NextPageLineage(string guid, string direction, bool? getDerivedLineage = null, int? offset = null, int? limit = null, RequestOptions options = null) + public virtual Response NextPageLineage(string guid, string direction, RequestOptions options, bool? getDerivedLineage = null, int? offset = null, int? limit = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateNextPageLineageRequest(guid, direction, getDerivedLineage, offset, limit); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewCatalogClient.NextPageLineage"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateNextPageLineageRequest(guid, direction, getDerivedLineage, offset, limit); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -791,13 +555,100 @@ public virtual Response NextPageLineage(string guid, string direction, bool? get } } - private HttpMessage CreateNextPageLineageRequest(string guid, string direction, bool? getDerivedLineage, int? offset, int? limit) + internal HttpMessage CreateSearchRequest(RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/search/query", 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; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateSuggestRequest(RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/search/suggest", 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; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateAutoCompleteRequest(RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/search/autocomplete", 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; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetLineageGraphRequest(string guid, string direction, int? depth, int? width, bool? includeParent, bool? getDerivedLineage) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/lineage/", false); + uri.AppendPath(guid, true); + if (depth != null) + { + uri.AppendQuery("depth", depth.Value, true); + } + if (width != null) + { + uri.AppendQuery("width", width.Value, true); + } + uri.AppendQuery("direction", direction, true); + if (includeParent != null) + { + uri.AppendQuery("includeParent", includeParent.Value, true); + } + if (getDerivedLineage != null) + { + uri.AppendQuery("getDerivedLineage", getDerivedLineage.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateNextPageLineageRequest(string guid, string direction, bool? getDerivedLineage, int? offset, int? limit) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); + uri.Reset(_endpoint); uri.AppendRaw("/api", false); uri.AppendPath("/lineage/", false); uri.AppendPath(guid, true); @@ -815,10 +666,25 @@ private HttpMessage CreateNextPageLineageRequest(string guid, string direction, { uri.AppendQuery("limit", limit.Value, true); } - uri.AppendQuery("api-version", apiVersion, true); + uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; return message; } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } } } diff --git a/sdk/purview/Azure.Analytics.Purview.Catalog/src/Generated/PurviewEntities.cs b/sdk/purview/Azure.Analytics.Purview.Catalog/src/Generated/PurviewEntities.cs index b61f2b250973e..552bc362033e8 100644 --- a/sdk/purview/Azure.Analytics.Purview.Catalog/src/Generated/PurviewEntities.cs +++ b/sdk/purview/Azure.Analytics.Purview.Catalog/src/Generated/PurviewEntities.cs @@ -17,14 +17,15 @@ namespace Azure.Analytics.Purview.Catalog /// The PurviewEntities service client. public partial class PurviewEntities { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of PurviewEntities for mocking. protected PurviewEntities() @@ -36,6 +37,9 @@ protected PurviewEntities() /// Existing entity is matched using its unique guid if supplied or by its unique attributes eg: qualifiedName. /// Map and array of collections are not well supported. E.g., array<array<int>>, array<map<string, int>>. /// + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -94,7 +98,6 @@ protected PurviewEntities() /// } /// } /// - /// /// Schema for Response Body: /// { /// guidAssignments: Dictionary<string, string>, @@ -148,34 +151,16 @@ protected PurviewEntities() /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task CreateOrUpdateAsync(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.CreateOrUpdate"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -189,6 +174,9 @@ public virtual async Task CreateOrUpdateAsync(RequestContent content, /// Existing entity is matched using its unique guid if supplied or by its unique attributes eg: qualifiedName. /// Map and array of collections are not well supported. E.g., array<array<int>>, array<map<string, int>>. /// + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -247,7 +235,6 @@ public virtual async Task CreateOrUpdateAsync(RequestContent content, /// } /// } /// - /// /// Schema for Response Body: /// { /// guidAssignments: Dictionary<string, string>, @@ -301,34 +288,16 @@ public virtual async Task CreateOrUpdateAsync(RequestContent content, /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response CreateOrUpdate(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.CreateOrUpdate"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -337,23 +306,13 @@ public virtual Response CreateOrUpdate(RequestContent content, RequestOptions op } } - private HttpMessage CreateCreateOrUpdateRequest(RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/entity", false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - /// List entities in bulk identified by its GUIDs. + /// An array of GUIDs of entities to create. + /// The request options. + /// Whether to return minimal information for referred entities. + /// Whether to ignore relationship attributes. + /// An array of the relationship types need to be excluded from the response. + /// is null. /// /// Schema for Response Body: /// { @@ -416,37 +375,16 @@ private HttpMessage CreateCreateOrUpdateRequest(RequestContent content) /// /// /// - /// An array of GUIDs of entities to create. - /// Whether to return minimal information for referred entities. - /// Whether to ignore relationship attributes. - /// An array of the relationship types need to be excluded from the response. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetByGuidsAsync(IEnumerable guids, bool? minExtInfo = null, bool? ignoreRelationships = null, IEnumerable excludeRelationshipTypes = null, RequestOptions options = null) + public virtual async Task GetByGuidsAsync(IEnumerable guids, RequestOptions options, bool? minExtInfo = null, bool? ignoreRelationships = null, IEnumerable excludeRelationshipTypes = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetByGuidsRequest(guids, minExtInfo, ignoreRelationships, excludeRelationshipTypes); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.GetByGuids"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetByGuidsRequest(guids, minExtInfo, ignoreRelationships, excludeRelationshipTypes); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -456,6 +394,12 @@ public virtual async Task GetByGuidsAsync(IEnumerable guids, b } /// List entities in bulk identified by its GUIDs. + /// An array of GUIDs of entities to create. + /// The request options. + /// Whether to return minimal information for referred entities. + /// Whether to ignore relationship attributes. + /// An array of the relationship types need to be excluded from the response. + /// is null. /// /// Schema for Response Body: /// { @@ -518,37 +462,16 @@ public virtual async Task GetByGuidsAsync(IEnumerable guids, b /// /// /// - /// An array of GUIDs of entities to create. - /// Whether to return minimal information for referred entities. - /// Whether to ignore relationship attributes. - /// An array of the relationship types need to be excluded from the response. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetByGuids(IEnumerable guids, bool? minExtInfo = null, bool? ignoreRelationships = null, IEnumerable excludeRelationshipTypes = null, RequestOptions options = null) + public virtual Response GetByGuids(IEnumerable guids, RequestOptions options, bool? minExtInfo = null, bool? ignoreRelationships = null, IEnumerable excludeRelationshipTypes = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetByGuidsRequest(guids, minExtInfo, ignoreRelationships, excludeRelationshipTypes); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.GetByGuids"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetByGuidsRequest(guids, minExtInfo, ignoreRelationships, excludeRelationshipTypes); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -557,38 +480,14 @@ public virtual Response GetByGuids(IEnumerable guids, bool? minExtInfo = } } - private HttpMessage CreateGetByGuidsRequest(IEnumerable guids, bool? minExtInfo, bool? ignoreRelationships, IEnumerable excludeRelationshipTypes) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/entity/bulk", false); - uri.AppendQueryDelimited("guids", guids, ",", true); - if (minExtInfo != null) - { - uri.AppendQuery("minExtInfo", minExtInfo.Value, true); - } - if (ignoreRelationships != null) - { - uri.AppendQuery("ignoreRelationships", ignoreRelationships.Value, true); - } - if (excludeRelationshipTypes != null) - { - uri.AppendQueryDelimited("excludeRelationshipTypes", excludeRelationshipTypes, ",", true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// /// Create or update entities in Atlas in bulk. /// Existing entity is matched using its unique guid if supplied or by its unique attributes eg: qualifiedName. /// Map and array of collections are not well supported. E.g., array<array<int>>, array<map<string, int>>. /// + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -649,7 +548,6 @@ private HttpMessage CreateGetByGuidsRequest(IEnumerable guids, bool? min /// ] /// } /// - /// /// Schema for Response Body: /// { /// guidAssignments: Dictionary<string, string>, @@ -703,34 +601,16 @@ private HttpMessage CreateGetByGuidsRequest(IEnumerable guids, bool? min /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task CreateOrUpdateEntitiesAsync(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateEntitiesRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.CreateOrUpdateEntities"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateEntitiesRequest(content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -744,6 +624,9 @@ public virtual async Task CreateOrUpdateEntitiesAsync(RequestContent c /// Existing entity is matched using its unique guid if supplied or by its unique attributes eg: qualifiedName. /// Map and array of collections are not well supported. E.g., array<array<int>>, array<map<string, int>>. /// + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -804,7 +687,6 @@ public virtual async Task CreateOrUpdateEntitiesAsync(RequestContent c /// ] /// } /// - /// /// Schema for Response Body: /// { /// guidAssignments: Dictionary<string, string>, @@ -858,34 +740,16 @@ public virtual async Task CreateOrUpdateEntitiesAsync(RequestContent c /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response CreateOrUpdateEntities(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateEntitiesRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.CreateOrUpdateEntities"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateEntitiesRequest(content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -894,23 +758,10 @@ public virtual Response CreateOrUpdateEntities(RequestContent content, RequestOp } } - private HttpMessage CreateCreateOrUpdateEntitiesRequest(RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/entity/bulk", false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - /// Delete a list of entities in bulk identified by their GUIDs or unique attributes. + /// An array of GUIDs of entities to delete. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -965,34 +816,16 @@ private HttpMessage CreateCreateOrUpdateEntitiesRequest(RequestContent content) /// /// /// - /// An array of GUIDs of entities to delete. - /// The request options. #pragma warning disable AZC0002 public virtual async Task DeleteByGuidsAsync(IEnumerable guids, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteByGuidsRequest(guids); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.DeleteByGuids"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteByGuidsRequest(guids); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1002,6 +835,9 @@ public virtual async Task DeleteByGuidsAsync(IEnumerable guids } /// Delete a list of entities in bulk identified by their GUIDs or unique attributes. + /// An array of GUIDs of entities to delete. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -1056,34 +892,16 @@ public virtual async Task DeleteByGuidsAsync(IEnumerable guids /// /// /// - /// An array of GUIDs of entities to delete. - /// The request options. #pragma warning disable AZC0002 public virtual Response DeleteByGuids(IEnumerable guids, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteByGuidsRequest(guids); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.DeleteByGuids"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteByGuidsRequest(guids); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1092,22 +910,10 @@ public virtual Response DeleteByGuids(IEnumerable guids, RequestOptions } } - private HttpMessage CreateDeleteByGuidsRequest(IEnumerable guids) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/entity/bulk", false); - uri.AppendQueryDelimited("guids", guids, ",", true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Associate a classification to multiple entities in bulk. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -1133,34 +939,16 @@ private HttpMessage CreateDeleteByGuidsRequest(IEnumerable guids) /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task AddClassificationAsync(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateAddClassificationRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.AddClassification"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateAddClassificationRequest(content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1170,6 +958,9 @@ public virtual async Task AddClassificationAsync(RequestContent conten } /// Associate a classification to multiple entities in bulk. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -1195,34 +986,16 @@ public virtual async Task AddClassificationAsync(RequestContent conten /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response AddClassification(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateAddClassificationRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.AddClassification"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateAddClassificationRequest(content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1231,22 +1004,12 @@ public virtual Response AddClassification(RequestContent content, RequestOptions } } - private HttpMessage CreateAddClassificationRequest(RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/entity/bulk/classification", false); - request.Uri = uri; - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - /// Get complete definition of an entity given its GUID. + /// The globally unique identifier of the entity. + /// The request options. + /// Whether to return minimal information for referred entities. + /// Whether to ignore relationship attributes. + /// is null. /// /// Schema for Response Body: /// { @@ -1307,36 +1070,16 @@ private HttpMessage CreateAddClassificationRequest(RequestContent content) /// /// /// - /// The globally unique identifier of the entity. - /// Whether to return minimal information for referred entities. - /// Whether to ignore relationship attributes. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetByGuidAsync(string guid, bool? minExtInfo = null, bool? ignoreRelationships = null, RequestOptions options = null) + public virtual async Task GetByGuidAsync(string guid, RequestOptions options, bool? minExtInfo = null, bool? ignoreRelationships = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetByGuidRequest(guid, minExtInfo, ignoreRelationships); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.GetByGuid"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetByGuidRequest(guid, minExtInfo, ignoreRelationships); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1346,6 +1089,11 @@ public virtual async Task GetByGuidAsync(string guid, bool? minExtInfo } /// Get complete definition of an entity given its GUID. + /// The globally unique identifier of the entity. + /// The request options. + /// Whether to return minimal information for referred entities. + /// Whether to ignore relationship attributes. + /// is null. /// /// Schema for Response Body: /// { @@ -1406,36 +1154,16 @@ public virtual async Task GetByGuidAsync(string guid, bool? minExtInfo /// /// /// - /// The globally unique identifier of the entity. - /// Whether to return minimal information for referred entities. - /// Whether to ignore relationship attributes. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetByGuid(string guid, bool? minExtInfo = null, bool? ignoreRelationships = null, RequestOptions options = null) + public virtual Response GetByGuid(string guid, RequestOptions options, bool? minExtInfo = null, bool? ignoreRelationships = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetByGuidRequest(guid, minExtInfo, ignoreRelationships); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.GetByGuid"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetByGuidRequest(guid, minExtInfo, ignoreRelationships); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1444,35 +1172,17 @@ public virtual Response GetByGuid(string guid, bool? minExtInfo = null, bool? ig } } - private HttpMessage CreateGetByGuidRequest(string guid, bool? minExtInfo, bool? ignoreRelationships) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/entity/guid/", false); - uri.AppendPath(guid, true); - if (minExtInfo != null) - { - uri.AppendQuery("minExtInfo", minExtInfo.Value, true); - } - if (ignoreRelationships != null) - { - uri.AppendQuery("ignoreRelationships", ignoreRelationships.Value, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// /// Update entity partially - create or update entity attribute identified by its GUID. /// Supports only primitive attribute type and entity references. /// It does not support updating complex types like arrays, and maps. /// Null updates are not possible. /// + /// The globally unique identifier of the entity. + /// The name of the attribute. + /// The content to send as the body of the request. + /// The request options. + /// , , or is null. /// /// Schema for Response Body: /// { @@ -1527,36 +1237,16 @@ private HttpMessage CreateGetByGuidRequest(string guid, bool? minExtInfo, bool? /// /// /// - /// The globally unique identifier of the entity. - /// The name of the attribute. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task PartialUpdateEntityAttributeByGuidAsync(string guid, string name, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreatePartialUpdateEntityAttributeByGuidRequest(guid, name, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.PartialUpdateEntityAttributeByGuid"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreatePartialUpdateEntityAttributeByGuidRequest(guid, name, content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1571,6 +1261,11 @@ public virtual async Task PartialUpdateEntityAttributeByGuidAsync(stri /// It does not support updating complex types like arrays, and maps. /// Null updates are not possible. /// + /// The globally unique identifier of the entity. + /// The name of the attribute. + /// The content to send as the body of the request. + /// The request options. + /// , , or is null. /// /// Schema for Response Body: /// { @@ -1625,36 +1320,16 @@ public virtual async Task PartialUpdateEntityAttributeByGuidAsync(stri /// /// /// - /// The globally unique identifier of the entity. - /// The name of the attribute. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response PartialUpdateEntityAttributeByGuid(string guid, string name, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreatePartialUpdateEntityAttributeByGuidRequest(guid, name, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.PartialUpdateEntityAttributeByGuid"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreatePartialUpdateEntityAttributeByGuidRequest(guid, name, content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1663,25 +1338,10 @@ public virtual Response PartialUpdateEntityAttributeByGuid(string guid, string n } } - private HttpMessage CreatePartialUpdateEntityAttributeByGuidRequest(string guid, string name, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/entity/guid/", false); - uri.AppendPath(guid, true); - uri.AppendQuery("name", name, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - /// Delete an entity identified by its GUID. + /// The globally unique identifier of the entity. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -1736,34 +1396,16 @@ private HttpMessage CreatePartialUpdateEntityAttributeByGuidRequest(string guid, /// /// /// - /// The globally unique identifier of the entity. - /// The request options. #pragma warning disable AZC0002 public virtual async Task DeleteByGuidAsync(string guid, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteByGuidRequest(guid); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.DeleteByGuid"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteByGuidRequest(guid); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1773,6 +1415,9 @@ public virtual async Task DeleteByGuidAsync(string guid, RequestOption } /// Delete an entity identified by its GUID. + /// The globally unique identifier of the entity. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -1827,34 +1472,16 @@ public virtual async Task DeleteByGuidAsync(string guid, RequestOption /// /// /// - /// The globally unique identifier of the entity. - /// The request options. #pragma warning disable AZC0002 public virtual Response DeleteByGuid(string guid, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteByGuidRequest(guid); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.DeleteByGuid"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteByGuidRequest(guid); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1863,22 +1490,11 @@ public virtual Response DeleteByGuid(string guid, RequestOptions options = null) } } - private HttpMessage CreateDeleteByGuidRequest(string guid) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/entity/guid/", false); - uri.AppendPath(guid, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// List classifications for a given entity represented by a GUID. + /// The globally unique identifier of the entity. + /// The name of the classification. + /// The request options. + /// or is null. /// /// Schema for Response Body: /// { @@ -1901,35 +1517,16 @@ private HttpMessage CreateDeleteByGuidRequest(string guid) /// /// /// - /// The globally unique identifier of the entity. - /// The name of the classification. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetClassificationAsync(string guid, string classificationName, RequestOptions options = null) + public virtual async Task GetClassificationAsync(string guid, string classificationName, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetClassificationRequest(guid, classificationName); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.GetClassification"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetClassificationRequest(guid, classificationName); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1939,6 +1536,10 @@ public virtual async Task GetClassificationAsync(string guid, string c } /// List classifications for a given entity represented by a GUID. + /// The globally unique identifier of the entity. + /// The name of the classification. + /// The request options. + /// or is null. /// /// Schema for Response Body: /// { @@ -1961,35 +1562,16 @@ public virtual async Task GetClassificationAsync(string guid, string c /// /// /// - /// The globally unique identifier of the entity. - /// The name of the classification. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetClassification(string guid, string classificationName, RequestOptions options = null) + public virtual Response GetClassification(string guid, string classificationName, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetClassificationRequest(guid, classificationName); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.GetClassification"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetClassificationRequest(guid, classificationName); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1998,53 +1580,21 @@ public virtual Response GetClassification(string guid, string classificationName } } - private HttpMessage CreateGetClassificationRequest(string guid, string classificationName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/entity/guid/", false); - uri.AppendPath(guid, true); - uri.AppendPath("/classification/", false); - uri.AppendPath(classificationName, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Delete a given classification from an existing entity represented by a GUID. /// The globally unique identifier of the entity. /// The name of the classification. /// The request options. + /// or is null. #pragma warning disable AZC0002 public virtual async Task DeleteClassificationAsync(string guid, string classificationName, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteClassificationRequest(guid, classificationName); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.DeleteClassification"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteClassificationRequest(guid, classificationName); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -2057,32 +1607,17 @@ public virtual async Task DeleteClassificationAsync(string guid, strin /// The globally unique identifier of the entity. /// The name of the classification. /// The request options. + /// or is null. #pragma warning disable AZC0002 public virtual Response DeleteClassification(string guid, string classificationName, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteClassificationRequest(guid, classificationName); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.DeleteClassification"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteClassificationRequest(guid, classificationName); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -2091,23 +1626,10 @@ public virtual Response DeleteClassification(string guid, string classificationN } } - private HttpMessage CreateDeleteClassificationRequest(string guid, string classificationName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/entity/guid/", false); - uri.AppendPath(guid, true); - uri.AppendPath("/classification/", false); - uri.AppendPath(classificationName, true); - request.Uri = uri; - return message; - } - /// List classifications for a given entity represented by a GUID. + /// The globally unique identifier of the entity. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -2121,34 +1643,16 @@ private HttpMessage CreateDeleteClassificationRequest(string guid, string classi /// /// /// - /// The globally unique identifier of the entity. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetClassificationsAsync(string guid, RequestOptions options = null) + public virtual async Task GetClassificationsAsync(string guid, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetClassificationsRequest(guid); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.GetClassifications"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetClassificationsRequest(guid); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -2158,6 +1662,9 @@ public virtual async Task GetClassificationsAsync(string guid, Request } /// List classifications for a given entity represented by a GUID. + /// The globally unique identifier of the entity. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -2171,34 +1678,16 @@ public virtual async Task GetClassificationsAsync(string guid, Request /// /// /// - /// The globally unique identifier of the entity. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetClassifications(string guid, RequestOptions options = null) + public virtual Response GetClassifications(string guid, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetClassificationsRequest(guid); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.GetClassifications"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetClassificationsRequest(guid); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -2207,23 +1696,11 @@ public virtual Response GetClassifications(string guid, RequestOptions options = } } - private HttpMessage CreateGetClassificationsRequest(string guid) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/entity/guid/", false); - uri.AppendPath(guid, true); - uri.AppendPath("/classifications", false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Add classifications to an existing entity represented by a GUID. + /// The globally unique identifier of the entity. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// /// Schema for Request Body: /// { @@ -2246,35 +1723,16 @@ private HttpMessage CreateGetClassificationsRequest(string guid) /// /// /// - /// The globally unique identifier of the entity. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task AddClassificationsAsync(string guid, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateAddClassificationsRequest(guid, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.AddClassifications"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateAddClassificationsRequest(guid, content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -2284,6 +1742,10 @@ public virtual async Task AddClassificationsAsync(string guid, Request } /// Add classifications to an existing entity represented by a GUID. + /// The globally unique identifier of the entity. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// /// Schema for Request Body: /// { @@ -2306,35 +1768,16 @@ public virtual async Task AddClassificationsAsync(string guid, Request /// /// /// - /// The globally unique identifier of the entity. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response AddClassifications(string guid, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateAddClassificationsRequest(guid, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.AddClassifications"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateAddClassificationsRequest(guid, content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -2343,24 +1786,11 @@ public virtual Response AddClassifications(string guid, RequestContent content, } } - private HttpMessage CreateAddClassificationsRequest(string guid, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/entity/guid/", false); - uri.AppendPath(guid, true); - uri.AppendPath("/classifications", false); - request.Uri = uri; - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - /// Update classifications to an existing entity represented by a guid. + /// The globally unique identifier of the entity. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// /// Schema for Request Body: /// { @@ -2383,35 +1813,16 @@ private HttpMessage CreateAddClassificationsRequest(string guid, RequestContent /// /// /// - /// The globally unique identifier of the entity. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task UpdateClassificationsAsync(string guid, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateUpdateClassificationsRequest(guid, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.UpdateClassifications"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateUpdateClassificationsRequest(guid, content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -2421,6 +1832,10 @@ public virtual async Task UpdateClassificationsAsync(string guid, Requ } /// Update classifications to an existing entity represented by a guid. + /// The globally unique identifier of the entity. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// /// Schema for Request Body: /// { @@ -2443,35 +1858,16 @@ public virtual async Task UpdateClassificationsAsync(string guid, Requ /// /// /// - /// The globally unique identifier of the entity. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response UpdateClassifications(string guid, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateUpdateClassificationsRequest(guid, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.UpdateClassifications"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateUpdateClassificationsRequest(guid, content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -2480,23 +1876,6 @@ public virtual Response UpdateClassifications(string guid, RequestContent conten } } - private HttpMessage CreateUpdateClassificationsRequest(string guid, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/entity/guid/", false); - uri.AppendPath(guid, true); - uri.AppendPath("/classifications", false); - request.Uri = uri; - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - /// /// Get complete definition of an entity given its type and unique attribute. /// In addition to the typeName path parameter, attribute key-value pair(s) can be provided in the following format: @@ -2505,6 +1884,12 @@ private HttpMessage CreateUpdateClassificationsRequest(string guid, RequestConte /// The REST request would look something like this: /// GET /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. /// + /// The name of the type. + /// The request options. + /// Whether to return minimal information for referred entities. + /// Whether to ignore relationship attributes. + /// The qualified name of the entity. + /// is null. /// /// Schema for Response Body: /// { @@ -2565,37 +1950,16 @@ private HttpMessage CreateUpdateClassificationsRequest(string guid, RequestConte /// /// /// - /// The name of the type. - /// Whether to return minimal information for referred entities. - /// Whether to ignore relationship attributes. - /// The qualified name of the entity. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetByUniqueAttributesAsync(string typeName, bool? minExtInfo = null, bool? ignoreRelationships = null, string attrQualifiedName = null, RequestOptions options = null) + public virtual async Task GetByUniqueAttributesAsync(string typeName, RequestOptions options, bool? minExtInfo = null, bool? ignoreRelationships = null, string attrQualifiedName = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetByUniqueAttributesRequest(typeName, minExtInfo, ignoreRelationships, attrQualifiedName); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.GetByUniqueAttributes"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetByUniqueAttributesRequest(typeName, minExtInfo, ignoreRelationships, attrQualifiedName); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -2612,6 +1976,12 @@ public virtual async Task GetByUniqueAttributesAsync(string typeName, /// The REST request would look something like this: /// GET /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. /// + /// The name of the type. + /// The request options. + /// Whether to return minimal information for referred entities. + /// Whether to ignore relationship attributes. + /// The qualified name of the entity. + /// is null. /// /// Schema for Response Body: /// { @@ -2672,37 +2042,16 @@ public virtual async Task GetByUniqueAttributesAsync(string typeName, /// /// /// - /// The name of the type. - /// Whether to return minimal information for referred entities. - /// Whether to ignore relationship attributes. - /// The qualified name of the entity. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetByUniqueAttributes(string typeName, bool? minExtInfo = null, bool? ignoreRelationships = null, string attrQualifiedName = null, RequestOptions options = null) + public virtual Response GetByUniqueAttributes(string typeName, RequestOptions options, bool? minExtInfo = null, bool? ignoreRelationships = null, string attrQualifiedName = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetByUniqueAttributesRequest(typeName, minExtInfo, ignoreRelationships, attrQualifiedName); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.GetByUniqueAttributes"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetByUniqueAttributesRequest(typeName, minExtInfo, ignoreRelationships, attrQualifiedName); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -2711,33 +2060,6 @@ public virtual Response GetByUniqueAttributes(string typeName, bool? minExtInfo } } - private HttpMessage CreateGetByUniqueAttributesRequest(string typeName, bool? minExtInfo, bool? ignoreRelationships, string attrQualifiedName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/entity/uniqueAttribute/type/", false); - uri.AppendPath(typeName, true); - if (minExtInfo != null) - { - uri.AppendQuery("minExtInfo", minExtInfo.Value, true); - } - if (ignoreRelationships != null) - { - uri.AppendQuery("ignoreRelationships", ignoreRelationships.Value, true); - } - if (attrQualifiedName != null) - { - uri.AppendQuery("attr:qualifiedName", attrQualifiedName, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// /// Update entity partially - Allow a subset of attributes to be updated on /// an entity which is identified by its type and unique attribute eg: Referenceable.qualifiedName. @@ -2748,6 +2070,11 @@ private HttpMessage CreateGetByUniqueAttributesRequest(string typeName, bool? mi /// The REST request would look something like this: /// PUT /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. /// + /// The name of the type. + /// The content to send as the body of the request. + /// The qualified name of the entity. + /// The request options. + /// or is null. /// /// Schema for Request Body: /// { @@ -2806,7 +2133,6 @@ private HttpMessage CreateGetByUniqueAttributesRequest(string typeName, bool? mi /// } /// } /// - /// /// Schema for Response Body: /// { /// guidAssignments: Dictionary<string, string>, @@ -2860,36 +2186,16 @@ private HttpMessage CreateGetByUniqueAttributesRequest(string typeName, bool? mi /// /// /// - /// The name of the type. - /// The content to send as the body of the request. - /// The qualified name of the entity. - /// The request options. #pragma warning disable AZC0002 public virtual async Task PartialUpdateEntityByUniqueAttributesAsync(string typeName, RequestContent content, string attrQualifiedName = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreatePartialUpdateEntityByUniqueAttributesRequest(typeName, content, attrQualifiedName); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.PartialUpdateEntityByUniqueAttributes"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreatePartialUpdateEntityByUniqueAttributesRequest(typeName, content, attrQualifiedName); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -2908,6 +2214,11 @@ public virtual async Task PartialUpdateEntityByUniqueAttributesAsync(s /// The REST request would look something like this: /// PUT /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. /// + /// The name of the type. + /// The content to send as the body of the request. + /// The qualified name of the entity. + /// The request options. + /// or is null. /// /// Schema for Request Body: /// { @@ -2966,7 +2277,6 @@ public virtual async Task PartialUpdateEntityByUniqueAttributesAsync(s /// } /// } /// - /// /// Schema for Response Body: /// { /// guidAssignments: Dictionary<string, string>, @@ -3020,36 +2330,16 @@ public virtual async Task PartialUpdateEntityByUniqueAttributesAsync(s /// /// /// - /// The name of the type. - /// The content to send as the body of the request. - /// The qualified name of the entity. - /// The request options. #pragma warning disable AZC0002 public virtual Response PartialUpdateEntityByUniqueAttributes(string typeName, RequestContent content, string attrQualifiedName = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreatePartialUpdateEntityByUniqueAttributesRequest(typeName, content, attrQualifiedName); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.PartialUpdateEntityByUniqueAttributes"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreatePartialUpdateEntityByUniqueAttributesRequest(typeName, content, attrQualifiedName); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -3058,27 +2348,6 @@ public virtual Response PartialUpdateEntityByUniqueAttributes(string typeName, R } } - private HttpMessage CreatePartialUpdateEntityByUniqueAttributesRequest(string typeName, RequestContent content, string attrQualifiedName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/entity/uniqueAttribute/type/", false); - uri.AppendPath(typeName, true); - if (attrQualifiedName != null) - { - uri.AppendQuery("attr:qualifiedName", attrQualifiedName, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - /// /// Delete an entity identified by its type and unique attributes. /// In addition to the typeName path parameter, attribute key-value pair(s) can be provided in the following format: @@ -3087,6 +2356,10 @@ private HttpMessage CreatePartialUpdateEntityByUniqueAttributesRequest(string ty /// The REST request would look something like this: /// DELETE /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. /// + /// The name of the type. + /// The qualified name of the entity. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -3141,35 +2414,16 @@ private HttpMessage CreatePartialUpdateEntityByUniqueAttributesRequest(string ty /// /// /// - /// The name of the type. - /// The qualified name of the entity. - /// The request options. #pragma warning disable AZC0002 public virtual async Task DeleteByUniqueAttributeAsync(string typeName, string attrQualifiedName = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteByUniqueAttributeRequest(typeName, attrQualifiedName); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.DeleteByUniqueAttribute"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteByUniqueAttributeRequest(typeName, attrQualifiedName); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -3186,6 +2440,10 @@ public virtual async Task DeleteByUniqueAttributeAsync(string typeName /// The REST request would look something like this: /// DELETE /v2/entity/uniqueAttribute/type/aType?attr:aTypeAttribute=someValue. /// + /// The name of the type. + /// The qualified name of the entity. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -3240,35 +2498,16 @@ public virtual async Task DeleteByUniqueAttributeAsync(string typeName /// /// /// - /// The name of the type. - /// The qualified name of the entity. - /// The request options. #pragma warning disable AZC0002 public virtual Response DeleteByUniqueAttribute(string typeName, string attrQualifiedName = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteByUniqueAttributeRequest(typeName, attrQualifiedName); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.DeleteByUniqueAttribute"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteByUniqueAttributeRequest(typeName, attrQualifiedName); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -3277,56 +2516,22 @@ public virtual Response DeleteByUniqueAttribute(string typeName, string attrQual } } - private HttpMessage CreateDeleteByUniqueAttributeRequest(string typeName, string attrQualifiedName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/entity/uniqueAttribute/type/", false); - uri.AppendPath(typeName, true); - if (attrQualifiedName != null) - { - uri.AppendQuery("attr:qualifiedName", attrQualifiedName, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Delete a given classification from an entity identified by its type and unique attributes. /// The name of the type. /// The name of the classification. /// The qualified name of the entity. /// The request options. + /// or is null. #pragma warning disable AZC0002 public virtual async Task DeleteClassificationByUniqueAttributeAsync(string typeName, string classificationName, string attrQualifiedName = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteClassificationByUniqueAttributeRequest(typeName, classificationName, attrQualifiedName); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.DeleteClassificationByUniqueAttribute"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteClassificationByUniqueAttributeRequest(typeName, classificationName, attrQualifiedName); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -3340,32 +2545,17 @@ public virtual async Task DeleteClassificationByUniqueAttributeAsync(s /// The name of the classification. /// The qualified name of the entity. /// The request options. + /// or is null. #pragma warning disable AZC0002 public virtual Response DeleteClassificationByUniqueAttribute(string typeName, string classificationName, string attrQualifiedName = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteClassificationByUniqueAttributeRequest(typeName, classificationName, attrQualifiedName); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.DeleteClassificationByUniqueAttribute"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteClassificationByUniqueAttributeRequest(typeName, classificationName, attrQualifiedName); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -3374,27 +2564,12 @@ public virtual Response DeleteClassificationByUniqueAttribute(string typeName, s } } - private HttpMessage CreateDeleteClassificationByUniqueAttributeRequest(string typeName, string classificationName, string attrQualifiedName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/entity/uniqueAttribute/type/", false); - uri.AppendPath(typeName, true); - uri.AppendPath("/classification/", false); - uri.AppendPath(classificationName, true); - if (attrQualifiedName != null) - { - uri.AppendQuery("attr:qualifiedName", attrQualifiedName, true); - } - request.Uri = uri; - return message; - } - /// Add classification to the entity identified by its type and unique attributes. + /// The name of the type. + /// The content to send as the body of the request. + /// The qualified name of the entity. + /// The request options. + /// or is null. /// /// Schema for Request Body: /// { @@ -3417,36 +2592,16 @@ private HttpMessage CreateDeleteClassificationByUniqueAttributeRequest(string ty /// /// /// - /// The name of the type. - /// The content to send as the body of the request. - /// The qualified name of the entity. - /// The request options. #pragma warning disable AZC0002 public virtual async Task AddClassificationsByUniqueAttributeAsync(string typeName, RequestContent content, string attrQualifiedName = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateAddClassificationsByUniqueAttributeRequest(typeName, content, attrQualifiedName); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.AddClassificationsByUniqueAttribute"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateAddClassificationsByUniqueAttributeRequest(typeName, content, attrQualifiedName); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -3456,6 +2611,11 @@ public virtual async Task AddClassificationsByUniqueAttributeAsync(str } /// Add classification to the entity identified by its type and unique attributes. + /// The name of the type. + /// The content to send as the body of the request. + /// The qualified name of the entity. + /// The request options. + /// or is null. /// /// Schema for Request Body: /// { @@ -3478,36 +2638,16 @@ public virtual async Task AddClassificationsByUniqueAttributeAsync(str /// /// /// - /// The name of the type. - /// The content to send as the body of the request. - /// The qualified name of the entity. - /// The request options. #pragma warning disable AZC0002 public virtual Response AddClassificationsByUniqueAttribute(string typeName, RequestContent content, string attrQualifiedName = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateAddClassificationsByUniqueAttributeRequest(typeName, content, attrQualifiedName); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.AddClassificationsByUniqueAttribute"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateAddClassificationsByUniqueAttributeRequest(typeName, content, attrQualifiedName); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -3516,28 +2656,12 @@ public virtual Response AddClassificationsByUniqueAttribute(string typeName, Req } } - private HttpMessage CreateAddClassificationsByUniqueAttributeRequest(string typeName, RequestContent content, string attrQualifiedName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/entity/uniqueAttribute/type/", false); - uri.AppendPath(typeName, true); - uri.AppendPath("/classifications", false); - if (attrQualifiedName != null) - { - uri.AppendQuery("attr:qualifiedName", attrQualifiedName, true); - } - request.Uri = uri; - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - /// Update classification on an entity identified by its type and unique attributes. + /// The name of the type. + /// The content to send as the body of the request. + /// The qualified name of the entity. + /// The request options. + /// or is null. /// /// Schema for Request Body: /// { @@ -3560,36 +2684,16 @@ private HttpMessage CreateAddClassificationsByUniqueAttributeRequest(string type /// /// /// - /// The name of the type. - /// The content to send as the body of the request. - /// The qualified name of the entity. - /// The request options. #pragma warning disable AZC0002 public virtual async Task UpdateClassificationsByUniqueAttributeAsync(string typeName, RequestContent content, string attrQualifiedName = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateUpdateClassificationsByUniqueAttributeRequest(typeName, content, attrQualifiedName); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.UpdateClassificationsByUniqueAttribute"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateUpdateClassificationsByUniqueAttributeRequest(typeName, content, attrQualifiedName); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -3599,6 +2703,11 @@ public virtual async Task UpdateClassificationsByUniqueAttributeAsync( } /// Update classification on an entity identified by its type and unique attributes. + /// The name of the type. + /// The content to send as the body of the request. + /// The qualified name of the entity. + /// The request options. + /// or is null. /// /// Schema for Request Body: /// { @@ -3621,36 +2730,16 @@ public virtual async Task UpdateClassificationsByUniqueAttributeAsync( /// /// /// - /// The name of the type. - /// The content to send as the body of the request. - /// The qualified name of the entity. - /// The request options. #pragma warning disable AZC0002 public virtual Response UpdateClassificationsByUniqueAttribute(string typeName, RequestContent content, string attrQualifiedName = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateUpdateClassificationsByUniqueAttributeRequest(typeName, content, attrQualifiedName); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.UpdateClassificationsByUniqueAttribute"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateUpdateClassificationsByUniqueAttributeRequest(typeName, content, attrQualifiedName); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -3659,28 +2748,10 @@ public virtual Response UpdateClassificationsByUniqueAttribute(string typeName, } } - private HttpMessage CreateUpdateClassificationsByUniqueAttributeRequest(string typeName, RequestContent content, string attrQualifiedName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/entity/uniqueAttribute/type/", false); - uri.AppendPath(typeName, true); - uri.AppendPath("/classifications", false); - if (attrQualifiedName != null) - { - uri.AppendQuery("attr:qualifiedName", attrQualifiedName, true); - } - request.Uri = uri; - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - /// Set classifications on entities in bulk. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -3689,34 +2760,16 @@ private HttpMessage CreateUpdateClassificationsByUniqueAttributeRequest(string t /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task SetClassificationsAsync(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateSetClassificationsRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.SetClassifications"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateSetClassificationsRequest(content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -3726,6 +2779,9 @@ public virtual async Task SetClassificationsAsync(RequestContent conte } /// Set classifications on entities in bulk. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -3734,34 +2790,16 @@ public virtual async Task SetClassificationsAsync(RequestContent conte /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response SetClassifications(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateSetClassificationsRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.SetClassifications"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateSetClassificationsRequest(content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -3770,22 +2808,6 @@ public virtual Response SetClassifications(RequestContent content, RequestOption } } - private HttpMessage CreateSetClassificationsRequest(RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/entity/bulk/setClassifications", false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - /// /// Bulk API to retrieve list of entities identified by its unique attributes. /// @@ -3799,6 +2821,12 @@ private HttpMessage CreateSetClassificationsRequest(RequestContent content) /// /// GET /v2/entity/bulk/uniqueAttribute/type/hive_db?attr_0:qualifiedName=db1@cl1&attr_2:qualifiedName=db2@cl1 /// + /// The name of the type. + /// The request options. + /// Whether to return minimal information for referred entities. + /// Whether to ignore relationship attributes. + /// Qualified name of an entity. E.g. to find 2 entities you can set attrs_0:qualifiedName=db1@cl1&attrs_2:qualifiedName=db2@cl1. + /// is null. /// /// Schema for Response Body: /// { @@ -3861,37 +2889,16 @@ private HttpMessage CreateSetClassificationsRequest(RequestContent content) /// /// /// - /// The name of the type. - /// Whether to return minimal information for referred entities. - /// Whether to ignore relationship attributes. - /// Qualified name of an entity. E.g. to find 2 entities you can set attrs_0:qualifiedName=db1@cl1&attrs_2:qualifiedName=db2@cl1. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetEntitiesByUniqueAttributesAsync(string typeName, bool? minExtInfo = null, bool? ignoreRelationships = null, string attrNQualifiedName = null, RequestOptions options = null) + public virtual async Task GetEntitiesByUniqueAttributesAsync(string typeName, RequestOptions options, bool? minExtInfo = null, bool? ignoreRelationships = null, string attrNQualifiedName = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetEntitiesByUniqueAttributesRequest(typeName, minExtInfo, ignoreRelationships, attrNQualifiedName); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.GetEntitiesByUniqueAttributes"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetEntitiesByUniqueAttributesRequest(typeName, minExtInfo, ignoreRelationships, attrNQualifiedName); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -3913,6 +2920,12 @@ public virtual async Task GetEntitiesByUniqueAttributesAsync(string ty /// /// GET /v2/entity/bulk/uniqueAttribute/type/hive_db?attr_0:qualifiedName=db1@cl1&attr_2:qualifiedName=db2@cl1 /// + /// The name of the type. + /// The request options. + /// Whether to return minimal information for referred entities. + /// Whether to ignore relationship attributes. + /// Qualified name of an entity. E.g. to find 2 entities you can set attrs_0:qualifiedName=db1@cl1&attrs_2:qualifiedName=db2@cl1. + /// is null. /// /// Schema for Response Body: /// { @@ -3975,37 +2988,16 @@ public virtual async Task GetEntitiesByUniqueAttributesAsync(string ty /// /// /// - /// The name of the type. - /// Whether to return minimal information for referred entities. - /// Whether to ignore relationship attributes. - /// Qualified name of an entity. E.g. to find 2 entities you can set attrs_0:qualifiedName=db1@cl1&attrs_2:qualifiedName=db2@cl1. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetEntitiesByUniqueAttributes(string typeName, bool? minExtInfo = null, bool? ignoreRelationships = null, string attrNQualifiedName = null, RequestOptions options = null) + public virtual Response GetEntitiesByUniqueAttributes(string typeName, RequestOptions options, bool? minExtInfo = null, bool? ignoreRelationships = null, string attrNQualifiedName = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetEntitiesByUniqueAttributesRequest(typeName, minExtInfo, ignoreRelationships, attrNQualifiedName); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.GetEntitiesByUniqueAttributes"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetEntitiesByUniqueAttributesRequest(typeName, minExtInfo, ignoreRelationships, attrNQualifiedName); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -4014,34 +3006,10 @@ public virtual Response GetEntitiesByUniqueAttributes(string typeName, bool? min } } - private HttpMessage CreateGetEntitiesByUniqueAttributesRequest(string typeName, bool? minExtInfo, bool? ignoreRelationships, string attrNQualifiedName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/entity/bulk/uniqueAttribute/type/", false); - uri.AppendPath(typeName, true); - if (minExtInfo != null) - { - uri.AppendQuery("minExtInfo", minExtInfo.Value, true); - } - if (ignoreRelationships != null) - { - uri.AppendQuery("ignoreRelationships", ignoreRelationships.Value, true); - } - if (attrNQualifiedName != null) - { - uri.AppendQuery("attr_N:qualifiedName", attrNQualifiedName, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Get entity header given its GUID. + /// The globally unique identifier of the entity. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -4090,34 +3058,16 @@ private HttpMessage CreateGetEntitiesByUniqueAttributesRequest(string typeName, /// /// /// - /// The globally unique identifier of the entity. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetHeaderAsync(string guid, RequestOptions options = null) + public virtual async Task GetHeaderAsync(string guid, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetHeaderRequest(guid); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.GetHeader"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetHeaderRequest(guid); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -4127,6 +3077,9 @@ public virtual async Task GetHeaderAsync(string guid, RequestOptions o } /// Get entity header given its GUID. + /// The globally unique identifier of the entity. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -4175,34 +3128,16 @@ public virtual async Task GetHeaderAsync(string guid, RequestOptions o /// /// /// - /// The globally unique identifier of the entity. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetHeader(string guid, RequestOptions options = null) + public virtual Response GetHeader(string guid, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetHeaderRequest(guid); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewEntities.GetHeader"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetHeaderRequest(guid); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -4211,20 +3146,478 @@ public virtual Response GetHeader(string guid, RequestOptions options = null) } } - private HttpMessage CreateGetHeaderRequest(string guid) + internal HttpMessage CreateCreateOrUpdateRequest(RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/entity", false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetByGuidsRequest(IEnumerable guids, bool? minExtInfo, bool? ignoreRelationships, IEnumerable excludeRelationshipTypes) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/entity/bulk", false); + foreach (var param in guids) + { + uri.AppendQuery("guids", param, true); + } + if (minExtInfo != null) + { + uri.AppendQuery("minExtInfo", minExtInfo.Value, true); + } + if (ignoreRelationships != null) + { + uri.AppendQuery("ignoreRelationships", ignoreRelationships.Value, true); + } + if (excludeRelationshipTypes != null) + { + foreach (var param0 in excludeRelationshipTypes) + { + uri.AppendQuery("excludeRelationshipTypes", param0, true); + } + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateOrUpdateEntitiesRequest(RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/entity/bulk", false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateDeleteByGuidsRequest(IEnumerable guids) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/entity/bulk", false); + foreach (var param in guids) + { + uri.AppendQuery("guids", param, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateAddClassificationRequest(RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/entity/bulk/classification", false); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier204.Instance; + return message; + } + + internal HttpMessage CreateGetByGuidRequest(string guid, bool? minExtInfo, bool? ignoreRelationships) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/entity/guid/", false); + uri.AppendPath(guid, true); + if (minExtInfo != null) + { + uri.AppendQuery("minExtInfo", minExtInfo.Value, true); + } + if (ignoreRelationships != null) + { + uri.AppendQuery("ignoreRelationships", ignoreRelationships.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreatePartialUpdateEntityAttributeByGuidRequest(string guid, string name, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/entity/guid/", false); + uri.AppendPath(guid, true); + uri.AppendQuery("name", name, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateDeleteByGuidRequest(string guid) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/entity/guid/", false); + uri.AppendPath(guid, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetClassificationRequest(string guid, string classificationName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/entity/guid/", false); + uri.AppendPath(guid, true); + uri.AppendPath("/classification/", false); + uri.AppendPath(classificationName, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateDeleteClassificationRequest(string guid, string classificationName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/entity/guid/", false); + uri.AppendPath(guid, true); + uri.AppendPath("/classification/", false); + uri.AppendPath(classificationName, true); + request.Uri = uri; + message.ResponseClassifier = ResponseClassifier204.Instance; + return message; + } + + internal HttpMessage CreateGetClassificationsRequest(string guid) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/entity/guid/", false); + uri.AppendPath(guid, true); + uri.AppendPath("/classifications", false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateAddClassificationsRequest(string guid, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/entity/guid/", false); + uri.AppendPath(guid, true); + uri.AppendPath("/classifications", false); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier204.Instance; + return message; + } + + internal HttpMessage CreateUpdateClassificationsRequest(string guid, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/entity/guid/", false); + uri.AppendPath(guid, true); + uri.AppendPath("/classifications", false); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier204.Instance; + return message; + } + + internal HttpMessage CreateGetByUniqueAttributesRequest(string typeName, bool? minExtInfo, bool? ignoreRelationships, string attrQualifiedName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/entity/uniqueAttribute/type/", false); + uri.AppendPath(typeName, true); + if (minExtInfo != null) + { + uri.AppendQuery("minExtInfo", minExtInfo.Value, true); + } + if (ignoreRelationships != null) + { + uri.AppendQuery("ignoreRelationships", ignoreRelationships.Value, true); + } + if (attrQualifiedName != null) + { + uri.AppendQuery("attr:qualifiedName", attrQualifiedName, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreatePartialUpdateEntityByUniqueAttributesRequest(string typeName, RequestContent content, string attrQualifiedName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/entity/uniqueAttribute/type/", false); + uri.AppendPath(typeName, true); + if (attrQualifiedName != null) + { + uri.AppendQuery("attr:qualifiedName", attrQualifiedName, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateDeleteByUniqueAttributeRequest(string typeName, string attrQualifiedName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/entity/uniqueAttribute/type/", false); + uri.AppendPath(typeName, true); + if (attrQualifiedName != null) + { + uri.AppendQuery("attr:qualifiedName", attrQualifiedName, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateDeleteClassificationByUniqueAttributeRequest(string typeName, string classificationName, string attrQualifiedName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/entity/uniqueAttribute/type/", false); + uri.AppendPath(typeName, true); + uri.AppendPath("/classification/", false); + uri.AppendPath(classificationName, true); + if (attrQualifiedName != null) + { + uri.AppendQuery("attr:qualifiedName", attrQualifiedName, true); + } + request.Uri = uri; + message.ResponseClassifier = ResponseClassifier204.Instance; + return message; + } + + internal HttpMessage CreateAddClassificationsByUniqueAttributeRequest(string typeName, RequestContent content, string attrQualifiedName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/entity/uniqueAttribute/type/", false); + uri.AppendPath(typeName, true); + uri.AppendPath("/classifications", false); + if (attrQualifiedName != null) + { + uri.AppendQuery("attr:qualifiedName", attrQualifiedName, true); + } + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier204.Instance; + return message; + } + + internal HttpMessage CreateUpdateClassificationsByUniqueAttributeRequest(string typeName, RequestContent content, string attrQualifiedName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/entity/uniqueAttribute/type/", false); + uri.AppendPath(typeName, true); + uri.AppendPath("/classifications", false); + if (attrQualifiedName != null) + { + uri.AppendQuery("attr:qualifiedName", attrQualifiedName, true); + } + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier204.Instance; + return message; + } + + internal HttpMessage CreateSetClassificationsRequest(RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/entity/bulk/setClassifications", false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetEntitiesByUniqueAttributesRequest(string typeName, bool? minExtInfo, bool? ignoreRelationships, string attrNQualifiedName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/entity/bulk/uniqueAttribute/type/", false); + uri.AppendPath(typeName, true); + if (minExtInfo != null) + { + uri.AppendQuery("minExtInfo", minExtInfo.Value, true); + } + if (ignoreRelationships != null) + { + uri.AppendQuery("ignoreRelationships", ignoreRelationships.Value, true); + } + if (attrNQualifiedName != null) + { + uri.AppendQuery("attr_N:qualifiedName", attrNQualifiedName, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetHeaderRequest(string guid) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); uri.AppendRaw("/api", false); uri.AppendPath("/atlas/v2/entity/guid/", false); uri.AppendPath(guid, true); uri.AppendPath("/header", false); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; return message; } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier204 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier204(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 204 => false, + _ => true + }; + } + } } } diff --git a/sdk/purview/Azure.Analytics.Purview.Catalog/src/Generated/PurviewGlossaries.cs b/sdk/purview/Azure.Analytics.Purview.Catalog/src/Generated/PurviewGlossaries.cs index f1ff7e7c0f845..8f6a1e802d6b1 100644 --- a/sdk/purview/Azure.Analytics.Purview.Catalog/src/Generated/PurviewGlossaries.cs +++ b/sdk/purview/Azure.Analytics.Purview.Catalog/src/Generated/PurviewGlossaries.cs @@ -16,14 +16,16 @@ namespace Azure.Analytics.Purview.Catalog /// The PurviewGlossaries service client. public partial class PurviewGlossaries { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of PurviewGlossaries for mocking. protected PurviewGlossaries() @@ -31,6 +33,10 @@ protected PurviewGlossaries() } /// Get all glossaries registered with Atlas. + /// The request options. + /// The page size - by default there is no paging. + /// The offset for pagination purpose. + /// The sort order, ASC (default) or DESC. /// /// Schema for Response Body: /// { @@ -86,36 +92,16 @@ protected PurviewGlossaries() /// /// /// - /// The page size - by default there is no paging. - /// The offset for pagination purpose. - /// The sort order, ASC (default) or DESC. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetGlossariesAsync(int? limit = null, int? offset = null, string sort = null, RequestOptions options = null) + public virtual async Task GetGlossariesAsync(RequestOptions options, int? limit = null, int? offset = null, string sort = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetGlossariesRequest(limit, offset, sort); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetGlossaries"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetGlossariesRequest(limit, offset, sort); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -125,6 +111,10 @@ public virtual async Task GetGlossariesAsync(int? limit = null, int? o } /// Get all glossaries registered with Atlas. + /// The request options. + /// The page size - by default there is no paging. + /// The offset for pagination purpose. + /// The sort order, ASC (default) or DESC. /// /// Schema for Response Body: /// { @@ -180,36 +170,16 @@ public virtual async Task GetGlossariesAsync(int? limit = null, int? o /// /// /// - /// The page size - by default there is no paging. - /// The offset for pagination purpose. - /// The sort order, ASC (default) or DESC. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetGlossaries(int? limit = null, int? offset = null, string sort = null, RequestOptions options = null) + public virtual Response GetGlossaries(RequestOptions options, int? limit = null, int? offset = null, string sort = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetGlossariesRequest(limit, offset, sort); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetGlossaries"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetGlossariesRequest(limit, offset, sort); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -218,33 +188,10 @@ public virtual Response GetGlossaries(int? limit = null, int? offset = null, str } } - private HttpMessage CreateGetGlossariesRequest(int? limit, int? offset, string sort) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/glossary", false); - if (limit != null) - { - uri.AppendQuery("limit", limit.Value, true); - } - if (offset != null) - { - uri.AppendQuery("offset", offset.Value, true); - } - if (sort != null) - { - uri.AppendQuery("sort", sort, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Create a glossary. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -298,7 +245,6 @@ private HttpMessage CreateGetGlossariesRequest(int? limit, int? offset, string s /// usage: string /// } /// - /// /// Schema for Response Body: /// { /// classifications: [ @@ -353,34 +299,16 @@ private HttpMessage CreateGetGlossariesRequest(int? limit, int? offset, string s /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task CreateGlossaryAsync(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateGlossaryRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.CreateGlossary"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateGlossaryRequest(content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -390,6 +318,9 @@ public virtual async Task CreateGlossaryAsync(RequestContent content, } /// Create a glossary. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -443,7 +374,6 @@ public virtual async Task CreateGlossaryAsync(RequestContent content, /// usage: string /// } /// - /// /// Schema for Response Body: /// { /// classifications: [ @@ -498,34 +428,16 @@ public virtual async Task CreateGlossaryAsync(RequestContent content, /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response CreateGlossary(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateGlossaryRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.CreateGlossary"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateGlossaryRequest(content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -534,23 +446,10 @@ public virtual Response CreateGlossary(RequestContent content, RequestOptions op } } - private HttpMessage CreateCreateGlossaryRequest(RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/glossary", false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - /// Create glossary category in bulk. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -608,7 +507,6 @@ private HttpMessage CreateCreateGlossaryRequest(RequestContent content) /// ] /// } /// - /// /// Schema for Response Body: /// { /// classifications: [ @@ -667,34 +565,16 @@ private HttpMessage CreateCreateGlossaryRequest(RequestContent content) /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task CreateGlossaryCategoriesAsync(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateGlossaryCategoriesRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.CreateGlossaryCategories"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateGlossaryCategoriesRequest(content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -704,6 +584,9 @@ public virtual async Task CreateGlossaryCategoriesAsync(RequestContent } /// Create glossary category in bulk. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -761,7 +644,6 @@ public virtual async Task CreateGlossaryCategoriesAsync(RequestContent /// ] /// } /// - /// /// Schema for Response Body: /// { /// classifications: [ @@ -820,34 +702,16 @@ public virtual async Task CreateGlossaryCategoriesAsync(RequestContent /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response CreateGlossaryCategories(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateGlossaryCategoriesRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.CreateGlossaryCategories"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateGlossaryCategoriesRequest(content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -856,23 +720,10 @@ public virtual Response CreateGlossaryCategories(RequestContent content, Request } } - private HttpMessage CreateCreateGlossaryCategoriesRequest(RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/glossary/categories", false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - /// Create a glossary category. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -930,7 +781,6 @@ private HttpMessage CreateCreateGlossaryCategoriesRequest(RequestContent content /// ] /// } /// - /// /// Schema for Response Body: /// { /// classifications: [ @@ -989,34 +839,16 @@ private HttpMessage CreateCreateGlossaryCategoriesRequest(RequestContent content /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task CreateGlossaryCategoryAsync(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateGlossaryCategoryRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.CreateGlossaryCategory"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateGlossaryCategoryRequest(content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1026,6 +858,9 @@ public virtual async Task CreateGlossaryCategoryAsync(RequestContent c } /// Create a glossary category. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -1083,7 +918,6 @@ public virtual async Task CreateGlossaryCategoryAsync(RequestContent c /// ] /// } /// - /// /// Schema for Response Body: /// { /// classifications: [ @@ -1142,34 +976,16 @@ public virtual async Task CreateGlossaryCategoryAsync(RequestContent c /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response CreateGlossaryCategory(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateGlossaryCategoryRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.CreateGlossaryCategory"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateGlossaryCategoryRequest(content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1178,23 +994,10 @@ public virtual Response CreateGlossaryCategory(RequestContent content, RequestOp } } - private HttpMessage CreateCreateGlossaryCategoryRequest(RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/glossary/category", false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - /// Get specific glossary category by its GUID. + /// The globally unique identifier of the category. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -1254,34 +1057,16 @@ private HttpMessage CreateCreateGlossaryCategoryRequest(RequestContent content) /// /// /// - /// The globally unique identifier of the category. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetGlossaryCategoryAsync(string categoryGuid, RequestOptions options = null) + public virtual async Task GetGlossaryCategoryAsync(string categoryGuid, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetGlossaryCategoryRequest(categoryGuid); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetGlossaryCategory"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetGlossaryCategoryRequest(categoryGuid); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1291,6 +1076,9 @@ public virtual async Task GetGlossaryCategoryAsync(string categoryGuid } /// Get specific glossary category by its GUID. + /// The globally unique identifier of the category. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -1350,34 +1138,16 @@ public virtual async Task GetGlossaryCategoryAsync(string categoryGuid /// /// /// - /// The globally unique identifier of the category. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetGlossaryCategory(string categoryGuid, RequestOptions options = null) + public virtual Response GetGlossaryCategory(string categoryGuid, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetGlossaryCategoryRequest(categoryGuid); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetGlossaryCategory"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetGlossaryCategoryRequest(categoryGuid); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1386,22 +1156,11 @@ public virtual Response GetGlossaryCategory(string categoryGuid, RequestOptions } } - private HttpMessage CreateGetGlossaryCategoryRequest(string categoryGuid) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/glossary/category/", false); - uri.AppendPath(categoryGuid, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Update the given glossary category by its GUID. + /// The globally unique identifier of the category. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// /// Schema for Request Body: /// { @@ -1459,7 +1218,6 @@ private HttpMessage CreateGetGlossaryCategoryRequest(string categoryGuid) /// ] /// } /// - /// /// Schema for Response Body: /// { /// classifications: [ @@ -1518,35 +1276,16 @@ private HttpMessage CreateGetGlossaryCategoryRequest(string categoryGuid) /// /// /// - /// The globally unique identifier of the category. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task UpdateGlossaryCategoryAsync(string categoryGuid, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateUpdateGlossaryCategoryRequest(categoryGuid, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.UpdateGlossaryCategory"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateUpdateGlossaryCategoryRequest(categoryGuid, content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1556,6 +1295,10 @@ public virtual async Task UpdateGlossaryCategoryAsync(string categoryG } /// Update the given glossary category by its GUID. + /// The globally unique identifier of the category. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// /// Schema for Request Body: /// { @@ -1613,7 +1356,6 @@ public virtual async Task UpdateGlossaryCategoryAsync(string categoryG /// ] /// } /// - /// /// Schema for Response Body: /// { /// classifications: [ @@ -1672,35 +1414,16 @@ public virtual async Task UpdateGlossaryCategoryAsync(string categoryG /// /// /// - /// The globally unique identifier of the category. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response UpdateGlossaryCategory(string categoryGuid, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateUpdateGlossaryCategoryRequest(categoryGuid, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.UpdateGlossaryCategory"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateUpdateGlossaryCategoryRequest(categoryGuid, content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1709,52 +1432,20 @@ public virtual Response UpdateGlossaryCategory(string categoryGuid, RequestConte } } - private HttpMessage CreateUpdateGlossaryCategoryRequest(string categoryGuid, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/glossary/category/", false); - uri.AppendPath(categoryGuid, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - /// Delete a glossary category. /// The globally unique identifier of the category. /// The request options. + /// is null. #pragma warning disable AZC0002 public virtual async Task DeleteGlossaryCategoryAsync(string categoryGuid, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteGlossaryCategoryRequest(categoryGuid); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.DeleteGlossaryCategory"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteGlossaryCategoryRequest(categoryGuid); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1766,32 +1457,17 @@ public virtual async Task DeleteGlossaryCategoryAsync(string categoryG /// Delete a glossary category. /// The globally unique identifier of the category. /// The request options. + /// is null. #pragma warning disable AZC0002 public virtual Response DeleteGlossaryCategory(string categoryGuid, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteGlossaryCategoryRequest(categoryGuid); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.DeleteGlossaryCategory"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteGlossaryCategoryRequest(categoryGuid); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1800,21 +1476,11 @@ public virtual Response DeleteGlossaryCategory(string categoryGuid, RequestOptio } } - private HttpMessage CreateDeleteGlossaryCategoryRequest(string categoryGuid) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/glossary/category/", false); - uri.AppendPath(categoryGuid, true); - request.Uri = uri; - return message; - } - /// Update the glossary category partially. + /// The globally unique identifier of the category. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// /// Schema for Response Body: /// { @@ -1874,35 +1540,16 @@ private HttpMessage CreateDeleteGlossaryCategoryRequest(string categoryGuid) /// /// /// - /// The globally unique identifier of the category. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task PartialUpdateGlossaryCategoryAsync(string categoryGuid, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreatePartialUpdateGlossaryCategoryRequest(categoryGuid, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.PartialUpdateGlossaryCategory"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreatePartialUpdateGlossaryCategoryRequest(categoryGuid, content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1912,6 +1559,10 @@ public virtual async Task PartialUpdateGlossaryCategoryAsync(string ca } /// Update the glossary category partially. + /// The globally unique identifier of the category. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// /// Schema for Response Body: /// { @@ -1971,35 +1622,16 @@ public virtual async Task PartialUpdateGlossaryCategoryAsync(string ca /// /// /// - /// The globally unique identifier of the category. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response PartialUpdateGlossaryCategory(string categoryGuid, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreatePartialUpdateGlossaryCategoryRequest(categoryGuid, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.PartialUpdateGlossaryCategory"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreatePartialUpdateGlossaryCategoryRequest(categoryGuid, content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -2008,25 +1640,13 @@ public virtual Response PartialUpdateGlossaryCategory(string categoryGuid, Reque } } - private HttpMessage CreatePartialUpdateGlossaryCategoryRequest(string categoryGuid, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/glossary/category/", false); - uri.AppendPath(categoryGuid, true); - uri.AppendPath("/partial", false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - /// Get all related categories (parent and children). Limit, offset, and sort parameters are currently not being enabled and won't work even they are passed. + /// The globally unique identifier of the category. + /// The request options. + /// The page size - by default there is no paging. + /// The offset for pagination purpose. + /// The sort order, ASC (default) or DESC. + /// is null. /// /// Schema for Response Body: /// { @@ -2039,37 +1659,16 @@ private HttpMessage CreatePartialUpdateGlossaryCategoryRequest(string categoryGu /// /// /// - /// The globally unique identifier of the category. - /// The page size - by default there is no paging. - /// The offset for pagination purpose. - /// The sort order, ASC (default) or DESC. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetRelatedCategoriesAsync(string categoryGuid, int? limit = null, int? offset = null, string sort = null, RequestOptions options = null) + public virtual async Task GetRelatedCategoriesAsync(string categoryGuid, RequestOptions options, int? limit = null, int? offset = null, string sort = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRelatedCategoriesRequest(categoryGuid, limit, offset, sort); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetRelatedCategories"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRelatedCategoriesRequest(categoryGuid, limit, offset, sort); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -2079,10 +1678,16 @@ public virtual async Task GetRelatedCategoriesAsync(string categoryGui } /// Get all related categories (parent and children). Limit, offset, and sort parameters are currently not being enabled and won't work even they are passed. - /// - /// Schema for Response Body: - /// { - /// categoryGuid: string, + /// The globally unique identifier of the category. + /// The request options. + /// The page size - by default there is no paging. + /// The offset for pagination purpose. + /// The sort order, ASC (default) or DESC. + /// is null. + /// + /// Schema for Response Body: + /// { + /// categoryGuid: string, /// description: string, /// displayText: string, /// parentCategoryGuid: string, @@ -2091,37 +1696,16 @@ public virtual async Task GetRelatedCategoriesAsync(string categoryGui /// /// /// - /// The globally unique identifier of the category. - /// The page size - by default there is no paging. - /// The offset for pagination purpose. - /// The sort order, ASC (default) or DESC. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetRelatedCategories(string categoryGuid, int? limit = null, int? offset = null, string sort = null, RequestOptions options = null) + public virtual Response GetRelatedCategories(string categoryGuid, RequestOptions options, int? limit = null, int? offset = null, string sort = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRelatedCategoriesRequest(categoryGuid, limit, offset, sort); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetRelatedCategories"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRelatedCategoriesRequest(categoryGuid, limit, offset, sort); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -2130,35 +1714,13 @@ public virtual Response GetRelatedCategories(string categoryGuid, int? limit = n } } - private HttpMessage CreateGetRelatedCategoriesRequest(string categoryGuid, int? limit, int? offset, string sort) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/glossary/category/", false); - uri.AppendPath(categoryGuid, true); - uri.AppendPath("/related", false); - if (limit != null) - { - uri.AppendQuery("limit", limit.Value, true); - } - if (offset != null) - { - uri.AppendQuery("offset", offset.Value, true); - } - if (sort != null) - { - uri.AppendQuery("sort", sort, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Get all terms associated with the specific category. + /// The globally unique identifier of the category. + /// The request options. + /// The page size - by default there is no paging. + /// The offset for pagination purpose. + /// The sort order, ASC (default) or DESC. + /// is null. /// /// Schema for Response Body: /// { @@ -2174,37 +1736,16 @@ private HttpMessage CreateGetRelatedCategoriesRequest(string categoryGuid, int? /// /// /// - /// The globally unique identifier of the category. - /// The page size - by default there is no paging. - /// The offset for pagination purpose. - /// The sort order, ASC (default) or DESC. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetCategoryTermsAsync(string categoryGuid, int? limit = null, int? offset = null, string sort = null, RequestOptions options = null) + public virtual async Task GetCategoryTermsAsync(string categoryGuid, RequestOptions options, int? limit = null, int? offset = null, string sort = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetCategoryTermsRequest(categoryGuid, limit, offset, sort); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetCategoryTerms"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetCategoryTermsRequest(categoryGuid, limit, offset, sort); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -2214,6 +1755,12 @@ public virtual async Task GetCategoryTermsAsync(string categoryGuid, i } /// Get all terms associated with the specific category. + /// The globally unique identifier of the category. + /// The request options. + /// The page size - by default there is no paging. + /// The offset for pagination purpose. + /// The sort order, ASC (default) or DESC. + /// is null. /// /// Schema for Response Body: /// { @@ -2229,37 +1776,16 @@ public virtual async Task GetCategoryTermsAsync(string categoryGuid, i /// /// /// - /// The globally unique identifier of the category. - /// The page size - by default there is no paging. - /// The offset for pagination purpose. - /// The sort order, ASC (default) or DESC. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetCategoryTerms(string categoryGuid, int? limit = null, int? offset = null, string sort = null, RequestOptions options = null) + public virtual Response GetCategoryTerms(string categoryGuid, RequestOptions options, int? limit = null, int? offset = null, string sort = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetCategoryTermsRequest(categoryGuid, limit, offset, sort); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetCategoryTerms"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetCategoryTermsRequest(categoryGuid, limit, offset, sort); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -2268,35 +1794,11 @@ public virtual Response GetCategoryTerms(string categoryGuid, int? limit = null, } } - private HttpMessage CreateGetCategoryTermsRequest(string categoryGuid, int? limit, int? offset, string sort) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/glossary/category/", false); - uri.AppendPath(categoryGuid, true); - uri.AppendPath("/terms", false); - if (limit != null) - { - uri.AppendQuery("limit", limit.Value, true); - } - if (offset != null) - { - uri.AppendQuery("offset", offset.Value, true); - } - if (sort != null) - { - uri.AppendQuery("sort", sort, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Create a glossary term. + /// The content to send as the body of the request. + /// Whether include term hierarchy. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -2399,7 +1901,6 @@ private HttpMessage CreateGetCategoryTermsRequest(string categoryGuid, int? limi /// validValuesFor: [AtlasRelatedTermHeader] /// } /// - /// /// Schema for Response Body: /// { /// classifications: [ @@ -2503,35 +2004,16 @@ private HttpMessage CreateGetCategoryTermsRequest(string categoryGuid, int? limi /// /// /// - /// The content to send as the body of the request. - /// Whether include term hierarchy. - /// The request options. #pragma warning disable AZC0002 public virtual async Task CreateGlossaryTermAsync(RequestContent content, bool? includeTermHierarchy = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateGlossaryTermRequest(content, includeTermHierarchy); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.CreateGlossaryTerm"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateGlossaryTermRequest(content, includeTermHierarchy); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -2541,6 +2023,10 @@ public virtual async Task CreateGlossaryTermAsync(RequestContent conte } /// Create a glossary term. + /// The content to send as the body of the request. + /// Whether include term hierarchy. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -2643,7 +2129,6 @@ public virtual async Task CreateGlossaryTermAsync(RequestContent conte /// validValuesFor: [AtlasRelatedTermHeader] /// } /// - /// /// Schema for Response Body: /// { /// classifications: [ @@ -2747,35 +2232,16 @@ public virtual async Task CreateGlossaryTermAsync(RequestContent conte /// /// /// - /// The content to send as the body of the request. - /// Whether include term hierarchy. - /// The request options. #pragma warning disable AZC0002 public virtual Response CreateGlossaryTerm(RequestContent content, bool? includeTermHierarchy = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateGlossaryTermRequest(content, includeTermHierarchy); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.CreateGlossaryTerm"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateGlossaryTermRequest(content, includeTermHierarchy); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -2784,27 +2250,11 @@ public virtual Response CreateGlossaryTerm(RequestContent content, bool? include } } - private HttpMessage CreateCreateGlossaryTermRequest(RequestContent content, bool? includeTermHierarchy) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/glossary/term", false); - if (includeTermHierarchy != null) - { - uri.AppendQuery("includeTermHierarchy", includeTermHierarchy.Value, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - /// Get a specific glossary term by its GUID. + /// The globally unique identifier for glossary term. + /// The request options. + /// Whether include term hierarchy. + /// is null. /// /// Schema for Response Body: /// { @@ -2909,35 +2359,16 @@ private HttpMessage CreateCreateGlossaryTermRequest(RequestContent content, bool /// /// /// - /// The globally unique identifier for glossary term. - /// Whether include term hierarchy. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetGlossaryTermAsync(string termGuid, bool? includeTermHierarchy = null, RequestOptions options = null) + public virtual async Task GetGlossaryTermAsync(string termGuid, RequestOptions options, bool? includeTermHierarchy = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetGlossaryTermRequest(termGuid, includeTermHierarchy); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetGlossaryTerm"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetGlossaryTermRequest(termGuid, includeTermHierarchy); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -2947,6 +2378,10 @@ public virtual async Task GetGlossaryTermAsync(string termGuid, bool? } /// Get a specific glossary term by its GUID. + /// The globally unique identifier for glossary term. + /// The request options. + /// Whether include term hierarchy. + /// is null. /// /// Schema for Response Body: /// { @@ -3051,35 +2486,16 @@ public virtual async Task GetGlossaryTermAsync(string termGuid, bool? /// /// /// - /// The globally unique identifier for glossary term. - /// Whether include term hierarchy. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetGlossaryTerm(string termGuid, bool? includeTermHierarchy = null, RequestOptions options = null) + public virtual Response GetGlossaryTerm(string termGuid, RequestOptions options, bool? includeTermHierarchy = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetGlossaryTermRequest(termGuid, includeTermHierarchy); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetGlossaryTerm"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetGlossaryTermRequest(termGuid, includeTermHierarchy); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -3088,26 +2504,11 @@ public virtual Response GetGlossaryTerm(string termGuid, bool? includeTermHierar } } - private HttpMessage CreateGetGlossaryTermRequest(string termGuid, bool? includeTermHierarchy) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/glossary/term/", false); - uri.AppendPath(termGuid, true); - if (includeTermHierarchy != null) - { - uri.AppendQuery("includeTermHierarchy", includeTermHierarchy.Value, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Update the given glossary term by its GUID. + /// The globally unique identifier for glossary term. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// /// Schema for Request Body: /// { @@ -3210,7 +2611,6 @@ private HttpMessage CreateGetGlossaryTermRequest(string termGuid, bool? includeT /// validValuesFor: [AtlasRelatedTermHeader] /// } /// - /// /// Schema for Response Body: /// { /// classifications: [ @@ -3314,35 +2714,16 @@ private HttpMessage CreateGetGlossaryTermRequest(string termGuid, bool? includeT /// /// /// - /// The globally unique identifier for glossary term. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task UpdateGlossaryTermAsync(string termGuid, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateUpdateGlossaryTermRequest(termGuid, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.UpdateGlossaryTerm"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateUpdateGlossaryTermRequest(termGuid, content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -3352,6 +2733,10 @@ public virtual async Task UpdateGlossaryTermAsync(string termGuid, Req } /// Update the given glossary term by its GUID. + /// The globally unique identifier for glossary term. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// /// Schema for Request Body: /// { @@ -3454,7 +2839,6 @@ public virtual async Task UpdateGlossaryTermAsync(string termGuid, Req /// validValuesFor: [AtlasRelatedTermHeader] /// } /// - /// /// Schema for Response Body: /// { /// classifications: [ @@ -3558,35 +2942,16 @@ public virtual async Task UpdateGlossaryTermAsync(string termGuid, Req /// /// /// - /// The globally unique identifier for glossary term. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response UpdateGlossaryTerm(string termGuid, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateUpdateGlossaryTermRequest(termGuid, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.UpdateGlossaryTerm"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateUpdateGlossaryTermRequest(termGuid, content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -3595,52 +2960,20 @@ public virtual Response UpdateGlossaryTerm(string termGuid, RequestContent conte } } - private HttpMessage CreateUpdateGlossaryTermRequest(string termGuid, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/glossary/term/", false); - uri.AppendPath(termGuid, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - /// Delete a glossary term. /// The globally unique identifier for glossary term. /// The request options. + /// is null. #pragma warning disable AZC0002 public virtual async Task DeleteGlossaryTermAsync(string termGuid, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteGlossaryTermRequest(termGuid); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.DeleteGlossaryTerm"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteGlossaryTermRequest(termGuid); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -3652,32 +2985,17 @@ public virtual async Task DeleteGlossaryTermAsync(string termGuid, Req /// Delete a glossary term. /// The globally unique identifier for glossary term. /// The request options. + /// is null. #pragma warning disable AZC0002 public virtual Response DeleteGlossaryTerm(string termGuid, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteGlossaryTermRequest(termGuid); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.DeleteGlossaryTerm"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteGlossaryTermRequest(termGuid); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -3686,21 +3004,12 @@ public virtual Response DeleteGlossaryTerm(string termGuid, RequestOptions optio } } - private HttpMessage CreateDeleteGlossaryTermRequest(string termGuid) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/glossary/term/", false); - uri.AppendPath(termGuid, true); - request.Uri = uri; - return message; - } - /// Update the glossary term partially. + /// The globally unique identifier for glossary term. + /// The content to send as the body of the request. + /// Whether include term hierarchy. + /// The request options. + /// or is null. /// /// Schema for Response Body: /// { @@ -3805,36 +3114,16 @@ private HttpMessage CreateDeleteGlossaryTermRequest(string termGuid) /// /// /// - /// The globally unique identifier for glossary term. - /// The content to send as the body of the request. - /// Whether include term hierarchy. - /// The request options. #pragma warning disable AZC0002 public virtual async Task PartialUpdateGlossaryTermAsync(string termGuid, RequestContent content, bool? includeTermHierarchy = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreatePartialUpdateGlossaryTermRequest(termGuid, content, includeTermHierarchy); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.PartialUpdateGlossaryTerm"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreatePartialUpdateGlossaryTermRequest(termGuid, content, includeTermHierarchy); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -3844,6 +3133,11 @@ public virtual async Task PartialUpdateGlossaryTermAsync(string termGu } /// Update the glossary term partially. + /// The globally unique identifier for glossary term. + /// The content to send as the body of the request. + /// Whether include term hierarchy. + /// The request options. + /// or is null. /// /// Schema for Response Body: /// { @@ -3948,36 +3242,16 @@ public virtual async Task PartialUpdateGlossaryTermAsync(string termGu /// /// /// - /// The globally unique identifier for glossary term. - /// The content to send as the body of the request. - /// Whether include term hierarchy. - /// The request options. #pragma warning disable AZC0002 public virtual Response PartialUpdateGlossaryTerm(string termGuid, RequestContent content, bool? includeTermHierarchy = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreatePartialUpdateGlossaryTermRequest(termGuid, content, includeTermHierarchy); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.PartialUpdateGlossaryTerm"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreatePartialUpdateGlossaryTermRequest(termGuid, content, includeTermHierarchy); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -3986,29 +3260,11 @@ public virtual Response PartialUpdateGlossaryTerm(string termGuid, RequestConten } } - private HttpMessage CreatePartialUpdateGlossaryTermRequest(string termGuid, RequestContent content, bool? includeTermHierarchy) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/glossary/term/", false); - uri.AppendPath(termGuid, true); - uri.AppendPath("/partial", false); - if (includeTermHierarchy != null) - { - uri.AppendQuery("includeTermHierarchy", includeTermHierarchy.Value, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - /// Create glossary terms in bulk. + /// The content to send as the body of the request. + /// Whether include term hierarchy. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -4111,7 +3367,6 @@ private HttpMessage CreatePartialUpdateGlossaryTermRequest(string termGuid, Requ /// validValuesFor: [AtlasRelatedTermHeader] /// } /// - /// /// Schema for Response Body: /// { /// classifications: [ @@ -4215,35 +3470,16 @@ private HttpMessage CreatePartialUpdateGlossaryTermRequest(string termGuid, Requ /// /// /// - /// The content to send as the body of the request. - /// Whether include term hierarchy. - /// The request options. #pragma warning disable AZC0002 public virtual async Task CreateGlossaryTermsAsync(RequestContent content, bool? includeTermHierarchy = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateGlossaryTermsRequest(content, includeTermHierarchy); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.CreateGlossaryTerms"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateGlossaryTermsRequest(content, includeTermHierarchy); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -4253,6 +3489,10 @@ public virtual async Task CreateGlossaryTermsAsync(RequestContent cont } /// Create glossary terms in bulk. + /// The content to send as the body of the request. + /// Whether include term hierarchy. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -4355,7 +3595,6 @@ public virtual async Task CreateGlossaryTermsAsync(RequestContent cont /// validValuesFor: [AtlasRelatedTermHeader] /// } /// - /// /// Schema for Response Body: /// { /// classifications: [ @@ -4459,35 +3698,16 @@ public virtual async Task CreateGlossaryTermsAsync(RequestContent cont /// /// /// - /// The content to send as the body of the request. - /// Whether include term hierarchy. - /// The request options. #pragma warning disable AZC0002 public virtual Response CreateGlossaryTerms(RequestContent content, bool? includeTermHierarchy = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateGlossaryTermsRequest(content, includeTermHierarchy); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.CreateGlossaryTerms"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateGlossaryTermsRequest(content, includeTermHierarchy); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -4496,27 +3716,13 @@ public virtual Response CreateGlossaryTerms(RequestContent content, bool? includ } } - private HttpMessage CreateCreateGlossaryTermsRequest(RequestContent content, bool? includeTermHierarchy) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/glossary/terms", false); - if (includeTermHierarchy != null) - { - uri.AppendQuery("includeTermHierarchy", includeTermHierarchy.Value, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - /// Get all related objects assigned with the specified term. + /// The globally unique identifier for glossary term. + /// The request options. + /// The page size - by default there is no paging. + /// The offset for pagination purpose. + /// The sort order, ASC (default) or DESC. + /// is null. /// /// Schema for Response Body: /// { @@ -4537,37 +3743,16 @@ private HttpMessage CreateCreateGlossaryTermsRequest(RequestContent content, boo /// /// /// - /// The globally unique identifier for glossary term. - /// The page size - by default there is no paging. - /// The offset for pagination purpose. - /// The sort order, ASC (default) or DESC. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetEntitiesAssignedWithTermAsync(string termGuid, int? limit = null, int? offset = null, string sort = null, RequestOptions options = null) + public virtual async Task GetEntitiesAssignedWithTermAsync(string termGuid, RequestOptions options, int? limit = null, int? offset = null, string sort = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetEntitiesAssignedWithTermRequest(termGuid, limit, offset, sort); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetEntitiesAssignedWithTerm"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetEntitiesAssignedWithTermRequest(termGuid, limit, offset, sort); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -4577,6 +3762,12 @@ public virtual async Task GetEntitiesAssignedWithTermAsync(string term } /// Get all related objects assigned with the specified term. + /// The globally unique identifier for glossary term. + /// The request options. + /// The page size - by default there is no paging. + /// The offset for pagination purpose. + /// The sort order, ASC (default) or DESC. + /// is null. /// /// Schema for Response Body: /// { @@ -4597,37 +3788,16 @@ public virtual async Task GetEntitiesAssignedWithTermAsync(string term /// /// /// - /// The globally unique identifier for glossary term. - /// The page size - by default there is no paging. - /// The offset for pagination purpose. - /// The sort order, ASC (default) or DESC. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetEntitiesAssignedWithTerm(string termGuid, int? limit = null, int? offset = null, string sort = null, RequestOptions options = null) + public virtual Response GetEntitiesAssignedWithTerm(string termGuid, RequestOptions options, int? limit = null, int? offset = null, string sort = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetEntitiesAssignedWithTermRequest(termGuid, limit, offset, sort); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetEntitiesAssignedWithTerm"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetEntitiesAssignedWithTermRequest(termGuid, limit, offset, sort); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -4636,35 +3806,11 @@ public virtual Response GetEntitiesAssignedWithTerm(string termGuid, int? limit } } - private HttpMessage CreateGetEntitiesAssignedWithTermRequest(string termGuid, int? limit, int? offset, string sort) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/glossary/terms/", false); - uri.AppendPath(termGuid, true); - uri.AppendPath("/assignedEntities", false); - if (limit != null) - { - uri.AppendQuery("limit", limit.Value, true); - } - if (offset != null) - { - uri.AppendQuery("offset", offset.Value, true); - } - if (sort != null) - { - uri.AppendQuery("sort", sort, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Assign the given term to the provided list of related objects. + /// The globally unique identifier for glossary term. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// /// Schema for Request Body: /// { @@ -4685,35 +3831,16 @@ private HttpMessage CreateGetEntitiesAssignedWithTermRequest(string termGuid, in /// /// /// - /// The globally unique identifier for glossary term. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task AssignTermToEntitiesAsync(string termGuid, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateAssignTermToEntitiesRequest(termGuid, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.AssignTermToEntities"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateAssignTermToEntitiesRequest(termGuid, content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -4723,6 +3850,10 @@ public virtual async Task AssignTermToEntitiesAsync(string termGuid, R } /// Assign the given term to the provided list of related objects. + /// The globally unique identifier for glossary term. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// /// Schema for Request Body: /// { @@ -4743,35 +3874,16 @@ public virtual async Task AssignTermToEntitiesAsync(string termGuid, R /// /// /// - /// The globally unique identifier for glossary term. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response AssignTermToEntities(string termGuid, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateAssignTermToEntitiesRequest(termGuid, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.AssignTermToEntities"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateAssignTermToEntitiesRequest(termGuid, content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -4780,24 +3892,11 @@ public virtual Response AssignTermToEntities(string termGuid, RequestContent con } } - private HttpMessage CreateAssignTermToEntitiesRequest(string termGuid, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/glossary/terms/", false); - uri.AppendPath(termGuid, true); - uri.AppendPath("/assignedEntities", false); - request.Uri = uri; - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - /// Delete the term assignment for the given list of related objects. + /// The globally unique identifier for glossary term. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// /// Schema for Request Body: /// { @@ -4818,35 +3917,16 @@ private HttpMessage CreateAssignTermToEntitiesRequest(string termGuid, RequestCo /// /// /// - /// The globally unique identifier for glossary term. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task RemoveTermAssignmentFromEntitiesAsync(string termGuid, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateRemoveTermAssignmentFromEntitiesRequest(termGuid, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.RemoveTermAssignmentFromEntities"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateRemoveTermAssignmentFromEntitiesRequest(termGuid, content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -4856,6 +3936,10 @@ public virtual async Task RemoveTermAssignmentFromEntitiesAsync(string } /// Delete the term assignment for the given list of related objects. + /// The globally unique identifier for glossary term. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// /// Schema for Request Body: /// { @@ -4876,35 +3960,16 @@ public virtual async Task RemoveTermAssignmentFromEntitiesAsync(string /// /// /// - /// The globally unique identifier for glossary term. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response RemoveTermAssignmentFromEntities(string termGuid, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateRemoveTermAssignmentFromEntitiesRequest(termGuid, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.RemoveTermAssignmentFromEntities"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateRemoveTermAssignmentFromEntitiesRequest(termGuid, content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -4913,24 +3978,11 @@ public virtual Response RemoveTermAssignmentFromEntities(string termGuid, Reques } } - private HttpMessage CreateRemoveTermAssignmentFromEntitiesRequest(string termGuid, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/glossary/terms/", false); - uri.AppendPath(termGuid, true); - uri.AppendPath("/assignedEntities", false); - request.Uri = uri; - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - /// Delete the term assignment for the given list of related objects. + /// The globally unique identifier for glossary term. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// /// Schema for Request Body: /// { @@ -4951,35 +4003,16 @@ private HttpMessage CreateRemoveTermAssignmentFromEntitiesRequest(string termGui /// /// /// - /// The globally unique identifier for glossary term. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task DeleteTermAssignmentFromEntitiesAsync(string termGuid, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteTermAssignmentFromEntitiesRequest(termGuid, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.DeleteTermAssignmentFromEntities"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteTermAssignmentFromEntitiesRequest(termGuid, content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -4989,6 +4022,10 @@ public virtual async Task DeleteTermAssignmentFromEntitiesAsync(string } /// Delete the term assignment for the given list of related objects. + /// The globally unique identifier for glossary term. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// /// Schema for Request Body: /// { @@ -5009,35 +4046,16 @@ public virtual async Task DeleteTermAssignmentFromEntitiesAsync(string /// /// /// - /// The globally unique identifier for glossary term. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response DeleteTermAssignmentFromEntities(string termGuid, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteTermAssignmentFromEntitiesRequest(termGuid, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.DeleteTermAssignmentFromEntities"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteTermAssignmentFromEntitiesRequest(termGuid, content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -5046,24 +4064,13 @@ public virtual Response DeleteTermAssignmentFromEntities(string termGuid, Reques } } - private HttpMessage CreateDeleteTermAssignmentFromEntitiesRequest(string termGuid, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/glossary/terms/", false); - uri.AppendPath(termGuid, true); - uri.AppendPath("/assignedEntities", false); - request.Uri = uri; - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - /// Get all related terms for a specific term by its GUID. Limit, offset, and sort parameters are currently not being enabled and won't work even they are passed. + /// The globally unique identifier for glossary term. + /// The request options. + /// The page size - by default there is no paging. + /// The offset for pagination purpose. + /// The sort order, ASC (default) or DESC. + /// is null. /// /// Schema for Response Body: /// { @@ -5079,37 +4086,16 @@ private HttpMessage CreateDeleteTermAssignmentFromEntitiesRequest(string termGui /// /// /// - /// The globally unique identifier for glossary term. - /// The page size - by default there is no paging. - /// The offset for pagination purpose. - /// The sort order, ASC (default) or DESC. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetRelatedTermsAsync(string termGuid, int? limit = null, int? offset = null, string sort = null, RequestOptions options = null) + public virtual async Task GetRelatedTermsAsync(string termGuid, RequestOptions options, int? limit = null, int? offset = null, string sort = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRelatedTermsRequest(termGuid, limit, offset, sort); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetRelatedTerms"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRelatedTermsRequest(termGuid, limit, offset, sort); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -5119,6 +4105,12 @@ public virtual async Task GetRelatedTermsAsync(string termGuid, int? l } /// Get all related terms for a specific term by its GUID. Limit, offset, and sort parameters are currently not being enabled and won't work even they are passed. + /// The globally unique identifier for glossary term. + /// The request options. + /// The page size - by default there is no paging. + /// The offset for pagination purpose. + /// The sort order, ASC (default) or DESC. + /// is null. /// /// Schema for Response Body: /// { @@ -5134,37 +4126,16 @@ public virtual async Task GetRelatedTermsAsync(string termGuid, int? l /// /// /// - /// The globally unique identifier for glossary term. - /// The page size - by default there is no paging. - /// The offset for pagination purpose. - /// The sort order, ASC (default) or DESC. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetRelatedTerms(string termGuid, int? limit = null, int? offset = null, string sort = null, RequestOptions options = null) + public virtual Response GetRelatedTerms(string termGuid, RequestOptions options, int? limit = null, int? offset = null, string sort = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRelatedTermsRequest(termGuid, limit, offset, sort); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetRelatedTerms"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRelatedTermsRequest(termGuid, limit, offset, sort); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -5173,35 +4144,10 @@ public virtual Response GetRelatedTerms(string termGuid, int? limit = null, int? } } - private HttpMessage CreateGetRelatedTermsRequest(string termGuid, int? limit, int? offset, string sort) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/glossary/terms/", false); - uri.AppendPath(termGuid, true); - uri.AppendPath("/related", false); - if (limit != null) - { - uri.AppendQuery("limit", limit.Value, true); - } - if (offset != null) - { - uri.AppendQuery("offset", offset.Value, true); - } - if (sort != null) - { - uri.AppendQuery("sort", sort, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Get a specific Glossary by its GUID. + /// The globally unique identifier for glossary. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -5257,34 +4203,16 @@ private HttpMessage CreateGetRelatedTermsRequest(string termGuid, int? limit, in /// /// /// - /// The globally unique identifier for glossary. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetGlossaryAsync(string glossaryGuid, RequestOptions options = null) + public virtual async Task GetGlossaryAsync(string glossaryGuid, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetGlossaryRequest(glossaryGuid); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetGlossary"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetGlossaryRequest(glossaryGuid); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -5294,6 +4222,9 @@ public virtual async Task GetGlossaryAsync(string glossaryGuid, Reques } /// Get a specific Glossary by its GUID. + /// The globally unique identifier for glossary. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -5349,34 +4280,16 @@ public virtual async Task GetGlossaryAsync(string glossaryGuid, Reques /// /// /// - /// The globally unique identifier for glossary. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetGlossary(string glossaryGuid, RequestOptions options = null) + public virtual Response GetGlossary(string glossaryGuid, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetGlossaryRequest(glossaryGuid); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetGlossary"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetGlossaryRequest(glossaryGuid); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -5385,22 +4298,11 @@ public virtual Response GetGlossary(string glossaryGuid, RequestOptions options } } - private HttpMessage CreateGetGlossaryRequest(string glossaryGuid) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/glossary/", false); - uri.AppendPath(glossaryGuid, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Update the given glossary. + /// The globally unique identifier for glossary. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// /// Schema for Request Body: /// { @@ -5454,7 +4356,6 @@ private HttpMessage CreateGetGlossaryRequest(string glossaryGuid) /// usage: string /// } /// - /// /// Schema for Response Body: /// { /// classifications: [ @@ -5509,35 +4410,16 @@ private HttpMessage CreateGetGlossaryRequest(string glossaryGuid) /// /// /// - /// The globally unique identifier for glossary. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task UpdateGlossaryAsync(string glossaryGuid, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateUpdateGlossaryRequest(glossaryGuid, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.UpdateGlossary"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateUpdateGlossaryRequest(glossaryGuid, content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -5547,6 +4429,10 @@ public virtual async Task UpdateGlossaryAsync(string glossaryGuid, Req } /// Update the given glossary. + /// The globally unique identifier for glossary. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// /// Schema for Request Body: /// { @@ -5600,7 +4486,6 @@ public virtual async Task UpdateGlossaryAsync(string glossaryGuid, Req /// usage: string /// } /// - /// /// Schema for Response Body: /// { /// classifications: [ @@ -5655,35 +4540,16 @@ public virtual async Task UpdateGlossaryAsync(string glossaryGuid, Req /// /// /// - /// The globally unique identifier for glossary. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response UpdateGlossary(string glossaryGuid, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateUpdateGlossaryRequest(glossaryGuid, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.UpdateGlossary"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateUpdateGlossaryRequest(glossaryGuid, content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -5692,52 +4558,20 @@ public virtual Response UpdateGlossary(string glossaryGuid, RequestContent conte } } - private HttpMessage CreateUpdateGlossaryRequest(string glossaryGuid, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/glossary/", false); - uri.AppendPath(glossaryGuid, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - /// Delete a glossary. /// The globally unique identifier for glossary. /// The request options. + /// is null. #pragma warning disable AZC0002 public virtual async Task DeleteGlossaryAsync(string glossaryGuid, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteGlossaryRequest(glossaryGuid); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.DeleteGlossary"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteGlossaryRequest(glossaryGuid); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -5749,32 +4583,17 @@ public virtual async Task DeleteGlossaryAsync(string glossaryGuid, Req /// Delete a glossary. /// The globally unique identifier for glossary. /// The request options. + /// is null. #pragma warning disable AZC0002 public virtual Response DeleteGlossary(string glossaryGuid, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteGlossaryRequest(glossaryGuid); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.DeleteGlossary"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteGlossaryRequest(glossaryGuid); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -5783,21 +4602,13 @@ public virtual Response DeleteGlossary(string glossaryGuid, RequestOptions optio } } - private HttpMessage CreateDeleteGlossaryRequest(string glossaryGuid) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/glossary/", false); - uri.AppendPath(glossaryGuid, true); - request.Uri = uri; - return message; - } - /// Get the categories belonging to a specific glossary. + /// The globally unique identifier for glossary. + /// The request options. + /// The page size - by default there is no paging. + /// The offset for pagination purpose. + /// The sort order, ASC (default) or DESC. + /// is null. /// /// Schema for Response Body: /// { @@ -5857,37 +4668,16 @@ private HttpMessage CreateDeleteGlossaryRequest(string glossaryGuid) /// /// /// - /// The globally unique identifier for glossary. - /// The page size - by default there is no paging. - /// The offset for pagination purpose. - /// The sort order, ASC (default) or DESC. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetGlossaryCategoriesAsync(string glossaryGuid, int? limit = null, int? offset = null, string sort = null, RequestOptions options = null) + public virtual async Task GetGlossaryCategoriesAsync(string glossaryGuid, RequestOptions options, int? limit = null, int? offset = null, string sort = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetGlossaryCategoriesRequest(glossaryGuid, limit, offset, sort); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetGlossaryCategories"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetGlossaryCategoriesRequest(glossaryGuid, limit, offset, sort); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -5897,6 +4687,12 @@ public virtual async Task GetGlossaryCategoriesAsync(string glossaryGu } /// Get the categories belonging to a specific glossary. + /// The globally unique identifier for glossary. + /// The request options. + /// The page size - by default there is no paging. + /// The offset for pagination purpose. + /// The sort order, ASC (default) or DESC. + /// is null. /// /// Schema for Response Body: /// { @@ -5956,37 +4752,16 @@ public virtual async Task GetGlossaryCategoriesAsync(string glossaryGu /// /// /// - /// The globally unique identifier for glossary. - /// The page size - by default there is no paging. - /// The offset for pagination purpose. - /// The sort order, ASC (default) or DESC. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetGlossaryCategories(string glossaryGuid, int? limit = null, int? offset = null, string sort = null, RequestOptions options = null) + public virtual Response GetGlossaryCategories(string glossaryGuid, RequestOptions options, int? limit = null, int? offset = null, string sort = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetGlossaryCategoriesRequest(glossaryGuid, limit, offset, sort); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetGlossaryCategories"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetGlossaryCategoriesRequest(glossaryGuid, limit, offset, sort); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -5995,35 +4770,13 @@ public virtual Response GetGlossaryCategories(string glossaryGuid, int? limit = } } - private HttpMessage CreateGetGlossaryCategoriesRequest(string glossaryGuid, int? limit, int? offset, string sort) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/glossary/", false); - uri.AppendPath(glossaryGuid, true); - uri.AppendPath("/categories", false); - if (limit != null) - { - uri.AppendQuery("limit", limit.Value, true); - } - if (offset != null) - { - uri.AppendQuery("offset", offset.Value, true); - } - if (sort != null) - { - uri.AppendQuery("sort", sort, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Get the category headers belonging to a specific glossary. + /// The globally unique identifier for glossary. + /// The request options. + /// The page size - by default there is no paging. + /// The offset for pagination purpose. + /// The sort order, ASC (default) or DESC. + /// is null. /// /// Schema for Response Body: /// { @@ -6036,37 +4789,16 @@ private HttpMessage CreateGetGlossaryCategoriesRequest(string glossaryGuid, int? /// /// /// - /// The globally unique identifier for glossary. - /// The page size - by default there is no paging. - /// The offset for pagination purpose. - /// The sort order, ASC (default) or DESC. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetGlossaryCategoriesHeadersAsync(string glossaryGuid, int? limit = null, int? offset = null, string sort = null, RequestOptions options = null) + public virtual async Task GetGlossaryCategoriesHeadersAsync(string glossaryGuid, RequestOptions options, int? limit = null, int? offset = null, string sort = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetGlossaryCategoriesHeadersRequest(glossaryGuid, limit, offset, sort); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetGlossaryCategoriesHeaders"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetGlossaryCategoriesHeadersRequest(glossaryGuid, limit, offset, sort); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -6076,6 +4808,12 @@ public virtual async Task GetGlossaryCategoriesHeadersAsync(string glo } /// Get the category headers belonging to a specific glossary. + /// The globally unique identifier for glossary. + /// The request options. + /// The page size - by default there is no paging. + /// The offset for pagination purpose. + /// The sort order, ASC (default) or DESC. + /// is null. /// /// Schema for Response Body: /// { @@ -6088,37 +4826,16 @@ public virtual async Task GetGlossaryCategoriesHeadersAsync(string glo /// /// /// - /// The globally unique identifier for glossary. - /// The page size - by default there is no paging. - /// The offset for pagination purpose. - /// The sort order, ASC (default) or DESC. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetGlossaryCategoriesHeaders(string glossaryGuid, int? limit = null, int? offset = null, string sort = null, RequestOptions options = null) + public virtual Response GetGlossaryCategoriesHeaders(string glossaryGuid, RequestOptions options, int? limit = null, int? offset = null, string sort = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetGlossaryCategoriesHeadersRequest(glossaryGuid, limit, offset, sort); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetGlossaryCategoriesHeaders"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetGlossaryCategoriesHeadersRequest(glossaryGuid, limit, offset, sort); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -6127,35 +4844,11 @@ public virtual Response GetGlossaryCategoriesHeaders(string glossaryGuid, int? l } } - private HttpMessage CreateGetGlossaryCategoriesHeadersRequest(string glossaryGuid, int? limit, int? offset, string sort) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/glossary/", false); - uri.AppendPath(glossaryGuid, true); - uri.AppendPath("/categories/headers", false); - if (limit != null) - { - uri.AppendQuery("limit", limit.Value, true); - } - if (offset != null) - { - uri.AppendQuery("offset", offset.Value, true); - } - if (sort != null) - { - uri.AppendQuery("sort", sort, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Get a specific glossary with detailed information. + /// The globally unique identifier for glossary. + /// The request options. + /// Whether include term hierarchy. + /// is null. /// /// Schema for Response Body: /// { @@ -6213,35 +4906,16 @@ private HttpMessage CreateGetGlossaryCategoriesHeadersRequest(string glossaryGui /// /// /// - /// The globally unique identifier for glossary. - /// Whether include term hierarchy. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetDetailedGlossaryAsync(string glossaryGuid, bool? includeTermHierarchy = null, RequestOptions options = null) + public virtual async Task GetDetailedGlossaryAsync(string glossaryGuid, RequestOptions options, bool? includeTermHierarchy = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetDetailedGlossaryRequest(glossaryGuid, includeTermHierarchy); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetDetailedGlossary"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetDetailedGlossaryRequest(glossaryGuid, includeTermHierarchy); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -6251,6 +4925,10 @@ public virtual async Task GetDetailedGlossaryAsync(string glossaryGuid } /// Get a specific glossary with detailed information. + /// The globally unique identifier for glossary. + /// The request options. + /// Whether include term hierarchy. + /// is null. /// /// Schema for Response Body: /// { @@ -6308,35 +4986,16 @@ public virtual async Task GetDetailedGlossaryAsync(string glossaryGuid /// /// /// - /// The globally unique identifier for glossary. - /// Whether include term hierarchy. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetDetailedGlossary(string glossaryGuid, bool? includeTermHierarchy = null, RequestOptions options = null) + public virtual Response GetDetailedGlossary(string glossaryGuid, RequestOptions options, bool? includeTermHierarchy = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetDetailedGlossaryRequest(glossaryGuid, includeTermHierarchy); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetDetailedGlossary"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetDetailedGlossaryRequest(glossaryGuid, includeTermHierarchy); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -6345,27 +5004,12 @@ public virtual Response GetDetailedGlossary(string glossaryGuid, bool? includeTe } } - private HttpMessage CreateGetDetailedGlossaryRequest(string glossaryGuid, bool? includeTermHierarchy) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/glossary/", false); - uri.AppendPath(glossaryGuid, true); - uri.AppendPath("/detailed", false); - if (includeTermHierarchy != null) - { - uri.AppendQuery("includeTermHierarchy", includeTermHierarchy.Value, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Update the glossary partially. Some properties such as qualifiedName are not allowed to be updated. + /// The globally unique identifier for glossary. + /// The content to send as the body of the request. + /// Whether include term hierarchy. + /// The request options. + /// or is null. /// /// Schema for Response Body: /// { @@ -6421,36 +5065,16 @@ private HttpMessage CreateGetDetailedGlossaryRequest(string glossaryGuid, bool? /// /// /// - /// The globally unique identifier for glossary. - /// The content to send as the body of the request. - /// Whether include term hierarchy. - /// The request options. #pragma warning disable AZC0002 public virtual async Task PartialUpdateGlossaryAsync(string glossaryGuid, RequestContent content, bool? includeTermHierarchy = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreatePartialUpdateGlossaryRequest(glossaryGuid, content, includeTermHierarchy); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.PartialUpdateGlossary"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreatePartialUpdateGlossaryRequest(glossaryGuid, content, includeTermHierarchy); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -6460,6 +5084,11 @@ public virtual async Task PartialUpdateGlossaryAsync(string glossaryGu } /// Update the glossary partially. Some properties such as qualifiedName are not allowed to be updated. + /// The globally unique identifier for glossary. + /// The content to send as the body of the request. + /// Whether include term hierarchy. + /// The request options. + /// or is null. /// /// Schema for Response Body: /// { @@ -6515,36 +5144,16 @@ public virtual async Task PartialUpdateGlossaryAsync(string glossaryGu /// /// /// - /// The globally unique identifier for glossary. - /// The content to send as the body of the request. - /// Whether include term hierarchy. - /// The request options. #pragma warning disable AZC0002 public virtual Response PartialUpdateGlossary(string glossaryGuid, RequestContent content, bool? includeTermHierarchy = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreatePartialUpdateGlossaryRequest(glossaryGuid, content, includeTermHierarchy); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.PartialUpdateGlossary"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreatePartialUpdateGlossaryRequest(glossaryGuid, content, includeTermHierarchy); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -6553,29 +5162,14 @@ public virtual Response PartialUpdateGlossary(string glossaryGuid, RequestConten } } - private HttpMessage CreatePartialUpdateGlossaryRequest(string glossaryGuid, RequestContent content, bool? includeTermHierarchy) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/glossary/", false); - uri.AppendPath(glossaryGuid, true); - uri.AppendPath("/partial", false); - if (includeTermHierarchy != null) - { - uri.AppendQuery("includeTermHierarchy", includeTermHierarchy.Value, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - /// Get terms belonging to a specific glossary. + /// The globally unique identifier for glossary. + /// The request options. + /// Whether include term hierarchy. + /// The page size - by default there is no paging. + /// The offset for pagination purpose. + /// The sort order, ASC (default) or DESC. + /// is null. /// /// Schema for Response Body: /// { @@ -6680,38 +5274,16 @@ private HttpMessage CreatePartialUpdateGlossaryRequest(string glossaryGuid, Requ /// /// /// - /// The globally unique identifier for glossary. - /// Whether include term hierarchy. - /// The page size - by default there is no paging. - /// The offset for pagination purpose. - /// The sort order, ASC (default) or DESC. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetGlossaryTermsAsync(string glossaryGuid, bool? includeTermHierarchy = null, int? limit = null, int? offset = null, string sort = null, RequestOptions options = null) + public virtual async Task GetGlossaryTermsAsync(string glossaryGuid, RequestOptions options, bool? includeTermHierarchy = null, int? limit = null, int? offset = null, string sort = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetGlossaryTermsRequest(glossaryGuid, includeTermHierarchy, limit, offset, sort); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetGlossaryTerms"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetGlossaryTermsRequest(glossaryGuid, includeTermHierarchy, limit, offset, sort); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -6721,6 +5293,13 @@ public virtual async Task GetGlossaryTermsAsync(string glossaryGuid, b } /// Get terms belonging to a specific glossary. + /// The globally unique identifier for glossary. + /// The request options. + /// Whether include term hierarchy. + /// The page size - by default there is no paging. + /// The offset for pagination purpose. + /// The sort order, ASC (default) or DESC. + /// is null. /// /// Schema for Response Body: /// { @@ -6825,38 +5404,16 @@ public virtual async Task GetGlossaryTermsAsync(string glossaryGuid, b /// /// /// - /// The globally unique identifier for glossary. - /// Whether include term hierarchy. - /// The page size - by default there is no paging. - /// The offset for pagination purpose. - /// The sort order, ASC (default) or DESC. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetGlossaryTerms(string glossaryGuid, bool? includeTermHierarchy = null, int? limit = null, int? offset = null, string sort = null, RequestOptions options = null) + public virtual Response GetGlossaryTerms(string glossaryGuid, RequestOptions options, bool? includeTermHierarchy = null, int? limit = null, int? offset = null, string sort = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetGlossaryTermsRequest(glossaryGuid, includeTermHierarchy, limit, offset, sort); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetGlossaryTerms"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetGlossaryTermsRequest(glossaryGuid, includeTermHierarchy, limit, offset, sort); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -6865,39 +5422,13 @@ public virtual Response GetGlossaryTerms(string glossaryGuid, bool? includeTermH } } - private HttpMessage CreateGetGlossaryTermsRequest(string glossaryGuid, bool? includeTermHierarchy, int? limit, int? offset, string sort) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/glossary/", false); - uri.AppendPath(glossaryGuid, true); - uri.AppendPath("/terms", false); - if (includeTermHierarchy != null) - { - uri.AppendQuery("includeTermHierarchy", includeTermHierarchy.Value, true); - } - if (limit != null) - { - uri.AppendQuery("limit", limit.Value, true); - } - if (offset != null) - { - uri.AppendQuery("offset", offset.Value, true); - } - if (sort != null) - { - uri.AppendQuery("sort", sort, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Get term headers belonging to a specific glossary. + /// The globally unique identifier for glossary. + /// The request options. + /// The page size - by default there is no paging. + /// The offset for pagination purpose. + /// The sort order, ASC (default) or DESC. + /// is null. /// /// Schema for Response Body: /// { @@ -6913,37 +5444,16 @@ private HttpMessage CreateGetGlossaryTermsRequest(string glossaryGuid, bool? inc /// /// /// - /// The globally unique identifier for glossary. - /// The page size - by default there is no paging. - /// The offset for pagination purpose. - /// The sort order, ASC (default) or DESC. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetGlossaryTermHeadersAsync(string glossaryGuid, int? limit = null, int? offset = null, string sort = null, RequestOptions options = null) + public virtual async Task GetGlossaryTermHeadersAsync(string glossaryGuid, RequestOptions options, int? limit = null, int? offset = null, string sort = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetGlossaryTermHeadersRequest(glossaryGuid, limit, offset, sort); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetGlossaryTermHeaders"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetGlossaryTermHeadersRequest(glossaryGuid, limit, offset, sort); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -6953,6 +5463,12 @@ public virtual async Task GetGlossaryTermHeadersAsync(string glossaryG } /// Get term headers belonging to a specific glossary. + /// The globally unique identifier for glossary. + /// The request options. + /// The page size - by default there is no paging. + /// The offset for pagination purpose. + /// The sort order, ASC (default) or DESC. + /// is null. /// /// Schema for Response Body: /// { @@ -6968,37 +5484,16 @@ public virtual async Task GetGlossaryTermHeadersAsync(string glossaryG /// /// /// - /// The globally unique identifier for glossary. - /// The page size - by default there is no paging. - /// The offset for pagination purpose. - /// The sort order, ASC (default) or DESC. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetGlossaryTermHeaders(string glossaryGuid, int? limit = null, int? offset = null, string sort = null, RequestOptions options = null) + public virtual Response GetGlossaryTermHeaders(string glossaryGuid, RequestOptions options, int? limit = null, int? offset = null, string sort = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetGlossaryTermHeadersRequest(glossaryGuid, limit, offset, sort); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetGlossaryTermHeaders"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetGlossaryTermHeadersRequest(glossaryGuid, limit, offset, sort); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -7007,35 +5502,10 @@ public virtual Response GetGlossaryTermHeaders(string glossaryGuid, int? limit = } } - private HttpMessage CreateGetGlossaryTermHeadersRequest(string glossaryGuid, int? limit, int? offset, string sort) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/glossary/", false); - uri.AppendPath(glossaryGuid, true); - uri.AppendPath("/terms/headers", false); - if (limit != null) - { - uri.AppendQuery("limit", limit.Value, true); - } - if (offset != null) - { - uri.AppendQuery("offset", offset.Value, true); - } - if (sort != null) - { - uri.AppendQuery("sort", sort, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Import Glossary Terms from local csv file. + /// Get the status of import csv operation. + /// The globally unique identifier for async operation/job. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -7055,36 +5525,16 @@ private HttpMessage CreateGetGlossaryTermHeadersRequest(string glossaryGuid, int /// /// /// - /// The globally unique identifier for glossary. - /// The content to send as the body of the request. - /// Whether include term hierarchy. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task> ImportGlossaryTermsViaCsvAsync(string glossaryGuid, RequestContent content, bool? includeTermHierarchy = null, RequestOptions options = null) + public virtual async Task GetImportCsvOperationStatusAsync(string operationGuid, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateImportGlossaryTermsViaCsvRequest(glossaryGuid, content, includeTermHierarchy); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.ImportGlossaryTermsViaCsv"); + using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetImportCsvOperationStatus"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.AzureAsyncOperation, "PurviewGlossaries.ImportGlossaryTermsViaCsv"); - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.AzureAsyncOperation, "PurviewGlossaries.ImportGlossaryTermsViaCsv"); - } + using HttpMessage message = CreateGetImportCsvOperationStatusRequest(operationGuid); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -7093,7 +5543,10 @@ public virtual async Task> ImportGlossaryTermsViaCsvAsync( } } - /// Import Glossary Terms from local csv file. + /// Get the status of import csv operation. + /// The globally unique identifier for async operation/job. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -7113,36 +5566,16 @@ public virtual async Task> ImportGlossaryTermsViaCsvAsync( /// /// /// - /// The globally unique identifier for glossary. - /// The content to send as the body of the request. - /// Whether include term hierarchy. - /// The request options. #pragma warning disable AZC0002 - public virtual Operation ImportGlossaryTermsViaCsv(string glossaryGuid, RequestContent content, bool? includeTermHierarchy = null, RequestOptions options = null) + public virtual Response GetImportCsvOperationStatus(string operationGuid, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateImportGlossaryTermsViaCsvRequest(glossaryGuid, content, includeTermHierarchy); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.ImportGlossaryTermsViaCsv"); + using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetImportCsvOperationStatus"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.AzureAsyncOperation, "PurviewGlossaries.ImportGlossaryTermsViaCsv"); - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.AzureAsyncOperation, "PurviewGlossaries.ImportGlossaryTermsViaCsv"); - } + using HttpMessage message = CreateGetImportCsvOperationStatusRequest(operationGuid); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -7151,79 +5584,22 @@ public virtual Operation ImportGlossaryTermsViaCsv(string glossaryGu } } - private HttpMessage CreateImportGlossaryTermsViaCsvRequest(string glossaryGuid, RequestContent content, bool? includeTermHierarchy) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/glossary/", false); - uri.AppendPath(glossaryGuid, true); - uri.AppendPath("/terms/import", false); - if (includeTermHierarchy != null) - { - uri.AppendQuery("includeTermHierarchy", includeTermHierarchy.Value, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "multipart/form-data"); - request.Content = content; - return message; - } - - /// Import Glossary Terms from local csv file by glossaryName. - /// - /// Schema for Response Body: - /// { - /// id: string, - /// status: "NotStarted" | "Succeeded" | "Failed" | "Running", - /// createTime: string, - /// lastUpdateTime: string, - /// properties: { - /// importedTerms: string, - /// totalTermsDetected: string - /// }, - /// error: { - /// errorCode: number, - /// errorMessage: string - /// } - /// } - /// - /// - /// - /// The name of the glossary. + /// Export Glossary Terms as csv file. + /// The globally unique identifier for glossary. /// The content to send as the body of the request. /// Whether include term hierarchy. /// The request options. + /// or is null. #pragma warning disable AZC0002 - public virtual async Task> ImportGlossaryTermsViaCsvByGlossaryNameAsync(string glossaryName, RequestContent content, bool? includeTermHierarchy = null, RequestOptions options = null) + public virtual async Task ExportGlossaryTermsAsCsvAsync(string glossaryGuid, RequestContent content, bool? includeTermHierarchy = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateImportGlossaryTermsViaCsvByGlossaryNameRequest(glossaryName, content, includeTermHierarchy); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.ImportGlossaryTermsViaCsvByGlossaryName"); + using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.ExportGlossaryTermsAsCsv"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.AzureAsyncOperation, "PurviewGlossaries.ImportGlossaryTermsViaCsvByGlossaryName"); - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.AzureAsyncOperation, "PurviewGlossaries.ImportGlossaryTermsViaCsvByGlossaryName"); - } + using HttpMessage message = CreateExportGlossaryTermsAsCsvRequest(glossaryGuid, content, includeTermHierarchy); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -7232,56 +5608,22 @@ public virtual async Task> ImportGlossaryTermsViaCsvByGlos } } - /// Import Glossary Terms from local csv file by glossaryName. - /// - /// Schema for Response Body: - /// { - /// id: string, - /// status: "NotStarted" | "Succeeded" | "Failed" | "Running", - /// createTime: string, - /// lastUpdateTime: string, - /// properties: { - /// importedTerms: string, - /// totalTermsDetected: string - /// }, - /// error: { - /// errorCode: number, - /// errorMessage: string - /// } - /// } - /// - /// - /// - /// The name of the glossary. + /// Export Glossary Terms as csv file. + /// The globally unique identifier for glossary. /// The content to send as the body of the request. /// Whether include term hierarchy. /// The request options. + /// or is null. #pragma warning disable AZC0002 - public virtual Operation ImportGlossaryTermsViaCsvByGlossaryName(string glossaryName, RequestContent content, bool? includeTermHierarchy = null, RequestOptions options = null) + public virtual Response ExportGlossaryTermsAsCsv(string glossaryGuid, RequestContent content, bool? includeTermHierarchy = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateImportGlossaryTermsViaCsvByGlossaryNameRequest(glossaryName, content, includeTermHierarchy); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.ImportGlossaryTermsViaCsvByGlossaryName"); + using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.ExportGlossaryTermsAsCsv"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.AzureAsyncOperation, "PurviewGlossaries.ImportGlossaryTermsViaCsvByGlossaryName"); - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return new LowLevelBinaryDataOperation(_clientDiagnostics, Pipeline, message.Request, message.Response, OperationFinalStateVia.AzureAsyncOperation, "PurviewGlossaries.ImportGlossaryTermsViaCsvByGlossaryName"); - } + using HttpMessage message = CreateExportGlossaryTermsAsCsvRequest(glossaryGuid, content, includeTermHierarchy); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -7290,259 +5632,13 @@ public virtual Operation ImportGlossaryTermsViaCsvByGlossaryName(str } } - private HttpMessage CreateImportGlossaryTermsViaCsvByGlossaryNameRequest(string glossaryName, RequestContent content, bool? includeTermHierarchy) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/glossary/name/", false); - uri.AppendPath(glossaryName, true); - uri.AppendPath("/terms/import", false); - if (includeTermHierarchy != null) - { - uri.AppendQuery("includeTermHierarchy", includeTermHierarchy.Value, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "multipart/form-data"); - request.Content = content; - return message; - } - - /// Get the status of import csv operation. - /// - /// Schema for Response Body: - /// { - /// id: string, - /// status: "NotStarted" | "Succeeded" | "Failed" | "Running", - /// createTime: string, - /// lastUpdateTime: string, - /// properties: { - /// importedTerms: string, - /// totalTermsDetected: string - /// }, - /// error: { - /// errorCode: number, - /// errorMessage: string - /// } - /// } - /// - /// - /// - /// The globally unique identifier for async operation/job. + /// Get terms by glossary name. + /// The name of the glossary. /// The request options. -#pragma warning disable AZC0002 - public virtual async Task GetImportCsvOperationStatusAsync(string operationGuid, RequestOptions options = null) -#pragma warning restore AZC0002 - { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetImportCsvOperationStatusRequest(operationGuid); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetImportCsvOperationStatus"); - scope.Start(); - try - { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Get the status of import csv operation. - /// - /// Schema for Response Body: - /// { - /// id: string, - /// status: "NotStarted" | "Succeeded" | "Failed" | "Running", - /// createTime: string, - /// lastUpdateTime: string, - /// properties: { - /// importedTerms: string, - /// totalTermsDetected: string - /// }, - /// error: { - /// errorCode: number, - /// errorMessage: string - /// } - /// } - /// - /// - /// - /// The globally unique identifier for async operation/job. - /// The request options. -#pragma warning disable AZC0002 - public virtual Response GetImportCsvOperationStatus(string operationGuid, RequestOptions options = null) -#pragma warning restore AZC0002 - { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetImportCsvOperationStatusRequest(operationGuid); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetImportCsvOperationStatus"); - scope.Start(); - try - { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - private HttpMessage CreateGetImportCsvOperationStatusRequest(string operationGuid) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/glossary/terms/import/", false); - uri.AppendPath(operationGuid, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Export Glossary Terms as csv file. - /// The globally unique identifier for glossary. - /// The content to send as the body of the request. - /// Whether include term hierarchy. - /// The request options. -#pragma warning disable AZC0002 - public virtual async Task ExportGlossaryTermsAsCsvAsync(string glossaryGuid, RequestContent content, bool? includeTermHierarchy = null, RequestOptions options = null) -#pragma warning restore AZC0002 - { - options ??= new RequestOptions(); - using HttpMessage message = CreateExportGlossaryTermsAsCsvRequest(glossaryGuid, content, includeTermHierarchy); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.ExportGlossaryTermsAsCsv"); - scope.Start(); - try - { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Export Glossary Terms as csv file. - /// The globally unique identifier for glossary. - /// The content to send as the body of the request. - /// Whether include term hierarchy. - /// The request options. -#pragma warning disable AZC0002 - public virtual Response ExportGlossaryTermsAsCsv(string glossaryGuid, RequestContent content, bool? includeTermHierarchy = null, RequestOptions options = null) -#pragma warning restore AZC0002 - { - options ??= new RequestOptions(); - using HttpMessage message = CreateExportGlossaryTermsAsCsvRequest(glossaryGuid, content, includeTermHierarchy); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.ExportGlossaryTermsAsCsv"); - scope.Start(); - try - { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - private HttpMessage CreateExportGlossaryTermsAsCsvRequest(string glossaryGuid, RequestContent content, bool? includeTermHierarchy) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/glossary/", false); - uri.AppendPath(glossaryGuid, true); - uri.AppendPath("/terms/export", false); - if (includeTermHierarchy != null) - { - uri.AppendQuery("includeTermHierarchy", includeTermHierarchy.Value, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "text/csv"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - - /// Get terms by glossary name. + /// The page size - by default there is no paging. + /// The offset for pagination purpose. + /// Whether include term hierarchy. + /// is null. /// /// Schema for Response Body: /// { @@ -7647,37 +5743,16 @@ private HttpMessage CreateExportGlossaryTermsAsCsvRequest(string glossaryGuid, R /// /// /// - /// The name of the glossary. - /// The page size - by default there is no paging. - /// The offset for pagination purpose. - /// Whether include term hierarchy. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetTermsByGlossaryNameAsync(string glossaryName, int? limit = null, int? offset = null, bool? includeTermHierarchy = null, RequestOptions options = null) + public virtual async Task GetTermsByGlossaryNameAsync(string glossaryName, RequestOptions options, int? limit = null, int? offset = null, bool? includeTermHierarchy = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetTermsByGlossaryNameRequest(glossaryName, limit, offset, includeTermHierarchy); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetTermsByGlossaryName"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetTermsByGlossaryNameRequest(glossaryName, limit, offset, includeTermHierarchy); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -7687,6 +5762,12 @@ public virtual async Task GetTermsByGlossaryNameAsync(string glossaryN } /// Get terms by glossary name. + /// The name of the glossary. + /// The request options. + /// The page size - by default there is no paging. + /// The offset for pagination purpose. + /// Whether include term hierarchy. + /// is null. /// /// Schema for Response Body: /// { @@ -7791,37 +5872,59 @@ public virtual async Task GetTermsByGlossaryNameAsync(string glossaryN /// /// /// - /// The name of the glossary. - /// The page size - by default there is no paging. - /// The offset for pagination purpose. +#pragma warning disable AZC0002 + public virtual Response GetTermsByGlossaryName(string glossaryName, RequestOptions options, int? limit = null, int? offset = null, bool? includeTermHierarchy = null) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetTermsByGlossaryName"); + scope.Start(); + try + { + using HttpMessage message = CreateGetTermsByGlossaryNameRequest(glossaryName, limit, offset, includeTermHierarchy); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Import Glossary Terms from local csv file. + /// The globally unique identifier for glossary. + /// The content to send as the body of the request. /// Whether include term hierarchy. /// The request options. + /// or is null. + /// + /// Schema for Response Body: + /// { + /// id: string, + /// status: "NotStarted" | "Succeeded" | "Failed" | "Running", + /// createTime: string, + /// lastUpdateTime: string, + /// properties: { + /// importedTerms: string, + /// totalTermsDetected: string + /// }, + /// error: { + /// errorCode: number, + /// errorMessage: string + /// } + /// } + /// + /// + /// #pragma warning disable AZC0002 - public virtual Response GetTermsByGlossaryName(string glossaryName, int? limit = null, int? offset = null, bool? includeTermHierarchy = null, RequestOptions options = null) + public virtual async Task> ImportGlossaryTermsViaCsvAsync(string glossaryGuid, RequestContent content, bool? includeTermHierarchy = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetTermsByGlossaryNameRequest(glossaryName, limit, offset, includeTermHierarchy); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.GetTermsByGlossaryName"); + using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.ImportGlossaryTermsViaCsv"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateImportGlossaryTermsViaCsvRequest(glossaryGuid, content, includeTermHierarchy); + return await LowLevelOperationHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, "PurviewGlossaries.ImportGlossaryTermsViaCsv", OperationFinalStateVia.AzureAsyncOperation, options).ConfigureAwait(false); } catch (Exception e) { @@ -7830,33 +5933,939 @@ public virtual Response GetTermsByGlossaryName(string glossaryName, int? limit = } } - private HttpMessage CreateGetTermsByGlossaryNameRequest(string glossaryName, int? limit, int? offset, bool? includeTermHierarchy) + /// Import Glossary Terms from local csv file. + /// The globally unique identifier for glossary. + /// The content to send as the body of the request. + /// Whether include term hierarchy. + /// The request options. + /// or is null. + /// + /// Schema for Response Body: + /// { + /// id: string, + /// status: "NotStarted" | "Succeeded" | "Failed" | "Running", + /// createTime: string, + /// lastUpdateTime: string, + /// properties: { + /// importedTerms: string, + /// totalTermsDetected: string + /// }, + /// error: { + /// errorCode: number, + /// errorMessage: string + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual Operation ImportGlossaryTermsViaCsv(string glossaryGuid, RequestContent content, bool? includeTermHierarchy = null, RequestOptions options = null) +#pragma warning restore AZC0002 { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/glossary/name/", false); - uri.AppendPath(glossaryName, true); - uri.AppendPath("/terms", false); - if (limit != null) + using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.ImportGlossaryTermsViaCsv"); + scope.Start(); + try { - uri.AppendQuery("limit", limit.Value, true); + using HttpMessage message = CreateImportGlossaryTermsViaCsvRequest(glossaryGuid, content, includeTermHierarchy); + return LowLevelOperationHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, "PurviewGlossaries.ImportGlossaryTermsViaCsv", OperationFinalStateVia.AzureAsyncOperation, options); } - if (offset != null) + catch (Exception e) { - uri.AppendQuery("offset", offset.Value, true); + scope.Failed(e); + throw; } - if (includeTermHierarchy != null) + } + + /// Import Glossary Terms from local csv file by glossaryName. + /// The name of the glossary. + /// The content to send as the body of the request. + /// Whether include term hierarchy. + /// The request options. + /// or is null. + /// + /// Schema for Response Body: + /// { + /// id: string, + /// status: "NotStarted" | "Succeeded" | "Failed" | "Running", + /// createTime: string, + /// lastUpdateTime: string, + /// properties: { + /// importedTerms: string, + /// totalTermsDetected: string + /// }, + /// error: { + /// errorCode: number, + /// errorMessage: string + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual async Task> ImportGlossaryTermsViaCsvByGlossaryNameAsync(string glossaryName, RequestContent content, bool? includeTermHierarchy = null, RequestOptions options = null) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.ImportGlossaryTermsViaCsvByGlossaryName"); + scope.Start(); + try { - uri.AppendQuery("includeTermHierarchy", includeTermHierarchy.Value, true); + using HttpMessage message = CreateImportGlossaryTermsViaCsvByGlossaryNameRequest(glossaryName, content, includeTermHierarchy); + return await LowLevelOperationHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, "PurviewGlossaries.ImportGlossaryTermsViaCsvByGlossaryName", OperationFinalStateVia.AzureAsyncOperation, options).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Import Glossary Terms from local csv file by glossaryName. + /// The name of the glossary. + /// The content to send as the body of the request. + /// Whether include term hierarchy. + /// The request options. + /// or is null. + /// + /// Schema for Response Body: + /// { + /// id: string, + /// status: "NotStarted" | "Succeeded" | "Failed" | "Running", + /// createTime: string, + /// lastUpdateTime: string, + /// properties: { + /// importedTerms: string, + /// totalTermsDetected: string + /// }, + /// error: { + /// errorCode: number, + /// errorMessage: string + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual Operation ImportGlossaryTermsViaCsvByGlossaryName(string glossaryName, RequestContent content, bool? includeTermHierarchy = null, RequestOptions options = null) +#pragma warning restore AZC0002 + { + using var scope = _clientDiagnostics.CreateScope("PurviewGlossaries.ImportGlossaryTermsViaCsvByGlossaryName"); + scope.Start(); + try + { + using HttpMessage message = CreateImportGlossaryTermsViaCsvByGlossaryNameRequest(glossaryName, content, includeTermHierarchy); + return LowLevelOperationHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, "PurviewGlossaries.ImportGlossaryTermsViaCsvByGlossaryName", OperationFinalStateVia.AzureAsyncOperation, options); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + internal HttpMessage CreateGetGlossariesRequest(int? limit, int? offset, string sort) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/glossary", false); + if (limit != null) + { + uri.AppendQuery("limit", limit.Value, true); + } + if (offset != null) + { + uri.AppendQuery("offset", offset.Value, true); + } + if (sort != null) + { + uri.AppendQuery("sort", sort, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateGlossaryRequest(RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/glossary", false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateGlossaryCategoriesRequest(RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/glossary/categories", false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateGlossaryCategoryRequest(RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/glossary/category", false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetGlossaryCategoryRequest(string categoryGuid) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/glossary/category/", false); + uri.AppendPath(categoryGuid, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateUpdateGlossaryCategoryRequest(string categoryGuid, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/glossary/category/", false); + uri.AppendPath(categoryGuid, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateDeleteGlossaryCategoryRequest(string categoryGuid) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/glossary/category/", false); + uri.AppendPath(categoryGuid, true); + request.Uri = uri; + message.ResponseClassifier = ResponseClassifier204.Instance; + return message; + } + + internal HttpMessage CreatePartialUpdateGlossaryCategoryRequest(string categoryGuid, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/glossary/category/", false); + uri.AppendPath(categoryGuid, true); + uri.AppendPath("/partial", false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetRelatedCategoriesRequest(string categoryGuid, int? limit, int? offset, string sort) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/glossary/category/", false); + uri.AppendPath(categoryGuid, true); + uri.AppendPath("/related", false); + if (limit != null) + { + uri.AppendQuery("limit", limit.Value, true); + } + if (offset != null) + { + uri.AppendQuery("offset", offset.Value, true); + } + if (sort != null) + { + uri.AppendQuery("sort", sort, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetCategoryTermsRequest(string categoryGuid, int? limit, int? offset, string sort) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/glossary/category/", false); + uri.AppendPath(categoryGuid, true); + uri.AppendPath("/terms", false); + if (limit != null) + { + uri.AppendQuery("limit", limit.Value, true); + } + if (offset != null) + { + uri.AppendQuery("offset", offset.Value, true); + } + if (sort != null) + { + uri.AppendQuery("sort", sort, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateGlossaryTermRequest(RequestContent content, bool? includeTermHierarchy) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/glossary/term", false); + if (includeTermHierarchy != null) + { + uri.AppendQuery("includeTermHierarchy", includeTermHierarchy.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetGlossaryTermRequest(string termGuid, bool? includeTermHierarchy) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/glossary/term/", false); + uri.AppendPath(termGuid, true); + if (includeTermHierarchy != null) + { + uri.AppendQuery("includeTermHierarchy", includeTermHierarchy.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateUpdateGlossaryTermRequest(string termGuid, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/glossary/term/", false); + uri.AppendPath(termGuid, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateDeleteGlossaryTermRequest(string termGuid) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/glossary/term/", false); + uri.AppendPath(termGuid, true); + request.Uri = uri; + message.ResponseClassifier = ResponseClassifier204.Instance; + return message; + } + + internal HttpMessage CreatePartialUpdateGlossaryTermRequest(string termGuid, RequestContent content, bool? includeTermHierarchy) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/glossary/term/", false); + uri.AppendPath(termGuid, true); + uri.AppendPath("/partial", false); + if (includeTermHierarchy != null) + { + uri.AppendQuery("includeTermHierarchy", includeTermHierarchy.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateGlossaryTermsRequest(RequestContent content, bool? includeTermHierarchy) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/glossary/terms", false); + if (includeTermHierarchy != null) + { + uri.AppendQuery("includeTermHierarchy", includeTermHierarchy.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetEntitiesAssignedWithTermRequest(string termGuid, int? limit, int? offset, string sort) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/glossary/terms/", false); + uri.AppendPath(termGuid, true); + uri.AppendPath("/assignedEntities", false); + if (limit != null) + { + uri.AppendQuery("limit", limit.Value, true); + } + if (offset != null) + { + uri.AppendQuery("offset", offset.Value, true); + } + if (sort != null) + { + uri.AppendQuery("sort", sort, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateAssignTermToEntitiesRequest(string termGuid, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/glossary/terms/", false); + uri.AppendPath(termGuid, true); + uri.AppendPath("/assignedEntities", false); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier204.Instance; + return message; + } + + internal HttpMessage CreateRemoveTermAssignmentFromEntitiesRequest(string termGuid, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/glossary/terms/", false); + uri.AppendPath(termGuid, true); + uri.AppendPath("/assignedEntities", false); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier204.Instance; + return message; + } + + internal HttpMessage CreateDeleteTermAssignmentFromEntitiesRequest(string termGuid, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/glossary/terms/", false); + uri.AppendPath(termGuid, true); + uri.AppendPath("/assignedEntities", false); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier204.Instance; + return message; + } + + internal HttpMessage CreateGetRelatedTermsRequest(string termGuid, int? limit, int? offset, string sort) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/glossary/terms/", false); + uri.AppendPath(termGuid, true); + uri.AppendPath("/related", false); + if (limit != null) + { + uri.AppendQuery("limit", limit.Value, true); + } + if (offset != null) + { + uri.AppendQuery("offset", offset.Value, true); + } + if (sort != null) + { + uri.AppendQuery("sort", sort, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetGlossaryRequest(string glossaryGuid) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/glossary/", false); + uri.AppendPath(glossaryGuid, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateUpdateGlossaryRequest(string glossaryGuid, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/glossary/", false); + uri.AppendPath(glossaryGuid, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateDeleteGlossaryRequest(string glossaryGuid) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/glossary/", false); + uri.AppendPath(glossaryGuid, true); + request.Uri = uri; + message.ResponseClassifier = ResponseClassifier204.Instance; + return message; + } + + internal HttpMessage CreateGetGlossaryCategoriesRequest(string glossaryGuid, int? limit, int? offset, string sort) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/glossary/", false); + uri.AppendPath(glossaryGuid, true); + uri.AppendPath("/categories", false); + if (limit != null) + { + uri.AppendQuery("limit", limit.Value, true); + } + if (offset != null) + { + uri.AppendQuery("offset", offset.Value, true); + } + if (sort != null) + { + uri.AppendQuery("sort", sort, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetGlossaryCategoriesHeadersRequest(string glossaryGuid, int? limit, int? offset, string sort) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/glossary/", false); + uri.AppendPath(glossaryGuid, true); + uri.AppendPath("/categories/headers", false); + if (limit != null) + { + uri.AppendQuery("limit", limit.Value, true); + } + if (offset != null) + { + uri.AppendQuery("offset", offset.Value, true); + } + if (sort != null) + { + uri.AppendQuery("sort", sort, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetDetailedGlossaryRequest(string glossaryGuid, bool? includeTermHierarchy) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/glossary/", false); + uri.AppendPath(glossaryGuid, true); + uri.AppendPath("/detailed", false); + if (includeTermHierarchy != null) + { + uri.AppendQuery("includeTermHierarchy", includeTermHierarchy.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreatePartialUpdateGlossaryRequest(string glossaryGuid, RequestContent content, bool? includeTermHierarchy) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/glossary/", false); + uri.AppendPath(glossaryGuid, true); + uri.AppendPath("/partial", false); + if (includeTermHierarchy != null) + { + uri.AppendQuery("includeTermHierarchy", includeTermHierarchy.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetGlossaryTermsRequest(string glossaryGuid, bool? includeTermHierarchy, int? limit, int? offset, string sort) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/glossary/", false); + uri.AppendPath(glossaryGuid, true); + uri.AppendPath("/terms", false); + if (includeTermHierarchy != null) + { + uri.AppendQuery("includeTermHierarchy", includeTermHierarchy.Value, true); + } + if (limit != null) + { + uri.AppendQuery("limit", limit.Value, true); + } + if (offset != null) + { + uri.AppendQuery("offset", offset.Value, true); + } + if (sort != null) + { + uri.AppendQuery("sort", sort, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetGlossaryTermHeadersRequest(string glossaryGuid, int? limit, int? offset, string sort) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/glossary/", false); + uri.AppendPath(glossaryGuid, true); + uri.AppendPath("/terms/headers", false); + if (limit != null) + { + uri.AppendQuery("limit", limit.Value, true); + } + if (offset != null) + { + uri.AppendQuery("offset", offset.Value, true); + } + if (sort != null) + { + uri.AppendQuery("sort", sort, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateImportGlossaryTermsViaCsvRequest(string glossaryGuid, RequestContent content, bool? includeTermHierarchy) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/glossary/", false); + uri.AppendPath(glossaryGuid, true); + uri.AppendPath("/terms/import", false); + if (includeTermHierarchy != null) + { + uri.AppendQuery("includeTermHierarchy", includeTermHierarchy.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "multipart/form-data"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier202.Instance; + return message; + } + + internal HttpMessage CreateImportGlossaryTermsViaCsvByGlossaryNameRequest(string glossaryName, RequestContent content, bool? includeTermHierarchy) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/glossary/name/", false); + uri.AppendPath(glossaryName, true); + uri.AppendPath("/terms/import", false); + if (includeTermHierarchy != null) + { + uri.AppendQuery("includeTermHierarchy", includeTermHierarchy.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "multipart/form-data"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier202.Instance; + return message; + } + + internal HttpMessage CreateGetImportCsvOperationStatusRequest(string operationGuid) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/glossary/terms/import/", false); + uri.AppendPath(operationGuid, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateExportGlossaryTermsAsCsvRequest(string glossaryGuid, RequestContent content, bool? includeTermHierarchy) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/glossary/", false); + uri.AppendPath(glossaryGuid, true); + uri.AppendPath("/terms/export", false); + if (includeTermHierarchy != null) + { + uri.AppendQuery("includeTermHierarchy", includeTermHierarchy.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "text/csv"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetTermsByGlossaryNameRequest(string glossaryName, int? limit, int? offset, bool? includeTermHierarchy) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/glossary/name/", false); + uri.AppendPath(glossaryName, true); + uri.AppendPath("/terms", false); + if (limit != null) + { + uri.AppendQuery("limit", limit.Value, true); + } + if (offset != null) + { + uri.AppendQuery("offset", offset.Value, true); + } + if (includeTermHierarchy != null) + { + uri.AppendQuery("includeTermHierarchy", includeTermHierarchy.Value, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier204 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier204(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 204 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier202 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier202(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 202 => false, + _ => true + }; } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; } } } diff --git a/sdk/purview/Azure.Analytics.Purview.Catalog/src/Generated/PurviewRelationships.cs b/sdk/purview/Azure.Analytics.Purview.Catalog/src/Generated/PurviewRelationships.cs index d13e4e03cd3dc..dbdfc0f426899 100644 --- a/sdk/purview/Azure.Analytics.Purview.Catalog/src/Generated/PurviewRelationships.cs +++ b/sdk/purview/Azure.Analytics.Purview.Catalog/src/Generated/PurviewRelationships.cs @@ -16,14 +16,15 @@ namespace Azure.Analytics.Purview.Catalog /// The PurviewRelationships service client. public partial class PurviewRelationships { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of PurviewRelationships for mocking. protected PurviewRelationships() @@ -31,6 +32,9 @@ protected PurviewRelationships() } /// Create a new relationship between entities. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -55,7 +59,6 @@ protected PurviewRelationships() /// version: number /// } /// - /// /// Schema for Response Body: /// { /// attributes: Dictionary<string, AnyObject>, @@ -81,34 +84,16 @@ protected PurviewRelationships() /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task CreateAsync(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewRelationships.Create"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateRequest(content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -118,6 +103,9 @@ public virtual async Task CreateAsync(RequestContent content, RequestO } /// Create a new relationship between entities. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -142,7 +130,6 @@ public virtual async Task CreateAsync(RequestContent content, RequestO /// version: number /// } /// - /// /// Schema for Response Body: /// { /// attributes: Dictionary<string, AnyObject>, @@ -168,34 +155,16 @@ public virtual async Task CreateAsync(RequestContent content, RequestO /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response Create(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewRelationships.Create"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateRequest(content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -204,23 +173,10 @@ public virtual Response Create(RequestContent content, RequestOptions options = } } - private HttpMessage CreateCreateRequest(RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/relationship", false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - /// Update an existing relationship between entities. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -245,7 +201,6 @@ private HttpMessage CreateCreateRequest(RequestContent content) /// version: number /// } /// - /// /// Schema for Response Body: /// { /// attributes: Dictionary<string, AnyObject>, @@ -271,34 +226,16 @@ private HttpMessage CreateCreateRequest(RequestContent content) /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task UpdateAsync(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateUpdateRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewRelationships.Update"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateUpdateRequest(content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -308,6 +245,9 @@ public virtual async Task UpdateAsync(RequestContent content, RequestO } /// Update an existing relationship between entities. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -332,7 +272,6 @@ public virtual async Task UpdateAsync(RequestContent content, RequestO /// version: number /// } /// - /// /// Schema for Response Body: /// { /// attributes: Dictionary<string, AnyObject>, @@ -358,34 +297,16 @@ public virtual async Task UpdateAsync(RequestContent content, RequestO /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response Update(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateUpdateRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewRelationships.Update"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateUpdateRequest(content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -394,23 +315,11 @@ public virtual Response Update(RequestContent content, RequestOptions options = } } - private HttpMessage CreateUpdateRequest(RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/relationship", false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - /// Get relationship information between entities by its GUID. + /// The globally unique identifier of the relationship. + /// The request options. + /// Limits whether includes extended information. + /// is null. /// /// Schema for Response Body: /// { @@ -440,35 +349,16 @@ private HttpMessage CreateUpdateRequest(RequestContent content) /// /// /// - /// The globally unique identifier of the relationship. - /// Limits whether includes extended information. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetAsync(string guid, bool? extendedInfo = null, RequestOptions options = null) + public virtual async Task GetAsync(string guid, RequestOptions options, bool? extendedInfo = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRequest(guid, extendedInfo); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewRelationships.Get"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRequest(guid, extendedInfo); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -478,6 +368,10 @@ public virtual async Task GetAsync(string guid, bool? extendedInfo = n } /// Get relationship information between entities by its GUID. + /// The globally unique identifier of the relationship. + /// The request options. + /// Limits whether includes extended information. + /// is null. /// /// Schema for Response Body: /// { @@ -507,35 +401,16 @@ public virtual async Task GetAsync(string guid, bool? extendedInfo = n /// /// /// - /// The globally unique identifier of the relationship. - /// Limits whether includes extended information. - /// The request options. #pragma warning disable AZC0002 - public virtual Response Get(string guid, bool? extendedInfo = null, RequestOptions options = null) + public virtual Response Get(string guid, RequestOptions options, bool? extendedInfo = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRequest(guid, extendedInfo); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewRelationships.Get"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRequest(guid, extendedInfo); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -544,54 +419,20 @@ public virtual Response Get(string guid, bool? extendedInfo = null, RequestOptio } } - private HttpMessage CreateGetRequest(string guid, bool? extendedInfo) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/relationship/guid/", false); - uri.AppendPath(guid, true); - if (extendedInfo != null) - { - uri.AppendQuery("extendedInfo", extendedInfo.Value, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Delete a relationship between entities by its GUID. /// The globally unique identifier of the relationship. /// The request options. + /// is null. #pragma warning disable AZC0002 public virtual async Task DeleteAsync(string guid, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(guid); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewRelationships.Delete"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(guid); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -603,32 +444,17 @@ public virtual async Task DeleteAsync(string guid, RequestOptions opti /// Delete a relationship between entities by its GUID. /// The globally unique identifier of the relationship. /// The request options. + /// is null. #pragma warning disable AZC0002 public virtual Response Delete(string guid, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(guid); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewRelationships.Delete"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(guid); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -637,18 +463,100 @@ public virtual Response Delete(string guid, RequestOptions options = null) } } - private HttpMessage CreateDeleteRequest(string guid) + internal HttpMessage CreateCreateRequest(RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/relationship", false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateUpdateRequest(RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/relationship", false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetRequest(string guid, bool? extendedInfo) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/relationship/guid/", false); + uri.AppendPath(guid, true); + if (extendedInfo != null) + { + uri.AppendQuery("extendedInfo", extendedInfo.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateDeleteRequest(string guid) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); + uri.Reset(_endpoint); uri.AppendRaw("/api", false); uri.AppendPath("/atlas/v2/relationship/guid/", false); uri.AppendPath(guid, true); request.Uri = uri; + message.ResponseClassifier = ResponseClassifier204.Instance; return message; } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier204 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier204(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 204 => false, + _ => true + }; + } + } } } diff --git a/sdk/purview/Azure.Analytics.Purview.Catalog/src/Generated/PurviewTypes.cs b/sdk/purview/Azure.Analytics.Purview.Catalog/src/Generated/PurviewTypes.cs index ec4b1459dd229..7aeca4efe2e8a 100644 --- a/sdk/purview/Azure.Analytics.Purview.Catalog/src/Generated/PurviewTypes.cs +++ b/sdk/purview/Azure.Analytics.Purview.Catalog/src/Generated/PurviewTypes.cs @@ -16,14 +16,16 @@ namespace Azure.Analytics.Purview.Catalog /// The PurviewTypes service client. public partial class PurviewTypes { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of PurviewTypes for mocking. protected PurviewTypes() @@ -31,6 +33,9 @@ protected PurviewTypes() } /// Get the classification definition for the given GUID. + /// The globally unique identifier of the classification. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -109,34 +114,16 @@ protected PurviewTypes() /// /// /// - /// The globally unique identifier of the classification. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetClassificationDefByGuidAsync(string guid, RequestOptions options = null) + public virtual async Task GetClassificationDefByGuidAsync(string guid, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetClassificationDefByGuidRequest(guid); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.GetClassificationDefByGuid"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetClassificationDefByGuidRequest(guid); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -146,6 +133,9 @@ public virtual async Task GetClassificationDefByGuidAsync(string guid, } /// Get the classification definition for the given GUID. + /// The globally unique identifier of the classification. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -224,34 +214,16 @@ public virtual async Task GetClassificationDefByGuidAsync(string guid, /// /// /// - /// The globally unique identifier of the classification. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetClassificationDefByGuid(string guid, RequestOptions options = null) + public virtual Response GetClassificationDefByGuid(string guid, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetClassificationDefByGuidRequest(guid); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.GetClassificationDefByGuid"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetClassificationDefByGuidRequest(guid); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -260,22 +232,10 @@ public virtual Response GetClassificationDefByGuid(string guid, RequestOptions o } } - private HttpMessage CreateGetClassificationDefByGuidRequest(string guid) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/types/classificationdef/guid/", false); - uri.AppendPath(guid, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Get the classification definition by its name (unique). + /// The name of the classification. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -354,34 +314,16 @@ private HttpMessage CreateGetClassificationDefByGuidRequest(string guid) /// /// /// - /// The name of the classification. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetClassificationDefByNameAsync(string name, RequestOptions options = null) + public virtual async Task GetClassificationDefByNameAsync(string name, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetClassificationDefByNameRequest(name); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.GetClassificationDefByName"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetClassificationDefByNameRequest(name); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -391,6 +333,9 @@ public virtual async Task GetClassificationDefByNameAsync(string name, } /// Get the classification definition by its name (unique). + /// The name of the classification. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -469,34 +414,16 @@ public virtual async Task GetClassificationDefByNameAsync(string name, /// /// /// - /// The name of the classification. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetClassificationDefByName(string name, RequestOptions options = null) + public virtual Response GetClassificationDefByName(string name, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetClassificationDefByNameRequest(name); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.GetClassificationDefByName"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetClassificationDefByNameRequest(name); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -505,22 +432,10 @@ public virtual Response GetClassificationDefByName(string name, RequestOptions o } } - private HttpMessage CreateGetClassificationDefByNameRequest(string name) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/types/classificationdef/name/", false); - uri.AppendPath(name, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Get the Entity definition for the given GUID. + /// The globally unique identifier of the entity. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -617,34 +532,16 @@ private HttpMessage CreateGetClassificationDefByNameRequest(string name) /// /// /// - /// The globally unique identifier of the entity. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetEntityDefinitionByGuidAsync(string guid, RequestOptions options = null) + public virtual async Task GetEntityDefinitionByGuidAsync(string guid, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetEntityDefinitionByGuidRequest(guid); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.GetEntityDefinitionByGuid"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetEntityDefinitionByGuidRequest(guid); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -654,6 +551,9 @@ public virtual async Task GetEntityDefinitionByGuidAsync(string guid, } /// Get the Entity definition for the given GUID. + /// The globally unique identifier of the entity. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -750,34 +650,16 @@ public virtual async Task GetEntityDefinitionByGuidAsync(string guid, /// /// /// - /// The globally unique identifier of the entity. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetEntityDefinitionByGuid(string guid, RequestOptions options = null) + public virtual Response GetEntityDefinitionByGuid(string guid, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetEntityDefinitionByGuidRequest(guid); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.GetEntityDefinitionByGuid"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetEntityDefinitionByGuidRequest(guid); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -786,22 +668,10 @@ public virtual Response GetEntityDefinitionByGuid(string guid, RequestOptions op } } - private HttpMessage CreateGetEntityDefinitionByGuidRequest(string guid) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/types/entitydef/guid/", false); - uri.AppendPath(guid, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Get the entity definition by its name (unique). + /// The name of the entity. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -898,34 +768,16 @@ private HttpMessage CreateGetEntityDefinitionByGuidRequest(string guid) /// /// /// - /// The name of the entity. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetEntityDefinitionByNameAsync(string name, RequestOptions options = null) + public virtual async Task GetEntityDefinitionByNameAsync(string name, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetEntityDefinitionByNameRequest(name); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.GetEntityDefinitionByName"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetEntityDefinitionByNameRequest(name); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -935,6 +787,9 @@ public virtual async Task GetEntityDefinitionByNameAsync(string name, } /// Get the entity definition by its name (unique). + /// The name of the entity. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -1031,34 +886,16 @@ public virtual async Task GetEntityDefinitionByNameAsync(string name, /// /// /// - /// The name of the entity. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetEntityDefinitionByName(string name, RequestOptions options = null) + public virtual Response GetEntityDefinitionByName(string name, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetEntityDefinitionByNameRequest(name); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.GetEntityDefinitionByName"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetEntityDefinitionByNameRequest(name); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1067,22 +904,10 @@ public virtual Response GetEntityDefinitionByName(string name, RequestOptions op } } - private HttpMessage CreateGetEntityDefinitionByNameRequest(string name) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/types/entitydef/name/", false); - uri.AppendPath(name, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Get the enum definition for the given GUID. + /// The globally unique identifier of the enum. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -1144,34 +969,16 @@ private HttpMessage CreateGetEntityDefinitionByNameRequest(string name) /// /// /// - /// The globally unique identifier of the enum. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetEnumDefByGuidAsync(string guid, RequestOptions options = null) + public virtual async Task GetEnumDefByGuidAsync(string guid, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetEnumDefByGuidRequest(guid); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.GetEnumDefByGuid"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetEnumDefByGuidRequest(guid); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1181,6 +988,9 @@ public virtual async Task GetEnumDefByGuidAsync(string guid, RequestOp } /// Get the enum definition for the given GUID. + /// The globally unique identifier of the enum. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -1242,34 +1052,16 @@ public virtual async Task GetEnumDefByGuidAsync(string guid, RequestOp /// /// /// - /// The globally unique identifier of the enum. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetEnumDefByGuid(string guid, RequestOptions options = null) + public virtual Response GetEnumDefByGuid(string guid, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetEnumDefByGuidRequest(guid); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.GetEnumDefByGuid"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetEnumDefByGuidRequest(guid); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1278,22 +1070,10 @@ public virtual Response GetEnumDefByGuid(string guid, RequestOptions options = n } } - private HttpMessage CreateGetEnumDefByGuidRequest(string guid) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/types/enumdef/guid/", false); - uri.AppendPath(guid, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Get the enum definition by its name (unique). + /// The name of the enum. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -1355,34 +1135,16 @@ private HttpMessage CreateGetEnumDefByGuidRequest(string guid) /// /// /// - /// The name of the enum. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetEnumDefByNameAsync(string name, RequestOptions options = null) + public virtual async Task GetEnumDefByNameAsync(string name, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetEnumDefByNameRequest(name); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.GetEnumDefByName"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetEnumDefByNameRequest(name); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1392,6 +1154,9 @@ public virtual async Task GetEnumDefByNameAsync(string name, RequestOp } /// Get the enum definition by its name (unique). + /// The name of the enum. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -1453,34 +1218,16 @@ public virtual async Task GetEnumDefByNameAsync(string name, RequestOp /// /// /// - /// The name of the enum. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetEnumDefByName(string name, RequestOptions options = null) + public virtual Response GetEnumDefByName(string name, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetEnumDefByNameRequest(name); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.GetEnumDefByName"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetEnumDefByNameRequest(name); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1489,22 +1236,10 @@ public virtual Response GetEnumDefByName(string name, RequestOptions options = n } } - private HttpMessage CreateGetEnumDefByNameRequest(string name) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/types/enumdef/name/", false); - uri.AppendPath(name, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Get the relationship definition for the given GUID. + /// The globally unique identifier of the relationship. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -1591,34 +1326,16 @@ private HttpMessage CreateGetEnumDefByNameRequest(string name) /// /// /// - /// The globally unique identifier of the relationship. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetRelationshipDefByGuidAsync(string guid, RequestOptions options = null) + public virtual async Task GetRelationshipDefByGuidAsync(string guid, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRelationshipDefByGuidRequest(guid); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.GetRelationshipDefByGuid"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRelationshipDefByGuidRequest(guid); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1628,6 +1345,9 @@ public virtual async Task GetRelationshipDefByGuidAsync(string guid, R } /// Get the relationship definition for the given GUID. + /// The globally unique identifier of the relationship. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -1714,34 +1434,16 @@ public virtual async Task GetRelationshipDefByGuidAsync(string guid, R /// /// /// - /// The globally unique identifier of the relationship. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetRelationshipDefByGuid(string guid, RequestOptions options = null) + public virtual Response GetRelationshipDefByGuid(string guid, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRelationshipDefByGuidRequest(guid); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.GetRelationshipDefByGuid"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRelationshipDefByGuidRequest(guid); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1750,22 +1452,10 @@ public virtual Response GetRelationshipDefByGuid(string guid, RequestOptions opt } } - private HttpMessage CreateGetRelationshipDefByGuidRequest(string guid) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/types/relationshipdef/guid/", false); - uri.AppendPath(guid, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Get the relationship definition by its name (unique). + /// The name of the relationship. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -1852,34 +1542,16 @@ private HttpMessage CreateGetRelationshipDefByGuidRequest(string guid) /// /// /// - /// The name of the relationship. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetRelationshipDefByNameAsync(string name, RequestOptions options = null) + public virtual async Task GetRelationshipDefByNameAsync(string name, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRelationshipDefByNameRequest(name); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.GetRelationshipDefByName"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRelationshipDefByNameRequest(name); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1889,6 +1561,9 @@ public virtual async Task GetRelationshipDefByNameAsync(string name, R } /// Get the relationship definition by its name (unique). + /// The name of the relationship. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -1975,34 +1650,16 @@ public virtual async Task GetRelationshipDefByNameAsync(string name, R /// /// /// - /// The name of the relationship. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetRelationshipDefByName(string name, RequestOptions options = null) + public virtual Response GetRelationshipDefByName(string name, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRelationshipDefByNameRequest(name); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.GetRelationshipDefByName"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRelationshipDefByNameRequest(name); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -2011,22 +1668,10 @@ public virtual Response GetRelationshipDefByName(string name, RequestOptions opt } } - private HttpMessage CreateGetRelationshipDefByNameRequest(string name) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/types/relationshipdef/name/", false); - uri.AppendPath(name, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Get the struct definition for the given GUID. + /// The globally unique identifier of the struct. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -2102,34 +1747,16 @@ private HttpMessage CreateGetRelationshipDefByNameRequest(string name) /// /// /// - /// The globally unique identifier of the struct. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetStructDefByGuidAsync(string guid, RequestOptions options = null) + public virtual async Task GetStructDefByGuidAsync(string guid, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetStructDefByGuidRequest(guid); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.GetStructDefByGuid"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetStructDefByGuidRequest(guid); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -2139,6 +1766,9 @@ public virtual async Task GetStructDefByGuidAsync(string guid, Request } /// Get the struct definition for the given GUID. + /// The globally unique identifier of the struct. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -2214,34 +1844,16 @@ public virtual async Task GetStructDefByGuidAsync(string guid, Request /// /// /// - /// The globally unique identifier of the struct. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetStructDefByGuid(string guid, RequestOptions options = null) + public virtual Response GetStructDefByGuid(string guid, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetStructDefByGuidRequest(guid); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.GetStructDefByGuid"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetStructDefByGuidRequest(guid); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -2250,22 +1862,10 @@ public virtual Response GetStructDefByGuid(string guid, RequestOptions options = } } - private HttpMessage CreateGetStructDefByGuidRequest(string guid) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/types/structdef/guid/", false); - uri.AppendPath(guid, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Get the struct definition by its name (unique). + /// The name of the struct. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -2341,34 +1941,16 @@ private HttpMessage CreateGetStructDefByGuidRequest(string guid) /// /// /// - /// The name of the struct. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetStructDefByNameAsync(string name, RequestOptions options = null) + public virtual async Task GetStructDefByNameAsync(string name, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetStructDefByNameRequest(name); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.GetStructDefByName"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetStructDefByNameRequest(name); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -2378,6 +1960,9 @@ public virtual async Task GetStructDefByNameAsync(string name, Request } /// Get the struct definition by its name (unique). + /// The name of the struct. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -2453,34 +2038,16 @@ public virtual async Task GetStructDefByNameAsync(string name, Request /// /// /// - /// The name of the struct. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetStructDefByName(string name, RequestOptions options = null) + public virtual Response GetStructDefByName(string name, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetStructDefByNameRequest(name); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.GetStructDefByName"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetStructDefByNameRequest(name); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -2489,22 +2056,10 @@ public virtual Response GetStructDefByName(string name, RequestOptions options = } } - private HttpMessage CreateGetStructDefByNameRequest(string name) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/types/structdef/name/", false); - uri.AppendPath(name, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Get the type definition for the given GUID. + /// The globally unique identifier of the type. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -2621,34 +2176,16 @@ private HttpMessage CreateGetStructDefByNameRequest(string name) /// /// /// - /// The globally unique identifier of the type. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetTypeDefinitionByGuidAsync(string guid, RequestOptions options = null) + public virtual async Task GetTypeDefinitionByGuidAsync(string guid, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetTypeDefinitionByGuidRequest(guid); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.GetTypeDefinitionByGuid"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetTypeDefinitionByGuidRequest(guid); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -2658,6 +2195,9 @@ public virtual async Task GetTypeDefinitionByGuidAsync(string guid, Re } /// Get the type definition for the given GUID. + /// The globally unique identifier of the type. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -2774,34 +2314,16 @@ public virtual async Task GetTypeDefinitionByGuidAsync(string guid, Re /// /// /// - /// The globally unique identifier of the type. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetTypeDefinitionByGuid(string guid, RequestOptions options = null) + public virtual Response GetTypeDefinitionByGuid(string guid, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetTypeDefinitionByGuidRequest(guid); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.GetTypeDefinitionByGuid"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetTypeDefinitionByGuidRequest(guid); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -2810,22 +2332,10 @@ public virtual Response GetTypeDefinitionByGuid(string guid, RequestOptions opti } } - private HttpMessage CreateGetTypeDefinitionByGuidRequest(string guid) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/types/typedef/guid/", false); - uri.AppendPath(guid, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Get the type definition by its name (unique). + /// The name of the type. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -2942,34 +2452,16 @@ private HttpMessage CreateGetTypeDefinitionByGuidRequest(string guid) /// /// /// - /// The name of the type. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetTypeDefinitionByNameAsync(string name, RequestOptions options = null) + public virtual async Task GetTypeDefinitionByNameAsync(string name, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetTypeDefinitionByNameRequest(name); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.GetTypeDefinitionByName"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetTypeDefinitionByNameRequest(name); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -2979,6 +2471,9 @@ public virtual async Task GetTypeDefinitionByNameAsync(string name, Re } /// Get the type definition by its name (unique). + /// The name of the type. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -3095,34 +2590,16 @@ public virtual async Task GetTypeDefinitionByNameAsync(string name, Re /// /// /// - /// The name of the type. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetTypeDefinitionByName(string name, RequestOptions options = null) + public virtual Response GetTypeDefinitionByName(string name, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetTypeDefinitionByNameRequest(name); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.GetTypeDefinitionByName"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetTypeDefinitionByNameRequest(name); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -3131,50 +2608,20 @@ public virtual Response GetTypeDefinitionByName(string name, RequestOptions opti } } - private HttpMessage CreateGetTypeDefinitionByNameRequest(string name) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/types/typedef/name/", false); - uri.AppendPath(name, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Delete API for type identified by its name. /// The name of the type. /// The request options. + /// is null. #pragma warning disable AZC0002 public virtual async Task DeleteTypeByNameAsync(string name, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteTypeByNameRequest(name); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.DeleteTypeByName"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteTypeByNameRequest(name); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -3186,32 +2633,17 @@ public virtual async Task DeleteTypeByNameAsync(string name, RequestOp /// Delete API for type identified by its name. /// The name of the type. /// The request options. + /// is null. #pragma warning disable AZC0002 public virtual Response DeleteTypeByName(string name, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteTypeByNameRequest(name); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.DeleteTypeByName"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteTypeByNameRequest(name); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -3220,21 +2652,13 @@ public virtual Response DeleteTypeByName(string name, RequestOptions options = n } } - private HttpMessage CreateDeleteTypeByNameRequest(string name) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/types/typedef/name/", false); - uri.AppendPath(name, true); - request.Uri = uri; - return message; - } - /// Get all type definitions in Atlas in bulk. + /// The request options. + /// + /// Whether include termtemplatedef when return all typedefs. + /// This is always true when search filter type=term_template + /// + /// Typedef name as search filter when get typedefs. Allowed values: "enum" | "entity" | "classification" | "relationship" | "struct" | "term_template". /// /// Schema for Response Body: /// { @@ -3451,38 +2875,16 @@ private HttpMessage CreateDeleteTypeByNameRequest(string name) /// /// /// - /// - /// Whether include termtemplatedef when return all typedefs. - /// This is always true when search filter type=term_template - /// - /// Typedef name as search filter when get typedefs. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetAllTypeDefinitionsAsync(bool? includeTermTemplate = null, string type = null, RequestOptions options = null) + public virtual async Task GetAllTypeDefinitionsAsync(RequestOptions options, bool? includeTermTemplate = null, string type = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetAllTypeDefinitionsRequest(includeTermTemplate, type); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.GetAllTypeDefinitions"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetAllTypeDefinitionsRequest(includeTermTemplate, type); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -3492,6 +2894,12 @@ public virtual async Task GetAllTypeDefinitionsAsync(bool? includeTerm } /// Get all type definitions in Atlas in bulk. + /// The request options. + /// + /// Whether include termtemplatedef when return all typedefs. + /// This is always true when search filter type=term_template + /// + /// Typedef name as search filter when get typedefs. Allowed values: "enum" | "entity" | "classification" | "relationship" | "struct" | "term_template". /// /// Schema for Response Body: /// { @@ -3708,38 +3116,16 @@ public virtual async Task GetAllTypeDefinitionsAsync(bool? includeTerm /// /// /// - /// - /// Whether include termtemplatedef when return all typedefs. - /// This is always true when search filter type=term_template - /// - /// Typedef name as search filter when get typedefs. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetAllTypeDefinitions(bool? includeTermTemplate = null, string type = null, RequestOptions options = null) + public virtual Response GetAllTypeDefinitions(RequestOptions options, bool? includeTermTemplate = null, string type = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetAllTypeDefinitionsRequest(includeTermTemplate, type); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.GetAllTypeDefinitions"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetAllTypeDefinitionsRequest(includeTermTemplate, type); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -3748,32 +3134,13 @@ public virtual Response GetAllTypeDefinitions(bool? includeTermTemplate = null, } } - private HttpMessage CreateGetAllTypeDefinitionsRequest(bool? includeTermTemplate, string type) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/types/typedefs", false); - if (includeTermTemplate != null) - { - uri.AppendQuery("includeTermTemplate", includeTermTemplate.Value, true); - } - if (type != null) - { - uri.AppendQuery("type", type, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// /// Create all atlas type definitions in bulk, only new definitions will be created. /// Any changes to the existing definitions will be discarded. /// + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -3988,7 +3355,6 @@ private HttpMessage CreateGetAllTypeDefinitionsRequest(bool? includeTermTemplate /// ] /// } /// - /// /// Schema for Response Body: /// { /// classificationDefs: [ @@ -4204,34 +3570,16 @@ private HttpMessage CreateGetAllTypeDefinitionsRequest(bool? includeTermTemplate /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task CreateTypeDefinitionsAsync(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateTypeDefinitionsRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.CreateTypeDefinitions"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateTypeDefinitionsRequest(content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -4244,6 +3592,9 @@ public virtual async Task CreateTypeDefinitionsAsync(RequestContent co /// Create all atlas type definitions in bulk, only new definitions will be created. /// Any changes to the existing definitions will be discarded. /// + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -4458,7 +3809,6 @@ public virtual async Task CreateTypeDefinitionsAsync(RequestContent co /// ] /// } /// - /// /// Schema for Response Body: /// { /// classificationDefs: [ @@ -4674,34 +4024,16 @@ public virtual async Task CreateTypeDefinitionsAsync(RequestContent co /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response CreateTypeDefinitions(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateTypeDefinitionsRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.CreateTypeDefinitions"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateTypeDefinitionsRequest(content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -4710,23 +4042,10 @@ public virtual Response CreateTypeDefinitions(RequestContent content, RequestOpt } } - private HttpMessage CreateCreateTypeDefinitionsRequest(RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/types/typedefs", false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - /// Update all types in bulk, changes detected in the type definitions would be persisted. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -4941,7 +4260,6 @@ private HttpMessage CreateCreateTypeDefinitionsRequest(RequestContent content) /// ] /// } /// - /// /// Schema for Response Body: /// { /// classificationDefs: [ @@ -5157,34 +4475,16 @@ private HttpMessage CreateCreateTypeDefinitionsRequest(RequestContent content) /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task UpdateAtlasTypeDefinitionsAsync(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateUpdateAtlasTypeDefinitionsRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.UpdateAtlasTypeDefinitions"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateUpdateAtlasTypeDefinitionsRequest(content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -5194,6 +4494,9 @@ public virtual async Task UpdateAtlasTypeDefinitionsAsync(RequestConte } /// Update all types in bulk, changes detected in the type definitions would be persisted. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -5408,7 +4711,6 @@ public virtual async Task UpdateAtlasTypeDefinitionsAsync(RequestConte /// ] /// } /// - /// /// Schema for Response Body: /// { /// classificationDefs: [ @@ -5624,34 +4926,16 @@ public virtual async Task UpdateAtlasTypeDefinitionsAsync(RequestConte /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response UpdateAtlasTypeDefinitions(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateUpdateAtlasTypeDefinitionsRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.UpdateAtlasTypeDefinitions"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateUpdateAtlasTypeDefinitionsRequest(content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -5660,23 +4944,10 @@ public virtual Response UpdateAtlasTypeDefinitions(RequestContent content, Reque } } - private HttpMessage CreateUpdateAtlasTypeDefinitionsRequest(RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/types/typedefs", false); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - /// Delete API for all types in bulk. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -5893,34 +5164,16 @@ private HttpMessage CreateUpdateAtlasTypeDefinitionsRequest(RequestContent conte /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task DeleteTypeDefinitionsAsync(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteTypeDefinitionsRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.DeleteTypeDefinitions"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteTypeDefinitionsRequest(content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -5930,6 +5183,9 @@ public virtual async Task DeleteTypeDefinitionsAsync(RequestContent co } /// Delete API for all types in bulk. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -6146,34 +5402,16 @@ public virtual async Task DeleteTypeDefinitionsAsync(RequestContent co /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response DeleteTypeDefinitions(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteTypeDefinitionsRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.DeleteTypeDefinitions"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteTypeDefinitionsRequest(content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -6182,22 +5420,13 @@ public virtual Response DeleteTypeDefinitions(RequestContent content, RequestOpt } } - private HttpMessage CreateDeleteTypeDefinitionsRequest(RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/types/typedefs", false); - request.Uri = uri; - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - /// List all type definitions returned as a list of minimal information header. + /// The request options. + /// + /// Whether include termtemplatedef when return all typedefs. + /// This is always true when search filter type=term_template + /// + /// Typedef name as search filter when get typedefs. Allowed values: "enum" | "entity" | "classification" | "relationship" | "struct" | "term_template". /// /// Schema for Response Body: /// { @@ -6208,38 +5437,16 @@ private HttpMessage CreateDeleteTypeDefinitionsRequest(RequestContent content) /// /// /// - /// - /// Whether include termtemplatedef when return all typedefs. - /// This is always true when search filter type=term_template - /// - /// Typedef name as search filter when get typedefs. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetTypeDefinitionHeadersAsync(bool? includeTermTemplate = null, string type = null, RequestOptions options = null) + public virtual async Task GetTypeDefinitionHeadersAsync(RequestOptions options, bool? includeTermTemplate = null, string type = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetTypeDefinitionHeadersRequest(includeTermTemplate, type); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.GetTypeDefinitionHeaders"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetTypeDefinitionHeadersRequest(includeTermTemplate, type); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -6249,6 +5456,12 @@ public virtual async Task GetTypeDefinitionHeadersAsync(bool? includeT } /// List all type definitions returned as a list of minimal information header. + /// The request options. + /// + /// Whether include termtemplatedef when return all typedefs. + /// This is always true when search filter type=term_template + /// + /// Typedef name as search filter when get typedefs. Allowed values: "enum" | "entity" | "classification" | "relationship" | "struct" | "term_template". /// /// Schema for Response Body: /// { @@ -6259,38 +5472,16 @@ public virtual async Task GetTypeDefinitionHeadersAsync(bool? includeT /// /// /// - /// - /// Whether include termtemplatedef when return all typedefs. - /// This is always true when search filter type=term_template - /// - /// Typedef name as search filter when get typedefs. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetTypeDefinitionHeaders(bool? includeTermTemplate = null, string type = null, RequestOptions options = null) + public virtual Response GetTypeDefinitionHeaders(RequestOptions options, bool? includeTermTemplate = null, string type = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetTypeDefinitionHeadersRequest(includeTermTemplate, type); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.GetTypeDefinitionHeaders"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetTypeDefinitionHeadersRequest(includeTermTemplate, type); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -6299,29 +5490,10 @@ public virtual Response GetTypeDefinitionHeaders(bool? includeTermTemplate = nul } } - private HttpMessage CreateGetTypeDefinitionHeadersRequest(bool? includeTermTemplate, string type) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/atlas/v2/types/typedefs/headers", false); - if (includeTermTemplate != null) - { - uri.AppendQuery("includeTermTemplate", includeTermTemplate.Value, true); - } - if (type != null) - { - uri.AppendQuery("type", type, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Get the term template definition for the given GUID. + /// The globally unique identifier of the term template. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -6397,34 +5569,16 @@ private HttpMessage CreateGetTypeDefinitionHeadersRequest(bool? includeTermTempl /// /// /// - /// The globally unique identifier of the term template. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetTermTemplateDefByGuidAsync(string guid, RequestOptions options = null) + public virtual async Task GetTermTemplateDefByGuidAsync(string guid, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetTermTemplateDefByGuidRequest(guid); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.GetTermTemplateDefByGuid"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetTermTemplateDefByGuidRequest(guid); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -6434,6 +5588,9 @@ public virtual async Task GetTermTemplateDefByGuidAsync(string guid, R } /// Get the term template definition for the given GUID. + /// The globally unique identifier of the term template. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -6509,34 +5666,16 @@ public virtual async Task GetTermTemplateDefByGuidAsync(string guid, R /// /// /// - /// The globally unique identifier of the term template. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetTermTemplateDefByGuid(string guid, RequestOptions options = null) + public virtual Response GetTermTemplateDefByGuid(string guid, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetTermTemplateDefByGuidRequest(guid); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.GetTermTemplateDefByGuid"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetTermTemplateDefByGuidRequest(guid); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -6545,23 +5684,10 @@ public virtual Response GetTermTemplateDefByGuid(string guid, RequestOptions opt } } - private HttpMessage CreateGetTermTemplateDefByGuidRequest(string guid) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendRaw("/api", false); - uri.AppendPath("/types/termtemplatedef/guid/", false); - uri.AppendPath(guid, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Get the term template definition by its name (unique). + /// The name of the term template. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -6637,34 +5763,16 @@ private HttpMessage CreateGetTermTemplateDefByGuidRequest(string guid) /// /// /// - /// The name of the term template. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetTermTemplateDefByNameAsync(string name, RequestOptions options = null) + public virtual async Task GetTermTemplateDefByNameAsync(string name, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetTermTemplateDefByNameRequest(name); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.GetTermTemplateDefByName"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetTermTemplateDefByNameRequest(name); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -6674,6 +5782,9 @@ public virtual async Task GetTermTemplateDefByNameAsync(string name, R } /// Get the term template definition by its name (unique). + /// The name of the term template. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -6749,34 +5860,16 @@ public virtual async Task GetTermTemplateDefByNameAsync(string name, R /// /// /// - /// The name of the term template. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetTermTemplateDefByName(string name, RequestOptions options = null) + public virtual Response GetTermTemplateDefByName(string name, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetTermTemplateDefByNameRequest(name); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewTypes.GetTermTemplateDefByName"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetTermTemplateDefByNameRequest(name); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -6785,20 +5878,368 @@ public virtual Response GetTermTemplateDefByName(string name, RequestOptions opt } } - private HttpMessage CreateGetTermTemplateDefByNameRequest(string name) + internal HttpMessage CreateGetClassificationDefByGuidRequest(string guid) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/types/classificationdef/guid/", false); + uri.AppendPath(guid, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetClassificationDefByNameRequest(string name) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/types/classificationdef/name/", false); + uri.AppendPath(name, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetEntityDefinitionByGuidRequest(string guid) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/types/entitydef/guid/", false); + uri.AppendPath(guid, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetEntityDefinitionByNameRequest(string name) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/types/entitydef/name/", false); + uri.AppendPath(name, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetEnumDefByGuidRequest(string guid) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/types/enumdef/guid/", false); + uri.AppendPath(guid, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetEnumDefByNameRequest(string name) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/types/enumdef/name/", false); + uri.AppendPath(name, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetRelationshipDefByGuidRequest(string guid) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/types/relationshipdef/guid/", false); + uri.AppendPath(guid, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetRelationshipDefByNameRequest(string name) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/types/relationshipdef/name/", false); + uri.AppendPath(name, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetStructDefByGuidRequest(string guid) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/types/structdef/guid/", false); + uri.AppendPath(guid, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetStructDefByNameRequest(string name) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/types/structdef/name/", false); + uri.AppendPath(name, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetTypeDefinitionByGuidRequest(string guid) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/types/typedef/guid/", false); + uri.AppendPath(guid, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetTypeDefinitionByNameRequest(string name) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/types/typedef/name/", false); + uri.AppendPath(name, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateDeleteTypeByNameRequest(string name) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/types/typedef/name/", false); + uri.AppendPath(name, true); + request.Uri = uri; + message.ResponseClassifier = ResponseClassifier204.Instance; + return message; + } + + internal HttpMessage CreateGetAllTypeDefinitionsRequest(bool? includeTermTemplate, string type) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/types/typedefs", false); + if (includeTermTemplate != null) + { + uri.AppendQuery("includeTermTemplate", includeTermTemplate.Value, true); + } + if (type != null) + { + uri.AppendQuery("type", type, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateTypeDefinitionsRequest(RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/types/typedefs", false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateUpdateAtlasTypeDefinitionsRequest(RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/types/typedefs", false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateDeleteTypeDefinitionsRequest(RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/types/typedefs", false); + request.Uri = uri; + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier204.Instance; + return message; + } + + internal HttpMessage CreateGetTypeDefinitionHeadersRequest(bool? includeTermTemplate, string type) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/atlas/v2/types/typedefs/headers", false); + if (includeTermTemplate != null) + { + uri.AppendQuery("includeTermTemplate", includeTermTemplate.Value, true); + } + if (type != null) + { + uri.AppendQuery("type", type, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetTermTemplateDefByGuidRequest(string guid) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRaw("/api", false); + uri.AppendPath("/types/termtemplatedef/guid/", false); + uri.AppendPath(guid, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetTermTemplateDefByNameRequest(string name) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); uri.AppendRaw("/api", false); uri.AppendPath("/types/termtemplatedef/name/", false); uri.AppendPath(name, true); - uri.AppendQuery("api-version", apiVersion, true); + uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; return message; } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier204 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier204(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 204 => false, + _ => true + }; + } + } } } diff --git a/sdk/purview/Azure.Analytics.Purview.Scanning/api/Azure.Analytics.Purview.Scanning.netstandard2.0.cs b/sdk/purview/Azure.Analytics.Purview.Scanning/api/Azure.Analytics.Purview.Scanning.netstandard2.0.cs index 02fd894251721..ede63547f10ce 100644 --- a/sdk/purview/Azure.Analytics.Purview.Scanning/api/Azure.Analytics.Purview.Scanning.netstandard2.0.cs +++ b/sdk/purview/Azure.Analytics.Purview.Scanning/api/Azure.Analytics.Purview.Scanning.netstandard2.0.cs @@ -9,12 +9,12 @@ public PurviewClassificationRuleClient(System.Uri endpoint, string classificatio public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual Azure.Response Delete(Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task DeleteAsync(Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetProperties(Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetPropertiesAsync(Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetVersions(Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetVersionsAsync(Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response TagVersion(int classificationRuleVersion, string action, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task TagVersionAsync(int classificationRuleVersion, string action, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response GetProperties(Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetPropertiesAsync(Azure.RequestOptions options) { throw null; } + public virtual Azure.Pageable GetVersions(Azure.RequestOptions options) { throw null; } + public virtual Azure.AsyncPageable GetVersionsAsync(Azure.RequestOptions options) { throw null; } + public virtual Azure.Response TagVersion(int classificationRuleVersion, string action, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task TagVersionAsync(int classificationRuleVersion, string action, Azure.RequestOptions options) { throw null; } } public partial class PurviewDataSourceClient { @@ -25,21 +25,21 @@ public PurviewDataSourceClient(System.Uri endpoint, string dataSourceName, Azure public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual Azure.Response Delete(Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task DeleteAsync(Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetChildren(Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetChildrenAsync(Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetProperties(Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetPropertiesAsync(Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Pageable GetChildren(Azure.RequestOptions options) { throw null; } + public virtual Azure.AsyncPageable GetChildrenAsync(Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetProperties(Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetPropertiesAsync(Azure.RequestOptions options) { throw null; } public Azure.Analytics.Purview.Scanning.PurviewScanClient GetScanClient(string scanName) { throw null; } - public virtual Azure.Response GetScans(Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetScansAsync(Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Pageable GetScans(Azure.RequestOptions options) { throw null; } + public virtual Azure.AsyncPageable GetScansAsync(Azure.RequestOptions options) { throw null; } } public partial class PurviewScanClient { protected PurviewScanClient() { } public PurviewScanClient(System.Uri endpoint, string dataSourceName, string scanName, Azure.Core.TokenCredential credential, Azure.Analytics.Purview.Scanning.PurviewScanningServiceClientOptions options = null) { } public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } - public virtual Azure.Response CancelScan(string runId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task CancelScanAsync(string runId, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response CancelScan(string runId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task CancelScanAsync(string runId, Azure.RequestOptions options) { throw null; } public virtual Azure.Response CreateOrUpdate(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task CreateOrUpdateAsync(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual Azure.Response CreateOrUpdateFilter(Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } @@ -50,16 +50,16 @@ public PurviewScanClient(System.Uri endpoint, string dataSourceName, string scan public virtual System.Threading.Tasks.Task DeleteAsync(Azure.RequestOptions options = null) { throw null; } public virtual Azure.Response DeleteTrigger(Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task DeleteTriggerAsync(Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetFilter(Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetFilterAsync(Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetProperties(Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetPropertiesAsync(Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetRuns(Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetRunsAsync(Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetTrigger(Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetTriggerAsync(Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response RunScan(string runId, string scanLevel = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task RunScanAsync(string runId, string scanLevel = null, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response GetFilter(Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetFilterAsync(Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetProperties(Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetPropertiesAsync(Azure.RequestOptions options) { throw null; } + public virtual Azure.Pageable GetRuns(Azure.RequestOptions options) { throw null; } + public virtual Azure.AsyncPageable GetRunsAsync(Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetTrigger(Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetTriggerAsync(Azure.RequestOptions options) { throw null; } + public virtual Azure.Response RunScan(string runId, Azure.RequestOptions options, string scanLevel = null) { throw null; } + public virtual System.Threading.Tasks.Task RunScanAsync(string runId, Azure.RequestOptions options, string scanLevel = null) { throw null; } } public partial class PurviewScanningServiceClient { @@ -75,31 +75,31 @@ public PurviewScanningServiceClient(System.Uri endpoint, Azure.Core.TokenCredent public virtual Azure.Response DeleteScanRuleset(string scanRulesetName, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task DeleteScanRulesetAsync(string scanRulesetName, Azure.RequestOptions options = null) { throw null; } public Azure.Analytics.Purview.Scanning.PurviewClassificationRuleClient GetClassificationRuleClient(string classificationRuleName) { throw null; } - public virtual Azure.Response GetClassificationRules(Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetClassificationRulesAsync(Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Pageable GetClassificationRules(Azure.RequestOptions options) { throw null; } + public virtual Azure.AsyncPageable GetClassificationRulesAsync(Azure.RequestOptions options) { throw null; } public Azure.Analytics.Purview.Scanning.PurviewDataSourceClient GetDataSourceClient(string dataSourceName) { throw null; } - public virtual Azure.Response GetDataSources(Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetDataSourcesAsync(Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetKeyVaultReference(string azureKeyVaultName, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetKeyVaultReferenceAsync(string azureKeyVaultName, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetKeyVaultReferences(Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetKeyVaultReferencesAsync(Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetLatestSystemRulestes(string dataSourceType = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetLatestSystemRulestesAsync(string dataSourceType = null, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetScanRuleset(string scanRulesetName, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetScanRulesetAsync(string scanRulesetName, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetScanRulesets(Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetScanRulesetsAsync(Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetSystemRulesets(Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetSystemRulesetsAsync(Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetSystemRulesetsForDataSource(string dataSourceType, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetSystemRulesetsForDataSourceAsync(string dataSourceType, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetSystemRulesetsForVersion(int version, string dataSourceType = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetSystemRulesetsForVersionAsync(int version, string dataSourceType = null, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetSystemRulesetsVersions(string dataSourceType = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetSystemRulesetsVersionsAsync(string dataSourceType = null, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetUnparentedDataSources(Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetUnparentedDataSourcesAsync(Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Pageable GetDataSources(Azure.RequestOptions options) { throw null; } + public virtual Azure.AsyncPageable GetDataSourcesAsync(Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetKeyVaultReference(string azureKeyVaultName, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetKeyVaultReferenceAsync(string azureKeyVaultName, Azure.RequestOptions options) { throw null; } + public virtual Azure.Pageable GetKeyVaultReferences(Azure.RequestOptions options) { throw null; } + public virtual Azure.AsyncPageable GetKeyVaultReferencesAsync(Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetLatestSystemRulestes(Azure.RequestOptions options, string dataSourceType = null) { throw null; } + public virtual System.Threading.Tasks.Task GetLatestSystemRulestesAsync(Azure.RequestOptions options, string dataSourceType = null) { throw null; } + public virtual Azure.Response GetScanRuleset(string scanRulesetName, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetScanRulesetAsync(string scanRulesetName, Azure.RequestOptions options) { throw null; } + public virtual Azure.Pageable GetScanRulesets(Azure.RequestOptions options) { throw null; } + public virtual Azure.AsyncPageable GetScanRulesetsAsync(Azure.RequestOptions options) { throw null; } + public virtual Azure.Pageable GetSystemRulesets(Azure.RequestOptions options) { throw null; } + public virtual Azure.AsyncPageable GetSystemRulesetsAsync(Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetSystemRulesetsForDataSource(string dataSourceType, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetSystemRulesetsForDataSourceAsync(string dataSourceType, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response GetSystemRulesetsForVersion(int version, Azure.RequestOptions options, string dataSourceType = null) { throw null; } + public virtual System.Threading.Tasks.Task GetSystemRulesetsForVersionAsync(int version, Azure.RequestOptions options, string dataSourceType = null) { throw null; } + public virtual Azure.Pageable GetSystemRulesetsVersions(Azure.RequestOptions options, string dataSourceType = null) { throw null; } + public virtual Azure.AsyncPageable GetSystemRulesetsVersionsAsync(Azure.RequestOptions options, string dataSourceType = null) { throw null; } + public virtual Azure.Pageable GetUnparentedDataSources(Azure.RequestOptions options) { throw null; } + public virtual Azure.AsyncPageable GetUnparentedDataSourcesAsync(Azure.RequestOptions options) { throw null; } } public partial class PurviewScanningServiceClientOptions : Azure.Core.ClientOptions { diff --git a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Azure.Analytics.Purview.Scanning.csproj b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Azure.Analytics.Purview.Scanning.csproj index a02cff915b4b6..da2c863c1c239 100644 --- a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Azure.Analytics.Purview.Scanning.csproj +++ b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Azure.Analytics.Purview.Scanning.csproj @@ -6,6 +6,7 @@ Azure Purview $(RequiredTargetFrameworks) $(NoWarn);AZC0001;CS0169 + $(DefineConstants);EXPERIMENTAL diff --git a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Customizations/PurviewClassificationRuleClient.cs b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Customizations/PurviewClassificationRuleClient.cs index 0304298b7797d..21a6425e614b2 100644 --- a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Customizations/PurviewClassificationRuleClient.cs +++ b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Customizations/PurviewClassificationRuleClient.cs @@ -9,10 +9,10 @@ namespace Azure.Analytics.Purview.Scanning public partial class PurviewClassificationRuleClient { internal PurviewClassificationRuleClient(Uri endpoint, string classificationRuleName, HttpPipeline pipeline, string apiVersion) { - this.endpoint = endpoint; - this._pipeline = pipeline; - this.classificationRuleName = classificationRuleName; - this.apiVersion = apiVersion; + _endpoint = endpoint; + _pipeline = pipeline; + _classificationRuleName = classificationRuleName; + _apiVersion = apiVersion; } } } diff --git a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Customizations/PurviewDataSourceClient.cs b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Customizations/PurviewDataSourceClient.cs index 148a1b6718c92..babf01a5d11bc 100644 --- a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Customizations/PurviewDataSourceClient.cs +++ b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Customizations/PurviewDataSourceClient.cs @@ -9,13 +9,13 @@ namespace Azure.Analytics.Purview.Scanning public partial class PurviewDataSourceClient { internal PurviewDataSourceClient(Uri endpoint, string dataSourceName, HttpPipeline pipeline, string apiVersion) { - this.endpoint = endpoint; - this.dataSourceName= dataSourceName; - this._pipeline = pipeline; - this.apiVersion = apiVersion; + _endpoint = endpoint; + _dataSourceName= dataSourceName; + _pipeline = pipeline; + _apiVersion = apiVersion; } /// - public PurviewScanClient GetScanClient(string scanName) => new PurviewScanClient(endpoint, dataSourceName, scanName, Pipeline, apiVersion); + public PurviewScanClient GetScanClient(string scanName) => new PurviewScanClient(_endpoint, _dataSourceName, scanName, Pipeline, _apiVersion); } } diff --git a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Customizations/PurviewScanClient.cs b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Customizations/PurviewScanClient.cs index 8debf5e8197e1..3437d8d7ff5c1 100644 --- a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Customizations/PurviewScanClient.cs +++ b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Customizations/PurviewScanClient.cs @@ -9,11 +9,11 @@ namespace Azure.Analytics.Purview.Scanning public partial class PurviewScanClient { internal PurviewScanClient(Uri endpoint, string dataSourceName, string scanName, HttpPipeline pipeline, string apiVersion) { - this.endpoint = endpoint; - this.dataSourceName= dataSourceName; - this.scanName = scanName; - this._pipeline = pipeline; - this.apiVersion = apiVersion; + _endpoint = endpoint; + _dataSourceName= dataSourceName; + _scanName = scanName; + _pipeline = pipeline; + _apiVersion = apiVersion; } } } diff --git a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Customizations/PurviewScanningClient.cs b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Customizations/PurviewScanningClient.cs index dd712080bdac3..887129148529b 100644 --- a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Customizations/PurviewScanningClient.cs +++ b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Customizations/PurviewScanningClient.cs @@ -6,9 +6,9 @@ namespace Azure.Analytics.Purview.Scanning public partial class PurviewScanningServiceClient { /// - public PurviewDataSourceClient GetDataSourceClient(string dataSourceName) => new PurviewDataSourceClient(endpoint, dataSourceName, Pipeline, apiVersion); + public PurviewDataSourceClient GetDataSourceClient(string dataSourceName) => new PurviewDataSourceClient(_endpoint, dataSourceName, Pipeline, _apiVersion); /// - public PurviewClassificationRuleClient GetClassificationRuleClient(string classificationRuleName) => new PurviewClassificationRuleClient(endpoint, classificationRuleName, Pipeline, apiVersion); + public PurviewClassificationRuleClient GetClassificationRuleClient(string classificationRuleName) => new PurviewClassificationRuleClient(_endpoint, classificationRuleName, Pipeline, _apiVersion); } } diff --git a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewClassificationRuleClient.cs b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewClassificationRuleClient.cs index d9b9a987b644b..ef9aa492b87e8 100644 --- a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewClassificationRuleClient.cs +++ b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewClassificationRuleClient.cs @@ -6,6 +6,9 @@ #nullable disable using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; @@ -16,15 +19,17 @@ namespace Azure.Analytics.Purview.Scanning /// The PurviewClassificationRule service client. public partial class PurviewClassificationRuleClient { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private string classificationRuleName; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _classificationRuleName; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of PurviewClassificationRuleClient for mocking. protected PurviewClassificationRuleClient() @@ -36,6 +41,7 @@ protected PurviewClassificationRuleClient() /// The String to use. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. + /// , , or is null. public PurviewClassificationRuleClient(Uri endpoint, string classificationRuleName, TokenCredential credential, PurviewScanningServiceClientOptions options = null) { if (endpoint == null) @@ -52,16 +58,17 @@ public PurviewClassificationRuleClient(Uri endpoint, string classificationRuleNa } options ??= new PurviewScanningServiceClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); _tokenCredential = credential; - var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); - _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { authPolicy }, new ResponseClassifier()); - this.endpoint = endpoint; - this.classificationRuleName = classificationRuleName; - apiVersion = options.Version; + _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _classificationRuleName = classificationRuleName; + _apiVersion = options.Version; } /// Get a classification rule. + /// The request options. /// /// Schema for Response Body: /// { @@ -70,7 +77,6 @@ public PurviewClassificationRuleClient(Uri endpoint, string classificationRuleNa /// kind: "System" | "Custom" /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -90,33 +96,16 @@ public PurviewClassificationRuleClient(Uri endpoint, string classificationRuleNa /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetPropertiesAsync(RequestOptions options = null) + public virtual async Task GetPropertiesAsync(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetPropertiesRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewClassificationRuleClient.GetProperties"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetPropertiesRequest(); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -126,6 +115,7 @@ public virtual async Task GetPropertiesAsync(RequestOptions options = } /// Get a classification rule. + /// The request options. /// /// Schema for Response Body: /// { @@ -134,7 +124,6 @@ public virtual async Task GetPropertiesAsync(RequestOptions options = /// kind: "System" | "Custom" /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -154,33 +143,16 @@ public virtual async Task GetPropertiesAsync(RequestOptions options = /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetProperties(RequestOptions options = null) + public virtual Response GetProperties(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetPropertiesRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewClassificationRuleClient.GetProperties"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetPropertiesRequest(); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -189,22 +161,9 @@ public virtual Response GetProperties(RequestOptions options = null) } } - private HttpMessage CreateGetPropertiesRequest() - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/classificationrules/", false); - uri.AppendPath(classificationRuleName, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Creates or Updates a classification rule. + /// The content to send as the body of the request. + /// The request options. /// /// Schema for Request Body: /// { @@ -213,7 +172,6 @@ private HttpMessage CreateGetPropertiesRequest() /// kind: "System" | "Custom" (required) /// } /// - /// /// Schema for Response Body: /// { /// id: string, @@ -221,7 +179,6 @@ private HttpMessage CreateGetPropertiesRequest() /// kind: "System" | "Custom" /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -241,35 +198,16 @@ private HttpMessage CreateGetPropertiesRequest() /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task CreateOrUpdateAsync(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewClassificationRuleClient.CreateOrUpdate"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -279,6 +217,8 @@ public virtual async Task CreateOrUpdateAsync(RequestContent content, } /// Creates or Updates a classification rule. + /// The content to send as the body of the request. + /// The request options. /// /// Schema for Request Body: /// { @@ -287,7 +227,6 @@ public virtual async Task CreateOrUpdateAsync(RequestContent content, /// kind: "System" | "Custom" (required) /// } /// - /// /// Schema for Response Body: /// { /// id: string, @@ -295,7 +234,6 @@ public virtual async Task CreateOrUpdateAsync(RequestContent content, /// kind: "System" | "Custom" /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -315,35 +253,16 @@ public virtual async Task CreateOrUpdateAsync(RequestContent content, /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response CreateOrUpdate(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewClassificationRuleClient.CreateOrUpdate"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -352,24 +271,8 @@ public virtual Response CreateOrUpdate(RequestContent content, RequestOptions op } } - private HttpMessage CreateCreateOrUpdateRequest(RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/classificationrules/", false); - uri.AppendPath(classificationRuleName, 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; - } - /// Deletes a classification rule. + /// The request options. /// /// Schema for Response Body: /// { @@ -378,7 +281,6 @@ private HttpMessage CreateCreateOrUpdateRequest(RequestContent content) /// kind: "System" | "Custom" /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -398,35 +300,16 @@ private HttpMessage CreateCreateOrUpdateRequest(RequestContent content) /// /// /// - /// The request options. #pragma warning disable AZC0002 public virtual async Task DeleteAsync(RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewClassificationRuleClient.Delete"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -436,6 +319,7 @@ public virtual async Task DeleteAsync(RequestOptions options = null) } /// Deletes a classification rule. + /// The request options. /// /// Schema for Response Body: /// { @@ -444,7 +328,6 @@ public virtual async Task DeleteAsync(RequestOptions options = null) /// kind: "System" | "Custom" /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -464,35 +347,16 @@ public virtual async Task DeleteAsync(RequestOptions options = null) /// /// /// - /// The request options. #pragma warning disable AZC0002 public virtual Response Delete(RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewClassificationRuleClient.Delete"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -501,39 +365,18 @@ public virtual Response Delete(RequestOptions options = null) } } - private HttpMessage CreateDeleteRequest() - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/classificationrules/", false); - uri.AppendPath(classificationRuleName, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the rule versions of a classification rule. + /// Sets Classification Action on a specific classification rule version. + /// The Integer to use. + /// The ClassificationAction to use. Allowed values: "Keep" | "Delete". + /// The request options. + /// is null. /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// id: string, - /// name: string, - /// kind: "System" | "Custom" - /// } - /// ], - /// nextLink: string, - /// count: number - /// } - /// - /// - /// Schema for Response Error: - /// { + /// scanResultId: OperationResponseScanResultId, + /// startTime: string (ISO 8601 Format), + /// endTime: string (ISO 8601 Format), + /// status: "Accepted" | "InProgress" | "TransientFailure" | "Succeeded" | "Failed" | "Canceled", /// error: { /// code: string, /// message: string, @@ -543,65 +386,12 @@ private HttpMessage CreateDeleteRequest() /// code: string, /// message: string, /// target: string, - /// details: [ErrorModel] + /// details: [ErrorInfo] /// } /// ] /// } /// } /// - /// - /// - /// The request options. -#pragma warning disable AZC0002 - public virtual async Task GetVersionsAsync(RequestOptions options = null) -#pragma warning restore AZC0002 - { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetVersionsRequest(); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewClassificationRuleClient.GetVersions"); - scope.Start(); - try - { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Lists the rule versions of a classification rule. - /// - /// Schema for Response Body: - /// { - /// value: [ - /// { - /// id: string, - /// name: string, - /// kind: "System" | "Custom" - /// } - /// ], - /// nextLink: string, - /// count: number - /// } - /// - /// /// Schema for Response Error: /// { /// error: { @@ -621,33 +411,16 @@ public virtual async Task GetVersionsAsync(RequestOptions options = nu /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetVersions(RequestOptions options = null) + public virtual async Task TagVersionAsync(int classificationRuleVersion, string action, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetVersionsRequest(); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewClassificationRuleClient.GetVersions"); + using var scope = _clientDiagnostics.CreateScope("PurviewClassificationRuleClient.TagVersion"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateTagVersionRequest(classificationRuleVersion, action); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -656,23 +429,11 @@ public virtual Response GetVersions(RequestOptions options = null) } } - private HttpMessage CreateGetVersionsRequest() - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/classificationrules/", false); - uri.AppendPath(classificationRuleName, true); - uri.AppendPath("/versions", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Sets Classification Action on a specific classification rule version. + /// The Integer to use. + /// The ClassificationAction to use. Allowed values: "Keep" | "Delete". + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -695,7 +456,6 @@ private HttpMessage CreateGetVersionsRequest() /// } /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -715,35 +475,16 @@ private HttpMessage CreateGetVersionsRequest() /// /// /// - /// The Integer to use. - /// The ClassificationAction to use. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task TagVersionAsync(int classificationRuleVersion, string action, RequestOptions options = null) + public virtual Response TagVersion(int classificationRuleVersion, string action, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateTagVersionRequest(classificationRuleVersion, action); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewClassificationRuleClient.TagVersion"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateTagVersionRequest(classificationRuleVersion, action); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -752,14 +493,24 @@ public virtual async Task TagVersionAsync(int classificationRuleVersio } } - /// Sets Classification Action on a specific classification rule version. + /// Lists the rule versions of a classification rule. + /// The request options. /// /// Schema for Response Body: /// { - /// scanResultId: OperationResponseScanResultId, - /// startTime: string (ISO 8601 Format), - /// endTime: string (ISO 8601 Format), - /// status: "Accepted" | "InProgress" | "TransientFailure" | "Succeeded" | "Failed" | "Canceled", + /// value: [ + /// { + /// id: string, + /// name: string, + /// kind: "System" | "Custom" + /// } + /// ], + /// nextLink: string, + /// count: number + /// } + /// + /// Schema for Response Error: + /// { /// error: { /// code: string, /// message: string, @@ -769,13 +520,49 @@ public virtual async Task TagVersionAsync(int classificationRuleVersio /// code: string, /// message: string, /// target: string, - /// details: [ErrorInfo] + /// details: [ErrorModel] /// } /// ] /// } /// } /// /// + /// +#pragma warning disable AZC0002 + public virtual AsyncPageable GetVersionsAsync(RequestOptions options) +#pragma warning restore AZC0002 + { + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "PurviewClassificationRuleClient.GetVersions"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetVersionsRequest() + : CreateGetVersionsNextPageRequest(nextLink); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + /// Lists the rule versions of a classification rule. + /// The request options. + /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// id: string, + /// name: string, + /// kind: "System" | "Custom" + /// } + /// ], + /// nextLink: string, + /// count: number + /// } + /// /// Schema for Response Error: /// { /// error: { @@ -795,60 +582,179 @@ public virtual async Task TagVersionAsync(int classificationRuleVersio /// /// /// - /// The Integer to use. - /// The ClassificationAction to use. - /// The request options. #pragma warning disable AZC0002 - public virtual Response TagVersion(int classificationRuleVersion, string action, RequestOptions options = null) + public virtual Pageable GetVersions(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateTagVersionRequest(classificationRuleVersion, action); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewClassificationRuleClient.TagVersion"); - scope.Start(); - try + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "PurviewClassificationRuleClient.GetVersions"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else + do { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetVersionsRequest() + : CreateGetVersionsNextPageRequest(nextLink); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - private HttpMessage CreateTagVersionRequest(int classificationRuleVersion, string action) + internal HttpMessage CreateGetPropertiesRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/classificationrules/", false); + uri.AppendPath(_classificationRuleName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateOrUpdateRequest(RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/classificationrules/", false); + uri.AppendPath(_classificationRuleName, 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; + message.ResponseClassifier = ResponseClassifier200201.Instance; + return message; + } + + internal HttpMessage CreateDeleteRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/classificationrules/", false); + uri.AppendPath(_classificationRuleName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200204.Instance; + return message; + } + + internal HttpMessage CreateGetVersionsRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/classificationrules/", false); + uri.AppendPath(_classificationRuleName, true); + uri.AppendPath("/versions", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateTagVersionRequest(int classificationRuleVersion, string action) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); + uri.Reset(_endpoint); uri.AppendPath("/classificationrules/", false); - uri.AppendPath(classificationRuleName, true); + uri.AppendPath(_classificationRuleName, true); uri.AppendPath("/versions/", false); uri.AppendPath(classificationRuleVersion, true); uri.AppendPath("/:tag", false); uri.AppendQuery("action", action, true); - uri.AppendQuery("api-version", apiVersion, true); + uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier202.Instance; return message; } + + internal HttpMessage CreateGetVersionsNextPageRequest(string nextLink) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier200201 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200201(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + 201 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier200204 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200204(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + 204 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier202 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier202(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 202 => false, + _ => true + }; + } + } } } diff --git a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewDataSourceClient.cs b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewDataSourceClient.cs index 93204d2260d09..571c7389bdc25 100644 --- a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewDataSourceClient.cs +++ b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewDataSourceClient.cs @@ -6,6 +6,9 @@ #nullable disable using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; @@ -16,15 +19,17 @@ namespace Azure.Analytics.Purview.Scanning /// The PurviewDataSource service client. public partial class PurviewDataSourceClient { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private string dataSourceName; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _dataSourceName; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of PurviewDataSourceClient for mocking. protected PurviewDataSourceClient() @@ -36,6 +41,7 @@ protected PurviewDataSourceClient() /// The String to use. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. + /// , , or is null. public PurviewDataSourceClient(Uri endpoint, string dataSourceName, TokenCredential credential, PurviewScanningServiceClientOptions options = null) { if (endpoint == null) @@ -52,16 +58,18 @@ public PurviewDataSourceClient(Uri endpoint, string dataSourceName, TokenCredent } options ??= new PurviewScanningServiceClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); _tokenCredential = credential; - var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); - _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { authPolicy }, new ResponseClassifier()); - this.endpoint = endpoint; - this.dataSourceName = dataSourceName; - apiVersion = options.Version; + _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _dataSourceName = dataSourceName; + _apiVersion = options.Version; } /// Creates or Updates a data source. + /// The content to send as the body of the request. + /// The request options. /// /// Schema for Request Body: /// { @@ -119,7 +127,6 @@ public PurviewDataSourceClient(Uri endpoint, string dataSourceName, TokenCredent /// ] /// } /// - /// /// Schema for Response Body: /// { /// id: string, @@ -176,7 +183,6 @@ public PurviewDataSourceClient(Uri endpoint, string dataSourceName, TokenCredent /// ] /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -196,35 +202,16 @@ public PurviewDataSourceClient(Uri endpoint, string dataSourceName, TokenCredent /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task CreateOrUpdateAsync(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewDataSourceClient.CreateOrUpdate"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -234,6 +221,8 @@ public virtual async Task CreateOrUpdateAsync(RequestContent content, } /// Creates or Updates a data source. + /// The content to send as the body of the request. + /// The request options. /// /// Schema for Request Body: /// { @@ -291,7 +280,6 @@ public virtual async Task CreateOrUpdateAsync(RequestContent content, /// ] /// } /// - /// /// Schema for Response Body: /// { /// id: string, @@ -348,7 +336,6 @@ public virtual async Task CreateOrUpdateAsync(RequestContent content, /// ] /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -368,35 +355,16 @@ public virtual async Task CreateOrUpdateAsync(RequestContent content, /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response CreateOrUpdate(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewDataSourceClient.CreateOrUpdate"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -405,24 +373,8 @@ public virtual Response CreateOrUpdate(RequestContent content, RequestOptions op } } - private HttpMessage CreateCreateOrUpdateRequest(RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/datasources/", false); - uri.AppendPath(dataSourceName, 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; - } - /// Get a data source. + /// The request options. /// /// Schema for Response Body: /// { @@ -480,7 +432,6 @@ private HttpMessage CreateCreateOrUpdateRequest(RequestContent content) /// ] /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -500,33 +451,16 @@ private HttpMessage CreateCreateOrUpdateRequest(RequestContent content) /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetPropertiesAsync(RequestOptions options = null) + public virtual async Task GetPropertiesAsync(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetPropertiesRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewDataSourceClient.GetProperties"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetPropertiesRequest(); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -536,6 +470,7 @@ public virtual async Task GetPropertiesAsync(RequestOptions options = } /// Get a data source. + /// The request options. /// /// Schema for Response Body: /// { @@ -593,7 +528,6 @@ public virtual async Task GetPropertiesAsync(RequestOptions options = /// ] /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -613,33 +547,16 @@ public virtual async Task GetPropertiesAsync(RequestOptions options = /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetProperties(RequestOptions options = null) + public virtual Response GetProperties(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetPropertiesRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewDataSourceClient.GetProperties"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetPropertiesRequest(); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -648,22 +565,8 @@ public virtual Response GetProperties(RequestOptions options = null) } } - private HttpMessage CreateGetPropertiesRequest() - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/datasources/", false); - uri.AppendPath(dataSourceName, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Deletes a data source. + /// The request options. /// /// Schema for Response Body: /// { @@ -721,7 +624,6 @@ private HttpMessage CreateGetPropertiesRequest() /// ] /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -741,35 +643,16 @@ private HttpMessage CreateGetPropertiesRequest() /// /// /// - /// The request options. #pragma warning disable AZC0002 public virtual async Task DeleteAsync(RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewDataSourceClient.Delete"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -779,6 +662,7 @@ public virtual async Task DeleteAsync(RequestOptions options = null) } /// Deletes a data source. + /// The request options. /// /// Schema for Response Body: /// { @@ -836,7 +720,6 @@ public virtual async Task DeleteAsync(RequestOptions options = null) /// ] /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -856,35 +739,16 @@ public virtual async Task DeleteAsync(RequestOptions options = null) /// /// /// - /// The request options. #pragma warning disable AZC0002 public virtual Response Delete(RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewDataSourceClient.Delete"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -893,22 +757,8 @@ public virtual Response Delete(RequestOptions options = null) } } - private HttpMessage CreateDeleteRequest() - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/datasources/", false); - uri.AppendPath(dataSourceName, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Lists the children of the collection. + /// The request options. /// /// Schema for Response Body: /// { @@ -972,7 +822,6 @@ private HttpMessage CreateDeleteRequest() /// count: number /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -992,42 +841,27 @@ private HttpMessage CreateDeleteRequest() /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetChildrenAsync(RequestOptions options = null) + public virtual AsyncPageable GetChildrenAsync(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetChildrenRequest(); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewDataSourceClient.GetChildren"); - scope.Start(); - try + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "PurviewDataSourceClient.GetChildren"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else + do { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetChildrenRequest() + : CreateGetChildrenNextPageRequest(nextLink); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } /// Lists the children of the collection. + /// The request options. /// /// Schema for Response Body: /// { @@ -1091,7 +925,6 @@ public virtual async Task GetChildrenAsync(RequestOptions options = nu /// count: number /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1111,58 +944,27 @@ public virtual async Task GetChildrenAsync(RequestOptions options = nu /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetChildren(RequestOptions options = null) + public virtual Pageable GetChildren(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetChildrenRequest(); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewDataSourceClient.GetChildren"); - scope.Start(); - try + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "PurviewDataSourceClient.GetChildren"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else + do { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetChildrenRequest() + : CreateGetChildrenNextPageRequest(nextLink); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - private HttpMessage CreateGetChildrenRequest() - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/datasources/", false); - uri.AppendPath(dataSourceName, true); - uri.AppendPath("/listChildren", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// List scans in data source. + /// The request options. /// /// Schema for Response Body: /// { @@ -1219,7 +1021,6 @@ private HttpMessage CreateGetChildrenRequest() /// count: number /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1239,42 +1040,27 @@ private HttpMessage CreateGetChildrenRequest() /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetScansAsync(RequestOptions options = null) + public virtual AsyncPageable GetScansAsync(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetScansRequest(); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewDataSourceClient.GetScans"); - scope.Start(); - try + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "PurviewDataSourceClient.GetScans"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else + do { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetScansRequest() + : CreateGetScansNextPageRequest(nextLink); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } /// List scans in data source. + /// The request options. /// /// Schema for Response Body: /// { @@ -1331,7 +1117,6 @@ public virtual async Task GetScansAsync(RequestOptions options = null) /// count: number /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1351,55 +1136,177 @@ public virtual async Task GetScansAsync(RequestOptions options = null) /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetScans(RequestOptions options = null) + public virtual Pageable GetScans(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetScansRequest(); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewDataSourceClient.GetScans"); - scope.Start(); - try + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "PurviewDataSourceClient.GetScans"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else + do { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetScansRequest() + : CreateGetScansNextPageRequest(nextLink); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - private HttpMessage CreateGetScansRequest() + internal HttpMessage CreateCreateOrUpdateRequest(RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/datasources/", false); + uri.AppendPath(_dataSourceName, 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; + message.ResponseClassifier = ResponseClassifier200201.Instance; + return message; + } + + internal HttpMessage CreateGetPropertiesRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/datasources/", false); + uri.AppendPath(_dataSourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateDeleteRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/datasources/", false); + uri.AppendPath(_dataSourceName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200204.Instance; + return message; + } + + internal HttpMessage CreateGetChildrenRequest() { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); + uri.Reset(_endpoint); uri.AppendPath("/datasources/", false); - uri.AppendPath(dataSourceName, true); + uri.AppendPath(_dataSourceName, true); + uri.AppendPath("/listChildren", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetScansRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/datasources/", false); + uri.AppendPath(_dataSourceName, true); uri.AppendPath("/scans", false); - uri.AppendQuery("api-version", apiVersion, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetChildrenNextPageRequest(string nextLink) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetScansNextPageRequest(string nextLink) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; return message; } + + private sealed class ResponseClassifier200201 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200201(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + 201 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier200204 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200204(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + 204 => false, + _ => true + }; + } + } } } diff --git a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewScanClient.cs b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewScanClient.cs index 0f3dabd82e11c..2330b2055122e 100644 --- a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewScanClient.cs +++ b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewScanClient.cs @@ -6,6 +6,9 @@ #nullable disable using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; @@ -16,16 +19,18 @@ namespace Azure.Analytics.Purview.Scanning /// The PurviewScan service client. public partial class PurviewScanClient { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private string dataSourceName; - private string scanName; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _dataSourceName; + private readonly string _scanName; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of PurviewScanClient for mocking. protected PurviewScanClient() @@ -38,6 +43,7 @@ protected PurviewScanClient() /// The String to use. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. + /// , , , or is null. public PurviewScanClient(Uri endpoint, string dataSourceName, string scanName, TokenCredential credential, PurviewScanningServiceClientOptions options = null) { if (endpoint == null) @@ -58,17 +64,18 @@ public PurviewScanClient(Uri endpoint, string dataSourceName, string scanName, T } options ??= new PurviewScanningServiceClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); _tokenCredential = credential; - var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); - _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { authPolicy }, new ResponseClassifier()); - this.endpoint = endpoint; - this.dataSourceName = dataSourceName; - this.scanName = scanName; - apiVersion = options.Version; + _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _dataSourceName = dataSourceName; + _scanName = scanName; + _apiVersion = options.Version; } /// Get a filter. + /// The request options. /// /// Schema for Response Body: /// { @@ -80,7 +87,6 @@ public PurviewScanClient(Uri endpoint, string dataSourceName, string scanName, T /// } /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -100,33 +106,16 @@ public PurviewScanClient(Uri endpoint, string dataSourceName, string scanName, T /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetFilterAsync(RequestOptions options = null) + public virtual async Task GetFilterAsync(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetFilterRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewScanClient.GetFilter"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetFilterRequest(); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -136,6 +125,7 @@ public virtual async Task GetFilterAsync(RequestOptions options = null } /// Get a filter. + /// The request options. /// /// Schema for Response Body: /// { @@ -147,7 +137,6 @@ public virtual async Task GetFilterAsync(RequestOptions options = null /// } /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -167,33 +156,16 @@ public virtual async Task GetFilterAsync(RequestOptions options = null /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetFilter(RequestOptions options = null) + public virtual Response GetFilter(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetFilterRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewScanClient.GetFilter"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetFilterRequest(); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -202,25 +174,9 @@ public virtual Response GetFilter(RequestOptions options = null) } } - private HttpMessage CreateGetFilterRequest() - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/datasources/", false); - uri.AppendPath(dataSourceName, true); - uri.AppendPath("/scans/", false); - uri.AppendPath(scanName, true); - uri.AppendPath("/filters/custom", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Creates or updates a filter. + /// The content to send as the body of the request. + /// The request options. /// /// Schema for Request Body: /// { @@ -232,7 +188,6 @@ private HttpMessage CreateGetFilterRequest() /// } /// } /// - /// /// Schema for Response Body: /// { /// id: string, @@ -243,7 +198,6 @@ private HttpMessage CreateGetFilterRequest() /// } /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -263,35 +217,16 @@ private HttpMessage CreateGetFilterRequest() /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task CreateOrUpdateFilterAsync(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateFilterRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewScanClient.CreateOrUpdateFilter"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateFilterRequest(content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -301,6 +236,8 @@ public virtual async Task CreateOrUpdateFilterAsync(RequestContent con } /// Creates or updates a filter. + /// The content to send as the body of the request. + /// The request options. /// /// Schema for Request Body: /// { @@ -312,7 +249,6 @@ public virtual async Task CreateOrUpdateFilterAsync(RequestContent con /// } /// } /// - /// /// Schema for Response Body: /// { /// id: string, @@ -323,7 +259,6 @@ public virtual async Task CreateOrUpdateFilterAsync(RequestContent con /// } /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -343,35 +278,16 @@ public virtual async Task CreateOrUpdateFilterAsync(RequestContent con /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response CreateOrUpdateFilter(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateFilterRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewScanClient.CreateOrUpdateFilter"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateFilterRequest(content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -380,27 +296,10 @@ public virtual Response CreateOrUpdateFilter(RequestContent content, RequestOpti } } - private HttpMessage CreateCreateOrUpdateFilterRequest(RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/datasources/", false); - uri.AppendPath(dataSourceName, true); - uri.AppendPath("/scans/", false); - uri.AppendPath(scanName, true); - uri.AppendPath("/filters/custom", 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; - } - /// Creates an instance of a scan. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -451,7 +350,6 @@ private HttpMessage CreateCreateOrUpdateFilterRequest(RequestContent content) /// ] /// } /// - /// /// Schema for Response Body: /// { /// id: string, @@ -501,7 +399,6 @@ private HttpMessage CreateCreateOrUpdateFilterRequest(RequestContent content) /// ] /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -521,35 +418,16 @@ private HttpMessage CreateCreateOrUpdateFilterRequest(RequestContent content) /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task CreateOrUpdateAsync(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewScanClient.CreateOrUpdate"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -559,6 +437,9 @@ public virtual async Task CreateOrUpdateAsync(RequestContent content, } /// Creates an instance of a scan. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -609,7 +490,6 @@ public virtual async Task CreateOrUpdateAsync(RequestContent content, /// ] /// } /// - /// /// Schema for Response Body: /// { /// id: string, @@ -659,7 +539,6 @@ public virtual async Task CreateOrUpdateAsync(RequestContent content, /// ] /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -679,35 +558,16 @@ public virtual async Task CreateOrUpdateAsync(RequestContent content, /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response CreateOrUpdate(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewScanClient.CreateOrUpdate"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateRequest(content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -716,26 +576,8 @@ public virtual Response CreateOrUpdate(RequestContent content, RequestOptions op } } - private HttpMessage CreateCreateOrUpdateRequest(RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/datasources/", false); - uri.AppendPath(dataSourceName, true); - uri.AppendPath("/scans/", false); - uri.AppendPath(scanName, 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; - } - /// Gets a scan information. + /// The request options. /// /// Schema for Response Body: /// { @@ -786,7 +628,6 @@ private HttpMessage CreateCreateOrUpdateRequest(RequestContent content) /// ] /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -806,33 +647,16 @@ private HttpMessage CreateCreateOrUpdateRequest(RequestContent content) /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetPropertiesAsync(RequestOptions options = null) + public virtual async Task GetPropertiesAsync(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetPropertiesRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewScanClient.GetProperties"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetPropertiesRequest(); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -842,6 +666,7 @@ public virtual async Task GetPropertiesAsync(RequestOptions options = } /// Gets a scan information. + /// The request options. /// /// Schema for Response Body: /// { @@ -892,7 +717,6 @@ public virtual async Task GetPropertiesAsync(RequestOptions options = /// ] /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -912,33 +736,16 @@ public virtual async Task GetPropertiesAsync(RequestOptions options = /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetProperties(RequestOptions options = null) + public virtual Response GetProperties(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetPropertiesRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewScanClient.GetProperties"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetPropertiesRequest(); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -947,24 +754,8 @@ public virtual Response GetProperties(RequestOptions options = null) } } - private HttpMessage CreateGetPropertiesRequest() - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/datasources/", false); - uri.AppendPath(dataSourceName, true); - uri.AppendPath("/scans/", false); - uri.AppendPath(scanName, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Deletes the scan associated with the data source. + /// The request options. /// /// Schema for Response Body: /// { @@ -1015,7 +806,6 @@ private HttpMessage CreateGetPropertiesRequest() /// ] /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1035,35 +825,16 @@ private HttpMessage CreateGetPropertiesRequest() /// /// /// - /// The request options. #pragma warning disable AZC0002 public virtual async Task DeleteAsync(RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewScanClient.Delete"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1073,6 +844,7 @@ public virtual async Task DeleteAsync(RequestOptions options = null) } /// Deletes the scan associated with the data source. + /// The request options. /// /// Schema for Response Body: /// { @@ -1123,7 +895,6 @@ public virtual async Task DeleteAsync(RequestOptions options = null) /// ] /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1143,35 +914,16 @@ public virtual async Task DeleteAsync(RequestOptions options = null) /// /// /// - /// The request options. #pragma warning disable AZC0002 public virtual Response Delete(RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewScanClient.Delete"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRequest(); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1180,24 +932,11 @@ public virtual Response Delete(RequestOptions options = null) } } - private HttpMessage CreateDeleteRequest() - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/datasources/", false); - uri.AppendPath(dataSourceName, true); - uri.AppendPath("/scans/", false); - uri.AppendPath(scanName, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Runs the scan. + /// The String to use. + /// The request options. + /// The ScanLevelType to use. Allowed values: "Full" | "Incremental". + /// is null. /// /// Schema for Response Body: /// { @@ -1220,7 +959,6 @@ private HttpMessage CreateDeleteRequest() /// } /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1240,35 +978,16 @@ private HttpMessage CreateDeleteRequest() /// /// /// - /// The String to use. - /// The ScanLevelType to use. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task RunScanAsync(string runId, string scanLevel = null, RequestOptions options = null) + public virtual async Task RunScanAsync(string runId, RequestOptions options, string scanLevel = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateRunScanRequest(runId, scanLevel); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewScanClient.RunScan"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateRunScanRequest(runId, scanLevel); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1278,6 +997,10 @@ public virtual async Task RunScanAsync(string runId, string scanLevel } /// Runs the scan. + /// The String to use. + /// The request options. + /// The ScanLevelType to use. Allowed values: "Full" | "Incremental". + /// is null. /// /// Schema for Response Body: /// { @@ -1300,7 +1023,6 @@ public virtual async Task RunScanAsync(string runId, string scanLevel /// } /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1320,35 +1042,16 @@ public virtual async Task RunScanAsync(string runId, string scanLevel /// /// /// - /// The String to use. - /// The ScanLevelType to use. - /// The request options. #pragma warning disable AZC0002 - public virtual Response RunScan(string runId, string scanLevel = null, RequestOptions options = null) + public virtual Response RunScan(string runId, RequestOptions options, string scanLevel = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateRunScanRequest(runId, scanLevel); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewScanClient.RunScan"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateRunScanRequest(runId, scanLevel); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1357,30 +1060,10 @@ public virtual Response RunScan(string runId, string scanLevel = null, RequestOp } } - private HttpMessage CreateRunScanRequest(string runId, string scanLevel) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/datasources/", false); - uri.AppendPath(dataSourceName, true); - uri.AppendPath("/scans/", false); - uri.AppendPath(scanName, true); - uri.AppendPath("/runs/", false); - uri.AppendPath(runId, true); - if (scanLevel != null) - { - uri.AppendQuery("scanLevel", scanLevel, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Cancels a scan. + /// The String to use. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -1403,7 +1086,6 @@ private HttpMessage CreateRunScanRequest(string runId, string scanLevel) /// } /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1423,34 +1105,16 @@ private HttpMessage CreateRunScanRequest(string runId, string scanLevel) /// /// /// - /// The String to use. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task CancelScanAsync(string runId, RequestOptions options = null) + public virtual async Task CancelScanAsync(string runId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCancelScanRequest(runId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewScanClient.CancelScan"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCancelScanRequest(runId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1460,6 +1124,9 @@ public virtual async Task CancelScanAsync(string runId, RequestOptions } /// Cancels a scan. + /// The String to use. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -1482,7 +1149,6 @@ public virtual async Task CancelScanAsync(string runId, RequestOptions /// } /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1502,34 +1168,16 @@ public virtual async Task CancelScanAsync(string runId, RequestOptions /// /// /// - /// The String to use. - /// The request options. #pragma warning disable AZC0002 - public virtual Response CancelScan(string runId, RequestOptions options = null) + public virtual Response CancelScan(string runId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCancelScanRequest(runId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewScanClient.CancelScan"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCancelScanRequest(runId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1538,277 +1186,30 @@ public virtual Response CancelScan(string runId, RequestOptions options = null) } } - private HttpMessage CreateCancelScanRequest(string runId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/datasources/", false); - uri.AppendPath(dataSourceName, true); - uri.AppendPath("/scans/", false); - uri.AppendPath(scanName, true); - uri.AppendPath("/runs/", false); - uri.AppendPath(runId, true); - uri.AppendPath("/:cancel", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the scan history of a scan. + /// Gets trigger information. + /// The request options. /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// parentId: string, - /// id: string, - /// resourceId: string, - /// status: string, - /// assetsDiscovered: number, - /// assetsClassified: number, - /// diagnostics: { - /// notifications: [ - /// { - /// message: string, - /// code: number - /// } - /// ], - /// exceptionCountMap: Dictionary<string, number> - /// }, + /// id: string, + /// name: string, + /// properties: { + /// recurrence: { + /// frequency: "Week" | "Month", + /// interval: number, /// startTime: string (ISO 8601 Format), - /// queuedTime: string (ISO 8601 Format), - /// pipelineStartTime: string (ISO 8601 Format), /// endTime: string (ISO 8601 Format), - /// scanRulesetVersion: number, - /// scanRulesetType: "Custom" | "System", - /// scanLevelType: "Full" | "Incremental", - /// errorMessage: string, - /// error: { - /// code: string, - /// message: string, - /// target: string, - /// details: [ + /// schedule: { + /// additionalProperties: Dictionary<string, AnyObject>, + /// minutes: [number], + /// hours: [number], + /// weekDays: ["Sunday" | "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday"], + /// monthDays: [number], + /// monthlyOccurrences: [ /// { - /// code: string, - /// message: string, - /// target: string, - /// details: [ErrorModel] - /// } - /// ] - /// }, - /// runType: string, - /// dataSourceType: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" - /// } - /// ], - /// nextLink: string, - /// count: number - /// } - /// - /// - /// Schema for Response Error: - /// { - /// error: { - /// code: string, - /// message: string, - /// target: string, - /// details: [ - /// { - /// code: string, - /// message: string, - /// target: string, - /// details: [ErrorModel] - /// } - /// ] - /// } - /// } - /// - /// - /// - /// The request options. -#pragma warning disable AZC0002 - public virtual async Task GetRunsAsync(RequestOptions options = null) -#pragma warning restore AZC0002 - { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRunsRequest(); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewScanClient.GetRuns"); - scope.Start(); - try - { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// Lists the scan history of a scan. - /// - /// Schema for Response Body: - /// { - /// value: [ - /// { - /// parentId: string, - /// id: string, - /// resourceId: string, - /// status: string, - /// assetsDiscovered: number, - /// assetsClassified: number, - /// diagnostics: { - /// notifications: [ - /// { - /// message: string, - /// code: number - /// } - /// ], - /// exceptionCountMap: Dictionary<string, number> - /// }, - /// startTime: string (ISO 8601 Format), - /// queuedTime: string (ISO 8601 Format), - /// pipelineStartTime: string (ISO 8601 Format), - /// endTime: string (ISO 8601 Format), - /// scanRulesetVersion: number, - /// scanRulesetType: "Custom" | "System", - /// scanLevelType: "Full" | "Incremental", - /// errorMessage: string, - /// error: { - /// code: string, - /// message: string, - /// target: string, - /// details: [ - /// { - /// code: string, - /// message: string, - /// target: string, - /// details: [ErrorModel] - /// } - /// ] - /// }, - /// runType: string, - /// dataSourceType: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" - /// } - /// ], - /// nextLink: string, - /// count: number - /// } - /// - /// - /// Schema for Response Error: - /// { - /// error: { - /// code: string, - /// message: string, - /// target: string, - /// details: [ - /// { - /// code: string, - /// message: string, - /// target: string, - /// details: [ErrorModel] - /// } - /// ] - /// } - /// } - /// - /// - /// - /// The request options. -#pragma warning disable AZC0002 - public virtual Response GetRuns(RequestOptions options = null) -#pragma warning restore AZC0002 - { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRunsRequest(); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewScanClient.GetRuns"); - scope.Start(); - try - { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - private HttpMessage CreateGetRunsRequest() - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/datasources/", false); - uri.AppendPath(dataSourceName, true); - uri.AppendPath("/scans/", false); - uri.AppendPath(scanName, true); - uri.AppendPath("/runs", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets trigger information. - /// - /// Schema for Response Body: - /// { - /// id: string, - /// name: string, - /// properties: { - /// recurrence: { - /// frequency: "Week" | "Month", - /// interval: number, - /// startTime: string (ISO 8601 Format), - /// endTime: string (ISO 8601 Format), - /// schedule: { - /// additionalProperties: Dictionary<string, AnyObject>, - /// minutes: [number], - /// hours: [number], - /// weekDays: ["Sunday" | "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday"], - /// monthDays: [number], - /// monthlyOccurrences: [ - /// { - /// additionalProperties: Dictionary<string, AnyObject>, - /// day: "Sunday" | "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday", - /// occurrence: number + /// additionalProperties: Dictionary<string, AnyObject>, + /// day: "Sunday" | "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday", + /// occurrence: number /// } /// ] /// }, @@ -1823,7 +1224,6 @@ private HttpMessage CreateGetRunsRequest() /// } /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1843,33 +1243,16 @@ private HttpMessage CreateGetRunsRequest() /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetTriggerAsync(RequestOptions options = null) + public virtual async Task GetTriggerAsync(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetTriggerRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewScanClient.GetTrigger"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetTriggerRequest(); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1879,6 +1262,7 @@ public virtual async Task GetTriggerAsync(RequestOptions options = nul } /// Gets trigger information. + /// The request options. /// /// Schema for Response Body: /// { @@ -1915,7 +1299,6 @@ public virtual async Task GetTriggerAsync(RequestOptions options = nul /// } /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1935,33 +1318,16 @@ public virtual async Task GetTriggerAsync(RequestOptions options = nul /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetTrigger(RequestOptions options = null) + public virtual Response GetTrigger(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetTriggerRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewScanClient.GetTrigger"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetTriggerRequest(); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1970,25 +1336,10 @@ public virtual Response GetTrigger(RequestOptions options = null) } } - private HttpMessage CreateGetTriggerRequest() - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/datasources/", false); - uri.AppendPath(dataSourceName, true); - uri.AppendPath("/scans/", false); - uri.AppendPath(scanName, true); - uri.AppendPath("/triggers/default", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Creates an instance of a trigger. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -2025,7 +1376,6 @@ private HttpMessage CreateGetTriggerRequest() /// } /// } /// - /// /// Schema for Response Body: /// { /// id: string, @@ -2061,7 +1411,6 @@ private HttpMessage CreateGetTriggerRequest() /// } /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -2081,35 +1430,16 @@ private HttpMessage CreateGetTriggerRequest() /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task CreateOrUpdateTriggerAsync(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateTriggerRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewScanClient.CreateOrUpdateTrigger"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateTriggerRequest(content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -2119,6 +1449,9 @@ public virtual async Task CreateOrUpdateTriggerAsync(RequestContent co } /// Creates an instance of a trigger. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -2155,7 +1488,6 @@ public virtual async Task CreateOrUpdateTriggerAsync(RequestContent co /// } /// } /// - /// /// Schema for Response Body: /// { /// id: string, @@ -2191,7 +1523,6 @@ public virtual async Task CreateOrUpdateTriggerAsync(RequestContent co /// } /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -2211,35 +1542,16 @@ public virtual async Task CreateOrUpdateTriggerAsync(RequestContent co /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response CreateOrUpdateTrigger(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateTriggerRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewScanClient.CreateOrUpdateTrigger"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateTriggerRequest(content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -2248,27 +1560,8 @@ public virtual Response CreateOrUpdateTrigger(RequestContent content, RequestOpt } } - private HttpMessage CreateCreateOrUpdateTriggerRequest(RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/datasources/", false); - uri.AppendPath(dataSourceName, true); - uri.AppendPath("/scans/", false); - uri.AppendPath(scanName, true); - uri.AppendPath("/triggers/default", 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; - } - /// Deletes the trigger associated with the scan. + /// The request options. /// /// Schema for Response Body: /// { @@ -2305,7 +1598,6 @@ private HttpMessage CreateCreateOrUpdateTriggerRequest(RequestContent content) /// } /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -2325,35 +1617,16 @@ private HttpMessage CreateCreateOrUpdateTriggerRequest(RequestContent content) /// /// /// - /// The request options. #pragma warning disable AZC0002 public virtual async Task DeleteTriggerAsync(RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteTriggerRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewScanClient.DeleteTrigger"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteTriggerRequest(); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -2363,6 +1636,7 @@ public virtual async Task DeleteTriggerAsync(RequestOptions options = } /// Deletes the trigger associated with the scan. + /// The request options. /// /// Schema for Response Body: /// { @@ -2399,7 +1673,6 @@ public virtual async Task DeleteTriggerAsync(RequestOptions options = /// } /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -2419,35 +1692,16 @@ public virtual async Task DeleteTriggerAsync(RequestOptions options = /// /// /// - /// The request options. #pragma warning disable AZC0002 public virtual Response DeleteTrigger(RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteTriggerRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewScanClient.DeleteTrigger"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteTriggerRequest(); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -2456,22 +1710,470 @@ public virtual Response DeleteTrigger(RequestOptions options = null) } } - private HttpMessage CreateDeleteTriggerRequest() - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/datasources/", false); - uri.AppendPath(dataSourceName, true); - uri.AppendPath("/scans/", false); - uri.AppendPath(scanName, true); - uri.AppendPath("/triggers/default", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; + /// Lists the scan history of a scan. + /// The request options. + /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// parentId: string, + /// id: string, + /// resourceId: string, + /// status: string, + /// assetsDiscovered: number, + /// assetsClassified: number, + /// diagnostics: { + /// notifications: [ + /// { + /// message: string, + /// code: number + /// } + /// ], + /// exceptionCountMap: Dictionary<string, number> + /// }, + /// startTime: string (ISO 8601 Format), + /// queuedTime: string (ISO 8601 Format), + /// pipelineStartTime: string (ISO 8601 Format), + /// endTime: string (ISO 8601 Format), + /// scanRulesetVersion: number, + /// scanRulesetType: "Custom" | "System", + /// scanLevelType: "Full" | "Incremental", + /// errorMessage: string, + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [ + /// { + /// code: string, + /// message: string, + /// target: string, + /// details: [ErrorModel] + /// } + /// ] + /// }, + /// runType: string, + /// dataSourceType: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" + /// } + /// ], + /// nextLink: string, + /// count: number + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [ + /// { + /// code: string, + /// message: string, + /// target: string, + /// details: [ErrorModel] + /// } + /// ] + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual AsyncPageable GetRunsAsync(RequestOptions options) +#pragma warning restore AZC0002 + { + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "PurviewScanClient.GetRuns"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetRunsRequest() + : CreateGetRunsNextPageRequest(nextLink); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + /// Lists the scan history of a scan. + /// The request options. + /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// parentId: string, + /// id: string, + /// resourceId: string, + /// status: string, + /// assetsDiscovered: number, + /// assetsClassified: number, + /// diagnostics: { + /// notifications: [ + /// { + /// message: string, + /// code: number + /// } + /// ], + /// exceptionCountMap: Dictionary<string, number> + /// }, + /// startTime: string (ISO 8601 Format), + /// queuedTime: string (ISO 8601 Format), + /// pipelineStartTime: string (ISO 8601 Format), + /// endTime: string (ISO 8601 Format), + /// scanRulesetVersion: number, + /// scanRulesetType: "Custom" | "System", + /// scanLevelType: "Full" | "Incremental", + /// errorMessage: string, + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [ + /// { + /// code: string, + /// message: string, + /// target: string, + /// details: [ErrorModel] + /// } + /// ] + /// }, + /// runType: string, + /// dataSourceType: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" + /// } + /// ], + /// nextLink: string, + /// count: number + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [ + /// { + /// code: string, + /// message: string, + /// target: string, + /// details: [ErrorModel] + /// } + /// ] + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual Pageable GetRuns(RequestOptions options) +#pragma warning restore AZC0002 + { + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "PurviewScanClient.GetRuns"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) + { + do + { + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetRunsRequest() + : CreateGetRunsNextPageRequest(nextLink); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + internal HttpMessage CreateGetFilterRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/datasources/", false); + uri.AppendPath(_dataSourceName, true); + uri.AppendPath("/scans/", false); + uri.AppendPath(_scanName, true); + uri.AppendPath("/filters/custom", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateOrUpdateFilterRequest(RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/datasources/", false); + uri.AppendPath(_dataSourceName, true); + uri.AppendPath("/scans/", false); + uri.AppendPath(_scanName, true); + uri.AppendPath("/filters/custom", 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; + message.ResponseClassifier = ResponseClassifier200201.Instance; + return message; + } + + internal HttpMessage CreateCreateOrUpdateRequest(RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/datasources/", false); + uri.AppendPath(_dataSourceName, true); + uri.AppendPath("/scans/", false); + uri.AppendPath(_scanName, 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; + message.ResponseClassifier = ResponseClassifier200201.Instance; + return message; + } + + internal HttpMessage CreateGetPropertiesRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/datasources/", false); + uri.AppendPath(_dataSourceName, true); + uri.AppendPath("/scans/", false); + uri.AppendPath(_scanName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateDeleteRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/datasources/", false); + uri.AppendPath(_dataSourceName, true); + uri.AppendPath("/scans/", false); + uri.AppendPath(_scanName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200204.Instance; + return message; + } + + internal HttpMessage CreateRunScanRequest(string runId, string scanLevel) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/datasources/", false); + uri.AppendPath(_dataSourceName, true); + uri.AppendPath("/scans/", false); + uri.AppendPath(_scanName, true); + uri.AppendPath("/runs/", false); + uri.AppendPath(runId, true); + if (scanLevel != null) + { + uri.AppendQuery("scanLevel", scanLevel, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier202.Instance; + return message; + } + + internal HttpMessage CreateCancelScanRequest(string runId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/datasources/", false); + uri.AppendPath(_dataSourceName, true); + uri.AppendPath("/scans/", false); + uri.AppendPath(_scanName, true); + uri.AppendPath("/runs/", false); + uri.AppendPath(runId, true); + uri.AppendPath("/:cancel", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier202.Instance; + return message; + } + + internal HttpMessage CreateGetRunsRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/datasources/", false); + uri.AppendPath(_dataSourceName, true); + uri.AppendPath("/scans/", false); + uri.AppendPath(_scanName, true); + uri.AppendPath("/runs", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetTriggerRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/datasources/", false); + uri.AppendPath(_dataSourceName, true); + uri.AppendPath("/scans/", false); + uri.AppendPath(_scanName, true); + uri.AppendPath("/triggers/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateOrUpdateTriggerRequest(RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/datasources/", false); + uri.AppendPath(_dataSourceName, true); + uri.AppendPath("/scans/", false); + uri.AppendPath(_scanName, true); + uri.AppendPath("/triggers/default", 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; + message.ResponseClassifier = ResponseClassifier200201.Instance; + return message; + } + + internal HttpMessage CreateDeleteTriggerRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/datasources/", false); + uri.AppendPath(_dataSourceName, true); + uri.AppendPath("/scans/", false); + uri.AppendPath(_scanName, true); + uri.AppendPath("/triggers/default", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200204.Instance; + return message; + } + + internal HttpMessage CreateGetRunsNextPageRequest(string nextLink) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier200201 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200201(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + 201 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier200204 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200204(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + 204 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier202 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier202(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 202 => false, + _ => true + }; + } } } } diff --git a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewScanningServiceClient.cs b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewScanningServiceClient.cs index 8e54c677ecd9a..e976143b82027 100644 --- a/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewScanningServiceClient.cs +++ b/sdk/purview/Azure.Analytics.Purview.Scanning/src/Generated/PurviewScanningServiceClient.cs @@ -6,6 +6,9 @@ #nullable disable using System; +using System.Collections.Generic; +using System.Runtime.CompilerServices; +using System.Threading; using System.Threading.Tasks; using Azure; using Azure.Core; @@ -16,14 +19,16 @@ namespace Azure.Analytics.Purview.Scanning /// The PurviewScanningService service client. public partial class PurviewScanningServiceClient { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://purview.azure.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of PurviewScanningServiceClient for mocking. protected PurviewScanningServiceClient() @@ -34,6 +39,7 @@ protected PurviewScanningServiceClient() /// The scanning endpoint of your purview account. Example: https://{accountName}.scan.purview.azure.com. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. + /// or is null. public PurviewScanningServiceClient(Uri endpoint, TokenCredential credential, PurviewScanningServiceClientOptions options = null) { if (endpoint == null) @@ -46,15 +52,18 @@ public PurviewScanningServiceClient(Uri endpoint, TokenCredential credential, Pu } options ??= new PurviewScanningServiceClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); _tokenCredential = credential; - var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); - _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { authPolicy }, new ResponseClassifier()); - this.endpoint = endpoint; - apiVersion = options.Version; + _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; } /// Gets azureKeyVault information. + /// The String to use. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -66,7 +75,6 @@ public PurviewScanningServiceClient(Uri endpoint, TokenCredential credential, Pu /// } /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -86,34 +94,16 @@ public PurviewScanningServiceClient(Uri endpoint, TokenCredential credential, Pu /// /// /// - /// The String to use. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetKeyVaultReferenceAsync(string azureKeyVaultName, RequestOptions options = null) + public virtual async Task GetKeyVaultReferenceAsync(string azureKeyVaultName, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetKeyVaultReferenceRequest(azureKeyVaultName); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.GetKeyVaultReference"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetKeyVaultReferenceRequest(azureKeyVaultName); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -123,6 +113,9 @@ public virtual async Task GetKeyVaultReferenceAsync(string azureKeyVau } /// Gets azureKeyVault information. + /// The String to use. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -134,7 +127,6 @@ public virtual async Task GetKeyVaultReferenceAsync(string azureKeyVau /// } /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -154,34 +146,16 @@ public virtual async Task GetKeyVaultReferenceAsync(string azureKeyVau /// /// /// - /// The String to use. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetKeyVaultReference(string azureKeyVaultName, RequestOptions options = null) + public virtual Response GetKeyVaultReference(string azureKeyVaultName, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetKeyVaultReferenceRequest(azureKeyVaultName); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.GetKeyVaultReference"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetKeyVaultReferenceRequest(azureKeyVaultName); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -190,22 +164,11 @@ public virtual Response GetKeyVaultReference(string azureKeyVaultName, RequestOp } } - private HttpMessage CreateGetKeyVaultReferenceRequest(string azureKeyVaultName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/azureKeyVaults/", false); - uri.AppendPath(azureKeyVaultName, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - /// Creates an instance of a azureKeyVault. + /// The String to use. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// /// Schema for Request Body: /// { @@ -217,7 +180,6 @@ private HttpMessage CreateGetKeyVaultReferenceRequest(string azureKeyVaultName) /// } /// } /// - /// /// Schema for Response Body: /// { /// id: string, @@ -228,7 +190,6 @@ private HttpMessage CreateGetKeyVaultReferenceRequest(string azureKeyVaultName) /// } /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -248,35 +209,16 @@ private HttpMessage CreateGetKeyVaultReferenceRequest(string azureKeyVaultName) /// /// /// - /// The String to use. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task CreateOrUpdateKeyVaultReferenceAsync(string azureKeyVaultName, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateKeyVaultReferenceRequest(azureKeyVaultName, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.CreateOrUpdateKeyVaultReference"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateKeyVaultReferenceRequest(azureKeyVaultName, content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -286,6 +228,10 @@ public virtual async Task CreateOrUpdateKeyVaultReferenceAsync(string } /// Creates an instance of a azureKeyVault. + /// The String to use. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// /// Schema for Request Body: /// { @@ -297,7 +243,6 @@ public virtual async Task CreateOrUpdateKeyVaultReferenceAsync(string /// } /// } /// - /// /// Schema for Response Body: /// { /// id: string, @@ -308,7 +253,6 @@ public virtual async Task CreateOrUpdateKeyVaultReferenceAsync(string /// } /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -328,35 +272,16 @@ public virtual async Task CreateOrUpdateKeyVaultReferenceAsync(string /// /// /// - /// The String to use. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response CreateOrUpdateKeyVaultReference(string azureKeyVaultName, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateKeyVaultReferenceRequest(azureKeyVaultName, content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.CreateOrUpdateKeyVaultReference"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateKeyVaultReferenceRequest(azureKeyVaultName, content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -365,24 +290,10 @@ public virtual Response CreateOrUpdateKeyVaultReference(string azureKeyVaultName } } - private HttpMessage CreateCreateOrUpdateKeyVaultReferenceRequest(string azureKeyVaultName, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/azureKeyVaults/", false); - uri.AppendPath(azureKeyVaultName, 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; - } - /// Deletes the azureKeyVault associated with the account. + /// The String to use. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -394,7 +305,6 @@ private HttpMessage CreateCreateOrUpdateKeyVaultReferenceRequest(string azureKey /// } /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -414,36 +324,16 @@ private HttpMessage CreateCreateOrUpdateKeyVaultReferenceRequest(string azureKey /// /// /// - /// The String to use. - /// The request options. #pragma warning disable AZC0002 public virtual async Task DeleteKeyVaultReferenceAsync(string azureKeyVaultName, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteKeyVaultReferenceRequest(azureKeyVaultName); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.DeleteKeyVaultReference"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteKeyVaultReferenceRequest(azureKeyVaultName); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -453,6 +343,9 @@ public virtual async Task DeleteKeyVaultReferenceAsync(string azureKey } /// Deletes the azureKeyVault associated with the account. + /// The String to use. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -464,7 +357,6 @@ public virtual async Task DeleteKeyVaultReferenceAsync(string azureKey /// } /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -484,36 +376,16 @@ public virtual async Task DeleteKeyVaultReferenceAsync(string azureKey /// /// /// - /// The String to use. - /// The request options. #pragma warning disable AZC0002 public virtual Response DeleteKeyVaultReference(string azureKeyVaultName, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteKeyVaultReferenceRequest(azureKeyVaultName); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.DeleteKeyVaultReference"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteKeyVaultReferenceRequest(azureKeyVaultName); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -522,40 +394,21 @@ public virtual Response DeleteKeyVaultReference(string azureKeyVaultName, Reques } } - private HttpMessage CreateDeleteKeyVaultReferenceRequest(string azureKeyVaultName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/azureKeyVaults/", false); - uri.AppendPath(azureKeyVaultName, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// List azureKeyVaults in account. + /// Get a scan ruleset. + /// The String to use. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// id: string, - /// name: string, - /// properties: { - /// baseUrl: string, - /// description: string - /// } - /// } - /// ], - /// nextLink: string, - /// count: number + /// scanRulesetType: "Custom" | "System", + /// status: "Enabled" | "Disabled", + /// version: number, + /// id: string, + /// name: string, + /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -575,33 +428,16 @@ private HttpMessage CreateDeleteKeyVaultReferenceRequest(string azureKeyVaultNam /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetKeyVaultReferencesAsync(RequestOptions options = null) + public virtual async Task GetScanRulesetAsync(string scanRulesetName, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetKeyVaultReferencesRequest(); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.GetKeyVaultReferences"); + using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.GetScanRuleset"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetScanRulesetRequest(scanRulesetName); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -610,25 +446,21 @@ public virtual async Task GetKeyVaultReferencesAsync(RequestOptions op } } - /// List azureKeyVaults in account. + /// Get a scan ruleset. + /// The String to use. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// id: string, - /// name: string, - /// properties: { - /// baseUrl: string, - /// description: string - /// } - /// } - /// ], - /// nextLink: string, - /// count: number + /// scanRulesetType: "Custom" | "System", + /// status: "Enabled" | "Disabled", + /// version: number, + /// id: string, + /// name: string, + /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -648,33 +480,16 @@ public virtual async Task GetKeyVaultReferencesAsync(RequestOptions op /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetKeyVaultReferences(RequestOptions options = null) + public virtual Response GetScanRuleset(string scanRulesetName, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetKeyVaultReferencesRequest(); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.GetKeyVaultReferences"); + using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.GetScanRuleset"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetScanRulesetRequest(scanRulesetName); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -683,36 +498,32 @@ public virtual Response GetKeyVaultReferences(RequestOptions options = null) } } - private HttpMessage CreateGetKeyVaultReferencesRequest() - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/azureKeyVaults", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// List classification rules in Account. + /// Creates or Updates a scan ruleset. + /// The String to use. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// + /// Schema for Request Body: + /// { + /// scanRulesetType: "Custom" | "System", + /// status: "Enabled" | "Disabled", + /// version: number, + /// id: string, + /// name: string, + /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" (required) + /// } + /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// id: string, - /// name: string, - /// kind: "System" | "Custom" - /// } - /// ], - /// nextLink: string, - /// count: number + /// scanRulesetType: "Custom" | "System", + /// status: "Enabled" | "Disabled", + /// version: number, + /// id: string, + /// name: string, + /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -732,33 +543,16 @@ private HttpMessage CreateGetKeyVaultReferencesRequest() /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetClassificationRulesAsync(RequestOptions options = null) + public virtual async Task CreateOrUpdateScanRuelsetAsync(string scanRulesetName, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetClassificationRulesRequest(); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.GetClassificationRules"); + using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.CreateOrUpdateScanRuelset"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateScanRuelsetRequest(scanRulesetName, content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -767,22 +561,32 @@ public virtual async Task GetClassificationRulesAsync(RequestOptions o } } - /// List classification rules in Account. + /// Creates or Updates a scan ruleset. + /// The String to use. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// + /// Schema for Request Body: + /// { + /// scanRulesetType: "Custom" | "System", + /// status: "Enabled" | "Disabled", + /// version: number, + /// id: string, + /// name: string, + /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" (required) + /// } + /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// id: string, - /// name: string, - /// kind: "System" | "Custom" - /// } - /// ], - /// nextLink: string, - /// count: number + /// scanRulesetType: "Custom" | "System", + /// status: "Enabled" | "Disabled", + /// version: number, + /// id: string, + /// name: string, + /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -802,33 +606,16 @@ public virtual async Task GetClassificationRulesAsync(RequestOptions o /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetClassificationRules(RequestOptions options = null) + public virtual Response CreateOrUpdateScanRuelset(string scanRulesetName, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetClassificationRulesRequest(); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.GetClassificationRules"); + using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.CreateOrUpdateScanRuelset"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateOrUpdateScanRuelsetRequest(scanRulesetName, content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -837,85 +624,21 @@ public virtual Response GetClassificationRules(RequestOptions options = null) } } - private HttpMessage CreateGetClassificationRulesRequest() - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/classificationrules", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// List data sources in Data catalog. + /// Deletes a scan ruleset. + /// The String to use. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// id: string, - /// name: string, - /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI", - /// scans: [ - /// { - /// id: string, - /// name: string, - /// kind: "AzureSubscriptionCredential" | "AzureSubscriptionMsi" | "AzureResourceGroupCredential" | "AzureResourceGroupMsi" | "AzureSynapseWorkspaceCredential" | "AzureSynapseWorkspaceMsi" | "AzureSynapseCredential" | "AzureSynapseMsi" | "AdlsGen1Credential" | "AdlsGen1Msi" | "AdlsGen2Credential" | "AdlsGen2Msi" | "AmazonAccountCredential" | "AmazonS3Credential" | "AmazonS3RoleARN" | "AmazonSqlCredential" | "AzureCosmosDbCredential" | "AzureDataExplorerCredential" | "AzureDataExplorerMsi" | "AzureFileServiceCredential" | "AzureSqlDatabaseCredential" | "AzureSqlDatabaseMsi" | "AmazonPostgreSqlCredential" | "AzurePostgreSqlCredential" | "SqlServerDatabaseCredential" | "AzureSqlDatabaseManagedInstanceCredential" | "AzureSqlDatabaseManagedInstanceMsi" | "AzureSqlDataWarehouseCredential" | "AzureSqlDataWarehouseMsi" | "AzureMySqlCredential" | "AzureStorageCredential" | "AzureStorageMsi" | "TeradataTeradataCredential" | "TeradataTeradataUserPass" | "TeradataUserPass" | "OracleOracleCredential" | "OracleOracleUserPass" | "SapS4HanaSapS4HanaCredential" | "SapS4HanaSapS4HanaUserPass" | "SapEccSapEccCredential" | "SapEccSapEccUserPass" | "PowerBIDelegated" | "PowerBIMsi", - /// scanResults: [ - /// { - /// parentId: string, - /// id: string, - /// resourceId: string, - /// status: string, - /// assetsDiscovered: number, - /// assetsClassified: number, - /// diagnostics: { - /// notifications: [ - /// { - /// message: string, - /// code: number - /// } - /// ], - /// exceptionCountMap: Dictionary<string, number> - /// }, - /// startTime: string (ISO 8601 Format), - /// queuedTime: string (ISO 8601 Format), - /// pipelineStartTime: string (ISO 8601 Format), - /// endTime: string (ISO 8601 Format), - /// scanRulesetVersion: number, - /// scanRulesetType: "Custom" | "System", - /// scanLevelType: "Full" | "Incremental", - /// errorMessage: string, - /// error: { - /// code: string, - /// message: string, - /// target: string, - /// details: [ - /// { - /// code: string, - /// message: string, - /// target: string, - /// details: [ErrorModel] - /// } - /// ] - /// }, - /// runType: string, - /// dataSourceType: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" - /// } - /// ] - /// } - /// ] - /// } - /// ], - /// nextLink: string, - /// count: number + /// scanRulesetType: "Custom" | "System", + /// status: "Enabled" | "Disabled", + /// version: number, + /// id: string, + /// name: string, + /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -935,33 +658,16 @@ private HttpMessage CreateGetClassificationRulesRequest() /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetDataSourcesAsync(RequestOptions options = null) + public virtual async Task DeleteScanRulesetAsync(string scanRulesetName, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetDataSourcesRequest(); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.GetDataSources"); + using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.DeleteScanRuleset"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteScanRulesetRequest(scanRulesetName); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -970,71 +676,21 @@ public virtual async Task GetDataSourcesAsync(RequestOptions options = } } - /// List data sources in Data catalog. + /// Deletes a scan ruleset. + /// The String to use. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// id: string, - /// name: string, - /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI", - /// scans: [ - /// { - /// id: string, - /// name: string, - /// kind: "AzureSubscriptionCredential" | "AzureSubscriptionMsi" | "AzureResourceGroupCredential" | "AzureResourceGroupMsi" | "AzureSynapseWorkspaceCredential" | "AzureSynapseWorkspaceMsi" | "AzureSynapseCredential" | "AzureSynapseMsi" | "AdlsGen1Credential" | "AdlsGen1Msi" | "AdlsGen2Credential" | "AdlsGen2Msi" | "AmazonAccountCredential" | "AmazonS3Credential" | "AmazonS3RoleARN" | "AmazonSqlCredential" | "AzureCosmosDbCredential" | "AzureDataExplorerCredential" | "AzureDataExplorerMsi" | "AzureFileServiceCredential" | "AzureSqlDatabaseCredential" | "AzureSqlDatabaseMsi" | "AmazonPostgreSqlCredential" | "AzurePostgreSqlCredential" | "SqlServerDatabaseCredential" | "AzureSqlDatabaseManagedInstanceCredential" | "AzureSqlDatabaseManagedInstanceMsi" | "AzureSqlDataWarehouseCredential" | "AzureSqlDataWarehouseMsi" | "AzureMySqlCredential" | "AzureStorageCredential" | "AzureStorageMsi" | "TeradataTeradataCredential" | "TeradataTeradataUserPass" | "TeradataUserPass" | "OracleOracleCredential" | "OracleOracleUserPass" | "SapS4HanaSapS4HanaCredential" | "SapS4HanaSapS4HanaUserPass" | "SapEccSapEccCredential" | "SapEccSapEccUserPass" | "PowerBIDelegated" | "PowerBIMsi", - /// scanResults: [ - /// { - /// parentId: string, - /// id: string, - /// resourceId: string, - /// status: string, - /// assetsDiscovered: number, - /// assetsClassified: number, - /// diagnostics: { - /// notifications: [ - /// { - /// message: string, - /// code: number - /// } - /// ], - /// exceptionCountMap: Dictionary<string, number> - /// }, - /// startTime: string (ISO 8601 Format), - /// queuedTime: string (ISO 8601 Format), - /// pipelineStartTime: string (ISO 8601 Format), - /// endTime: string (ISO 8601 Format), - /// scanRulesetVersion: number, - /// scanRulesetType: "Custom" | "System", - /// scanLevelType: "Full" | "Incremental", - /// errorMessage: string, - /// error: { - /// code: string, - /// message: string, - /// target: string, - /// details: [ - /// { - /// code: string, - /// message: string, - /// target: string, - /// details: [ErrorModel] - /// } - /// ] - /// }, - /// runType: string, - /// dataSourceType: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" - /// } - /// ] - /// } - /// ] - /// } - /// ], - /// nextLink: string, - /// count: number + /// scanRulesetType: "Custom" | "System", + /// status: "Enabled" | "Disabled", + /// version: number, + /// id: string, + /// name: string, + /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1054,33 +710,16 @@ public virtual async Task GetDataSourcesAsync(RequestOptions options = /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetDataSources(RequestOptions options = null) + public virtual Response DeleteScanRuleset(string scanRulesetName, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetDataSourcesRequest(); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.GetDataSources"); + using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.DeleteScanRuleset"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteScanRulesetRequest(scanRulesetName); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1089,85 +728,21 @@ public virtual Response GetDataSources(RequestOptions options = null) } } - private HttpMessage CreateGetDataSourcesRequest() - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/datasources", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Lists the data sources in the account that do not belong to any collection. + /// Get a system scan ruleset for a data source. + /// The DataSourceType to use. Allowed values: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI". + /// The request options. + /// is null. /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// id: string, - /// name: string, - /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI", - /// scans: [ - /// { - /// id: string, - /// name: string, - /// kind: "AzureSubscriptionCredential" | "AzureSubscriptionMsi" | "AzureResourceGroupCredential" | "AzureResourceGroupMsi" | "AzureSynapseWorkspaceCredential" | "AzureSynapseWorkspaceMsi" | "AzureSynapseCredential" | "AzureSynapseMsi" | "AdlsGen1Credential" | "AdlsGen1Msi" | "AdlsGen2Credential" | "AdlsGen2Msi" | "AmazonAccountCredential" | "AmazonS3Credential" | "AmazonS3RoleARN" | "AmazonSqlCredential" | "AzureCosmosDbCredential" | "AzureDataExplorerCredential" | "AzureDataExplorerMsi" | "AzureFileServiceCredential" | "AzureSqlDatabaseCredential" | "AzureSqlDatabaseMsi" | "AmazonPostgreSqlCredential" | "AzurePostgreSqlCredential" | "SqlServerDatabaseCredential" | "AzureSqlDatabaseManagedInstanceCredential" | "AzureSqlDatabaseManagedInstanceMsi" | "AzureSqlDataWarehouseCredential" | "AzureSqlDataWarehouseMsi" | "AzureMySqlCredential" | "AzureStorageCredential" | "AzureStorageMsi" | "TeradataTeradataCredential" | "TeradataTeradataUserPass" | "TeradataUserPass" | "OracleOracleCredential" | "OracleOracleUserPass" | "SapS4HanaSapS4HanaCredential" | "SapS4HanaSapS4HanaUserPass" | "SapEccSapEccCredential" | "SapEccSapEccUserPass" | "PowerBIDelegated" | "PowerBIMsi", - /// scanResults: [ - /// { - /// parentId: string, - /// id: string, - /// resourceId: string, - /// status: string, - /// assetsDiscovered: number, - /// assetsClassified: number, - /// diagnostics: { - /// notifications: [ - /// { - /// message: string, - /// code: number - /// } - /// ], - /// exceptionCountMap: Dictionary<string, number> - /// }, - /// startTime: string (ISO 8601 Format), - /// queuedTime: string (ISO 8601 Format), - /// pipelineStartTime: string (ISO 8601 Format), - /// endTime: string (ISO 8601 Format), - /// scanRulesetVersion: number, - /// scanRulesetType: "Custom" | "System", - /// scanLevelType: "Full" | "Incremental", - /// errorMessage: string, - /// error: { - /// code: string, - /// message: string, - /// target: string, - /// details: [ - /// { - /// code: string, - /// message: string, - /// target: string, - /// details: [ErrorModel] - /// } - /// ] - /// }, - /// runType: string, - /// dataSourceType: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" - /// } - /// ] - /// } - /// ] - /// } - /// ], - /// nextLink: string, - /// count: number + /// scanRulesetType: "Custom" | "System", + /// status: "Enabled" | "Disabled", + /// version: number, + /// id: string, + /// name: string, + /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1187,33 +762,16 @@ private HttpMessage CreateGetDataSourcesRequest() /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetUnparentedDataSourcesAsync(RequestOptions options = null) + public virtual async Task GetSystemRulesetsForDataSourceAsync(string dataSourceType, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetUnparentedDataSourcesRequest(); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.GetUnparentedDataSources"); + using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.GetSystemRulesetsForDataSource"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetSystemRulesetsForDataSourceRequest(dataSourceType); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1222,71 +780,21 @@ public virtual async Task GetUnparentedDataSourcesAsync(RequestOptions } } - /// Lists the data sources in the account that do not belong to any collection. + /// Get a system scan ruleset for a data source. + /// The DataSourceType to use. Allowed values: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI". + /// The request options. + /// is null. /// /// Schema for Response Body: /// { - /// value: [ - /// { - /// id: string, - /// name: string, - /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI", - /// scans: [ - /// { - /// id: string, - /// name: string, - /// kind: "AzureSubscriptionCredential" | "AzureSubscriptionMsi" | "AzureResourceGroupCredential" | "AzureResourceGroupMsi" | "AzureSynapseWorkspaceCredential" | "AzureSynapseWorkspaceMsi" | "AzureSynapseCredential" | "AzureSynapseMsi" | "AdlsGen1Credential" | "AdlsGen1Msi" | "AdlsGen2Credential" | "AdlsGen2Msi" | "AmazonAccountCredential" | "AmazonS3Credential" | "AmazonS3RoleARN" | "AmazonSqlCredential" | "AzureCosmosDbCredential" | "AzureDataExplorerCredential" | "AzureDataExplorerMsi" | "AzureFileServiceCredential" | "AzureSqlDatabaseCredential" | "AzureSqlDatabaseMsi" | "AmazonPostgreSqlCredential" | "AzurePostgreSqlCredential" | "SqlServerDatabaseCredential" | "AzureSqlDatabaseManagedInstanceCredential" | "AzureSqlDatabaseManagedInstanceMsi" | "AzureSqlDataWarehouseCredential" | "AzureSqlDataWarehouseMsi" | "AzureMySqlCredential" | "AzureStorageCredential" | "AzureStorageMsi" | "TeradataTeradataCredential" | "TeradataTeradataUserPass" | "TeradataUserPass" | "OracleOracleCredential" | "OracleOracleUserPass" | "SapS4HanaSapS4HanaCredential" | "SapS4HanaSapS4HanaUserPass" | "SapEccSapEccCredential" | "SapEccSapEccUserPass" | "PowerBIDelegated" | "PowerBIMsi", - /// scanResults: [ - /// { - /// parentId: string, - /// id: string, - /// resourceId: string, - /// status: string, - /// assetsDiscovered: number, - /// assetsClassified: number, - /// diagnostics: { - /// notifications: [ - /// { - /// message: string, - /// code: number - /// } - /// ], - /// exceptionCountMap: Dictionary<string, number> - /// }, - /// startTime: string (ISO 8601 Format), - /// queuedTime: string (ISO 8601 Format), - /// pipelineStartTime: string (ISO 8601 Format), - /// endTime: string (ISO 8601 Format), - /// scanRulesetVersion: number, - /// scanRulesetType: "Custom" | "System", - /// scanLevelType: "Full" | "Incremental", - /// errorMessage: string, - /// error: { - /// code: string, - /// message: string, - /// target: string, - /// details: [ - /// { - /// code: string, - /// message: string, - /// target: string, - /// details: [ErrorModel] - /// } - /// ] - /// }, - /// runType: string, - /// dataSourceType: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" - /// } - /// ] - /// } - /// ] - /// } - /// ], - /// nextLink: string, - /// count: number + /// scanRulesetType: "Custom" | "System", + /// status: "Enabled" | "Disabled", + /// version: number, + /// id: string, + /// name: string, + /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1306,33 +814,16 @@ public virtual async Task GetUnparentedDataSourcesAsync(RequestOptions /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetUnparentedDataSources(RequestOptions options = null) + public virtual Response GetSystemRulesetsForDataSource(string dataSourceType, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetUnparentedDataSourcesRequest(); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.GetUnparentedDataSources"); + using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.GetSystemRulesetsForDataSource"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetSystemRulesetsForDataSourceRequest(dataSourceType); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1341,21 +832,10 @@ public virtual Response GetUnparentedDataSources(RequestOptions options = null) } } - private HttpMessage CreateGetUnparentedDataSourcesRequest() - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/listUnparentedDataSources", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Get a scan ruleset. + /// Get a scan ruleset by version. + /// The Integer to use. + /// The request options. + /// The DataSourceType to use. Allowed values: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI". /// /// Schema for Response Body: /// { @@ -1367,7 +847,6 @@ private HttpMessage CreateGetUnparentedDataSourcesRequest() /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1387,34 +866,16 @@ private HttpMessage CreateGetUnparentedDataSourcesRequest() /// /// /// - /// The String to use. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetScanRulesetAsync(string scanRulesetName, RequestOptions options = null) + public virtual async Task GetSystemRulesetsForVersionAsync(int version, RequestOptions options, string dataSourceType = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetScanRulesetRequest(scanRulesetName); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.GetScanRuleset"); + using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.GetSystemRulesetsForVersion"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetSystemRulesetsForVersionRequest(version, dataSourceType); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1423,7 +884,10 @@ public virtual async Task GetScanRulesetAsync(string scanRulesetName, } } - /// Get a scan ruleset. + /// Get a scan ruleset by version. + /// The Integer to use. + /// The request options. + /// The DataSourceType to use. Allowed values: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI". /// /// Schema for Response Body: /// { @@ -1435,7 +899,6 @@ public virtual async Task GetScanRulesetAsync(string scanRulesetName, /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1455,34 +918,16 @@ public virtual async Task GetScanRulesetAsync(string scanRulesetName, /// /// /// - /// The String to use. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetScanRuleset(string scanRulesetName, RequestOptions options = null) + public virtual Response GetSystemRulesetsForVersion(int version, RequestOptions options, string dataSourceType = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetScanRulesetRequest(scanRulesetName); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.GetScanRuleset"); + using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.GetSystemRulesetsForVersion"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetSystemRulesetsForVersionRequest(version, dataSourceType); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1491,34 +936,10 @@ public virtual Response GetScanRuleset(string scanRulesetName, RequestOptions op } } - private HttpMessage CreateGetScanRulesetRequest(string scanRulesetName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/scanrulesets/", false); - uri.AppendPath(scanRulesetName, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Creates or Updates a scan ruleset. + /// Get the latest version of a system scan ruleset. + /// The request options. + /// The DataSourceType to use. Allowed values: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI". /// - /// Schema for Request Body: - /// { - /// scanRulesetType: "Custom" | "System", - /// status: "Enabled" | "Disabled", - /// version: number, - /// id: string, - /// name: string, - /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" (required) - /// } - /// - /// /// Schema for Response Body: /// { /// scanRulesetType: "Custom" | "System", @@ -1529,7 +950,6 @@ private HttpMessage CreateGetScanRulesetRequest(string scanRulesetName) /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1549,36 +969,16 @@ private HttpMessage CreateGetScanRulesetRequest(string scanRulesetName) /// /// /// - /// The String to use. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task CreateOrUpdateScanRuelsetAsync(string scanRulesetName, RequestContent content, RequestOptions options = null) + public virtual async Task GetLatestSystemRulestesAsync(RequestOptions options, string dataSourceType = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateScanRuelsetRequest(scanRulesetName, content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.CreateOrUpdateScanRuelset"); + using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.GetLatestSystemRulestes"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetLatestSystemRulestesRequest(dataSourceType); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1587,19 +987,10 @@ public virtual async Task CreateOrUpdateScanRuelsetAsync(string scanRu } } - /// Creates or Updates a scan ruleset. + /// Get the latest version of a system scan ruleset. + /// The request options. + /// The DataSourceType to use. Allowed values: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI". /// - /// Schema for Request Body: - /// { - /// scanRulesetType: "Custom" | "System", - /// status: "Enabled" | "Disabled", - /// version: number, - /// id: string, - /// name: string, - /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" (required) - /// } - /// - /// /// Schema for Response Body: /// { /// scanRulesetType: "Custom" | "System", @@ -1610,7 +1001,6 @@ public virtual async Task CreateOrUpdateScanRuelsetAsync(string scanRu /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1630,36 +1020,16 @@ public virtual async Task CreateOrUpdateScanRuelsetAsync(string scanRu /// /// /// - /// The String to use. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 - public virtual Response CreateOrUpdateScanRuelset(string scanRulesetName, RequestContent content, RequestOptions options = null) + public virtual Response GetLatestSystemRulestes(RequestOptions options, string dataSourceType = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateOrUpdateScanRuelsetRequest(scanRulesetName, content); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.CreateOrUpdateScanRuelset"); + using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.GetLatestSystemRulestes"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 201: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetLatestSystemRulestesRequest(dataSourceType); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1668,36 +1038,25 @@ public virtual Response CreateOrUpdateScanRuelset(string scanRulesetName, Reques } } - private HttpMessage CreateCreateOrUpdateScanRuelsetRequest(string scanRulesetName, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/scanrulesets/", false); - uri.AppendPath(scanRulesetName, 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; - } - - /// Deletes a scan ruleset. + /// List azureKeyVaults in account. + /// The request options. /// /// Schema for Response Body: /// { - /// scanRulesetType: "Custom" | "System", - /// status: "Enabled" | "Disabled", - /// version: number, - /// id: string, - /// name: string, - /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" + /// value: [ + /// { + /// id: string, + /// name: string, + /// properties: { + /// baseUrl: string, + /// description: string + /// } + /// } + /// ], + /// nextLink: string, + /// count: number /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1717,57 +1076,44 @@ private HttpMessage CreateCreateOrUpdateScanRuelsetRequest(string scanRulesetNam /// /// /// - /// The String to use. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task DeleteScanRulesetAsync(string scanRulesetName, RequestOptions options = null) + public virtual AsyncPageable GetKeyVaultReferencesAsync(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteScanRulesetRequest(scanRulesetName); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.DeleteScanRuleset"); - scope.Start(); - try + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "PurviewScanningServiceClient.GetKeyVaultReferences"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else + do { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetKeyVaultReferencesRequest() + : CreateGetKeyVaultReferencesNextPageRequest(nextLink); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - /// Deletes a scan ruleset. + /// List azureKeyVaults in account. + /// The request options. /// /// Schema for Response Body: /// { - /// scanRulesetType: "Custom" | "System", - /// status: "Enabled" | "Disabled", - /// version: number, - /// id: string, - /// name: string, - /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" + /// value: [ + /// { + /// id: string, + /// name: string, + /// properties: { + /// baseUrl: string, + /// description: string + /// } + /// } + /// ], + /// nextLink: string, + /// count: number /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1787,78 +1133,41 @@ public virtual async Task DeleteScanRulesetAsync(string scanRulesetNam /// /// /// - /// The String to use. - /// The request options. #pragma warning disable AZC0002 - public virtual Response DeleteScanRuleset(string scanRulesetName, RequestOptions options = null) + public virtual Pageable GetKeyVaultReferences(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteScanRulesetRequest(scanRulesetName); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.DeleteScanRuleset"); - scope.Start(); - try + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "PurviewScanningServiceClient.GetKeyVaultReferences"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else + do { - return message.Response; - } + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetKeyVaultReferencesRequest() + : CreateGetKeyVaultReferencesNextPageRequest(nextLink); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - private HttpMessage CreateDeleteScanRulesetRequest(string scanRulesetName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/scanrulesets/", false); - uri.AppendPath(scanRulesetName, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; } - /// List scan rulesets in Data catalog. + /// List classification rules in Account. + /// The request options. /// /// Schema for Response Body: /// { /// value: [ /// { - /// scanRulesetType: "Custom" | "System", - /// status: "Enabled" | "Disabled", - /// version: number, /// id: string, /// name: string, - /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" + /// kind: "System" | "Custom" /// } /// ], /// nextLink: string, /// count: number /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1878,60 +1187,41 @@ private HttpMessage CreateDeleteScanRulesetRequest(string scanRulesetName) /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetScanRulesetsAsync(RequestOptions options = null) + public virtual AsyncPageable GetClassificationRulesAsync(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetScanRulesetsRequest(); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.GetScanRulesets"); - scope.Start(); - try + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "PurviewScanningServiceClient.GetClassificationRules"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else + do { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetClassificationRulesRequest() + : CreateGetClassificationRulesNextPageRequest(nextLink); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - /// List scan rulesets in Data catalog. + /// List classification rules in Account. + /// The request options. /// /// Schema for Response Body: /// { /// value: [ /// { - /// scanRulesetType: "Custom" | "System", - /// status: "Enabled" | "Disabled", - /// version: number, /// id: string, /// name: string, - /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" + /// kind: "System" | "Custom" /// } /// ], /// nextLink: string, /// count: number /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -1951,74 +1241,90 @@ public virtual async Task GetScanRulesetsAsync(RequestOptions options /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetScanRulesets(RequestOptions options = null) + public virtual Pageable GetClassificationRules(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetScanRulesetsRequest(); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.GetScanRulesets"); - scope.Start(); - try + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "PurviewScanningServiceClient.GetClassificationRules"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else + do { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetClassificationRulesRequest() + : CreateGetClassificationRulesNextPageRequest(nextLink); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - private HttpMessage CreateGetScanRulesetsRequest() - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/scanrulesets", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// List all system scan rulesets for an account. + /// List data sources in Data catalog. + /// The request options. /// /// Schema for Response Body: /// { /// value: [ /// { - /// scanRulesetType: "Custom" | "System", - /// status: "Enabled" | "Disabled", - /// version: number, /// id: string, /// name: string, - /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" + /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI", + /// scans: [ + /// { + /// id: string, + /// name: string, + /// kind: "AzureSubscriptionCredential" | "AzureSubscriptionMsi" | "AzureResourceGroupCredential" | "AzureResourceGroupMsi" | "AzureSynapseWorkspaceCredential" | "AzureSynapseWorkspaceMsi" | "AzureSynapseCredential" | "AzureSynapseMsi" | "AdlsGen1Credential" | "AdlsGen1Msi" | "AdlsGen2Credential" | "AdlsGen2Msi" | "AmazonAccountCredential" | "AmazonS3Credential" | "AmazonS3RoleARN" | "AmazonSqlCredential" | "AzureCosmosDbCredential" | "AzureDataExplorerCredential" | "AzureDataExplorerMsi" | "AzureFileServiceCredential" | "AzureSqlDatabaseCredential" | "AzureSqlDatabaseMsi" | "AmazonPostgreSqlCredential" | "AzurePostgreSqlCredential" | "SqlServerDatabaseCredential" | "AzureSqlDatabaseManagedInstanceCredential" | "AzureSqlDatabaseManagedInstanceMsi" | "AzureSqlDataWarehouseCredential" | "AzureSqlDataWarehouseMsi" | "AzureMySqlCredential" | "AzureStorageCredential" | "AzureStorageMsi" | "TeradataTeradataCredential" | "TeradataTeradataUserPass" | "TeradataUserPass" | "OracleOracleCredential" | "OracleOracleUserPass" | "SapS4HanaSapS4HanaCredential" | "SapS4HanaSapS4HanaUserPass" | "SapEccSapEccCredential" | "SapEccSapEccUserPass" | "PowerBIDelegated" | "PowerBIMsi", + /// scanResults: [ + /// { + /// parentId: string, + /// id: string, + /// resourceId: string, + /// status: string, + /// assetsDiscovered: number, + /// assetsClassified: number, + /// diagnostics: { + /// notifications: [ + /// { + /// message: string, + /// code: number + /// } + /// ], + /// exceptionCountMap: Dictionary<string, number> + /// }, + /// startTime: string (ISO 8601 Format), + /// queuedTime: string (ISO 8601 Format), + /// pipelineStartTime: string (ISO 8601 Format), + /// endTime: string (ISO 8601 Format), + /// scanRulesetVersion: number, + /// scanRulesetType: "Custom" | "System", + /// scanLevelType: "Full" | "Incremental", + /// errorMessage: string, + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [ + /// { + /// code: string, + /// message: string, + /// target: string, + /// details: [ErrorModel] + /// } + /// ] + /// }, + /// runType: string, + /// dataSourceType: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" + /// } + /// ] + /// } + /// ] /// } /// ], /// nextLink: string, /// count: number /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -2038,60 +1344,90 @@ private HttpMessage CreateGetScanRulesetsRequest() /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetSystemRulesetsAsync(RequestOptions options = null) + public virtual AsyncPageable GetDataSourcesAsync(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetSystemRulesetsRequest(); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.GetSystemRulesets"); - scope.Start(); - try + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "PurviewScanningServiceClient.GetDataSources"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else + do { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetDataSourcesRequest() + : CreateGetDataSourcesNextPageRequest(nextLink); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - /// List all system scan rulesets for an account. + /// List data sources in Data catalog. + /// The request options. /// /// Schema for Response Body: /// { /// value: [ /// { - /// scanRulesetType: "Custom" | "System", - /// status: "Enabled" | "Disabled", - /// version: number, /// id: string, /// name: string, - /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" + /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI", + /// scans: [ + /// { + /// id: string, + /// name: string, + /// kind: "AzureSubscriptionCredential" | "AzureSubscriptionMsi" | "AzureResourceGroupCredential" | "AzureResourceGroupMsi" | "AzureSynapseWorkspaceCredential" | "AzureSynapseWorkspaceMsi" | "AzureSynapseCredential" | "AzureSynapseMsi" | "AdlsGen1Credential" | "AdlsGen1Msi" | "AdlsGen2Credential" | "AdlsGen2Msi" | "AmazonAccountCredential" | "AmazonS3Credential" | "AmazonS3RoleARN" | "AmazonSqlCredential" | "AzureCosmosDbCredential" | "AzureDataExplorerCredential" | "AzureDataExplorerMsi" | "AzureFileServiceCredential" | "AzureSqlDatabaseCredential" | "AzureSqlDatabaseMsi" | "AmazonPostgreSqlCredential" | "AzurePostgreSqlCredential" | "SqlServerDatabaseCredential" | "AzureSqlDatabaseManagedInstanceCredential" | "AzureSqlDatabaseManagedInstanceMsi" | "AzureSqlDataWarehouseCredential" | "AzureSqlDataWarehouseMsi" | "AzureMySqlCredential" | "AzureStorageCredential" | "AzureStorageMsi" | "TeradataTeradataCredential" | "TeradataTeradataUserPass" | "TeradataUserPass" | "OracleOracleCredential" | "OracleOracleUserPass" | "SapS4HanaSapS4HanaCredential" | "SapS4HanaSapS4HanaUserPass" | "SapEccSapEccCredential" | "SapEccSapEccUserPass" | "PowerBIDelegated" | "PowerBIMsi", + /// scanResults: [ + /// { + /// parentId: string, + /// id: string, + /// resourceId: string, + /// status: string, + /// assetsDiscovered: number, + /// assetsClassified: number, + /// diagnostics: { + /// notifications: [ + /// { + /// message: string, + /// code: number + /// } + /// ], + /// exceptionCountMap: Dictionary<string, number> + /// }, + /// startTime: string (ISO 8601 Format), + /// queuedTime: string (ISO 8601 Format), + /// pipelineStartTime: string (ISO 8601 Format), + /// endTime: string (ISO 8601 Format), + /// scanRulesetVersion: number, + /// scanRulesetType: "Custom" | "System", + /// scanLevelType: "Full" | "Incremental", + /// errorMessage: string, + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [ + /// { + /// code: string, + /// message: string, + /// target: string, + /// details: [ErrorModel] + /// } + /// ] + /// }, + /// runType: string, + /// dataSourceType: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" + /// } + /// ] + /// } + /// ] /// } /// ], /// nextLink: string, /// count: number /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -2111,68 +1447,90 @@ public virtual async Task GetSystemRulesetsAsync(RequestOptions option /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetSystemRulesets(RequestOptions options = null) + public virtual Pageable GetDataSources(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetSystemRulesetsRequest(); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.GetSystemRulesets"); - scope.Start(); - try + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "PurviewScanningServiceClient.GetDataSources"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) + do { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetDataSourcesRequest() + : CreateGetDataSourcesNextPageRequest(nextLink); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - private HttpMessage CreateGetSystemRulesetsRequest() - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/systemScanRulesets", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Get a system scan ruleset for a data source. + /// Lists the data sources in the account that do not belong to any collection. + /// The request options. /// /// Schema for Response Body: /// { - /// scanRulesetType: "Custom" | "System", - /// status: "Enabled" | "Disabled", - /// version: number, - /// id: string, - /// name: string, - /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" + /// value: [ + /// { + /// id: string, + /// name: string, + /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI", + /// scans: [ + /// { + /// id: string, + /// name: string, + /// kind: "AzureSubscriptionCredential" | "AzureSubscriptionMsi" | "AzureResourceGroupCredential" | "AzureResourceGroupMsi" | "AzureSynapseWorkspaceCredential" | "AzureSynapseWorkspaceMsi" | "AzureSynapseCredential" | "AzureSynapseMsi" | "AdlsGen1Credential" | "AdlsGen1Msi" | "AdlsGen2Credential" | "AdlsGen2Msi" | "AmazonAccountCredential" | "AmazonS3Credential" | "AmazonS3RoleARN" | "AmazonSqlCredential" | "AzureCosmosDbCredential" | "AzureDataExplorerCredential" | "AzureDataExplorerMsi" | "AzureFileServiceCredential" | "AzureSqlDatabaseCredential" | "AzureSqlDatabaseMsi" | "AmazonPostgreSqlCredential" | "AzurePostgreSqlCredential" | "SqlServerDatabaseCredential" | "AzureSqlDatabaseManagedInstanceCredential" | "AzureSqlDatabaseManagedInstanceMsi" | "AzureSqlDataWarehouseCredential" | "AzureSqlDataWarehouseMsi" | "AzureMySqlCredential" | "AzureStorageCredential" | "AzureStorageMsi" | "TeradataTeradataCredential" | "TeradataTeradataUserPass" | "TeradataUserPass" | "OracleOracleCredential" | "OracleOracleUserPass" | "SapS4HanaSapS4HanaCredential" | "SapS4HanaSapS4HanaUserPass" | "SapEccSapEccCredential" | "SapEccSapEccUserPass" | "PowerBIDelegated" | "PowerBIMsi", + /// scanResults: [ + /// { + /// parentId: string, + /// id: string, + /// resourceId: string, + /// status: string, + /// assetsDiscovered: number, + /// assetsClassified: number, + /// diagnostics: { + /// notifications: [ + /// { + /// message: string, + /// code: number + /// } + /// ], + /// exceptionCountMap: Dictionary<string, number> + /// }, + /// startTime: string (ISO 8601 Format), + /// queuedTime: string (ISO 8601 Format), + /// pipelineStartTime: string (ISO 8601 Format), + /// endTime: string (ISO 8601 Format), + /// scanRulesetVersion: number, + /// scanRulesetType: "Custom" | "System", + /// scanLevelType: "Full" | "Incremental", + /// errorMessage: string, + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [ + /// { + /// code: string, + /// message: string, + /// target: string, + /// details: [ErrorModel] + /// } + /// ] + /// }, + /// runType: string, + /// dataSourceType: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" + /// } + /// ] + /// } + /// ] + /// } + /// ], + /// nextLink: string, + /// count: number /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -2192,138 +1550,90 @@ private HttpMessage CreateGetSystemRulesetsRequest() /// /// /// - /// The DataSourceType to use. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetSystemRulesetsForDataSourceAsync(string dataSourceType, RequestOptions options = null) + public virtual AsyncPageable GetUnparentedDataSourcesAsync(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetSystemRulesetsForDataSourceRequest(dataSourceType); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.GetSystemRulesetsForDataSource"); - scope.Start(); - try + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "PurviewScanningServiceClient.GetUnparentedDataSources"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else + do { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetUnparentedDataSourcesRequest() + : CreateGetUnparentedDataSourcesNextPageRequest(nextLink); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - /// Get a system scan ruleset for a data source. + /// Lists the data sources in the account that do not belong to any collection. + /// The request options. /// /// Schema for Response Body: /// { - /// scanRulesetType: "Custom" | "System", - /// status: "Enabled" | "Disabled", - /// version: number, - /// id: string, - /// name: string, - /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" - /// } - /// - /// - /// Schema for Response Error: - /// { - /// error: { - /// code: string, - /// message: string, - /// target: string, - /// details: [ - /// { - /// code: string, - /// message: string, - /// target: string, - /// details: [ErrorModel] - /// } - /// ] - /// } - /// } - /// - /// - /// - /// The DataSourceType to use. - /// The request options. -#pragma warning disable AZC0002 - public virtual Response GetSystemRulesetsForDataSource(string dataSourceType, RequestOptions options = null) -#pragma warning restore AZC0002 - { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetSystemRulesetsForDataSourceRequest(dataSourceType); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.GetSystemRulesetsForDataSource"); - scope.Start(); - try - { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - private HttpMessage CreateGetSystemRulesetsForDataSourceRequest(string dataSourceType) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/systemScanRulesets/datasources/", false); - uri.AppendPath(dataSourceType, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Get a scan ruleset by version. - /// - /// Schema for Response Body: - /// { - /// scanRulesetType: "Custom" | "System", - /// status: "Enabled" | "Disabled", - /// version: number, - /// id: string, - /// name: string, - /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" + /// value: [ + /// { + /// id: string, + /// name: string, + /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI", + /// scans: [ + /// { + /// id: string, + /// name: string, + /// kind: "AzureSubscriptionCredential" | "AzureSubscriptionMsi" | "AzureResourceGroupCredential" | "AzureResourceGroupMsi" | "AzureSynapseWorkspaceCredential" | "AzureSynapseWorkspaceMsi" | "AzureSynapseCredential" | "AzureSynapseMsi" | "AdlsGen1Credential" | "AdlsGen1Msi" | "AdlsGen2Credential" | "AdlsGen2Msi" | "AmazonAccountCredential" | "AmazonS3Credential" | "AmazonS3RoleARN" | "AmazonSqlCredential" | "AzureCosmosDbCredential" | "AzureDataExplorerCredential" | "AzureDataExplorerMsi" | "AzureFileServiceCredential" | "AzureSqlDatabaseCredential" | "AzureSqlDatabaseMsi" | "AmazonPostgreSqlCredential" | "AzurePostgreSqlCredential" | "SqlServerDatabaseCredential" | "AzureSqlDatabaseManagedInstanceCredential" | "AzureSqlDatabaseManagedInstanceMsi" | "AzureSqlDataWarehouseCredential" | "AzureSqlDataWarehouseMsi" | "AzureMySqlCredential" | "AzureStorageCredential" | "AzureStorageMsi" | "TeradataTeradataCredential" | "TeradataTeradataUserPass" | "TeradataUserPass" | "OracleOracleCredential" | "OracleOracleUserPass" | "SapS4HanaSapS4HanaCredential" | "SapS4HanaSapS4HanaUserPass" | "SapEccSapEccCredential" | "SapEccSapEccUserPass" | "PowerBIDelegated" | "PowerBIMsi", + /// scanResults: [ + /// { + /// parentId: string, + /// id: string, + /// resourceId: string, + /// status: string, + /// assetsDiscovered: number, + /// assetsClassified: number, + /// diagnostics: { + /// notifications: [ + /// { + /// message: string, + /// code: number + /// } + /// ], + /// exceptionCountMap: Dictionary<string, number> + /// }, + /// startTime: string (ISO 8601 Format), + /// queuedTime: string (ISO 8601 Format), + /// pipelineStartTime: string (ISO 8601 Format), + /// endTime: string (ISO 8601 Format), + /// scanRulesetVersion: number, + /// scanRulesetType: "Custom" | "System", + /// scanLevelType: "Full" | "Incremental", + /// errorMessage: string, + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [ + /// { + /// code: string, + /// message: string, + /// target: string, + /// details: [ErrorModel] + /// } + /// ] + /// }, + /// runType: string, + /// dataSourceType: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" + /// } + /// ] + /// } + /// ] + /// } + /// ], + /// nextLink: string, + /// count: number /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -2343,56 +1653,44 @@ private HttpMessage CreateGetSystemRulesetsForDataSourceRequest(string dataSourc /// /// /// - /// The Integer to use. - /// The DataSourceType to use. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetSystemRulesetsForVersionAsync(int version, string dataSourceType = null, RequestOptions options = null) + public virtual Pageable GetUnparentedDataSources(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetSystemRulesetsForVersionRequest(version, dataSourceType); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.GetSystemRulesetsForVersion"); - scope.Start(); - try + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "PurviewScanningServiceClient.GetUnparentedDataSources"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) + do { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetUnparentedDataSourcesRequest() + : CreateGetUnparentedDataSourcesNextPageRequest(nextLink); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - /// Get a scan ruleset by version. + /// List scan rulesets in Data catalog. + /// The request options. /// /// Schema for Response Body: /// { - /// scanRulesetType: "Custom" | "System", - /// status: "Enabled" | "Disabled", - /// version: number, - /// id: string, - /// name: string, - /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" + /// value: [ + /// { + /// scanRulesetType: "Custom" | "System", + /// status: "Enabled" | "Disabled", + /// version: number, + /// id: string, + /// name: string, + /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" + /// } + /// ], + /// nextLink: string, + /// count: number /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -2412,75 +1710,44 @@ public virtual async Task GetSystemRulesetsForVersionAsync(int version /// /// /// - /// The Integer to use. - /// The DataSourceType to use. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetSystemRulesetsForVersion(int version, string dataSourceType = null, RequestOptions options = null) + public virtual AsyncPageable GetScanRulesetsAsync(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetSystemRulesetsForVersionRequest(version, dataSourceType); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.GetSystemRulesetsForVersion"); - scope.Start(); - try + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "PurviewScanningServiceClient.GetScanRulesets"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else + do { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - private HttpMessage CreateGetSystemRulesetsForVersionRequest(int version, string dataSourceType) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/systemScanRulesets/versions/", false); - uri.AppendPath(version, true); - if (dataSourceType != null) - { - uri.AppendQuery("dataSourceType", dataSourceType, true); + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetScanRulesetsRequest() + : CreateGetScanRulesetsNextPageRequest(nextLink); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; } - /// Get the latest version of a system scan ruleset. + /// List scan rulesets in Data catalog. + /// The request options. /// /// Schema for Response Body: /// { - /// scanRulesetType: "Custom" | "System", - /// status: "Enabled" | "Disabled", - /// version: number, - /// id: string, - /// name: string, - /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" + /// value: [ + /// { + /// scanRulesetType: "Custom" | "System", + /// status: "Enabled" | "Disabled", + /// version: number, + /// id: string, + /// name: string, + /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" + /// } + /// ], + /// nextLink: string, + /// count: number /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -2500,55 +1767,44 @@ private HttpMessage CreateGetSystemRulesetsForVersionRequest(int version, string /// /// /// - /// The DataSourceType to use. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetLatestSystemRulestesAsync(string dataSourceType = null, RequestOptions options = null) + public virtual Pageable GetScanRulesets(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetLatestSystemRulestesRequest(dataSourceType); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.GetLatestSystemRulestes"); - scope.Start(); - try + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "PurviewScanningServiceClient.GetScanRulesets"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else + do { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetScanRulesetsRequest() + : CreateGetScanRulesetsNextPageRequest(nextLink); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } - /// Get the latest version of a system scan ruleset. + /// List all system scan rulesets for an account. + /// The request options. /// /// Schema for Response Body: /// { - /// scanRulesetType: "Custom" | "System", - /// status: "Enabled" | "Disabled", - /// version: number, - /// id: string, - /// name: string, - /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" + /// value: [ + /// { + /// scanRulesetType: "Custom" | "System", + /// status: "Enabled" | "Disabled", + /// version: number, + /// id: string, + /// name: string, + /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" + /// } + /// ], + /// nextLink: string, + /// count: number /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -2568,61 +1824,27 @@ public virtual async Task GetLatestSystemRulestesAsync(string dataSour /// /// /// - /// The DataSourceType to use. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetLatestSystemRulestes(string dataSourceType = null, RequestOptions options = null) + public virtual AsyncPageable GetSystemRulesetsAsync(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetLatestSystemRulestesRequest(dataSourceType); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.GetLatestSystemRulestes"); - scope.Start(); - try + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "PurviewScanningServiceClient.GetSystemRulesets"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else + do { - return message.Response; - } + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetSystemRulesetsRequest() + : CreateGetSystemRulesetsNextPageRequest(nextLink); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - private HttpMessage CreateGetLatestSystemRulestesRequest(string dataSourceType) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/systemScanRulesets/versions/latest", false); - if (dataSourceType != null) - { - uri.AppendQuery("dataSourceType", dataSourceType, true); - } - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; } - /// List system scan ruleset versions in Data catalog. + /// List all system scan rulesets for an account. + /// The request options. /// /// Schema for Response Body: /// { @@ -2640,7 +1862,6 @@ private HttpMessage CreateGetLatestSystemRulestesRequest(string dataSourceType) /// count: number /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -2660,43 +1881,28 @@ private HttpMessage CreateGetLatestSystemRulestesRequest(string dataSourceType) /// /// /// - /// The DataSourceType to use. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetSystemRulesetsVersionsAsync(string dataSourceType = null, RequestOptions options = null) + public virtual Pageable GetSystemRulesets(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetSystemRulesetsVersionsRequest(dataSourceType); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.GetSystemRulesetsVersions"); - scope.Start(); - try + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "PurviewScanningServiceClient.GetSystemRulesets"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else + do { - return message.Response; - } - } - catch (Exception e) - { - scope.Failed(e); - throw; + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetSystemRulesetsRequest() + : CreateGetSystemRulesetsNextPageRequest(nextLink); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } } /// List system scan ruleset versions in Data catalog. + /// The request options. + /// The DataSourceType to use. Allowed values: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI". /// /// Schema for Response Body: /// { @@ -2714,7 +1920,6 @@ public virtual async Task GetSystemRulesetsVersionsAsync(string dataSo /// count: number /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -2734,58 +1939,485 @@ public virtual async Task GetSystemRulesetsVersionsAsync(string dataSo /// /// /// - /// The DataSourceType to use. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetSystemRulesetsVersions(string dataSourceType = null, RequestOptions options = null) + public virtual AsyncPageable GetSystemRulesetsVersionsAsync(RequestOptions options, string dataSourceType = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetSystemRulesetsVersionsRequest(dataSourceType); - RequestOptions.Apply(options, message); - using var scope = _clientDiagnostics.CreateScope("PurviewScanningServiceClient.GetSystemRulesetsVersions"); - scope.Start(); - try + return PageableHelpers.CreateAsyncPageable(CreateEnumerableAsync, _clientDiagnostics, "PurviewScanningServiceClient.GetSystemRulesetsVersions"); + async IAsyncEnumerable> CreateEnumerableAsync(string nextLink, int? pageSizeHint, [EnumeratorCancellation] CancellationToken cancellationToken = default) { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) + do { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetSystemRulesetsVersionsRequest(dataSourceType) + : CreateGetSystemRulesetsVersionsNextPageRequest(nextLink, dataSourceType); + var page = await LowLevelPageableHelpers.ProcessMessageAsync(_pipeline, message, _clientDiagnostics, options, "value", "nextLink", cancellationToken).ConfigureAwait(false); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); + } + } + + /// List system scan ruleset versions in Data catalog. + /// The request options. + /// The DataSourceType to use. Allowed values: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI". + /// + /// Schema for Response Body: + /// { + /// value: [ + /// { + /// scanRulesetType: "Custom" | "System", + /// status: "Enabled" | "Disabled", + /// version: number, + /// id: string, + /// name: string, + /// kind: "None" | "Collection" | "AzureSubscription" | "AzureResourceGroup" | "AzureSynapseWorkspace" | "AzureSynapse" | "AdlsGen1" | "AdlsGen2" | "AmazonAccount" | "AmazonS3" | "AmazonSql" | "AzureCosmosDb" | "AzureDataExplorer" | "AzureFileService" | "AzureSqlDatabase" | "AmazonPostgreSql" | "AzurePostgreSql" | "SqlServerDatabase" | "AzureSqlDatabaseManagedInstance" | "AzureSqlDataWarehouse" | "AzureMySql" | "AzureStorage" | "Teradata" | "Oracle" | "SapS4Hana" | "SapEcc" | "PowerBI" + /// } + /// ], + /// nextLink: string, + /// count: number + /// } + /// + /// Schema for Response Error: + /// { + /// error: { + /// code: string, + /// message: string, + /// target: string, + /// details: [ + /// { + /// code: string, + /// message: string, + /// target: string, + /// details: [ErrorModel] + /// } + /// ] + /// } + /// } + /// + /// + /// +#pragma warning disable AZC0002 + public virtual Pageable GetSystemRulesetsVersions(RequestOptions options, string dataSourceType = null) +#pragma warning restore AZC0002 + { + return PageableHelpers.CreatePageable(CreateEnumerable, _clientDiagnostics, "PurviewScanningServiceClient.GetSystemRulesetsVersions"); + IEnumerable> CreateEnumerable(string nextLink, int? pageSizeHint) + { + do { - return message.Response; - } + var message = string.IsNullOrEmpty(nextLink) + ? CreateGetSystemRulesetsVersionsRequest(dataSourceType) + : CreateGetSystemRulesetsVersionsNextPageRequest(nextLink, dataSourceType); + var page = LowLevelPageableHelpers.ProcessMessage(_pipeline, message, _clientDiagnostics, options, "value", "nextLink"); + nextLink = page.ContinuationToken; + yield return page; + } while (!string.IsNullOrEmpty(nextLink)); } - catch (Exception e) + } + + internal HttpMessage CreateGetKeyVaultReferenceRequest(string azureKeyVaultName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/azureKeyVaults/", false); + uri.AppendPath(azureKeyVaultName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateOrUpdateKeyVaultReferenceRequest(string azureKeyVaultName, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/azureKeyVaults/", false); + uri.AppendPath(azureKeyVaultName, 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; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateDeleteKeyVaultReferenceRequest(string azureKeyVaultName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/azureKeyVaults/", false); + uri.AppendPath(azureKeyVaultName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200204.Instance; + return message; + } + + internal HttpMessage CreateGetKeyVaultReferencesRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/azureKeyVaults", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetClassificationRulesRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/classificationrules", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetDataSourcesRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/datasources", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetUnparentedDataSourcesRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/listUnparentedDataSources", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetScanRulesetRequest(string scanRulesetName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/scanrulesets/", false); + uri.AppendPath(scanRulesetName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateOrUpdateScanRuelsetRequest(string scanRulesetName, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/scanrulesets/", false); + uri.AppendPath(scanRulesetName, 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; + message.ResponseClassifier = ResponseClassifier200201.Instance; + return message; + } + + internal HttpMessage CreateDeleteScanRulesetRequest(string scanRulesetName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/scanrulesets/", false); + uri.AppendPath(scanRulesetName, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200204.Instance; + return message; + } + + internal HttpMessage CreateGetScanRulesetsRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/scanrulesets", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetSystemRulesetsRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/systemScanRulesets", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetSystemRulesetsForDataSourceRequest(string dataSourceType) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/systemScanRulesets/datasources/", false); + uri.AppendPath(dataSourceType, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetSystemRulesetsForVersionRequest(int version, string dataSourceType) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/systemScanRulesets/versions/", false); + uri.AppendPath(version, true); + if (dataSourceType != null) { - scope.Failed(e); - throw; + uri.AppendQuery("dataSourceType", dataSourceType, true); + } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetLatestSystemRulestesRequest(string dataSourceType) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/systemScanRulesets/versions/latest", false); + if (dataSourceType != null) + { + uri.AppendQuery("dataSourceType", dataSourceType, true); } + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; } - private HttpMessage CreateGetSystemRulesetsVersionsRequest(string dataSourceType) + internal HttpMessage CreateGetSystemRulesetsVersionsRequest(string dataSourceType) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); + uri.Reset(_endpoint); uri.AppendPath("/systemScanRulesets/versions", false); if (dataSourceType != null) { uri.AppendQuery("dataSourceType", dataSourceType, true); } - uri.AppendQuery("api-version", apiVersion, true); + uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; return message; } + + internal HttpMessage CreateGetKeyVaultReferencesNextPageRequest(string nextLink) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetClassificationRulesNextPageRequest(string nextLink) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetDataSourcesNextPageRequest(string nextLink) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetUnparentedDataSourcesNextPageRequest(string nextLink) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetScanRulesetsNextPageRequest(string nextLink) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetSystemRulesetsNextPageRequest(string nextLink) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetSystemRulesetsVersionsNextPageRequest(string nextLink, string dataSourceType) + { + 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"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier200204 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200204(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + 204 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier200201 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200201(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + 201 => false, + _ => true + }; + } + } } } diff --git a/sdk/resourcemanager/Azure.ResourceManager/docs/MigrationGuide.md b/sdk/resourcemanager/Azure.ResourceManager/docs/MigrationGuide.md index 906a31c7a01f6..7ce24634e61b0 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/docs/MigrationGuide.md +++ b/sdk/resourcemanager/Azure.ResourceManager/docs/MigrationGuide.md @@ -289,7 +289,7 @@ VirtualMachineData vmData = new VirtualMachineData(location); vmData.OsProfile.AdminUsername = "admin-username"; vmData.OsProfile.AdminPassword = "admin-p4$$w0rd"; vmData.OsProfile.ComputerName = "computer-name"; -vmData.AvailabilitySet = new Compute.Models.SubResource(); +//vmData.AvailabilitySet = new WritableSubResource(); // Uncomment when package is updated vmData.AvailabilitySet.Id = aset.Id; NetworkInterfaceReference nicReference = new NetworkInterfaceReference(); nicReference.Id = nic.Id; diff --git a/sdk/resourcemanager/Azure.ResourceManager/tests/Samples/MigrationGuide.cs b/sdk/resourcemanager/Azure.ResourceManager/tests/Samples/MigrationGuide.cs index 669dd95455c48..f3d37d393b722 100644 --- a/sdk/resourcemanager/Azure.ResourceManager/tests/Samples/MigrationGuide.cs +++ b/sdk/resourcemanager/Azure.ResourceManager/tests/Samples/MigrationGuide.cs @@ -96,7 +96,7 @@ public async Task MigrationExample() vmData.OsProfile.AdminUsername = "admin-username"; vmData.OsProfile.AdminPassword = "admin-p4$$w0rd"; vmData.OsProfile.ComputerName = "computer-name"; - vmData.AvailabilitySet = new Compute.Models.SubResource(); + //vmData.AvailabilitySet = new WritableSubResource(); // Uncomment when package is updated vmData.AvailabilitySet.Id = aset.Id; NetworkInterfaceReference nicReference = new NetworkInterfaceReference(); nicReference.Id = nic.Id; diff --git a/sdk/resources/Azure.ResourceManager.Resources/api/Azure.ResourceManager.Resources.netstandard2.0.cs b/sdk/resources/Azure.ResourceManager.Resources/api/Azure.ResourceManager.Resources.netstandard2.0.cs index fb37bb963e841..4db552fbb8962 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/api/Azure.ResourceManager.Resources.netstandard2.0.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/api/Azure.ResourceManager.Resources.netstandard2.0.cs @@ -193,9 +193,10 @@ protected DeploymentOperationContainer() { } public virtual Azure.Response GetIfExists(string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task> GetIfExistsAsync(string operationId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } - public partial class DeploymentOperationData : Azure.ResourceManager.Resources.Models.SubResource + public partial class DeploymentOperationData { internal DeploymentOperationData() { } + public string Id { get { throw null; } } public string OperationId { get { throw null; } } public Azure.ResourceManager.Resources.Models.DeploymentOperationProperties Properties { get { throw null; } } } @@ -732,9 +733,10 @@ public partial class AzureResourceBaseAutoGenerated : Azure.ResourceManager.Mode public AzureResourceBaseAutoGenerated() { } public Azure.ResourceManager.Models.SystemData SystemData { get { throw null; } } } - public partial class BasicDependency : Azure.ResourceManager.Resources.Models.SubResource + public partial class BasicDependency { internal BasicDependency() { } + public string Id { get { throw null; } } public string ResourceName { get { throw null; } } public string ResourceType { get { throw null; } } } @@ -797,10 +799,11 @@ public partial class DebugSetting public DebugSetting() { } public string DetailLevel { get { throw null; } set { } } } - public partial class Dependency : Azure.ResourceManager.Resources.Models.SubResource + public partial class Dependency { internal Dependency() { } public System.Collections.Generic.IReadOnlyList DependsOn { get { throw null; } } + public string Id { get { throw null; } } public string ResourceName { get { throw null; } } public string ResourceType { get { throw null; } } } @@ -895,7 +898,7 @@ internal DeploymentPropertiesExtended() { } public Azure.ResourceManager.Models.ErrorDetail Error { get { throw null; } } public Azure.ResourceManager.Resources.Models.DeploymentMode? Mode { get { throw null; } } public Azure.ResourceManager.Resources.Models.OnErrorDeploymentExtended OnErrorDeployment { get { throw null; } } - public System.Collections.Generic.IReadOnlyList OutputResources { get { throw null; } } + public System.Collections.Generic.IReadOnlyList OutputResources { get { throw null; } } public object Outputs { get { throw null; } } public object Parameters { get { throw null; } } public Azure.ResourceManager.Resources.Models.ParametersLink ParametersLink { get { throw null; } } @@ -904,7 +907,7 @@ internal DeploymentPropertiesExtended() { } public string TemplateHash { get { throw null; } } public Azure.ResourceManager.Resources.Models.TemplateLink TemplateLink { get { throw null; } } public System.DateTimeOffset? Timestamp { get { throw null; } } - public System.Collections.Generic.IReadOnlyList ValidatedResources { get { throw null; } } + public System.Collections.Generic.IReadOnlyList ValidatedResources { get { throw null; } } } public partial class DeploymentScriptCreateOperation : Azure.Operation { @@ -1115,10 +1118,11 @@ public IdentityAutoGenerated() { } public static bool operator !=(Azure.ResourceManager.Resources.Models.JitApprovalMode left, Azure.ResourceManager.Resources.Models.JitApprovalMode right) { throw null; } public override string ToString() { throw null; } } - public partial class JitApproverDefinition : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class JitApproverDefinition { - public JitApproverDefinition() { } + public JitApproverDefinition(string id) { } public string DisplayName { get { throw null; } set { } } + public string Id { get { throw null; } set { } } public Azure.ResourceManager.Resources.Models.JitApproverType? Type { get { throw null; } set { } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] @@ -1341,11 +1345,6 @@ public enum ProvisioningOperation public static bool operator !=(Azure.ResourceManager.Resources.Models.ProvisioningState left, Azure.ResourceManager.Resources.Models.ProvisioningState right) { throw null; } public override string ToString() { throw null; } } - public partial class ResourceReference - { - internal ResourceReference() { } - public string Id { get { throw null; } } - } public partial class ScriptLogsList { internal ScriptLogsList() { } @@ -1442,9 +1441,10 @@ public StorageAccountConfiguration() { } public static bool operator !=(Azure.ResourceManager.Resources.Models.TagsPatchOperation left, Azure.ResourceManager.Resources.Models.TagsPatchOperation right) { throw null; } public override string ToString() { throw null; } } - public partial class TargetResource : Azure.ResourceManager.Resources.Models.SubResource + public partial class TargetResource { internal TargetResource() { } + public string Id { get { throw null; } } public string ResourceName { get { throw null; } } public string ResourceType { get { throw null; } } } @@ -1454,10 +1454,11 @@ internal TemplateHashResult() { } public string MinifiedTemplate { get { throw null; } } public string TemplateHash { get { throw null; } } } - public partial class TemplateLink : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class TemplateLink { public TemplateLink() { } public string ContentVersion { get { throw null; } set { } } + public string Id { get { throw null; } set { } } public string QueryString { get { throw null; } set { } } public string RelativePath { get { throw null; } set { } } public string Uri { get { throw null; } set { } } diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/DeploymentOperationData.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/DeploymentOperationData.cs index 739863a8625dc..5e7b9fda56977 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/DeploymentOperationData.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/DeploymentOperationData.cs @@ -10,7 +10,7 @@ namespace Azure.ResourceManager.Resources { /// A class representing the DeploymentOperation data model. - public partial class DeploymentOperationData : SubResource + public partial class DeploymentOperationData { /// Initializes a new instance of DeploymentOperationData. internal DeploymentOperationData() @@ -18,15 +18,18 @@ internal DeploymentOperationData() } /// Initializes a new instance of DeploymentOperationData. - /// The id. + /// Full deployment operation ID. /// Deployment operation ID. /// Deployment properties. - internal DeploymentOperationData(string id, string operationId, DeploymentOperationProperties properties) : base(id) + internal DeploymentOperationData(string id, string operationId, DeploymentOperationProperties properties) { + Id = id; OperationId = operationId; Properties = properties; } + /// Full deployment operation ID. + public string Id { get; } /// Deployment operation ID. public string OperationId { get; } /// Deployment properties. diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/BasicDependency.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/BasicDependency.Serialization.cs index c6f99cd1417da..809fa1ff0ac36 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/BasicDependency.Serialization.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/BasicDependency.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Resources.Models { @@ -15,11 +14,16 @@ public partial class BasicDependency { internal static BasicDependency DeserializeBasicDependency(JsonElement element) { + Optional id = default; Optional resourceType = default; Optional resourceName = default; - ResourceIdentifier id = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("resourceType")) { resourceType = property.Value.GetString(); @@ -30,13 +34,8 @@ internal static BasicDependency DeserializeBasicDependency(JsonElement element) resourceName = property.Value.GetString(); continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } } - return new BasicDependency(id, resourceType.Value, resourceName.Value); + return new BasicDependency(id.Value, resourceType.Value, resourceName.Value); } } } diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/BasicDependency.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/BasicDependency.cs index 0b111a7a06337..4ed2cc3883711 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/BasicDependency.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/BasicDependency.cs @@ -8,7 +8,7 @@ namespace Azure.ResourceManager.Resources.Models { /// Deployment dependency information. - public partial class BasicDependency : SubResource + public partial class BasicDependency { /// Initializes a new instance of BasicDependency. internal BasicDependency() @@ -16,15 +16,18 @@ internal BasicDependency() } /// Initializes a new instance of BasicDependency. - /// The id. + /// The ID of the dependency. /// The dependency resource type. /// The dependency resource name. - internal BasicDependency(string id, string resourceType, string resourceName) : base(id) + internal BasicDependency(string id, string resourceType, string resourceName) { + Id = id; ResourceType = resourceType; ResourceName = resourceName; } + /// The ID of the dependency. + public string Id { get; } /// The dependency resource type. public string ResourceType { get; } /// The dependency resource name. diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/Dependency.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/Dependency.Serialization.cs index 3d3aa38dfa366..01fa3c6d94eb8 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/Dependency.Serialization.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/Dependency.Serialization.cs @@ -8,7 +8,6 @@ using System.Collections.Generic; using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Resources.Models { @@ -17,9 +16,9 @@ public partial class Dependency internal static Dependency DeserializeDependency(JsonElement element) { Optional> dependsOn = default; + Optional id = default; Optional resourceType = default; Optional resourceName = default; - ResourceIdentifier id = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("dependsOn")) @@ -37,6 +36,11 @@ internal static Dependency DeserializeDependency(JsonElement element) dependsOn = array; continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("resourceType")) { resourceType = property.Value.GetString(); @@ -47,13 +51,8 @@ internal static Dependency DeserializeDependency(JsonElement element) resourceName = property.Value.GetString(); continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } } - return new Dependency(id, Optional.ToList(dependsOn), resourceType.Value, resourceName.Value); + return new Dependency(Optional.ToList(dependsOn), id.Value, resourceType.Value, resourceName.Value); } } } diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/Dependency.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/Dependency.cs index fde02782a798f..1fc1ccc3e3b5e 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/Dependency.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/Dependency.cs @@ -11,7 +11,7 @@ namespace Azure.ResourceManager.Resources.Models { /// Deployment dependency information. - public partial class Dependency : SubResource + public partial class Dependency { /// Initializes a new instance of Dependency. internal Dependency() @@ -20,19 +20,22 @@ internal Dependency() } /// Initializes a new instance of Dependency. - /// The id. /// The list of dependencies. + /// The ID of the dependency. /// The dependency resource type. /// The dependency resource name. - internal Dependency(string id, IReadOnlyList dependsOn, string resourceType, string resourceName) : base(id) + internal Dependency(IReadOnlyList dependsOn, string id, string resourceType, string resourceName) { DependsOn = dependsOn; + Id = id; ResourceType = resourceType; ResourceName = resourceName; } /// The list of dependencies. public IReadOnlyList DependsOn { get; } + /// The ID of the dependency. + public string Id { get; } /// The dependency resource type. public string ResourceType { get; } /// The dependency resource name. diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/DeploymentOperationData.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/DeploymentOperationData.Serialization.cs index 97e22035541ae..a9a2b170ae100 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/DeploymentOperationData.Serialization.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/DeploymentOperationData.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; using Azure.ResourceManager.Resources.Models; namespace Azure.ResourceManager.Resources @@ -16,11 +15,16 @@ public partial class DeploymentOperationData { internal static DeploymentOperationData DeserializeDeploymentOperationData(JsonElement element) { + Optional id = default; Optional operationId = default; Optional properties = default; - ResourceIdentifier id = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("operationId")) { operationId = property.Value.GetString(); @@ -36,13 +40,8 @@ internal static DeploymentOperationData DeserializeDeploymentOperationData(JsonE properties = DeploymentOperationProperties.DeserializeDeploymentOperationProperties(property.Value); continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } } - return new DeploymentOperationData(id, operationId.Value, properties.Value); + return new DeploymentOperationData(id.Value, operationId.Value, properties.Value); } } } diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/DeploymentPropertiesExtended.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/DeploymentPropertiesExtended.Serialization.cs index a380570361266..f1e2a6ae32dd3 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/DeploymentPropertiesExtended.Serialization.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/DeploymentPropertiesExtended.Serialization.cs @@ -32,8 +32,8 @@ internal static DeploymentPropertiesExtended DeserializeDeploymentPropertiesExte Optional debugSetting = default; Optional onErrorDeployment = default; Optional templateHash = default; - Optional> outputResources = default; - Optional> validatedResources = default; + Optional> outputResources = default; + Optional> validatedResources = default; Optional error = default; foreach (var property in element.EnumerateObject()) { @@ -179,10 +179,10 @@ internal static DeploymentPropertiesExtended DeserializeDeploymentPropertiesExte property.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(ResourceReference.DeserializeResourceReference(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } outputResources = array; continue; @@ -194,10 +194,10 @@ internal static DeploymentPropertiesExtended DeserializeDeploymentPropertiesExte property.ThrowNonNullablePropertyIsNull(); continue; } - List array = new List(); + List array = new List(); foreach (var item in property.Value.EnumerateArray()) { - array.Add(ResourceReference.DeserializeResourceReference(item)); + array.Add(JsonSerializer.Deserialize(item.ToString())); } validatedResources = array; continue; diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/DeploymentPropertiesExtended.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/DeploymentPropertiesExtended.cs index 16e350d94679a..f87fac928a280 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/DeploymentPropertiesExtended.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/DeploymentPropertiesExtended.cs @@ -21,8 +21,8 @@ internal DeploymentPropertiesExtended() { Providers = new ChangeTrackingList(); Dependencies = new ChangeTrackingList(); - OutputResources = new ChangeTrackingList(); - ValidatedResources = new ChangeTrackingList(); + OutputResources = new ChangeTrackingList(); + ValidatedResources = new ChangeTrackingList(); } /// Initializes a new instance of DeploymentPropertiesExtended. @@ -43,7 +43,7 @@ internal DeploymentPropertiesExtended() /// Array of provisioned resources. /// Array of validated resources. /// The deployment error. - internal DeploymentPropertiesExtended(ProvisioningState? provisioningState, string correlationId, DateTimeOffset? timestamp, string duration, object outputs, IReadOnlyList providers, IReadOnlyList dependencies, TemplateLink templateLink, object parameters, ParametersLink parametersLink, DeploymentMode? mode, DebugSetting debugSetting, OnErrorDeploymentExtended onErrorDeployment, string templateHash, IReadOnlyList outputResources, IReadOnlyList validatedResources, ErrorDetail error) + internal DeploymentPropertiesExtended(ProvisioningState? provisioningState, string correlationId, DateTimeOffset? timestamp, string duration, object outputs, IReadOnlyList providers, IReadOnlyList dependencies, TemplateLink templateLink, object parameters, ParametersLink parametersLink, DeploymentMode? mode, DebugSetting debugSetting, OnErrorDeploymentExtended onErrorDeployment, string templateHash, IReadOnlyList outputResources, IReadOnlyList validatedResources, ErrorDetail error) { ProvisioningState = provisioningState; CorrelationId = correlationId; @@ -93,9 +93,9 @@ internal DeploymentPropertiesExtended(ProvisioningState? provisioningState, stri /// The hash produced for the template. public string TemplateHash { get; } /// Array of provisioned resources. - public IReadOnlyList OutputResources { get; } + public IReadOnlyList OutputResources { get; } /// Array of validated resources. - public IReadOnlyList ValidatedResources { get; } + public IReadOnlyList ValidatedResources { get; } /// The deployment error. public ErrorDetail Error { get; } } diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/JitApproverDefinition.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/JitApproverDefinition.Serialization.cs index 30111bd3e9c67..b1d866b68f2a4 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/JitApproverDefinition.Serialization.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/JitApproverDefinition.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Resources.Models { @@ -16,6 +15,8 @@ public partial class JitApproverDefinition : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); if (Optional.IsDefined(Type)) { writer.WritePropertyName("type"); @@ -26,18 +27,21 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("displayName"); writer.WriteStringValue(DisplayName); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WriteEndObject(); } internal static JitApproverDefinition DeserializeJitApproverDefinition(JsonElement element) { + string id = default; Optional type = default; Optional displayName = default; - ResourceIdentifier id = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("type")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -53,11 +57,6 @@ internal static JitApproverDefinition DeserializeJitApproverDefinition(JsonEleme displayName = property.Value.GetString(); continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } } return new JitApproverDefinition(id, Optional.ToNullable(type), displayName.Value); } diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/JitApproverDefinition.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/JitApproverDefinition.cs index 0ac9bd4e64a1e..0451b994416c7 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/JitApproverDefinition.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/JitApproverDefinition.cs @@ -5,26 +5,39 @@ #nullable disable +using System; + namespace Azure.ResourceManager.Resources.Models { /// JIT approver definition. - public partial class JitApproverDefinition : WritableSubResource + public partial class JitApproverDefinition { /// Initializes a new instance of JitApproverDefinition. - public JitApproverDefinition() + /// The approver service principal Id. + /// is null. + public JitApproverDefinition(string id) { + if (id == null) + { + throw new ArgumentNullException(nameof(id)); + } + + Id = id; } /// Initializes a new instance of JitApproverDefinition. - /// The id. + /// The approver service principal Id. /// The approver type. /// The approver display name. - internal JitApproverDefinition(string id, JitApproverType? type, string displayName) : base(id) + internal JitApproverDefinition(string id, JitApproverType? type, string displayName) { + Id = id; Type = type; DisplayName = displayName; } + /// The approver service principal Id. + public string Id { get; set; } /// The approver type. public JitApproverType? Type { get; set; } /// The approver display name. diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/ResourceReference.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/ResourceReference.Serialization.cs deleted file mode 100644 index 9fb34298cab89..0000000000000 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/ResourceReference.Serialization.cs +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Resources.Models -{ - public partial class ResourceReference - { - internal static ResourceReference DeserializeResourceReference(JsonElement element) - { - Optional id = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - } - return new ResourceReference(id.Value); - } - } -} diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/ResourceReference.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/ResourceReference.cs deleted file mode 100644 index 0a589f2f59b79..0000000000000 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/ResourceReference.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Resources.Models -{ - /// The resource Id model. - public partial class ResourceReference - { - /// Initializes a new instance of ResourceReference. - internal ResourceReference() - { - } - - /// Initializes a new instance of ResourceReference. - /// The fully qualified resource Id. - internal ResourceReference(string id) - { - Id = id; - } - - /// The fully qualified resource Id. - public string Id { get; } - } -} diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/TargetResource.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/TargetResource.Serialization.cs index 769aedd10f3a2..2fa22e859077e 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/TargetResource.Serialization.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/TargetResource.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Resources.Models { @@ -15,11 +14,16 @@ public partial class TargetResource { internal static TargetResource DeserializeTargetResource(JsonElement element) { + Optional id = default; Optional resourceName = default; Optional resourceType = default; - ResourceIdentifier id = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("resourceName")) { resourceName = property.Value.GetString(); @@ -30,13 +34,8 @@ internal static TargetResource DeserializeTargetResource(JsonElement element) resourceType = property.Value.GetString(); continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } } - return new TargetResource(id, resourceName.Value, resourceType.Value); + return new TargetResource(id.Value, resourceName.Value, resourceType.Value); } } } diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/TargetResource.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/TargetResource.cs index 9cd818efc4771..af3306066a12c 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/TargetResource.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/TargetResource.cs @@ -8,7 +8,7 @@ namespace Azure.ResourceManager.Resources.Models { /// Target resource. - public partial class TargetResource : SubResource + public partial class TargetResource { /// Initializes a new instance of TargetResource. internal TargetResource() @@ -16,15 +16,18 @@ internal TargetResource() } /// Initializes a new instance of TargetResource. - /// The id. + /// The ID of the resource. /// The name of the resource. /// The type of the resource. - internal TargetResource(string id, string resourceName, string resourceType) : base(id) + internal TargetResource(string id, string resourceName, string resourceType) { + Id = id; ResourceName = resourceName; ResourceType = resourceType; } + /// The ID of the resource. + public string Id { get; } /// The name of the resource. public string ResourceName { get; } /// The type of the resource. diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/TemplateLink.Serialization.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/TemplateLink.Serialization.cs index a432d36a6e0c1..821821a9e473c 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/TemplateLink.Serialization.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/TemplateLink.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Resources.Models { @@ -21,6 +20,11 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("uri"); writer.WriteStringValue(Uri); } + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(RelativePath)) { writer.WritePropertyName("relativePath"); @@ -36,18 +40,16 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) writer.WritePropertyName("queryString"); writer.WriteStringValue(QueryString); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WriteEndObject(); } internal static TemplateLink DeserializeTemplateLink(JsonElement element) { Optional uri = default; + Optional id = default; Optional relativePath = default; Optional contentVersion = default; Optional queryString = default; - ResourceIdentifier id = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("uri")) @@ -55,6 +57,11 @@ internal static TemplateLink DeserializeTemplateLink(JsonElement element) uri = property.Value.GetString(); continue; } + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("relativePath")) { relativePath = property.Value.GetString(); @@ -70,13 +77,8 @@ internal static TemplateLink DeserializeTemplateLink(JsonElement element) queryString = property.Value.GetString(); continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } } - return new TemplateLink(id, uri.Value, relativePath.Value, contentVersion.Value, queryString.Value); + return new TemplateLink(uri.Value, id.Value, relativePath.Value, contentVersion.Value, queryString.Value); } } } diff --git a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/TemplateLink.cs b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/TemplateLink.cs index f2dc8ebb0e854..527430dd30979 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/TemplateLink.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/src/Generated/Models/TemplateLink.cs @@ -8,7 +8,7 @@ namespace Azure.ResourceManager.Resources.Models { /// Entity representing the reference to the template. - public partial class TemplateLink : WritableSubResource + public partial class TemplateLink { /// Initializes a new instance of TemplateLink. public TemplateLink() @@ -16,14 +16,15 @@ public TemplateLink() } /// Initializes a new instance of TemplateLink. - /// The id. /// The URI of the template to deploy. Use either the uri or id property, but not both. + /// The resource id of a Template Spec. Use either the id or uri property, but not both. /// The relativePath property can be used to deploy a linked template at a location relative to the parent. If the parent template was linked with a TemplateSpec, this will reference an artifact in the TemplateSpec. If the parent was linked with a URI, the child deployment will be a combination of the parent and relativePath URIs. /// If included, must match the ContentVersion in the template. /// The query string (for example, a SAS token) to be used with the templateLink URI. - internal TemplateLink(string id, string uri, string relativePath, string contentVersion, string queryString) : base(id) + internal TemplateLink(string uri, string id, string relativePath, string contentVersion, string queryString) { Uri = uri; + Id = id; RelativePath = relativePath; ContentVersion = contentVersion; QueryString = queryString; @@ -31,6 +32,8 @@ internal TemplateLink(string id, string uri, string relativePath, string content /// The URI of the template to deploy. Use either the uri or id property, but not both. public string Uri { get; set; } + /// The resource id of a Template Spec. Use either the id or uri property, but not both. + public string Id { get; set; } /// The relativePath property can be used to deploy a linked template at a location relative to the parent. If the parent template was linked with a TemplateSpec, this will reference an artifact in the TemplateSpec. If the parent was linked with a URI, the child deployment will be a combination of the parent and relativePath URIs. public string RelativePath { get; set; } /// If included, must match the ContentVersion in the template. diff --git a/sdk/resources/Azure.ResourceManager.Resources/tests/Scenario/DeploymentExtendedContainerTests.cs b/sdk/resources/Azure.ResourceManager.Resources/tests/Scenario/DeploymentExtendedContainerTests.cs index 37274a394df03..7b218db9fe2aa 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/tests/Scenario/DeploymentExtendedContainerTests.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/tests/Scenario/DeploymentExtendedContainerTests.cs @@ -9,6 +9,7 @@ namespace Azure.ResourceManager.Resources.Tests { + [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/24578")] public class DeploymentExtendedContainerTests : ResourcesTestBase { public DeploymentExtendedContainerTests(bool isAsync) diff --git a/sdk/resources/Azure.ResourceManager.Resources/tests/Scenario/DeploymentExtendedOperationsTests.cs b/sdk/resources/Azure.ResourceManager.Resources/tests/Scenario/DeploymentExtendedOperationsTests.cs index f0a74e6b040ab..a71081f3f1d21 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/tests/Scenario/DeploymentExtendedOperationsTests.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/tests/Scenario/DeploymentExtendedOperationsTests.cs @@ -8,6 +8,7 @@ namespace Azure.ResourceManager.Resources.Tests { + [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/24578")] public class DeploymentExtendedOperationsTests : ResourcesTestBase { public DeploymentExtendedOperationsTests(bool isAsync) diff --git a/sdk/resources/Azure.ResourceManager.Resources/tests/Scenario/DeploymentOperationContainerTests.cs b/sdk/resources/Azure.ResourceManager.Resources/tests/Scenario/DeploymentOperationContainerTests.cs index d25dc25232fab..307bf72a0385a 100644 --- a/sdk/resources/Azure.ResourceManager.Resources/tests/Scenario/DeploymentOperationContainerTests.cs +++ b/sdk/resources/Azure.ResourceManager.Resources/tests/Scenario/DeploymentOperationContainerTests.cs @@ -8,6 +8,7 @@ namespace Azure.ResourceManager.Resources.Tests { + [Ignore("https://github.com/Azure/azure-sdk-for-net/issues/24578")] public class DeploymentOperationContainerTests : ResourcesTestBase { public DeploymentOperationContainerTests(bool isAsync) diff --git a/sdk/search/Azure.Search.Documents/src/autorest.md b/sdk/search/Azure.Search.Documents/src/autorest.md index 360b01adfde53..9e465963b1331 100644 --- a/sdk/search/Azure.Search.Documents/src/autorest.md +++ b/sdk/search/Azure.Search.Documents/src/autorest.md @@ -15,6 +15,8 @@ title: SearchServiceClient input-file: - https://github.com/Azure/azure-rest-api-specs/blob/4e3ae66b8b25c53be84bb0c35c3d6d43291f7a40/specification/search/data-plane/Azure.Search/preview/2021-04-30-Preview/searchindex.json - https://github.com/Azure/azure-rest-api-specs/blob/4e3ae66b8b25c53be84bb0c35c3d6d43291f7a40/specification/search/data-plane/Azure.Search/preview/2021-04-30-Preview/searchservice.json +modelerfour: + seal-single-value-enum-by-default: true ``` ## Release hacks diff --git a/sdk/storage/Azure.ResourceManager.Storage/api/Azure.ResourceManager.Storage.netstandard2.0.cs b/sdk/storage/Azure.ResourceManager.Storage/api/Azure.ResourceManager.Storage.netstandard2.0.cs index f2ea1b2bbaece..92bb9f58b96e6 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/api/Azure.ResourceManager.Storage.netstandard2.0.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/api/Azure.ResourceManager.Storage.netstandard2.0.cs @@ -400,7 +400,7 @@ protected PrivateEndpointConnectionContainer() { } public partial class PrivateEndpointConnectionData : Azure.ResourceManager.Models.Resource { public PrivateEndpointConnectionData() { } - public Azure.ResourceManager.Storage.Models.PrivateEndpoint PrivateEndpoint { get { throw null; } set { } } + public Azure.ResourceManager.Resources.Models.SubResource PrivateEndpoint { get { throw null; } set { } } public Azure.ResourceManager.Storage.Models.PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get { throw null; } set { } } public Azure.ResourceManager.Storage.Models.PrivateEndpointConnectionProvisioningState? ProvisioningState { get { throw null; } } } @@ -2051,11 +2051,6 @@ public ObjectReplicationPolicyRule(string sourceContainer, string destinationCon public static bool operator !=(Azure.ResourceManager.Storage.Models.Permissions left, Azure.ResourceManager.Storage.Models.Permissions right) { throw null; } public override string ToString() { throw null; } } - public partial class PrivateEndpoint - { - public PrivateEndpoint() { } - public string Id { get { throw null; } } - } public partial class PrivateEndpointConnectionDeleteOperation : Azure.Operation { protected PrivateEndpointConnectionDeleteOperation() { } @@ -2396,10 +2391,11 @@ public ServiceSasParameters(string canonicalizedResource) { } public static bool operator !=(Azure.ResourceManager.Storage.Models.ShareAccessTier left, Azure.ResourceManager.Storage.Models.ShareAccessTier right) { throw null; } public override string ToString() { throw null; } } - public partial class SignedIdentifier : Azure.ResourceManager.Resources.Models.WritableSubResource + public partial class SignedIdentifier { public SignedIdentifier() { } public Azure.ResourceManager.Storage.Models.AccessPolicy AccessPolicy { get { throw null; } set { } } + public string Id { get { throw null; } set { } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct SignedResource : System.IEquatable diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Models/PrivateEndpoint.Serialization.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Models/PrivateEndpoint.Serialization.cs deleted file mode 100644 index ac11f20cd3eb4..0000000000000 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Models/PrivateEndpoint.Serialization.cs +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.ResourceManager.Storage.Models -{ - public partial class PrivateEndpoint : IUtf8JsonSerializable - { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WriteEndObject(); - } - - internal static PrivateEndpoint DeserializePrivateEndpoint(JsonElement element) - { - Optional id = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } - } - return new PrivateEndpoint(id.Value); - } - } -} diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Models/PrivateEndpoint.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Models/PrivateEndpoint.cs deleted file mode 100644 index 8da80aa6059dc..0000000000000 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Models/PrivateEndpoint.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.ResourceManager.Storage.Models -{ - /// The Private Endpoint resource. - public partial class PrivateEndpoint - { - /// Initializes a new instance of PrivateEndpoint. - public PrivateEndpoint() - { - } - - /// Initializes a new instance of PrivateEndpoint. - /// The ARM identifier for Private Endpoint. - internal PrivateEndpoint(string id) - { - Id = id; - } - - /// The ARM identifier for Private Endpoint. - public string Id { get; } - } -} diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Models/PrivateEndpointConnectionData.Serialization.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Models/PrivateEndpointConnectionData.Serialization.cs index 131856ac5a674..4aeac0ce26985 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Models/PrivateEndpointConnectionData.Serialization.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Models/PrivateEndpointConnectionData.Serialization.cs @@ -8,6 +8,7 @@ using System.Text.Json; using Azure.Core; using Azure.ResourceManager; +using Azure.ResourceManager.Resources.Models; using Azure.ResourceManager.Storage.Models; namespace Azure.ResourceManager.Storage @@ -22,7 +23,7 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) if (Optional.IsDefined(PrivateEndpoint)) { writer.WritePropertyName("privateEndpoint"); - writer.WriteObjectValue(PrivateEndpoint); + JsonSerializer.Serialize(writer, PrivateEndpoint); } if (Optional.IsDefined(PrivateLinkServiceConnectionState)) { @@ -38,7 +39,7 @@ internal static PrivateEndpointConnectionData DeserializePrivateEndpointConnecti ResourceIdentifier id = default; string name = default; ResourceType type = default; - Optional privateEndpoint = default; + Optional privateEndpoint = default; Optional privateLinkServiceConnectionState = default; Optional provisioningState = default; foreach (var property in element.EnumerateObject()) @@ -74,7 +75,7 @@ internal static PrivateEndpointConnectionData DeserializePrivateEndpointConnecti property0.ThrowNonNullablePropertyIsNull(); continue; } - privateEndpoint = PrivateEndpoint.DeserializePrivateEndpoint(property0.Value); + privateEndpoint = JsonSerializer.Deserialize(property0.Value.ToString()); continue; } if (property0.NameEquals("privateLinkServiceConnectionState")) @@ -101,7 +102,7 @@ internal static PrivateEndpointConnectionData DeserializePrivateEndpointConnecti continue; } } - return new PrivateEndpointConnectionData(id, name, type, privateEndpoint.Value, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState)); + return new PrivateEndpointConnectionData(id, name, type, privateEndpoint, privateLinkServiceConnectionState.Value, Optional.ToNullable(provisioningState)); } } } diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Models/SignedIdentifier.Serialization.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Models/SignedIdentifier.Serialization.cs index 2c7814d322c4d..e4daf605f11ba 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Models/SignedIdentifier.Serialization.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Models/SignedIdentifier.Serialization.cs @@ -7,7 +7,6 @@ using System.Text.Json; using Azure.Core; -using Azure.ResourceManager; namespace Azure.ResourceManager.Storage.Models { @@ -16,22 +15,30 @@ public partial class SignedIdentifier : IUtf8JsonSerializable void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); + if (Optional.IsDefined(Id)) + { + writer.WritePropertyName("id"); + writer.WriteStringValue(Id); + } if (Optional.IsDefined(AccessPolicy)) { writer.WritePropertyName("accessPolicy"); writer.WriteObjectValue(AccessPolicy); } - writer.WritePropertyName("id"); - writer.WriteStringValue(Id); writer.WriteEndObject(); } internal static SignedIdentifier DeserializeSignedIdentifier(JsonElement element) { + Optional id = default; Optional accessPolicy = default; - ResourceIdentifier id = default; foreach (var property in element.EnumerateObject()) { + if (property.NameEquals("id")) + { + id = property.Value.GetString(); + continue; + } if (property.NameEquals("accessPolicy")) { if (property.Value.ValueKind == JsonValueKind.Null) @@ -42,13 +49,8 @@ internal static SignedIdentifier DeserializeSignedIdentifier(JsonElement element accessPolicy = AccessPolicy.DeserializeAccessPolicy(property.Value); continue; } - if (property.NameEquals("id")) - { - id = property.Value.GetString(); - continue; - } } - return new SignedIdentifier(id, accessPolicy.Value); + return new SignedIdentifier(id.Value, accessPolicy.Value); } } } diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Models/SignedIdentifier.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Models/SignedIdentifier.cs index e452b327307c0..b38d232f8898a 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Models/SignedIdentifier.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/Models/SignedIdentifier.cs @@ -5,12 +5,10 @@ #nullable disable -using Azure.ResourceManager.Resources.Models; - namespace Azure.ResourceManager.Storage.Models { /// The SignedIdentifier. - public partial class SignedIdentifier : WritableSubResource + public partial class SignedIdentifier { /// Initializes a new instance of SignedIdentifier. public SignedIdentifier() @@ -18,13 +16,16 @@ public SignedIdentifier() } /// Initializes a new instance of SignedIdentifier. - /// The id. + /// An unique identifier of the stored access policy. /// Access policy. - internal SignedIdentifier(string id, AccessPolicy accessPolicy) : base(id) + internal SignedIdentifier(string id, AccessPolicy accessPolicy) { + Id = id; AccessPolicy = accessPolicy; } + /// An unique identifier of the stored access policy. + public string Id { get; set; } /// Access policy. public AccessPolicy AccessPolicy { get; set; } } diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/PrivateEndpointConnectionData.cs b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/PrivateEndpointConnectionData.cs index 057753bdcc894..b8b84b4368955 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/Generated/PrivateEndpointConnectionData.cs +++ b/sdk/storage/Azure.ResourceManager.Storage/src/Generated/PrivateEndpointConnectionData.cs @@ -7,6 +7,7 @@ using Azure.ResourceManager; using Azure.ResourceManager.Models; +using Azure.ResourceManager.Resources.Models; using Azure.ResourceManager.Storage.Models; namespace Azure.ResourceManager.Storage @@ -26,7 +27,7 @@ public PrivateEndpointConnectionData() /// The resource of private end point. /// A collection of information about the state of the connection between service consumer and provider. /// The provisioning state of the private endpoint connection resource. - internal PrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType type, PrivateEndpoint privateEndpoint, PrivateLinkServiceConnectionState privateLinkServiceConnectionState, PrivateEndpointConnectionProvisioningState? provisioningState) : base(id, name, type) + internal PrivateEndpointConnectionData(ResourceIdentifier id, string name, ResourceType type, SubResource privateEndpoint, PrivateLinkServiceConnectionState privateLinkServiceConnectionState, PrivateEndpointConnectionProvisioningState? provisioningState) : base(id, name, type) { PrivateEndpoint = privateEndpoint; PrivateLinkServiceConnectionState = privateLinkServiceConnectionState; @@ -34,7 +35,7 @@ internal PrivateEndpointConnectionData(ResourceIdentifier id, string name, Resou } /// The resource of private end point. - public PrivateEndpoint PrivateEndpoint { get; set; } + public SubResource PrivateEndpoint { get; set; } /// A collection of information about the state of the connection between service consumer and provider. public PrivateLinkServiceConnectionState PrivateLinkServiceConnectionState { get; set; } /// The provisioning state of the private endpoint connection resource. diff --git a/sdk/storage/Azure.ResourceManager.Storage/src/autorest.md b/sdk/storage/Azure.ResourceManager.Storage/src/autorest.md index cf0a96fc3fde0..2771e0b26672b 100644 --- a/sdk/storage/Azure.ResourceManager.Storage/src/autorest.md +++ b/sdk/storage/Azure.ResourceManager.Storage/src/autorest.md @@ -12,6 +12,7 @@ clear-output-folder: true skip-csproj: true modelerfour: lenient-model-deduplication: true + seal-single-value-enum-by-default: true operation-group-to-resource-type: Skus: Microsoft.Storage/skus DeletedAccounts: Microsoft.Storage/deletedAccounts diff --git a/sdk/storage/Azure.Storage.Blobs.Batch/src/autorest.md b/sdk/storage/Azure.Storage.Blobs.Batch/src/autorest.md index e8af150ecf73d..dea5f75228536 100644 --- a/sdk/storage/Azure.Storage.Blobs.Batch/src/autorest.md +++ b/sdk/storage/Azure.Storage.Blobs.Batch/src/autorest.md @@ -5,6 +5,8 @@ Run `dotnet build /t:GenerateCode` to generate code. ``` yaml input-file: - https://raw.githubusercontent.com/Azure/azure-rest-api-specs/f8c3f91da6a9ed64b687711af64e8d70cb500e1d/specification/storage/data-plane/Microsoft.BlobStorage/preview/2020-06-12/blob.json +modelerfour: + seal-single-value-enum-by-default: true ``` ### Batch returns a 202 diff --git a/sdk/storage/Azure.Storage.Blobs/src/autorest.md b/sdk/storage/Azure.Storage.Blobs/src/autorest.md index 2748919cfe5e3..e2aa4bb921b3a 100644 --- a/sdk/storage/Azure.Storage.Blobs/src/autorest.md +++ b/sdk/storage/Azure.Storage.Blobs/src/autorest.md @@ -7,6 +7,8 @@ input-file: - https://raw.githubusercontent.com/Azure/azure-rest-api-specs/aacb979c4b6ed682c6f29f4e62ae024c154befe7/specification/storage/data-plane/Microsoft.BlobStorage/preview/2020-12-06/blob.json # https://github.com/Azure/autorest/issues/4075 skip-semantics-validation: true +modelerfour: + seal-single-value-enum-by-default: true ``` ### Don't include container name or blob in path - we have direct URIs. diff --git a/sdk/storage/Azure.Storage.Files.DataLake/src/autorest.md b/sdk/storage/Azure.Storage.Files.DataLake/src/autorest.md index 744ada444adca..f658bc8ddc24b 100644 --- a/sdk/storage/Azure.Storage.Files.DataLake/src/autorest.md +++ b/sdk/storage/Azure.Storage.Files.DataLake/src/autorest.md @@ -5,6 +5,8 @@ Run `dotnet build /t:GenerateCode` to generate code. ``` yaml input-file: - https://raw.githubusercontent.com/Azure/azure-rest-api-specs/4a93ab078fba7f087116283c8ed169f9b8e30397/specification/storage/data-plane/Microsoft.StorageDataLake/stable/2020-06-12/DataLakeStorage.json +modelerfour: + seal-single-value-enum-by-default: true ``` ### Don't include file system or path in path - we have direct URIs. diff --git a/sdk/storage/Azure.Storage.Files.Shares/src/autorest.md b/sdk/storage/Azure.Storage.Files.Shares/src/autorest.md index 84fc167450743..2c8005057c609 100644 --- a/sdk/storage/Azure.Storage.Files.Shares/src/autorest.md +++ b/sdk/storage/Azure.Storage.Files.Shares/src/autorest.md @@ -7,6 +7,8 @@ input-file: - https://raw.githubusercontent.com/Azure/azure-rest-api-specs/4a93ab078fba7f087116283c8ed169f9b8e30397/specification/storage/data-plane/Microsoft.FileStorage/preview/2020-10-02/file.json # https://github.com/Azure/autorest/issues/4075 skip-semantics-validation: true +modelerfour: + seal-single-value-enum-by-default: true ``` ### Don't include share name, directory, or file name in path - we have direct URIs. diff --git a/sdk/storage/Azure.Storage.Queues/src/autorest.md b/sdk/storage/Azure.Storage.Queues/src/autorest.md index f7b008754c8b9..dac9b47913828 100644 --- a/sdk/storage/Azure.Storage.Queues/src/autorest.md +++ b/sdk/storage/Azure.Storage.Queues/src/autorest.md @@ -7,6 +7,8 @@ input-file: - https://raw.githubusercontent.com/Azure/azure-rest-api-specs/4a93ab078fba7f087116283c8ed169f9b8e30397/specification/storage/data-plane/Microsoft.QueueStorage/preview/2018-03-28/queue.json # https://github.com/Azure/autorest/issues/4075 skip-semantics-validation: true +modelerfour: + seal-single-value-enum-by-default: true ``` ### Don't include queue name or message ID path - we have direct URIs. diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/README.md b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/README.md index b443c57c068eb..707f56adc1c84 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/README.md +++ b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/README.md @@ -98,7 +98,7 @@ RoleDefinitionsClient definitionsClient = new RoleDefinitionsClient(new Uri(endp First, you need to the determine the ID of the role you wish to assign, along with the ID of the principal you wish to assign that role. ```C# Snippet:PrepCreateRoleAssignment -Response roleDefinitionsReponse = definitionsClient.ListRoleDefinitions(); +Response roleDefinitionsReponse = definitionsClient.ListRoleDefinitions(new()); BinaryData roleDefinitionsContent = roleDefinitionsReponse.Content; JsonDocument roleDefinitionsJson = JsonDocument.Parse(roleDefinitionsContent.ToMemory()); @@ -136,7 +136,7 @@ string addedRoleAssignmentId = addedRoleAssignmentJson.RootElement.GetProperty(" You can retrieve the details of a role assignment by calling `GetRoleAssignmentById`, passing in the assignment ID. ```C# Snippet:RetrieveRoleAssignment -Response roleAssignmentResponse = roleAssignmentsClient.GetRoleAssignmentById(addedRoleAssignmentId); +Response roleAssignmentResponse = roleAssignmentsClient.GetRoleAssignmentById(addedRoleAssignmentId, new()); BinaryData roleAssignmentContent = roleAssignmentResponse.Content; JsonDocument roleAssignmentJson = JsonDocument.Parse(roleAssignmentContent.ToMemory()); string roleAssignmentRoleDefinitionId = roleAssignmentJson.RootElement.GetProperty("roleDefinitionId").ToString(); @@ -149,7 +149,7 @@ Console.WriteLine($"Role {roleAssignmentRoleDefinitionId} is assigned to {roleAs To enumerate all role assignments in the Synapse workspace you can call `ListRoleAssignments`. ```C# Snippet:ListRoleAssignments -Response roleAssignmentsResponse = roleAssignmentsClient.ListRoleAssignments(); +Response roleAssignmentsResponse = roleAssignmentsClient.ListRoleAssignments(new()); BinaryData roleAssignmentsContent = roleAssignmentsResponse.Content; JsonDocument roleAssignmentsJson = JsonDocument.Parse(roleAssignmentsContent.ToMemory()); diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/api/Azure.Analytics.Synapse.AccessControl.netstandard2.0.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/api/Azure.Analytics.Synapse.AccessControl.netstandard2.0.cs index cdfc6f089f7b1..435358cbba4c2 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/api/Azure.Analytics.Synapse.AccessControl.netstandard2.0.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/api/Azure.Analytics.Synapse.AccessControl.netstandard2.0.cs @@ -19,21 +19,21 @@ public RoleAssignmentsClient(System.Uri endpoint, Azure.Core.TokenCredential cre public virtual System.Threading.Tasks.Task CreateRoleAssignmentAsync(string roleAssignmentId, Azure.Core.RequestContent content, Azure.RequestOptions options = null) { throw null; } public virtual Azure.Response DeleteRoleAssignmentById(string roleAssignmentId, string scope = null, Azure.RequestOptions options = null) { throw null; } public virtual System.Threading.Tasks.Task DeleteRoleAssignmentByIdAsync(string roleAssignmentId, string scope = null, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response GetRoleAssignmentById(string roleAssignmentId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetRoleAssignmentByIdAsync(string roleAssignmentId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response ListRoleAssignments(string roleId = null, string principalId = null, string scope = null, string continuationToken = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task ListRoleAssignmentsAsync(string roleId = null, string principalId = null, string scope = null, string continuationToken = null, Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response GetRoleAssignmentById(string roleAssignmentId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetRoleAssignmentByIdAsync(string roleAssignmentId, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response ListRoleAssignments(Azure.RequestOptions options, string roleId = null, string principalId = null, string scope = null, string continuationToken = null) { throw null; } + public virtual System.Threading.Tasks.Task ListRoleAssignmentsAsync(Azure.RequestOptions options, string roleId = null, string principalId = null, string scope = null, string continuationToken = null) { throw null; } } public partial class RoleDefinitionsClient { protected RoleDefinitionsClient() { } public RoleDefinitionsClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Analytics.Synapse.AccessControl.AccessControlClientOptions options = null) { } public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } - public virtual Azure.Response GetRoleDefinitionById(string roleDefinitionId, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task GetRoleDefinitionByIdAsync(string roleDefinitionId, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response ListRoleDefinitions(bool? isBuiltIn = default(bool?), string scope = null, Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task ListRoleDefinitionsAsync(bool? isBuiltIn = default(bool?), string scope = null, Azure.RequestOptions options = null) { throw null; } - public virtual Azure.Response ListScopes(Azure.RequestOptions options = null) { throw null; } - public virtual System.Threading.Tasks.Task ListScopesAsync(Azure.RequestOptions options = null) { throw null; } + public virtual Azure.Response GetRoleDefinitionById(string roleDefinitionId, Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task GetRoleDefinitionByIdAsync(string roleDefinitionId, Azure.RequestOptions options) { throw null; } + public virtual Azure.Response ListRoleDefinitions(Azure.RequestOptions options, bool? isBuiltIn = default(bool?), string scope = null) { throw null; } + public virtual System.Threading.Tasks.Task ListRoleDefinitionsAsync(Azure.RequestOptions options, bool? isBuiltIn = default(bool?), string scope = null) { throw null; } + public virtual Azure.Response ListScopes(Azure.RequestOptions options) { throw null; } + public virtual System.Threading.Tasks.Task ListScopesAsync(Azure.RequestOptions options) { throw null; } } } diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/samples/Sample1_HelloWorld.md b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/samples/Sample1_HelloWorld.md index d6c68dd992be0..3efa5f49ffb7d 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/samples/Sample1_HelloWorld.md +++ b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/samples/Sample1_HelloWorld.md @@ -19,7 +19,7 @@ RoleDefinitionsClient definitionsClient = new RoleDefinitionsClient(new Uri(endp First, you need to the determine the ID of the role you wish to assign, along with the ID of the principal you wish to assign that role. ```C# Snippet:PrepCreateRoleAssignment -Response roleDefinitionsReponse = definitionsClient.ListRoleDefinitions(); +Response roleDefinitionsReponse = definitionsClient.ListRoleDefinitions(new()); BinaryData roleDefinitionsContent = roleDefinitionsReponse.Content; JsonDocument roleDefinitionsJson = JsonDocument.Parse(roleDefinitionsContent.ToMemory()); @@ -57,7 +57,7 @@ string addedRoleAssignmentId = addedRoleAssignmentJson.RootElement.GetProperty(" To retrieve the details of assignment call `GetRoleAssignmentById`, passing in the assignment ID. ```C# Snippet:RetrieveRoleAssignment -Response roleAssignmentResponse = roleAssignmentsClient.GetRoleAssignmentById(addedRoleAssignmentId); +Response roleAssignmentResponse = roleAssignmentsClient.GetRoleAssignmentById(addedRoleAssignmentId, new()); BinaryData roleAssignmentContent = roleAssignmentResponse.Content; JsonDocument roleAssignmentJson = JsonDocument.Parse(roleAssignmentContent.ToMemory()); string roleAssignmentRoleDefinitionId = roleAssignmentJson.RootElement.GetProperty("roleDefinitionId").ToString(); @@ -70,7 +70,7 @@ Console.WriteLine($"Role {roleAssignmentRoleDefinitionId} is assigned to {roleAs To enumerate all role assignments in the Synapse workspace call `GetRoleAssignments`. ```C# Snippet:ListRoleAssignments -Response roleAssignmentsResponse = roleAssignmentsClient.ListRoleAssignments(); +Response roleAssignmentsResponse = roleAssignmentsClient.ListRoleAssignments(new()); BinaryData roleAssignmentsContent = roleAssignmentsResponse.Content; JsonDocument roleAssignmentsJson = JsonDocument.Parse(roleAssignmentsContent.ToMemory()); diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Azure.Analytics.Synapse.AccessControl.csproj b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Azure.Analytics.Synapse.AccessControl.csproj index 7c28cad9e713f..8479e9cb683a2 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Azure.Analytics.Synapse.AccessControl.csproj +++ b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Azure.Analytics.Synapse.AccessControl.csproj @@ -5,7 +5,7 @@ 1.0.0-preview.6 Microsoft Azure Synapse Access Control;$(PackageCommonTags) $(RequiredTargetFrameworks) - + $(DefineConstants);EXPERIMENTAL $(NoWarn); SA1649; diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/RoleAssignmentsClient.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/RoleAssignmentsClient.cs index 2ddfb5e60f20c..3b9536df769ee 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/RoleAssignmentsClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/RoleAssignmentsClient.cs @@ -16,14 +16,16 @@ namespace Azure.Analytics.Synapse.AccessControl /// The RoleAssignments service client. public partial class RoleAssignmentsClient { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://dev.azuresynapse.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://dev.azuresynapse.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of RoleAssignmentsClient for mocking. protected RoleAssignmentsClient() @@ -34,6 +36,7 @@ protected RoleAssignmentsClient() /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. + /// or is null. public RoleAssignmentsClient(Uri endpoint, TokenCredential credential, AccessControlClientOptions options = null) { if (endpoint == null) @@ -46,15 +49,18 @@ public RoleAssignmentsClient(Uri endpoint, TokenCredential credential, AccessCon } options ??= new AccessControlClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); _tokenCredential = credential; - var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); - _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { authPolicy }, new ResponseClassifier()); - this.endpoint = endpoint; - apiVersion = options.Version; + _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; } /// Check if the given principalId has access to perform list of actions at a given scope. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -71,7 +77,6 @@ public RoleAssignmentsClient(Uri endpoint, TokenCredential credential, AccessCon /// scope: string (required) /// } /// - /// /// Schema for Response Body: /// { /// accessDecisions: [ @@ -89,7 +94,6 @@ public RoleAssignmentsClient(Uri endpoint, TokenCredential credential, AccessCon /// ] /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -108,34 +112,16 @@ public RoleAssignmentsClient(Uri endpoint, TokenCredential credential, AccessCon /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task CheckPrincipalAccessAsync(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCheckPrincipalAccessRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("RoleAssignmentsClient.CheckPrincipalAccess"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCheckPrincipalAccessRequest(content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -145,6 +131,9 @@ public virtual async Task CheckPrincipalAccessAsync(RequestContent con } /// Check if the given principalId has access to perform list of actions at a given scope. + /// The content to send as the body of the request. + /// The request options. + /// is null. /// /// Schema for Request Body: /// { @@ -161,7 +150,6 @@ public virtual async Task CheckPrincipalAccessAsync(RequestContent con /// scope: string (required) /// } /// - /// /// Schema for Response Body: /// { /// accessDecisions: [ @@ -179,7 +167,6 @@ public virtual async Task CheckPrincipalAccessAsync(RequestContent con /// ] /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -198,34 +185,16 @@ public virtual async Task CheckPrincipalAccessAsync(RequestContent con /// /// /// - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response CheckPrincipalAccess(RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCheckPrincipalAccessRequest(content); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("RoleAssignmentsClient.CheckPrincipalAccess"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCheckPrincipalAccessRequest(content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -234,23 +203,12 @@ public virtual Response CheckPrincipalAccess(RequestContent content, RequestOpti } } - private HttpMessage CreateCheckPrincipalAccessRequest(RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/checkAccessSynapseRbac", false); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json, text/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - /// List role assignments. + /// The request options. + /// Synapse Built-In Role Id. + /// Object ID of the AAD principal or security-group. + /// Scope of the Synapse Built-in Role. + /// Continuation token. /// /// Schema for Response Body: /// { @@ -266,7 +224,6 @@ private HttpMessage CreateCheckPrincipalAccessRequest(RequestContent content) /// ] /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -285,37 +242,16 @@ private HttpMessage CreateCheckPrincipalAccessRequest(RequestContent content) /// /// /// - /// Synapse Built-In Role Id. - /// Object ID of the AAD principal or security-group. - /// Scope of the Synapse Built-in Role. - /// Continuation token. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task ListRoleAssignmentsAsync(string roleId = null, string principalId = null, string scope = null, string continuationToken = null, RequestOptions options = null) + public virtual async Task ListRoleAssignmentsAsync(RequestOptions options, string roleId = null, string principalId = null, string scope = null, string continuationToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRoleAssignmentsRequest(roleId, principalId, scope, continuationToken); - RequestOptions.Apply(options, message); using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsClient.ListRoleAssignments"); scope0.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateListRoleAssignmentsRequest(roleId, principalId, scope, continuationToken); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -325,6 +261,11 @@ public virtual async Task ListRoleAssignmentsAsync(string roleId = nul } /// List role assignments. + /// The request options. + /// Synapse Built-In Role Id. + /// Object ID of the AAD principal or security-group. + /// Scope of the Synapse Built-in Role. + /// Continuation token. /// /// Schema for Response Body: /// { @@ -340,7 +281,6 @@ public virtual async Task ListRoleAssignmentsAsync(string roleId = nul /// ] /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -359,37 +299,16 @@ public virtual async Task ListRoleAssignmentsAsync(string roleId = nul /// /// /// - /// Synapse Built-In Role Id. - /// Object ID of the AAD principal or security-group. - /// Scope of the Synapse Built-in Role. - /// Continuation token. - /// The request options. #pragma warning disable AZC0002 - public virtual Response ListRoleAssignments(string roleId = null, string principalId = null, string scope = null, string continuationToken = null, RequestOptions options = null) + public virtual Response ListRoleAssignments(RequestOptions options, string roleId = null, string principalId = null, string scope = null, string continuationToken = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRoleAssignmentsRequest(roleId, principalId, scope, continuationToken); - RequestOptions.Apply(options, message); using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsClient.ListRoleAssignments"); scope0.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateListRoleAssignmentsRequest(roleId, principalId, scope, continuationToken); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -398,37 +317,11 @@ public virtual Response ListRoleAssignments(string roleId = null, string princip } } - private HttpMessage CreateListRoleAssignmentsRequest(string roleId, string principalId, string scope, string continuationToken) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/roleAssignments", false); - uri.AppendQuery("api-version", apiVersion, true); - if (roleId != null) - { - uri.AppendQuery("roleId", roleId, true); - } - if (principalId != null) - { - uri.AppendQuery("principalId", principalId, true); - } - if (scope != null) - { - uri.AppendQuery("scope", scope, true); - } - request.Uri = uri; - if (continuationToken != null) - { - request.Headers.Add("x-ms-continuation", continuationToken); - } - request.Headers.Add("Accept", "application/json, text/json"); - return message; - } - /// Create role assignment. + /// The ID of the role assignment. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// /// Schema for Request Body: /// { @@ -438,7 +331,6 @@ private HttpMessage CreateListRoleAssignmentsRequest(string roleId, string princ /// principalType: string /// } /// - /// /// Schema for Response Body: /// { /// id: string, @@ -448,7 +340,6 @@ private HttpMessage CreateListRoleAssignmentsRequest(string roleId, string princ /// principalType: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -467,35 +358,16 @@ private HttpMessage CreateListRoleAssignmentsRequest(string roleId, string princ /// /// /// - /// The ID of the role assignment. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual async Task CreateRoleAssignmentAsync(string roleAssignmentId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateRoleAssignmentRequest(roleAssignmentId, content); - RequestOptions.Apply(options, message); using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsClient.CreateRoleAssignment"); scope0.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateRoleAssignmentRequest(roleAssignmentId, content); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -505,6 +377,10 @@ public virtual async Task CreateRoleAssignmentAsync(string roleAssignm } /// Create role assignment. + /// The ID of the role assignment. + /// The content to send as the body of the request. + /// The request options. + /// or is null. /// /// Schema for Request Body: /// { @@ -514,7 +390,6 @@ public virtual async Task CreateRoleAssignmentAsync(string roleAssignm /// principalType: string /// } /// - /// /// Schema for Response Body: /// { /// id: string, @@ -524,7 +399,6 @@ public virtual async Task CreateRoleAssignmentAsync(string roleAssignm /// principalType: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -543,35 +417,16 @@ public virtual async Task CreateRoleAssignmentAsync(string roleAssignm /// /// /// - /// The ID of the role assignment. - /// The content to send as the body of the request. - /// The request options. #pragma warning disable AZC0002 public virtual Response CreateRoleAssignment(string roleAssignmentId, RequestContent content, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCreateRoleAssignmentRequest(roleAssignmentId, content); - RequestOptions.Apply(options, message); using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsClient.CreateRoleAssignment"); scope0.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCreateRoleAssignmentRequest(roleAssignmentId, content); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -580,24 +435,10 @@ public virtual Response CreateRoleAssignment(string roleAssignmentId, RequestCon } } - private HttpMessage CreateCreateRoleAssignmentRequest(string roleAssignmentId, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/roleAssignments/", false); - uri.AppendPath(roleAssignmentId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json, text/json"); - request.Headers.Add("Content-Type", "application/json"); - request.Content = content; - return message; - } - /// Get role assignment by role assignment Id. + /// The ID of the role assignment. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -608,7 +449,6 @@ private HttpMessage CreateCreateRoleAssignmentRequest(string roleAssignmentId, R /// principalType: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -627,34 +467,16 @@ private HttpMessage CreateCreateRoleAssignmentRequest(string roleAssignmentId, R /// /// /// - /// The ID of the role assignment. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetRoleAssignmentByIdAsync(string roleAssignmentId, RequestOptions options = null) + public virtual async Task GetRoleAssignmentByIdAsync(string roleAssignmentId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRoleAssignmentByIdRequest(roleAssignmentId); - RequestOptions.Apply(options, message); using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsClient.GetRoleAssignmentById"); scope0.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRoleAssignmentByIdRequest(roleAssignmentId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -664,6 +486,9 @@ public virtual async Task GetRoleAssignmentByIdAsync(string roleAssign } /// Get role assignment by role assignment Id. + /// The ID of the role assignment. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -674,7 +499,6 @@ public virtual async Task GetRoleAssignmentByIdAsync(string roleAssign /// principalType: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -693,34 +517,16 @@ public virtual async Task GetRoleAssignmentByIdAsync(string roleAssign /// /// /// - /// The ID of the role assignment. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetRoleAssignmentById(string roleAssignmentId, RequestOptions options = null) + public virtual Response GetRoleAssignmentById(string roleAssignmentId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRoleAssignmentByIdRequest(roleAssignmentId); - RequestOptions.Apply(options, message); using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsClient.GetRoleAssignmentById"); scope0.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRoleAssignmentByIdRequest(roleAssignmentId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -729,22 +535,11 @@ public virtual Response GetRoleAssignmentById(string roleAssignmentId, RequestOp } } - private HttpMessage CreateGetRoleAssignmentByIdRequest(string roleAssignmentId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/roleAssignments/", false); - uri.AppendPath(roleAssignmentId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json, text/json"); - return message; - } - /// Delete role assignment by role assignment Id. + /// The ID of the role assignment. + /// Scope of the Synapse Built-in Role. + /// The request options. + /// is null. /// /// Schema for Response Error: /// { @@ -764,36 +559,16 @@ private HttpMessage CreateGetRoleAssignmentByIdRequest(string roleAssignmentId) /// /// /// - /// The ID of the role assignment. - /// Scope of the Synapse Built-in Role. - /// The request options. #pragma warning disable AZC0002 public virtual async Task DeleteRoleAssignmentByIdAsync(string roleAssignmentId, string scope = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRoleAssignmentByIdRequest(roleAssignmentId, scope); - RequestOptions.Apply(options, message); using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsClient.DeleteRoleAssignmentById"); scope0.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 204: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRoleAssignmentByIdRequest(roleAssignmentId, scope); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -803,6 +578,10 @@ public virtual async Task DeleteRoleAssignmentByIdAsync(string roleAss } /// Delete role assignment by role assignment Id. + /// The ID of the role assignment. + /// Scope of the Synapse Built-in Role. + /// The request options. + /// is null. /// /// Schema for Response Error: /// { @@ -822,36 +601,16 @@ public virtual async Task DeleteRoleAssignmentByIdAsync(string roleAss /// /// /// - /// The ID of the role assignment. - /// Scope of the Synapse Built-in Role. - /// The request options. #pragma warning disable AZC0002 public virtual Response DeleteRoleAssignmentById(string roleAssignmentId, string scope = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateDeleteRoleAssignmentByIdRequest(roleAssignmentId, scope); - RequestOptions.Apply(options, message); using var scope0 = _clientDiagnostics.CreateScope("RoleAssignmentsClient.DeleteRoleAssignmentById"); scope0.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 204: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateDeleteRoleAssignmentByIdRequest(roleAssignmentId, scope); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -860,23 +619,134 @@ public virtual Response DeleteRoleAssignmentById(string roleAssignmentId, string } } - private HttpMessage CreateDeleteRoleAssignmentByIdRequest(string roleAssignmentId, string scope) + internal HttpMessage CreateCheckPrincipalAccessRequest(RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/checkAccessSynapseRbac", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json, text/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateListRoleAssignmentsRequest(string roleId, string principalId, string scope, string continuationToken) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/roleAssignments", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (roleId != null) + { + uri.AppendQuery("roleId", roleId, true); + } + if (principalId != null) + { + uri.AppendQuery("principalId", principalId, true); + } + if (scope != null) + { + uri.AppendQuery("scope", scope, true); + } + request.Uri = uri; + if (continuationToken != null) + { + request.Headers.Add("x-ms-continuation", continuationToken); + } + request.Headers.Add("Accept", "application/json, text/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateCreateRoleAssignmentRequest(string roleAssignmentId, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/roleAssignments/", false); + uri.AppendPath(roleAssignmentId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json, text/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetRoleAssignmentByIdRequest(string roleAssignmentId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/roleAssignments/", false); + uri.AppendPath(roleAssignmentId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json, text/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateDeleteRoleAssignmentByIdRequest(string roleAssignmentId, string scope) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Delete; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); + uri.Reset(_endpoint); uri.AppendPath("/roleAssignments/", false); uri.AppendPath(roleAssignmentId, true); - uri.AppendQuery("api-version", apiVersion, true); + uri.AppendQuery("api-version", _apiVersion, true); if (scope != null) { uri.AppendQuery("scope", scope, true); } request.Uri = uri; request.Headers.Add("Accept", "application/json, text/json"); + message.ResponseClassifier = ResponseClassifier200204.Instance; return message; } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier200204 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200204(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + 204 => false, + _ => true + }; + } + } } } diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/RoleDefinitionsClient.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/RoleDefinitionsClient.cs index 68b372869f421..626c435b5e6b4 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/RoleDefinitionsClient.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/src/Generated/RoleDefinitionsClient.cs @@ -16,14 +16,16 @@ namespace Azure.Analytics.Synapse.AccessControl /// The RoleDefinitions service client. public partial class RoleDefinitionsClient { - /// The HTTP pipeline for sending and receiving REST requests and responses. - public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private readonly string[] AuthorizationScopes = { "https://dev.azuresynapse.net/.default" }; + private static readonly string[] AuthorizationScopes = { "https://dev.azuresynapse.net/.default" }; private readonly TokenCredential _tokenCredential; - private Uri endpoint; - private readonly string apiVersion; + + private readonly HttpPipeline _pipeline; private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline { get => _pipeline; } /// Initializes a new instance of RoleDefinitionsClient for mocking. protected RoleDefinitionsClient() @@ -34,6 +36,7 @@ protected RoleDefinitionsClient() /// The workspace development endpoint, for example https://myworkspace.dev.azuresynapse.net. /// A credential used to authenticate to an Azure Service. /// The options for configuring the client. + /// or is null. public RoleDefinitionsClient(Uri endpoint, TokenCredential credential, AccessControlClientOptions options = null) { if (endpoint == null) @@ -46,15 +49,18 @@ public RoleDefinitionsClient(Uri endpoint, TokenCredential credential, AccessCon } options ??= new AccessControlClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); _tokenCredential = credential; - var authPolicy = new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes); - _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { authPolicy }, new ResponseClassifier()); - this.endpoint = endpoint; - apiVersion = options.Version; + _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; } /// List role definitions. + /// The request options. + /// Is a Synapse Built-In Role or not. + /// Scope of the Synapse Built-in Role. /// /// Schema for Response Body: /// { @@ -74,7 +80,6 @@ public RoleDefinitionsClient(Uri endpoint, TokenCredential credential, AccessCon /// availabilityStatus: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -93,35 +98,16 @@ public RoleDefinitionsClient(Uri endpoint, TokenCredential credential, AccessCon /// /// /// - /// Is a Synapse Built-In Role or not. - /// Scope of the Synapse Built-in Role. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task ListRoleDefinitionsAsync(bool? isBuiltIn = null, string scope = null, RequestOptions options = null) + public virtual async Task ListRoleDefinitionsAsync(RequestOptions options, bool? isBuiltIn = null, string scope = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRoleDefinitionsRequest(isBuiltIn, scope); - RequestOptions.Apply(options, message); using var scope0 = _clientDiagnostics.CreateScope("RoleDefinitionsClient.ListRoleDefinitions"); scope0.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateListRoleDefinitionsRequest(isBuiltIn, scope); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -131,6 +117,9 @@ public virtual async Task ListRoleDefinitionsAsync(bool? isBuiltIn = n } /// List role definitions. + /// The request options. + /// Is a Synapse Built-In Role or not. + /// Scope of the Synapse Built-in Role. /// /// Schema for Response Body: /// { @@ -150,7 +139,6 @@ public virtual async Task ListRoleDefinitionsAsync(bool? isBuiltIn = n /// availabilityStatus: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -169,35 +157,16 @@ public virtual async Task ListRoleDefinitionsAsync(bool? isBuiltIn = n /// /// /// - /// Is a Synapse Built-In Role or not. - /// Scope of the Synapse Built-in Role. - /// The request options. #pragma warning disable AZC0002 - public virtual Response ListRoleDefinitions(bool? isBuiltIn = null, string scope = null, RequestOptions options = null) + public virtual Response ListRoleDefinitions(RequestOptions options, bool? isBuiltIn = null, string scope = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListRoleDefinitionsRequest(isBuiltIn, scope); - RequestOptions.Apply(options, message); using var scope0 = _clientDiagnostics.CreateScope("RoleDefinitionsClient.ListRoleDefinitions"); scope0.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateListRoleDefinitionsRequest(isBuiltIn, scope); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -206,29 +175,10 @@ public virtual Response ListRoleDefinitions(bool? isBuiltIn = null, string scope } } - private HttpMessage CreateListRoleDefinitionsRequest(bool? isBuiltIn, string scope) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/roleDefinitions", false); - uri.AppendQuery("api-version", apiVersion, true); - if (isBuiltIn != null) - { - uri.AppendQuery("isBuiltIn", isBuiltIn.Value, true); - } - if (scope != null) - { - uri.AppendQuery("scope", scope, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json, text/json"); - return message; - } - /// Get role definition by role definition Id. + /// Synapse Built-In Role Definition Id. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -248,7 +198,6 @@ private HttpMessage CreateListRoleDefinitionsRequest(bool? isBuiltIn, string sco /// availabilityStatus: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -267,34 +216,16 @@ private HttpMessage CreateListRoleDefinitionsRequest(bool? isBuiltIn, string sco /// /// /// - /// Synapse Built-In Role Definition Id. - /// The request options. #pragma warning disable AZC0002 - public virtual async Task GetRoleDefinitionByIdAsync(string roleDefinitionId, RequestOptions options = null) + public virtual async Task GetRoleDefinitionByIdAsync(string roleDefinitionId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRoleDefinitionByIdRequest(roleDefinitionId); - RequestOptions.Apply(options, message); using var scope0 = _clientDiagnostics.CreateScope("RoleDefinitionsClient.GetRoleDefinitionById"); scope0.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRoleDefinitionByIdRequest(roleDefinitionId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -304,6 +235,9 @@ public virtual async Task GetRoleDefinitionByIdAsync(string roleDefini } /// Get role definition by role definition Id. + /// Synapse Built-In Role Definition Id. + /// The request options. + /// is null. /// /// Schema for Response Body: /// { @@ -323,7 +257,6 @@ public virtual async Task GetRoleDefinitionByIdAsync(string roleDefini /// availabilityStatus: string /// } /// - /// /// Schema for Response Error: /// { /// error: { @@ -342,34 +275,16 @@ public virtual async Task GetRoleDefinitionByIdAsync(string roleDefini /// /// /// - /// Synapse Built-In Role Definition Id. - /// The request options. #pragma warning disable AZC0002 - public virtual Response GetRoleDefinitionById(string roleDefinitionId, RequestOptions options = null) + public virtual Response GetRoleDefinitionById(string roleDefinitionId, RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetRoleDefinitionByIdRequest(roleDefinitionId); - RequestOptions.Apply(options, message); using var scope0 = _clientDiagnostics.CreateScope("RoleDefinitionsClient.GetRoleDefinitionById"); scope0.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetRoleDefinitionByIdRequest(roleDefinitionId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -378,22 +293,8 @@ public virtual Response GetRoleDefinitionById(string roleDefinitionId, RequestOp } } - private HttpMessage CreateGetRoleDefinitionByIdRequest(string roleDefinitionId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/roleDefinitions/", false); - uri.AppendPath(roleDefinitionId, true); - uri.AppendQuery("api-version", apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json, text/json"); - return message; - } - /// List rbac scopes. + /// The request options. /// /// Schema for Response Error: /// { @@ -413,33 +314,16 @@ private HttpMessage CreateGetRoleDefinitionByIdRequest(string roleDefinitionId) /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual async Task ListScopesAsync(RequestOptions options = null) + public virtual async Task ListScopesAsync(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListScopesRequest(); - RequestOptions.Apply(options, message); using var scope0 = _clientDiagnostics.CreateScope("RoleDefinitionsClient.ListScopes"); scope0.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateListScopesRequest(); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -449,6 +333,7 @@ public virtual async Task ListScopesAsync(RequestOptions options = nul } /// List rbac scopes. + /// The request options. /// /// Schema for Response Error: /// { @@ -468,33 +353,16 @@ public virtual async Task ListScopesAsync(RequestOptions options = nul /// /// /// - /// The request options. #pragma warning disable AZC0002 - public virtual Response ListScopes(RequestOptions options = null) + public virtual Response ListScopes(RequestOptions options) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateListScopesRequest(); - RequestOptions.Apply(options, message); using var scope0 = _clientDiagnostics.CreateScope("RoleDefinitionsClient.ListScopes"); scope0.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateListScopesRequest(); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -503,18 +371,72 @@ public virtual Response ListScopes(RequestOptions options = null) } } - private HttpMessage CreateListScopesRequest() + internal HttpMessage CreateListRoleDefinitionsRequest(bool? isBuiltIn, string scope) { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Get; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); + uri.Reset(_endpoint); + uri.AppendPath("/roleDefinitions", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (isBuiltIn != null) + { + uri.AppendQuery("isBuiltIn", isBuiltIn.Value, true); + } + if (scope != null) + { + uri.AppendQuery("scope", scope, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json, text/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGetRoleDefinitionByIdRequest(string roleDefinitionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/roleDefinitions/", false); + uri.AppendPath(roleDefinitionId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json, text/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateListScopesRequest() + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); uri.AppendPath("/rbacScopes", false); - uri.AppendQuery("api-version", apiVersion, true); + uri.AppendQuery("api-version", _apiVersion, true); request.Uri = uri; request.Headers.Add("Accept", "application/json, text/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; return message; } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } } } diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/tests/AccessControlClientLiveTests.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/tests/AccessControlClientLiveTests.cs index 97fc01744bfde..0e46c0f0c849d 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/tests/AccessControlClientLiveTests.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/tests/AccessControlClientLiveTests.cs @@ -51,7 +51,7 @@ public static async ValueTask Create(RoleAssignmentsClient public static async ValueTask CreateResource(RoleAssignmentsClient assignmentsClient, RoleDefinitionsClient definitionsClient, SynapseTestEnvironment testEnvironment) { - Response listReponse = await definitionsClient.ListRoleDefinitionsAsync(); + Response listReponse = await definitionsClient.ListRoleDefinitionsAsync(new()); var listContent = listReponse.Content; var roleDefinitionsJson = JsonDocument.Parse(listContent.ToMemory()); @@ -118,7 +118,7 @@ public async Task GetRoleAssignment() await using DisposableClientRole role = await DisposableClientRole.Create(assignmentsClient, definitionsClient, TestEnvironment); - var response = await assignmentsClient.GetRoleAssignmentByIdAsync(role.RoleAssignmentId); + var response = await assignmentsClient.GetRoleAssignmentByIdAsync(role.RoleAssignmentId, new()); var content = response.Content; var roleAssignmentJson = JsonDocument.Parse(content.ToMemory()); @@ -135,7 +135,7 @@ public async Task ListRoleAssignments() await using DisposableClientRole role = await DisposableClientRole.Create(assignmentsClient, definitionsClient, TestEnvironment); // TODO: This will change to pageable with next LLC Generator update - Response listReponse = await definitionsClient.ListRoleDefinitionsAsync(); + Response listReponse = await definitionsClient.ListRoleDefinitionsAsync(new()); var listContent = listReponse.Content; var roleDefinitionsJson = JsonDocument.Parse(listContent.ToMemory()); @@ -143,7 +143,7 @@ public async Task ListRoleAssignments() { string id = expectedRoleDefinitionJson.GetProperty("id").ToString(); - var roleDefinitionResponse = await definitionsClient.GetRoleDefinitionByIdAsync(id); + var roleDefinitionResponse = await definitionsClient.GetRoleDefinitionByIdAsync(id, new()); var roleDefinitionContent = roleDefinitionResponse.Content; var actualRoleDefinitionJson = JsonDocument.Parse(roleDefinitionContent.ToMemory()); diff --git a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/tests/samples/Sample1_HelloWorld.cs b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/tests/samples/Sample1_HelloWorld.cs index c10b948848dd1..fe598dff3815c 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.AccessControl/tests/samples/Sample1_HelloWorld.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.AccessControl/tests/samples/Sample1_HelloWorld.cs @@ -30,7 +30,7 @@ public void AddAndRemoveRoleAssignmentSync() #endregion #region Snippet:PrepCreateRoleAssignment - Response roleDefinitionsReponse = definitionsClient.ListRoleDefinitions(); + Response roleDefinitionsReponse = definitionsClient.ListRoleDefinitions(new()); BinaryData roleDefinitionsContent = roleDefinitionsReponse.Content; JsonDocument roleDefinitionsJson = JsonDocument.Parse(roleDefinitionsContent.ToMemory()); @@ -65,7 +65,7 @@ public void AddAndRemoveRoleAssignmentSync() #endregion #region Snippet:RetrieveRoleAssignment - Response roleAssignmentResponse = roleAssignmentsClient.GetRoleAssignmentById(addedRoleAssignmentId); + Response roleAssignmentResponse = roleAssignmentsClient.GetRoleAssignmentById(addedRoleAssignmentId, new()); BinaryData roleAssignmentContent = roleAssignmentResponse.Content; JsonDocument roleAssignmentJson = JsonDocument.Parse(roleAssignmentContent.ToMemory()); string roleAssignmentRoleDefinitionId = roleAssignmentJson.RootElement.GetProperty("roleDefinitionId").ToString(); @@ -74,7 +74,7 @@ public void AddAndRemoveRoleAssignmentSync() #endregion #region Snippet:ListRoleAssignments - Response roleAssignmentsResponse = roleAssignmentsClient.ListRoleAssignments(); + Response roleAssignmentsResponse = roleAssignmentsClient.ListRoleAssignments(new()); BinaryData roleAssignmentsContent = roleAssignmentsResponse.Content; JsonDocument roleAssignmentsJson = JsonDocument.Parse(roleAssignmentsContent.ToMemory()); diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/ArtifactsModelFactory.cs b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/ArtifactsModelFactory.cs index ce9488732ca5b..2b7c148e19ce9 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/ArtifactsModelFactory.cs +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/Generated/ArtifactsModelFactory.cs @@ -14,25 +14,25 @@ namespace Azure.Analytics.Synapse.Artifacts.Models /// Model factory for read-only models. public static partial class ArtifactsModelFactory { - /// Initializes a new instance of Resource. + /// Initializes a new instance of AzureEntityResource. /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. /// The name of the resource. /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - /// A new instance for mocking. - public static Resource Resource(string id = null, string name = null, string type = null) + /// Resource Etag. + /// A new instance for mocking. + public static AzureEntityResource AzureEntityResource(string id = null, string name = null, string type = null, string etag = null) { - return new Resource(id, name, type); + return new AzureEntityResource(id, name, type, etag); } - /// Initializes a new instance of AzureEntityResource. + /// Initializes a new instance of Resource. /// Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}. /// The name of the resource. /// The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts". - /// Resource Etag. - /// A new instance for mocking. - public static AzureEntityResource AzureEntityResource(string id = null, string name = null, string type = null, string etag = null) + /// A new instance for mocking. + public static Resource Resource(string id = null, string name = null, string type = null) { - return new AzureEntityResource(id, name, type, etag); + return new Resource(id, name, type); } /// Initializes a new instance of BigDataPoolResourceInfoListResult. diff --git a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/autorest.md b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/autorest.md index 3c41b04690f48..27859b5dadfdd 100644 --- a/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/autorest.md +++ b/sdk/synapse/Azure.Analytics.Synapse.Artifacts/src/autorest.md @@ -15,6 +15,7 @@ security: AADToken security-scopes: https://dev.azuresynapse.net/.default modelerfour: lenient-model-deduplication: true + seal-single-value-enum-by-default: true ``` ### Make Endpoint type as Uri diff --git a/sdk/tables/Azure.Data.Tables/src/autorest.md b/sdk/tables/Azure.Data.Tables/src/autorest.md index ff90e60a99abc..91b465b3c683f 100644 --- a/sdk/tables/Azure.Data.Tables/src/autorest.md +++ b/sdk/tables/Azure.Data.Tables/src/autorest.md @@ -13,6 +13,8 @@ require: - https://github.com/Azure/azure-rest-api-specs/blob/2df8b07bf9af7c96066ca4dda21b79297307d108/specification/cosmos-db/data-plane/readme.md namespace: Azure.Data.Tables include-csproj: disable +modelerfour: + seal-single-value-enum-by-default: true ``` ### Add nullable annotations diff --git a/sdk/textanalytics/Azure.AI.TextAnalytics/src/autorest.md b/sdk/textanalytics/Azure.AI.TextAnalytics/src/autorest.md index 125e7aba6703f..88ce5417402ca 100644 --- a/sdk/textanalytics/Azure.AI.TextAnalytics/src/autorest.md +++ b/sdk/textanalytics/Azure.AI.TextAnalytics/src/autorest.md @@ -8,6 +8,8 @@ Run `dotnet build /t:GenerateCode` to generate code. ``` yaml input-file: - https://raw.githubusercontent.com/Azure/azure-rest-api-specs/d758c4205d331c552cafbb755ed02673b9fa5e22/specification/cognitiveservices/data-plane/TextAnalytics/preview/v3.2-preview.1/TextAnalytics.json +modelerfour: + seal-single-value-enum-by-default: true ``` ### Make generated models internal by default diff --git a/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Azure.Messaging.WebPubSub.csproj b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Azure.Messaging.WebPubSub.csproj index 0d92e30232f60..47058954d0c40 100644 --- a/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Azure.Messaging.WebPubSub.csproj +++ b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Azure.Messaging.WebPubSub.csproj @@ -7,6 +7,7 @@ $(RequiredTargetFrameworks) $(NoWarn);419 true + $(DefineConstants);EXPERIMENTAL diff --git a/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/HealthApiClient.cs b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/HealthApiClient.cs index 1cadf7b5f838a..1a24d59214ff1 100644 --- a/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/HealthApiClient.cs +++ b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/HealthApiClient.cs @@ -16,12 +16,13 @@ namespace Azure.Messaging.WebPubSub /// The HealthApi service client. internal partial class HealthApiClient { + private readonly HttpPipeline _pipeline; + private readonly ClientDiagnostics _clientDiagnostics; + private readonly Uri _endpoint; + private readonly string _apiVersion; + /// The HTTP pipeline for sending and receiving REST requests and responses. public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private Uri endpoint; - private readonly string apiVersion; - private readonly ClientDiagnostics _clientDiagnostics; /// Initializes a new instance of HealthApiClient for mocking. protected HealthApiClient() @@ -36,10 +37,11 @@ public HealthApiClient(Uri endpoint = null, WebPubSubServiceClientOptions option endpoint ??= new Uri(""); options ??= new WebPubSubServiceClientOptions(); + _clientDiagnostics = new ClientDiagnostics(options); _pipeline = HttpPipelineBuilder.Build(options, new HttpPipelinePolicy[] { new LowLevelCallbackPolicy() }, Array.Empty(), new ResponseClassifier()); - this.endpoint = endpoint; - apiVersion = options.Version; + _endpoint = endpoint; + _apiVersion = options.Version; } /// Get service health status. @@ -48,28 +50,12 @@ public HealthApiClient(Uri endpoint = null, WebPubSubServiceClientOptions option public virtual async Task GetServiceStatusAsync(RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetServiceStatusRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("HealthApiClient.GetServiceStatus"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetServiceStatusRequest(); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -84,28 +70,12 @@ public virtual async Task GetServiceStatusAsync(RequestOptions options public virtual Response GetServiceStatus(RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGetServiceStatusRequest(); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("HealthApiClient.GetServiceStatus"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGetServiceStatusRequest(); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -114,20 +84,35 @@ public virtual Response GetServiceStatus(RequestOptions options = null) } } - private HttpMessage CreateGetServiceStatusRequest() + internal HttpMessage CreateGetServiceStatusRequest() { var message = _pipeline.CreateMessage(); var request = message.Request; request.Method = RequestMethod.Head; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); + uri.Reset(_endpoint); uri.AppendPath("/api/health", false); - if (apiVersion != null) + if (_apiVersion != null) { - uri.AppendQuery("api-version", apiVersion, true); + uri.AppendQuery("api-version", _apiVersion, true); } request.Uri = uri; + message.ResponseClassifier = ResponseClassifier200.Instance; return message; } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } } } diff --git a/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/WebPubSubServiceClient.cs b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/WebPubSubServiceClient.cs index cbe6587d813e7..949e37153e180 100644 --- a/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/WebPubSubServiceClient.cs +++ b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/Generated/WebPubSubServiceClient.cs @@ -17,13 +17,14 @@ namespace Azure.Messaging.WebPubSub /// The WebPubSubService service client. public partial class WebPubSubServiceClient { + private readonly HttpPipeline _pipeline; + private readonly ClientDiagnostics _clientDiagnostics; + private readonly string _hub; + private readonly Uri _endpoint; + private readonly string _apiVersion; + /// The HTTP pipeline for sending and receiving REST requests and responses. public virtual HttpPipeline Pipeline { get => _pipeline; } - private HttpPipeline _pipeline; - private string hub; - private Uri endpoint; - private readonly string apiVersion; - private readonly ClientDiagnostics _clientDiagnostics; /// Initializes a new instance of WebPubSubServiceClient for mocking. protected WebPubSubServiceClient() @@ -31,6 +32,10 @@ protected WebPubSubServiceClient() } /// Generate token for the client to connect Azure Web PubSub service. + /// The request options. + /// User Id. + /// Roles that the connection with the generated token will have. + /// The expire time of the generated token. /// /// Schema for Response Body: /// { @@ -39,36 +44,16 @@ protected WebPubSubServiceClient() /// /// /// - /// User Id. - /// Roles that the connection with the generated token will have. - /// The expire time of the generated token. - /// The request options. #pragma warning disable AZC0002 - internal virtual async Task GenerateClientTokenImplAsync(string userId = null, IEnumerable role = null, int? minutesToExpire = null, RequestOptions options = null) + internal virtual async Task GenerateClientTokenImplAsync(RequestOptions options, string userId = null, IEnumerable role = null, int? minutesToExpire = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGenerateClientTokenImplRequest(userId, role, minutesToExpire); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.GenerateClientTokenImpl"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGenerateClientTokenImplRequest(userId, role, minutesToExpire); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -78,6 +63,10 @@ internal virtual async Task GenerateClientTokenImplAsync(string userId } /// Generate token for the client to connect Azure Web PubSub service. + /// The request options. + /// User Id. + /// Roles that the connection with the generated token will have. + /// The expire time of the generated token. /// /// Schema for Response Body: /// { @@ -86,36 +75,16 @@ internal virtual async Task GenerateClientTokenImplAsync(string userId /// /// /// - /// User Id. - /// Roles that the connection with the generated token will have. - /// The expire time of the generated token. - /// The request options. #pragma warning disable AZC0002 - internal virtual Response GenerateClientTokenImpl(string userId = null, IEnumerable role = null, int? minutesToExpire = null, RequestOptions options = null) + internal virtual Response GenerateClientTokenImpl(RequestOptions options, string userId = null, IEnumerable role = null, int? minutesToExpire = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGenerateClientTokenImplRequest(userId, role, minutesToExpire); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.GenerateClientTokenImpl"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGenerateClientTokenImplRequest(userId, role, minutesToExpire); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -124,68 +93,22 @@ internal virtual Response GenerateClientTokenImpl(string userId = null, IEnumera } } - private HttpMessage CreateGenerateClientTokenImplRequest(string userId, IEnumerable role, int? minutesToExpire) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/api/hubs/", false); - uri.AppendPath(hub, true); - uri.AppendPath("/:generateToken", false); - if (userId != null) - { - uri.AppendQuery("userId", userId, true); - } - if (role != null) - { - uri.AppendQueryDelimited("role", role, ",", true); - } - if (minutesToExpire != null) - { - uri.AppendQuery("minutesToExpire", minutesToExpire.Value, true); - } - if (apiVersion != null) - { - uri.AppendQuery("api-version", apiVersion, true); - } - request.Uri = uri; - request.Headers.Add("Accept", "application/json, text/json"); - return message; - } - /// Broadcast content inside request body to all the connected client connections. /// The content to send as the body of the request. - /// Upload file type. + /// Upload file type. Allowed values: "application/json" | "application/octet-stream". /// Excluded connection Ids. /// The request options. + /// is null. #pragma warning disable AZC0002 public virtual async Task SendToAllAsync(RequestContent content, ContentType contentType, IEnumerable excluded = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateSendToAllRequest(content, contentType, excluded); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.SendToAll"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateSendToAllRequest(content, contentType, excluded); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -196,35 +119,20 @@ public virtual async Task SendToAllAsync(RequestContent content, Conte /// Broadcast content inside request body to all the connected client connections. /// The content to send as the body of the request. - /// Upload file type. + /// Upload file type. Allowed values: "application/json" | "application/octet-stream". /// Excluded connection Ids. /// The request options. + /// is null. #pragma warning disable AZC0002 public virtual Response SendToAll(RequestContent content, ContentType contentType, IEnumerable excluded = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateSendToAllRequest(content, contentType, excluded); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.SendToAll"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateSendToAllRequest(content, contentType, excluded); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -233,84 +141,20 @@ public virtual Response SendToAll(RequestContent content, ContentType contentTyp } } - private HttpMessage CreateSendToAllRequest(RequestContent content, ContentType contentType, IEnumerable excluded) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/api/hubs/", false); - uri.AppendPath(hub, true); - uri.AppendPath("/:send", false); - if (excluded != null) - { - uri.AppendQueryDelimited("excluded", excluded, ",", true); - } - if (apiVersion != null) - { - uri.AppendQuery("api-version", apiVersion, true); - } - request.Uri = uri; - request.Headers.Add("Content-Type", contentType.ToString()); - request.Content = content; - return message; - } - - private HttpMessage CreateSendToAllRequest(RequestContent content, IEnumerable excluded) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/api/hubs/", false); - uri.AppendPath(hub, true); - uri.AppendPath("/:send", false); - if (excluded != null) - { - uri.AppendQueryDelimited("excluded", excluded, ",", true); - } - if (apiVersion != null) - { - uri.AppendQuery("api-version", apiVersion, true); - } - request.Uri = uri; - request.Headers.Add("Content-Type", "text/plain"); - request.Content = content; - return message; - } - /// Check if the connection with the given connectionId exists. /// The connection Id. /// The request options. + /// is null. #pragma warning disable AZC0002 internal virtual async Task ConnectionExistsImplAsync(string connectionId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateConnectionExistsImplRequest(connectionId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.ConnectionExistsImpl"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 404: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateConnectionExistsImplRequest(connectionId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -322,33 +166,17 @@ internal virtual async Task ConnectionExistsImplAsync(string connectio /// Check if the connection with the given connectionId exists. /// The connection Id. /// The request options. + /// is null. #pragma warning disable AZC0002 internal virtual Response ConnectionExistsImpl(string connectionId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateConnectionExistsImplRequest(connectionId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.ConnectionExistsImpl"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 404: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateConnectionExistsImplRequest(connectionId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -357,55 +185,21 @@ internal virtual Response ConnectionExistsImpl(string connectionId, RequestOptio } } - private HttpMessage CreateConnectionExistsImplRequest(string connectionId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Head; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/api/hubs/", false); - uri.AppendPath(hub, true); - uri.AppendPath("/connections/", false); - uri.AppendPath(connectionId, true); - if (apiVersion != null) - { - uri.AppendQuery("api-version", apiVersion, true); - } - request.Uri = uri; - return message; - } - /// Close the client connection. /// Target connection Id. /// The reason closing the client connection. /// The request options. + /// is null. #pragma warning disable AZC0002 public virtual async Task CloseConnectionAsync(string connectionId, string reason = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCloseConnectionRequest(connectionId, reason); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.CloseConnection"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCloseConnectionRequest(connectionId, reason); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -418,32 +212,17 @@ public virtual async Task CloseConnectionAsync(string connectionId, st /// Target connection Id. /// The reason closing the client connection. /// The request options. + /// is null. #pragma warning disable AZC0002 public virtual Response CloseConnection(string connectionId, string reason = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCloseConnectionRequest(connectionId, reason); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.CloseConnection"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCloseConnectionRequest(connectionId, reason); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -452,60 +231,22 @@ public virtual Response CloseConnection(string connectionId, string reason = nul } } - private HttpMessage CreateCloseConnectionRequest(string connectionId, string reason) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/api/hubs/", false); - uri.AppendPath(hub, true); - uri.AppendPath("/connections/", false); - uri.AppendPath(connectionId, true); - if (reason != null) - { - uri.AppendQuery("reason", reason, true); - } - if (apiVersion != null) - { - uri.AppendQuery("api-version", apiVersion, true); - } - request.Uri = uri; - return message; - } - /// Send content inside request body to the specific connection. /// The connection Id. /// The content to send as the body of the request. - /// Upload file type. + /// Upload file type. Allowed values: "application/json" | "application/octet-stream". /// The request options. + /// or is null. #pragma warning disable AZC0002 public virtual async Task SendToConnectionAsync(string connectionId, RequestContent content, ContentType contentType, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateSendToConnectionRequest(connectionId, content, contentType); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.SendToConnection"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateSendToConnectionRequest(connectionId, content, contentType); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -517,34 +258,19 @@ public virtual async Task SendToConnectionAsync(string connectionId, R /// Send content inside request body to the specific connection. /// The connection Id. /// The content to send as the body of the request. - /// Upload file type. + /// Upload file type. Allowed values: "application/json" | "application/octet-stream". /// The request options. + /// or is null. #pragma warning disable AZC0002 public virtual Response SendToConnection(string connectionId, RequestContent content, ContentType contentType, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateSendToConnectionRequest(connectionId, content, contentType); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.SendToConnection"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateSendToConnectionRequest(connectionId, content, contentType); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -553,80 +279,20 @@ public virtual Response SendToConnection(string connectionId, RequestContent con } } - private HttpMessage CreateSendToConnectionRequest(string connectionId, RequestContent content, ContentType contentType) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/api/hubs/", false); - uri.AppendPath(hub, true); - uri.AppendPath("/connections/", false); - uri.AppendPath(connectionId, true); - uri.AppendPath("/:send", false); - if (apiVersion != null) - { - uri.AppendQuery("api-version", apiVersion, true); - } - request.Uri = uri; - request.Headers.Add("Content-Type", contentType.ToString()); - request.Content = content; - return message; - } - - private HttpMessage CreateSendToConnectionRequest(string connectionId, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/api/hubs/", false); - uri.AppendPath(hub, true); - uri.AppendPath("/connections/", false); - uri.AppendPath(connectionId, true); - uri.AppendPath("/:send", false); - if (apiVersion != null) - { - uri.AppendQuery("api-version", apiVersion, true); - } - request.Uri = uri; - request.Headers.Add("Content-Type", "text/plain"); - request.Content = content; - return message; - } - /// Check if there are any client connections inside the given group. /// Target group name, which length should be greater than 0 and less than 1025. /// The request options. + /// is null. #pragma warning disable AZC0002 internal virtual async Task GroupExistsImplAsync(string group, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGroupExistsImplRequest(group); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.GroupExistsImpl"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 404: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGroupExistsImplRequest(group); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -638,33 +304,17 @@ internal virtual async Task GroupExistsImplAsync(string group, Request /// Check if there are any client connections inside the given group. /// Target group name, which length should be greater than 0 and less than 1025. /// The request options. + /// is null. #pragma warning disable AZC0002 internal virtual Response GroupExistsImpl(string group, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGroupExistsImplRequest(group); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.GroupExistsImpl"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 404: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGroupExistsImplRequest(group); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -673,57 +323,23 @@ internal virtual Response GroupExistsImpl(string group, RequestOptions options = } } - private HttpMessage CreateGroupExistsImplRequest(string group) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Head; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/api/hubs/", false); - uri.AppendPath(hub, true); - uri.AppendPath("/groups/", false); - uri.AppendPath(group, true); - if (apiVersion != null) - { - uri.AppendQuery("api-version", apiVersion, true); - } - request.Uri = uri; - return message; - } - /// Send content inside request body to a group of connections. /// Target group name, which length should be greater than 0 and less than 1025. /// The content to send as the body of the request. - /// Upload file type. + /// Upload file type. Allowed values: "application/json" | "application/octet-stream". /// Excluded connection Ids. /// The request options. + /// or is null. #pragma warning disable AZC0002 public virtual async Task SendToGroupAsync(string group, RequestContent content, ContentType contentType, IEnumerable excluded = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateSendToGroupRequest(group, content, contentType, excluded); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.SendToGroup"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateSendToGroupRequest(group, content, contentType, excluded); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -735,35 +351,20 @@ public virtual async Task SendToGroupAsync(string group, RequestConten /// Send content inside request body to a group of connections. /// Target group name, which length should be greater than 0 and less than 1025. /// The content to send as the body of the request. - /// Upload file type. + /// Upload file type. Allowed values: "application/json" | "application/octet-stream". /// Excluded connection Ids. /// The request options. + /// or is null. #pragma warning disable AZC0002 public virtual Response SendToGroup(string group, RequestContent content, ContentType contentType, IEnumerable excluded = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateSendToGroupRequest(group, content, contentType, excluded); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.SendToGroup"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateSendToGroupRequest(group, content, contentType, excluded); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -772,89 +373,21 @@ public virtual Response SendToGroup(string group, RequestContent content, Conten } } - private HttpMessage CreateSendToGroupRequest(string group, RequestContent content, ContentType contentType, IEnumerable excluded) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/api/hubs/", false); - uri.AppendPath(hub, true); - uri.AppendPath("/groups/", false); - uri.AppendPath(group, true); - uri.AppendPath("/:send", false); - if (excluded != null) - { - uri.AppendQueryDelimited("excluded", excluded, ",", true); - } - if (apiVersion != null) - { - uri.AppendQuery("api-version", apiVersion, true); - } - request.Uri = uri; - request.Headers.Add("Content-Type", contentType.ToString()); - request.Content = content; - return message; - } - - private HttpMessage CreateSendToGroupRequest(string group, RequestContent content, IEnumerable excluded) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/api/hubs/", false); - uri.AppendPath(hub, true); - uri.AppendPath("/groups/", false); - uri.AppendPath(group, true); - uri.AppendPath("/:send", false); - if (excluded != null) - { - uri.AppendQueryDelimited("excluded", excluded, ",", true); - } - if (apiVersion != null) - { - uri.AppendQuery("api-version", apiVersion, true); - } - request.Uri = uri; - request.Headers.Add("Content-Type", "text/plain"); - request.Content = content; - return message; - } - /// Add a connection to the target group. /// Target group name, which length should be greater than 0 and less than 1025. /// Target connection Id. /// The request options. + /// or is null. #pragma warning disable AZC0002 public virtual async Task AddConnectionToGroupAsync(string group, string connectionId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateAddConnectionToGroupRequest(group, connectionId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.AddConnectionToGroup"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 404: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateAddConnectionToGroupRequest(group, connectionId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -867,33 +400,17 @@ public virtual async Task AddConnectionToGroupAsync(string group, stri /// Target group name, which length should be greater than 0 and less than 1025. /// Target connection Id. /// The request options. + /// or is null. #pragma warning disable AZC0002 public virtual Response AddConnectionToGroup(string group, string connectionId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateAddConnectionToGroupRequest(group, connectionId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.AddConnectionToGroup"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 404: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateAddConnectionToGroupRequest(group, connectionId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -902,57 +419,21 @@ public virtual Response AddConnectionToGroup(string group, string connectionId, } } - private HttpMessage CreateAddConnectionToGroupRequest(string group, string connectionId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/api/hubs/", false); - uri.AppendPath(hub, true); - uri.AppendPath("/groups/", false); - uri.AppendPath(group, true); - uri.AppendPath("/connections/", false); - uri.AppendPath(connectionId, true); - if (apiVersion != null) - { - uri.AppendQuery("api-version", apiVersion, true); - } - request.Uri = uri; - return message; - } - /// Remove a connection from the target group. /// Target group name, which length should be greater than 0 and less than 1025. /// Target connection Id. /// The request options. + /// or is null. #pragma warning disable AZC0002 public virtual async Task RemoveConnectionFromGroupAsync(string group, string connectionId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateRemoveConnectionFromGroupRequest(group, connectionId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.RemoveConnectionFromGroup"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateRemoveConnectionFromGroupRequest(group, connectionId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -965,32 +446,17 @@ public virtual async Task RemoveConnectionFromGroupAsync(string group, /// Target group name, which length should be greater than 0 and less than 1025. /// Target connection Id. /// The request options. + /// or is null. #pragma warning disable AZC0002 public virtual Response RemoveConnectionFromGroup(string group, string connectionId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateRemoveConnectionFromGroupRequest(group, connectionId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.RemoveConnectionFromGroup"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateRemoveConnectionFromGroupRequest(group, connectionId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -999,57 +465,20 @@ public virtual Response RemoveConnectionFromGroup(string group, string connectio } } - private HttpMessage CreateRemoveConnectionFromGroupRequest(string group, string connectionId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/api/hubs/", false); - uri.AppendPath(hub, true); - uri.AppendPath("/groups/", false); - uri.AppendPath(group, true); - uri.AppendPath("/connections/", false); - uri.AppendPath(connectionId, true); - if (apiVersion != null) - { - uri.AppendQuery("api-version", apiVersion, true); - } - request.Uri = uri; - return message; - } - /// Check if there are any client connections connected for the given user. /// Target user Id. /// The request options. + /// is null. #pragma warning disable AZC0002 internal virtual async Task UserExistsImplAsync(string userId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateUserExistsImplRequest(userId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.UserExistsImpl"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 404: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateUserExistsImplRequest(userId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1061,33 +490,17 @@ internal virtual async Task UserExistsImplAsync(string userId, Request /// Check if there are any client connections connected for the given user. /// Target user Id. /// The request options. + /// is null. #pragma warning disable AZC0002 internal virtual Response UserExistsImpl(string userId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateUserExistsImplRequest(userId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.UserExistsImpl"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 404: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateUserExistsImplRequest(userId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1096,56 +509,22 @@ internal virtual Response UserExistsImpl(string userId, RequestOptions options = } } - private HttpMessage CreateUserExistsImplRequest(string userId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Head; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/api/hubs/", false); - uri.AppendPath(hub, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userId, true); - if (apiVersion != null) - { - uri.AppendQuery("api-version", apiVersion, true); - } - request.Uri = uri; - return message; - } - /// Send content inside request body to the specific user. /// The user Id. /// The content to send as the body of the request. - /// Upload file type. + /// Upload file type. Allowed values: "application/json" | "application/octet-stream". /// The request options. + /// or is null. #pragma warning disable AZC0002 public virtual async Task SendToUserAsync(string userId, RequestContent content, ContentType contentType, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateSendToUserRequest(userId, content, contentType); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.SendToUser"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateSendToUserRequest(userId, content, contentType); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1157,34 +536,19 @@ public virtual async Task SendToUserAsync(string userId, RequestConten /// Send content inside request body to the specific user. /// The user Id. /// The content to send as the body of the request. - /// Upload file type. + /// Upload file type. Allowed values: "application/json" | "application/octet-stream". /// The request options. + /// or is null. #pragma warning disable AZC0002 public virtual Response SendToUser(string userId, RequestContent content, ContentType contentType, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateSendToUserRequest(userId, content, contentType); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.SendToUser"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 202: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateSendToUserRequest(userId, content, contentType); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1193,81 +557,21 @@ public virtual Response SendToUser(string userId, RequestContent content, Conten } } - private HttpMessage CreateSendToUserRequest(string userId, RequestContent content, ContentType contentType) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/api/hubs/", false); - uri.AppendPath(hub, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userId, true); - uri.AppendPath("/:send", false); - if (apiVersion != null) - { - uri.AppendQuery("api-version", apiVersion, true); - } - request.Uri = uri; - request.Headers.Add("Content-Type", contentType.ToString()); - request.Content = content; - return message; - } - - private HttpMessage CreateSendToUserRequest(string userId, RequestContent content) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/api/hubs/", false); - uri.AppendPath(hub, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userId, true); - uri.AppendPath("/:send", false); - if (apiVersion != null) - { - uri.AppendQuery("api-version", apiVersion, true); - } - request.Uri = uri; - request.Headers.Add("Content-Type", "text/plain"); - request.Content = content; - return message; - } - /// Add a user to the target group. /// Target group name, which length should be greater than 0 and less than 1025. /// Target user Id. /// The request options. + /// or is null. #pragma warning disable AZC0002 public virtual async Task AddUserToGroupAsync(string group, string userId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateAddUserToGroupRequest(group, userId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.AddUserToGroup"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 404: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateAddUserToGroupRequest(group, userId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1280,33 +584,17 @@ public virtual async Task AddUserToGroupAsync(string group, string use /// Target group name, which length should be greater than 0 and less than 1025. /// Target user Id. /// The request options. + /// or is null. #pragma warning disable AZC0002 public virtual Response AddUserToGroup(string group, string userId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateAddUserToGroupRequest(group, userId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.AddUserToGroup"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 404: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateAddUserToGroupRequest(group, userId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1315,57 +603,21 @@ public virtual Response AddUserToGroup(string group, string userId, RequestOptio } } - private HttpMessage CreateAddUserToGroupRequest(string group, string userId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/api/hubs/", false); - uri.AppendPath(hub, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userId, true); - uri.AppendPath("/groups/", false); - uri.AppendPath(group, true); - if (apiVersion != null) - { - uri.AppendQuery("api-version", apiVersion, true); - } - request.Uri = uri; - return message; - } - /// Remove a user from the target group. /// Target group name, which length should be greater than 0 and less than 1025. /// Target user Id. /// The request options. + /// or is null. #pragma warning disable AZC0002 public virtual async Task RemoveUserFromGroupAsync(string group, string userId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateRemoveUserFromGroupRequest(group, userId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.RemoveUserFromGroup"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateRemoveUserFromGroupRequest(group, userId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1378,32 +630,17 @@ public virtual async Task RemoveUserFromGroupAsync(string group, strin /// Target group name, which length should be greater than 0 and less than 1025. /// Target user Id. /// The request options. + /// or is null. #pragma warning disable AZC0002 public virtual Response RemoveUserFromGroup(string group, string userId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateRemoveUserFromGroupRequest(group, userId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.RemoveUserFromGroup"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateRemoveUserFromGroupRequest(group, userId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1412,56 +649,20 @@ public virtual Response RemoveUserFromGroup(string group, string userId, Request } } - private HttpMessage CreateRemoveUserFromGroupRequest(string group, string userId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/api/hubs/", false); - uri.AppendPath(hub, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userId, true); - uri.AppendPath("/groups/", false); - uri.AppendPath(group, true); - if (apiVersion != null) - { - uri.AppendQuery("api-version", apiVersion, true); - } - request.Uri = uri; - return message; - } - /// Remove a user from all groups. /// Target user Id. /// The request options. + /// is null. #pragma warning disable AZC0002 public virtual async Task RemoveUserFromAllGroupsAsync(string userId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateRemoveUserFromAllGroupsRequest(userId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.RemoveUserFromAllGroups"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateRemoveUserFromAllGroupsRequest(userId); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1473,32 +674,17 @@ public virtual async Task RemoveUserFromAllGroupsAsync(string userId, /// Remove a user from all groups. /// Target user Id. /// The request options. + /// is null. #pragma warning disable AZC0002 public virtual Response RemoveUserFromAllGroups(string userId, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateRemoveUserFromAllGroupsRequest(userId); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.RemoveUserFromAllGroups"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateRemoveUserFromAllGroupsRequest(userId); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1507,57 +693,22 @@ public virtual Response RemoveUserFromAllGroups(string userId, RequestOptions op } } - private HttpMessage CreateRemoveUserFromAllGroupsRequest(string userId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/api/hubs/", false); - uri.AppendPath(hub, true); - uri.AppendPath("/users/", false); - uri.AppendPath(userId, true); - uri.AppendPath("/groups", false); - if (apiVersion != null) - { - uri.AppendQuery("api-version", apiVersion, true); - } - request.Uri = uri; - return message; - } - /// Grant permission to the connection. - /// The permission: current supported actions are joinLeaveGroup and sendToGroup. + /// The permission: current supported actions are joinLeaveGroup and sendToGroup. Allowed values: "sendToGroup" | "joinLeaveGroup". /// Target connection Id. /// Optional. If not set, grant the permission to all the targets. If set, grant the permission to the specific target. The meaning of the target depends on the specific permission. /// The request options. + /// or is null. #pragma warning disable AZC0002 internal virtual async Task GrantPermissionAsync(string permission, string connectionId, string targetName = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGrantPermissionRequest(permission, connectionId, targetName); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.GrantPermission"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGrantPermissionRequest(permission, connectionId, targetName); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1567,36 +718,21 @@ internal virtual async Task GrantPermissionAsync(string permission, st } /// Grant permission to the connection. - /// The permission: current supported actions are joinLeaveGroup and sendToGroup. + /// The permission: current supported actions are joinLeaveGroup and sendToGroup. Allowed values: "sendToGroup" | "joinLeaveGroup". /// Target connection Id. /// Optional. If not set, grant the permission to all the targets. If set, grant the permission to the specific target. The meaning of the target depends on the specific permission. /// The request options. + /// or is null. #pragma warning disable AZC0002 internal virtual Response GrantPermission(string permission, string connectionId, string targetName = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateGrantPermissionRequest(permission, connectionId, targetName); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.GrantPermission"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateGrantPermissionRequest(permission, connectionId, targetName); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1605,62 +741,22 @@ internal virtual Response GrantPermission(string permission, string connectionId } } - private HttpMessage CreateGrantPermissionRequest(string permission, string connectionId, string targetName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Put; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/api/hubs/", false); - uri.AppendPath(hub, true); - uri.AppendPath("/permissions/", false); - uri.AppendPath(permission, true); - uri.AppendPath("/connections/", false); - uri.AppendPath(connectionId, true); - if (targetName != null) - { - uri.AppendQuery("targetName", targetName, true); - } - if (apiVersion != null) - { - uri.AppendQuery("api-version", apiVersion, true); - } - request.Uri = uri; - return message; - } - /// Revoke permission for the connection. - /// The permission: current supported actions are joinLeaveGroup and sendToGroup. + /// The permission: current supported actions are joinLeaveGroup and sendToGroup. Allowed values: "sendToGroup" | "joinLeaveGroup". /// Target connection Id. /// Optional. If not set, revoke the permission for all targets. If set, revoke the permission for the specific target. The meaning of the target depends on the specific permission. /// The request options. + /// or is null. #pragma warning disable AZC0002 internal virtual async Task RevokePermissionAsync(string permission, string connectionId, string targetName = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateRevokePermissionRequest(permission, connectionId, targetName); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.RevokePermission"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateRevokePermissionRequest(permission, connectionId, targetName); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1670,36 +766,21 @@ internal virtual async Task RevokePermissionAsync(string permission, s } /// Revoke permission for the connection. - /// The permission: current supported actions are joinLeaveGroup and sendToGroup. + /// The permission: current supported actions are joinLeaveGroup and sendToGroup. Allowed values: "sendToGroup" | "joinLeaveGroup". /// Target connection Id. /// Optional. If not set, revoke the permission for all targets. If set, revoke the permission for the specific target. The meaning of the target depends on the specific permission. /// The request options. + /// or is null. #pragma warning disable AZC0002 internal virtual Response RevokePermission(string permission, string connectionId, string targetName = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateRevokePermissionRequest(permission, connectionId, targetName); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.RevokePermission"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateRevokePermissionRequest(permission, connectionId, targetName); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1708,63 +789,22 @@ internal virtual Response RevokePermission(string permission, string connectionI } } - private HttpMessage CreateRevokePermissionRequest(string permission, string connectionId, string targetName) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); - uri.AppendPath("/api/hubs/", false); - uri.AppendPath(hub, true); - uri.AppendPath("/permissions/", false); - uri.AppendPath(permission, true); - uri.AppendPath("/connections/", false); - uri.AppendPath(connectionId, true); - if (targetName != null) - { - uri.AppendQuery("targetName", targetName, true); - } - if (apiVersion != null) - { - uri.AppendQuery("api-version", apiVersion, true); - } - request.Uri = uri; - return message; - } - /// Check if a connection has permission to the specified action. - /// The permission: current supported actions are joinLeaveGroup and sendToGroup. + /// The permission: current supported actions are joinLeaveGroup and sendToGroup. Allowed values: "sendToGroup" | "joinLeaveGroup". /// Target connection Id. /// Optional. If not set, get the permission for all targets. If set, get the permission for the specific target. The meaning of the target depends on the specific permission. /// The request options. + /// or is null. #pragma warning disable AZC0002 internal virtual async Task CheckPermissionAsync(string permission, string connectionId, string targetName = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCheckPermissionRequest(permission, connectionId, targetName); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.CheckPermission"); scope.Start(); try { - await Pipeline.SendAsync(message, options.CancellationToken).ConfigureAwait(false); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 404: - return message.Response; - default: - throw await _clientDiagnostics.CreateRequestFailedExceptionAsync(message.Response).ConfigureAwait(false); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCheckPermissionRequest(permission, connectionId, targetName); + return await _pipeline.ProcessMessageAsync(message, _clientDiagnostics, options).ConfigureAwait(false); } catch (Exception e) { @@ -1774,37 +814,21 @@ internal virtual async Task CheckPermissionAsync(string permission, st } /// Check if a connection has permission to the specified action. - /// The permission: current supported actions are joinLeaveGroup and sendToGroup. + /// The permission: current supported actions are joinLeaveGroup and sendToGroup. Allowed values: "sendToGroup" | "joinLeaveGroup". /// Target connection Id. /// Optional. If not set, get the permission for all targets. If set, get the permission for the specific target. The meaning of the target depends on the specific permission. /// The request options. + /// or is null. #pragma warning disable AZC0002 internal virtual Response CheckPermission(string permission, string connectionId, string targetName = null, RequestOptions options = null) #pragma warning restore AZC0002 { - options ??= new RequestOptions(); - using HttpMessage message = CreateCheckPermissionRequest(permission, connectionId, targetName); - RequestOptions.Apply(options, message); using var scope = _clientDiagnostics.CreateScope("WebPubSubServiceClient.CheckPermission"); scope.Start(); try { - Pipeline.Send(message, options.CancellationToken); - if (options.StatusOption == ResponseStatusOption.Default) - { - switch (message.Response.Status) - { - case 200: - case 404: - return message.Response; - default: - throw _clientDiagnostics.CreateRequestFailedException(message.Response); - } - } - else - { - return message.Response; - } + using HttpMessage message = CreateCheckPermissionRequest(permission, connectionId, targetName); + return _pipeline.ProcessMessage(message, _clientDiagnostics, options); } catch (Exception e) { @@ -1813,29 +837,559 @@ internal virtual Response CheckPermission(string permission, string connectionId } } - private HttpMessage CreateCheckPermissionRequest(string permission, string connectionId, string targetName) + internal HttpMessage CreateGenerateClientTokenImplRequest(string userId, IEnumerable role, int? minutesToExpire) { var message = _pipeline.CreateMessage(); var request = message.Request; - request.Method = RequestMethod.Head; + request.Method = RequestMethod.Post; var uri = new RawRequestUriBuilder(); - uri.Reset(endpoint); + uri.Reset(_endpoint); uri.AppendPath("/api/hubs/", false); - uri.AppendPath(hub, true); - uri.AppendPath("/permissions/", false); - uri.AppendPath(permission, true); - uri.AppendPath("/connections/", false); - uri.AppendPath(connectionId, true); - if (targetName != null) + uri.AppendPath(_hub, true); + uri.AppendPath("/:generateToken", false); + if (userId != null) + { + uri.AppendQuery("userId", userId, true); + } + if (role != null) + { + foreach (var param in role) + { + uri.AppendQuery("role", param, true); + } + } + if (minutesToExpire != null) + { + uri.AppendQuery("minutesToExpire", minutesToExpire.Value, true); + } + if (_apiVersion != null) + { + uri.AppendQuery("api-version", _apiVersion, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json, text/json"); + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateSendToAllRequest(RequestContent content, ContentType contentType, IEnumerable excluded) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/api/hubs/", false); + uri.AppendPath(_hub, true); + uri.AppendPath("/:send", false); + if (excluded != null) + { + foreach (var param in excluded) + { + uri.AppendQuery("excluded", param, true); + } + } + if (_apiVersion != null) + { + uri.AppendQuery("api-version", _apiVersion, true); + } + request.Uri = uri; + request.Headers.Add("Content-Type", contentType.ToString()); + request.Content = content; + message.ResponseClassifier = ResponseClassifier202.Instance; + return message; + } + + internal HttpMessage CreateSendToAllRequest(RequestContent content, IEnumerable excluded) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/api/hubs/", false); + uri.AppendPath(_hub, true); + uri.AppendPath("/:send", false); + if (excluded != null) + { + foreach (var param in excluded) + { + uri.AppendQuery("excluded", param, true); + } + } + if (_apiVersion != null) + { + uri.AppendQuery("api-version", _apiVersion, true); + } + request.Uri = uri; + request.Headers.Add("Content-Type", "text/plain"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier202.Instance; + return message; + } + + internal HttpMessage CreateConnectionExistsImplRequest(string connectionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/api/hubs/", false); + uri.AppendPath(_hub, true); + uri.AppendPath("/connections/", false); + uri.AppendPath(connectionId, true); + if (_apiVersion != null) + { + uri.AppendQuery("api-version", _apiVersion, true); + } + request.Uri = uri; + message.ResponseClassifier = ResponseClassifier200404.Instance; + return message; + } + + internal HttpMessage CreateCloseConnectionRequest(string connectionId, string reason) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/api/hubs/", false); + uri.AppendPath(_hub, true); + uri.AppendPath("/connections/", false); + uri.AppendPath(connectionId, true); + if (reason != null) + { + uri.AppendQuery("reason", reason, true); + } + if (_apiVersion != null) + { + uri.AppendQuery("api-version", _apiVersion, true); + } + request.Uri = uri; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateSendToConnectionRequest(string connectionId, RequestContent content, ContentType contentType) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/api/hubs/", false); + uri.AppendPath(_hub, true); + uri.AppendPath("/connections/", false); + uri.AppendPath(connectionId, true); + uri.AppendPath("/:send", false); + if (_apiVersion != null) + { + uri.AppendQuery("api-version", _apiVersion, true); + } + request.Uri = uri; + request.Headers.Add("Content-Type", contentType.ToString()); + request.Content = content; + message.ResponseClassifier = ResponseClassifier202.Instance; + return message; + } + + internal HttpMessage CreateSendToConnectionRequest(string connectionId, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/api/hubs/", false); + uri.AppendPath(_hub, true); + uri.AppendPath("/connections/", false); + uri.AppendPath(connectionId, true); + uri.AppendPath("/:send", false); + if (_apiVersion != null) + { + uri.AppendQuery("api-version", _apiVersion, true); + } + request.Uri = uri; + request.Headers.Add("Content-Type", "text/plain"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier202.Instance; + return message; + } + + internal HttpMessage CreateGroupExistsImplRequest(string group) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/api/hubs/", false); + uri.AppendPath(_hub, true); + uri.AppendPath("/groups/", false); + uri.AppendPath(group, true); + if (_apiVersion != null) + { + uri.AppendQuery("api-version", _apiVersion, true); + } + request.Uri = uri; + message.ResponseClassifier = ResponseClassifier200404.Instance; + return message; + } + + internal HttpMessage CreateSendToGroupRequest(string group, RequestContent content, ContentType contentType, IEnumerable excluded) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/api/hubs/", false); + uri.AppendPath(_hub, true); + uri.AppendPath("/groups/", false); + uri.AppendPath(group, true); + uri.AppendPath("/:send", false); + if (excluded != null) + { + foreach (var param in excluded) + { + uri.AppendQuery("excluded", param, true); + } + } + if (_apiVersion != null) + { + uri.AppendQuery("api-version", _apiVersion, true); + } + request.Uri = uri; + request.Headers.Add("Content-Type", contentType.ToString()); + request.Content = content; + message.ResponseClassifier = ResponseClassifier202.Instance; + return message; + } + + internal HttpMessage CreateSendToGroupRequest(string group, RequestContent content, IEnumerable excluded) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/api/hubs/", false); + uri.AppendPath(_hub, true); + uri.AppendPath("/groups/", false); + uri.AppendPath(group, true); + uri.AppendPath("/:send", false); + if (excluded != null) + { + foreach (var param in excluded) + { + uri.AppendQuery("excluded", param, true); + } + } + if (_apiVersion != null) + { + uri.AppendQuery("api-version", _apiVersion, true); + } + request.Uri = uri; + request.Headers.Add("Content-Type", "text/plain"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier202.Instance; + return message; + } + + internal HttpMessage CreateAddConnectionToGroupRequest(string group, string connectionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/api/hubs/", false); + uri.AppendPath(_hub, true); + uri.AppendPath("/groups/", false); + uri.AppendPath(group, true); + uri.AppendPath("/connections/", false); + uri.AppendPath(connectionId, true); + if (_apiVersion != null) + { + uri.AppendQuery("api-version", _apiVersion, true); + } + request.Uri = uri; + message.ResponseClassifier = ResponseClassifier200404.Instance; + return message; + } + + internal HttpMessage CreateRemoveConnectionFromGroupRequest(string group, string connectionId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/api/hubs/", false); + uri.AppendPath(_hub, true); + uri.AppendPath("/groups/", false); + uri.AppendPath(group, true); + uri.AppendPath("/connections/", false); + uri.AppendPath(connectionId, true); + if (_apiVersion != null) + { + uri.AppendQuery("api-version", _apiVersion, true); + } + request.Uri = uri; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateUserExistsImplRequest(string userId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/api/hubs/", false); + uri.AppendPath(_hub, true); + uri.AppendPath("/users/", false); + uri.AppendPath(userId, true); + if (_apiVersion != null) + { + uri.AppendQuery("api-version", _apiVersion, true); + } + request.Uri = uri; + message.ResponseClassifier = ResponseClassifier200404.Instance; + return message; + } + + internal HttpMessage CreateSendToUserRequest(string userId, RequestContent content, ContentType contentType) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/api/hubs/", false); + uri.AppendPath(_hub, true); + uri.AppendPath("/users/", false); + uri.AppendPath(userId, true); + uri.AppendPath("/:send", false); + if (_apiVersion != null) + { + uri.AppendQuery("api-version", _apiVersion, true); + } + request.Uri = uri; + request.Headers.Add("Content-Type", contentType.ToString()); + request.Content = content; + message.ResponseClassifier = ResponseClassifier202.Instance; + return message; + } + + internal HttpMessage CreateSendToUserRequest(string userId, RequestContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/api/hubs/", false); + uri.AppendPath(_hub, true); + uri.AppendPath("/users/", false); + uri.AppendPath(userId, true); + uri.AppendPath("/:send", false); + if (_apiVersion != null) + { + uri.AppendQuery("api-version", _apiVersion, true); + } + request.Uri = uri; + request.Headers.Add("Content-Type", "text/plain"); + request.Content = content; + message.ResponseClassifier = ResponseClassifier202.Instance; + return message; + } + + internal HttpMessage CreateAddUserToGroupRequest(string group, string userId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/api/hubs/", false); + uri.AppendPath(_hub, true); + uri.AppendPath("/users/", false); + uri.AppendPath(userId, true); + uri.AppendPath("/groups/", false); + uri.AppendPath(group, true); + if (_apiVersion != null) + { + uri.AppendQuery("api-version", _apiVersion, true); + } + request.Uri = uri; + message.ResponseClassifier = ResponseClassifier200404.Instance; + return message; + } + + internal HttpMessage CreateRemoveUserFromGroupRequest(string group, string userId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/api/hubs/", false); + uri.AppendPath(_hub, true); + uri.AppendPath("/users/", false); + uri.AppendPath(userId, true); + uri.AppendPath("/groups/", false); + uri.AppendPath(group, true); + if (_apiVersion != null) + { + uri.AppendQuery("api-version", _apiVersion, true); + } + request.Uri = uri; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateRemoveUserFromAllGroupsRequest(string userId) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/api/hubs/", false); + uri.AppendPath(_hub, true); + uri.AppendPath("/users/", false); + uri.AppendPath(userId, true); + uri.AppendPath("/groups", false); + if (_apiVersion != null) + { + uri.AppendQuery("api-version", _apiVersion, true); + } + request.Uri = uri; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateGrantPermissionRequest(string permission, string connectionId, string targetName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Put; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/api/hubs/", false); + uri.AppendPath(_hub, true); + uri.AppendPath("/permissions/", false); + uri.AppendPath(permission, true); + uri.AppendPath("/connections/", false); + uri.AppendPath(connectionId, true); + if (targetName != null) + { + uri.AppendQuery("targetName", targetName, true); + } + if (_apiVersion != null) + { + uri.AppendQuery("api-version", _apiVersion, true); + } + request.Uri = uri; + message.ResponseClassifier = ResponseClassifier200.Instance; + return message; + } + + internal HttpMessage CreateRevokePermissionRequest(string permission, string connectionId, string targetName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/api/hubs/", false); + uri.AppendPath(_hub, true); + uri.AppendPath("/permissions/", false); + uri.AppendPath(permission, true); + uri.AppendPath("/connections/", false); + uri.AppendPath(connectionId, true); + if (targetName != null) { uri.AppendQuery("targetName", targetName, true); } - if (apiVersion != null) + if (_apiVersion != null) { - uri.AppendQuery("api-version", apiVersion, true); + uri.AppendQuery("api-version", _apiVersion, true); } request.Uri = uri; + message.ResponseClassifier = ResponseClassifier200.Instance; return message; } + + internal HttpMessage CreateCheckPermissionRequest(string permission, string connectionId, string targetName) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Head; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/api/hubs/", false); + uri.AppendPath(_hub, true); + uri.AppendPath("/permissions/", false); + uri.AppendPath(permission, true); + uri.AppendPath("/connections/", false); + uri.AppendPath(connectionId, true); + if (targetName != null) + { + uri.AppendQuery("targetName", targetName, true); + } + if (_apiVersion != null) + { + uri.AppendQuery("api-version", _apiVersion, true); + } + request.Uri = uri; + message.ResponseClassifier = ResponseClassifier200404.Instance; + return message; + } + + private sealed class ResponseClassifier200 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier202 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier202(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 202 => false, + _ => true + }; + } + } + private sealed class ResponseClassifier200404 : ResponseClassifier + { + private static ResponseClassifier _instance; + public static ResponseClassifier Instance => _instance ??= new ResponseClassifier200404(); + public override bool IsErrorResponse(HttpMessage message) + { + return message.Response.Status switch + { + 200 => false, + 404 => false, + _ => true + }; + } + } } } diff --git a/sdk/webpubsub/Azure.Messaging.WebPubSub/src/WebPubSubServiceClient_extensions.cs b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/WebPubSubServiceClient_extensions.cs index 1455b15ba51b3..9c2055063bf16 100644 --- a/sdk/webpubsub/Azure.Messaging.WebPubSub/src/WebPubSubServiceClient_extensions.cs +++ b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/WebPubSubServiceClient_extensions.cs @@ -29,12 +29,12 @@ public partial class WebPubSubServiceClient /// /// The hub. /// - public virtual string Hub => hub; + public virtual string Hub => _hub; /// /// The service endpoint. /// - public virtual Uri Endpoint => endpoint; + public virtual Uri Endpoint => _endpoint; /// Initializes a new instance of WebPubSubServiceClient. /// server parameter. @@ -149,12 +149,12 @@ private WebPubSubServiceClient(Uri endpoint, string hub, WebPubSubServiceClientO Argument.AssertNotNull(endpoint, nameof(endpoint)); Argument.AssertNotNull(hub, nameof(hub)); - this.hub = hub; - this.endpoint = endpoint; + _hub = hub; + _endpoint = endpoint; options ??= new WebPubSubServiceClientOptions(); _clientDiagnostics = new ClientDiagnostics(options); - apiVersion = options.Version; + _apiVersion = options.Version; } /// Broadcast message to all the connected client connections. diff --git a/sdk/webpubsub/Azure.Messaging.WebPubSub/src/WebPubSubServiceClient_helpers.cs b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/WebPubSubServiceClient_helpers.cs index 80c64c1fa1f95..f9354e010506b 100644 --- a/sdk/webpubsub/Azure.Messaging.WebPubSub/src/WebPubSubServiceClient_helpers.cs +++ b/sdk/webpubsub/Azure.Messaging.WebPubSub/src/WebPubSubServiceClient_helpers.cs @@ -105,8 +105,8 @@ private async Task GenerateClientAccessUriInternal( RequestOptions options = new() { CancellationToken = cancellationToken }; Response clientTokenResponse = async ? - await GenerateClientTokenImplAsync(userId, roles, expiresAt.Minute, options).ConfigureAwait(false) : - GenerateClientTokenImpl(userId, roles, expiresAt.Minute, options); + await GenerateClientTokenImplAsync(options, userId, roles, expiresAt.Minute).ConfigureAwait(false) : + GenerateClientTokenImpl(options, userId, roles, expiresAt.Minute); token = JsonDocument.Parse(clientTokenResponse.Content).RootElement.GetProperty(ClientTokenResponseTokenPropertyName).GetString(); } else if (_credential != null) @@ -118,12 +118,12 @@ await GenerateClientTokenImplAsync(userId, roles, expiresAt.Minute, options).Con throw new InvalidOperationException($"{nameof(WebPubSubServiceClient)} must be constructed with either a {typeof(TokenCredential)} or {typeof(AzureKeyCredential)} to generate client access URIs."); } - UriBuilder clientEndpoint = new(endpoint) + UriBuilder clientEndpoint = new(_endpoint) { - Scheme = endpoint.Scheme == "http" ? "ws" : "wss" + Scheme = _endpoint.Scheme == "http" ? "ws" : "wss" }; - return new Uri($"{clientEndpoint}client/hubs/{hub}?access_token={token}"); + return new Uri($"{clientEndpoint}client/hubs/{_hub}?access_token={token}"); } /// @@ -231,12 +231,12 @@ private string GenerateTokenFromAzureKeyCredential(DateTimeOffset expiresAt, str var jwt = new JwtBuilder(keyBytes); var now = DateTimeOffset.UtcNow; - string endpoint = this.endpoint.AbsoluteUri; + string endpoint = _endpoint.AbsoluteUri; if (!endpoint.EndsWith("/", StringComparison.Ordinal)) { endpoint += "/"; } - var audience = $"{endpoint}client/hubs/{hub}"; + var audience = $"{endpoint}client/hubs/{_hub}"; if (userId != default) {