diff --git a/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/IResourceGraphClient.cs b/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/IResourceGraphClient.cs index fe940384cd33b..8fda38b86b76e 100644 --- a/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/IResourceGraphClient.cs +++ b/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/IResourceGraphClient.cs @@ -88,5 +88,33 @@ public partial interface IResourceGraphClient : System.IDisposable /// Task> ResourcesWithHttpMessagesAsync(QueryRequest query, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// List changes to a resource for a given time interval. + /// + /// + /// the parameters for this request for changes. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> ResourceChangesWithHttpMessagesAsync(ResourceChangesRequestParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + + /// + /// Get resource change details. + /// + /// + /// The parameters for this request for resource change details. + /// + /// + /// The headers that will be added to request. + /// + /// + /// The cancellation token. + /// + Task> ResourceChangeDetailsWithHttpMessagesAsync(ResourceChangeDetailsRequestParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)); + } } diff --git a/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/Models/DateTimeInterval.cs b/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/Models/DateTimeInterval.cs new file mode 100644 index 0000000000000..d9afca89cddfa --- /dev/null +++ b/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/Models/DateTimeInterval.cs @@ -0,0 +1,81 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ResourceGraph.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// An interval in time specifying the date and time for the inclusive + /// start and exclusive end, i.e. `[start, end)`. + /// + public partial class DateTimeInterval + { + /// + /// Initializes a new instance of the DateTimeInterval class. + /// + public DateTimeInterval() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the DateTimeInterval class. + /// + /// A datetime indicating the inclusive/closed + /// start of the time interval, i.e. `[`**`start`**`, end)`. Specifying + /// a `start` that occurs chronologically after `end` will result in an + /// error. + /// A datetime indicating the exclusive/open end of + /// the time interval, i.e. `[start, `**`end`**`)`. Specifying an `end` + /// that occurs chronologically before `start` will result in an + /// error. + public DateTimeInterval(System.DateTime start, System.DateTime end) + { + Start = start; + End = end; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets a datetime indicating the inclusive/closed start of + /// the time interval, i.e. `[`**`start`**`, end)`. Specifying a + /// `start` that occurs chronologically after `end` will result in an + /// error. + /// + [JsonProperty(PropertyName = "start")] + public System.DateTime Start { get; set; } + + /// + /// Gets or sets a datetime indicating the exclusive/open end of the + /// time interval, i.e. `[start, `**`end`**`)`. Specifying an `end` + /// that occurs chronologically before `start` will result in an error. + /// + [JsonProperty(PropertyName = "end")] + public System.DateTime End { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/Models/FacetRequestOptions.cs b/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/Models/FacetRequestOptions.cs index 62564cddc6c19..a6ea39b355a7f 100644 --- a/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/Models/FacetRequestOptions.cs +++ b/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/Models/FacetRequestOptions.cs @@ -30,13 +30,20 @@ public FacetRequestOptions() /// /// Initializes a new instance of the FacetRequestOptions class. /// - /// The sorting order by the hit count. - /// Possible values include: 'asc', 'desc' + /// The column name or query expression to sort + /// on. Defaults to count if not present. + /// The sorting order by the selected column + /// (count by default). Possible values include: 'asc', 'desc' + /// Specifies the filter condition for the 'where' + /// clause which will be run on main query's result, just before the + /// actual faceting. /// The maximum number of facet rows that should be /// returned. - public FacetRequestOptions(FacetSortOrder? sortOrder = default(FacetSortOrder?), int? top = default(int?)) + public FacetRequestOptions(string sortBy = default(string), FacetSortOrder? sortOrder = default(FacetSortOrder?), string filter = default(string), int? top = default(int?)) { + SortBy = sortBy; SortOrder = sortOrder; + Filter = filter; Top = top; CustomInit(); } @@ -47,12 +54,27 @@ public FacetRequestOptions() partial void CustomInit(); /// - /// Gets or sets the sorting order by the hit count. Possible values - /// include: 'asc', 'desc' + /// Gets or sets the column name or query expression to sort on. + /// Defaults to count if not present. + /// + [JsonProperty(PropertyName = "sortBy")] + public string SortBy { get; set; } + + /// + /// Gets or sets the sorting order by the selected column (count by + /// default). Possible values include: 'asc', 'desc' /// [JsonProperty(PropertyName = "sortOrder")] public FacetSortOrder? SortOrder { get; set; } + /// + /// Gets or sets specifies the filter condition for the 'where' clause + /// which will be run on main query's result, just before the actual + /// faceting. + /// + [JsonProperty(PropertyName = "filter")] + public string Filter { get; set; } + /// /// Gets or sets the maximum number of facet rows that should be /// returned. diff --git a/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/Models/ResourceChangeData.cs b/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/Models/ResourceChangeData.cs new file mode 100644 index 0000000000000..1e46d729e8c63 --- /dev/null +++ b/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/Models/ResourceChangeData.cs @@ -0,0 +1,101 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ResourceGraph.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// Data on a specific change, represented by a pair of before and after + /// resource snapshots. + /// + public partial class ResourceChangeData + { + /// + /// Initializes a new instance of the ResourceChangeData class. + /// + public ResourceChangeData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceChangeData class. + /// + /// The change ID. Valid and unique within the + /// specified resource only. + /// The snapshot before the + /// change. + /// The snapshot after the change. + public ResourceChangeData(string changeId, ResourceChangeDataBeforeSnapshot beforeSnapshot, ResourceChangeDataAfterSnapshot afterSnapshot) + { + ChangeId = changeId; + BeforeSnapshot = beforeSnapshot; + AfterSnapshot = afterSnapshot; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the change ID. Valid and unique within the specified + /// resource only. + /// + [JsonProperty(PropertyName = "changeId")] + public string ChangeId { get; set; } + + /// + /// Gets or sets the snapshot before the change. + /// + [JsonProperty(PropertyName = "beforeSnapshot")] + public ResourceChangeDataBeforeSnapshot BeforeSnapshot { get; set; } + + /// + /// Gets or sets the snapshot after the change. + /// + [JsonProperty(PropertyName = "afterSnapshot")] + public ResourceChangeDataAfterSnapshot AfterSnapshot { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ChangeId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ChangeId"); + } + if (BeforeSnapshot == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "BeforeSnapshot"); + } + if (AfterSnapshot == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "AfterSnapshot"); + } + if (BeforeSnapshot != null) + { + BeforeSnapshot.Validate(); + } + if (AfterSnapshot != null) + { + AfterSnapshot.Validate(); + } + } + } +} diff --git a/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/Models/ResourceChangeDataAfterSnapshot.cs b/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/Models/ResourceChangeDataAfterSnapshot.cs new file mode 100644 index 0000000000000..3f2ec8c3bdc7e --- /dev/null +++ b/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/Models/ResourceChangeDataAfterSnapshot.cs @@ -0,0 +1,64 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ResourceGraph.Models +{ + using System.Linq; + + /// + /// The snapshot after the change. + /// + public partial class ResourceChangeDataAfterSnapshot : ResourceSnapshotData + { + /// + /// Initializes a new instance of the ResourceChangeDataAfterSnapshot + /// class. + /// + public ResourceChangeDataAfterSnapshot() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceChangeDataAfterSnapshot + /// class. + /// + /// The time when the snapshot was created. + /// The snapshot timestamp provides an approximation as to when a + /// modification to a resource was detected. There can be a difference + /// between the actual modification time and the detection time. This + /// is due to differences in how operations that modify a resource are + /// processed, versus how operation that record resource snapshots are + /// processed. + /// The resource snapshot content (in + /// resourceChangeDetails response only). + public ResourceChangeDataAfterSnapshot(System.DateTime timestamp, object content = default(object)) + : base(timestamp, content) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/Models/ResourceChangeDataBeforeSnapshot.cs b/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/Models/ResourceChangeDataBeforeSnapshot.cs new file mode 100644 index 0000000000000..f8e471ec05ca4 --- /dev/null +++ b/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/Models/ResourceChangeDataBeforeSnapshot.cs @@ -0,0 +1,64 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ResourceGraph.Models +{ + using System.Linq; + + /// + /// The snapshot before the change. + /// + public partial class ResourceChangeDataBeforeSnapshot : ResourceSnapshotData + { + /// + /// Initializes a new instance of the ResourceChangeDataBeforeSnapshot + /// class. + /// + public ResourceChangeDataBeforeSnapshot() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceChangeDataBeforeSnapshot + /// class. + /// + /// The time when the snapshot was created. + /// The snapshot timestamp provides an approximation as to when a + /// modification to a resource was detected. There can be a difference + /// between the actual modification time and the detection time. This + /// is due to differences in how operations that modify a resource are + /// processed, versus how operation that record resource snapshots are + /// processed. + /// The resource snapshot content (in + /// resourceChangeDetails response only). + public ResourceChangeDataBeforeSnapshot(System.DateTime timestamp, object content = default(object)) + : base(timestamp, content) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/Models/ResourceChangeDetailsRequestParameters.cs b/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/Models/ResourceChangeDetailsRequestParameters.cs new file mode 100644 index 0000000000000..b4c7f2672abae --- /dev/null +++ b/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/Models/ResourceChangeDetailsRequestParameters.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ResourceGraph.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The parameters for a specific change details request. + /// + public partial class ResourceChangeDetailsRequestParameters + { + /// + /// Initializes a new instance of the + /// ResourceChangeDetailsRequestParameters class. + /// + public ResourceChangeDetailsRequestParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ResourceChangeDetailsRequestParameters class. + /// + /// Specifies the resource for a change + /// details request. + /// Specifies the change ID. + public ResourceChangeDetailsRequestParameters(string resourceId, string changeId) + { + ResourceId = resourceId; + ChangeId = changeId; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the resource for a change details request. + /// + [JsonProperty(PropertyName = "resourceId")] + public string ResourceId { get; set; } + + /// + /// Gets or sets specifies the change ID. + /// + [JsonProperty(PropertyName = "changeId")] + public string ChangeId { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ResourceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ResourceId"); + } + if (ChangeId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ChangeId"); + } + } + } +} diff --git a/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/Models/ResourceChangeList.cs b/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/Models/ResourceChangeList.cs new file mode 100644 index 0000000000000..1b3757e0f024c --- /dev/null +++ b/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/Models/ResourceChangeList.cs @@ -0,0 +1,80 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ResourceGraph.Models +{ + using Newtonsoft.Json; + using System.Collections; + using System.Collections.Generic; + using System.Linq; + + /// + /// A list of changes associated with a resource over a specific time + /// interval. + /// + public partial class ResourceChangeList + { + /// + /// Initializes a new instance of the ResourceChangeList class. + /// + public ResourceChangeList() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceChangeList class. + /// + /// The pageable value returned by the operation, + /// i.e. a list of changes to the resource. + /// + /// - The list is ordered from the most recent changes to the least + /// recent changes. + /// - This list will be empty if there were no changes during the + /// requested interval. + /// - The `Before` snapshot timestamp value of the oldest change can be + /// outside of the specified time interval. + /// Skip token that encodes the skip + /// information while executing the current request + public ResourceChangeList(IList changes = default(IList), object skipToken = default(object)) + { + Changes = changes; + SkipToken = skipToken; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the pageable value returned by the operation, i.e. a + /// list of changes to the resource. + /// + /// - The list is ordered from the most recent changes to the least + /// recent changes. + /// - This list will be empty if there were no changes during the + /// requested interval. + /// - The `Before` snapshot timestamp value of the oldest change can be + /// outside of the specified time interval. + /// + [JsonProperty(PropertyName = "changes")] + public IList Changes { get; set; } + + /// + /// Gets or sets skip token that encodes the skip information while + /// executing the current request + /// + [JsonProperty(PropertyName = "$skipToken")] + public object SkipToken { get; set; } + + } +} diff --git a/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/Models/ResourceChangesRequestParameters.cs b/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/Models/ResourceChangesRequestParameters.cs new file mode 100644 index 0000000000000..1d8e9541fc564 --- /dev/null +++ b/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/Models/ResourceChangesRequestParameters.cs @@ -0,0 +1,113 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ResourceGraph.Models +{ + using Microsoft.Rest; + using Newtonsoft.Json; + using System.Linq; + + /// + /// The parameters for a specific changes request. + /// + public partial class ResourceChangesRequestParameters + { + /// + /// Initializes a new instance of the ResourceChangesRequestParameters + /// class. + /// + public ResourceChangesRequestParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceChangesRequestParameters + /// class. + /// + /// Specifies the resource for a changes + /// request. + /// Specifies the date and time interval for a + /// changes request. + /// Acts as the continuation token for paged + /// responses. + /// The maximum number of changes the client can + /// accept in a paged response. + public ResourceChangesRequestParameters(string resourceId, ResourceChangesRequestParametersInterval interval, string skipToken = default(string), int? top = default(int?)) + { + ResourceId = resourceId; + Interval = interval; + SkipToken = skipToken; + Top = top; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets specifies the resource for a changes request. + /// + [JsonProperty(PropertyName = "resourceId")] + public string ResourceId { get; set; } + + /// + /// Gets or sets specifies the date and time interval for a changes + /// request. + /// + [JsonProperty(PropertyName = "interval")] + public ResourceChangesRequestParametersInterval Interval { get; set; } + + /// + /// Gets or sets acts as the continuation token for paged responses. + /// + [JsonProperty(PropertyName = "$skipToken")] + public string SkipToken { get; set; } + + /// + /// Gets or sets the maximum number of changes the client can accept in + /// a paged response. + /// + [JsonProperty(PropertyName = "$top")] + public int? Top { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (ResourceId == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "ResourceId"); + } + if (Interval == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "Interval"); + } + if (Interval != null) + { + Interval.Validate(); + } + if (Top > 1000) + { + throw new ValidationException(ValidationRules.InclusiveMaximum, "Top", 1000); + } + if (Top < 1) + { + throw new ValidationException(ValidationRules.InclusiveMinimum, "Top", 1); + } + } + } +} diff --git a/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/Models/ResourceChangesRequestParametersInterval.cs b/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/Models/ResourceChangesRequestParametersInterval.cs new file mode 100644 index 0000000000000..8e117167d6516 --- /dev/null +++ b/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/Models/ResourceChangesRequestParametersInterval.cs @@ -0,0 +1,63 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ResourceGraph.Models +{ + using System.Linq; + + /// + /// Specifies the date and time interval for a changes request. + /// + public partial class ResourceChangesRequestParametersInterval : DateTimeInterval + { + /// + /// Initializes a new instance of the + /// ResourceChangesRequestParametersInterval class. + /// + public ResourceChangesRequestParametersInterval() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the + /// ResourceChangesRequestParametersInterval class. + /// + /// A datetime indicating the inclusive/closed + /// start of the time interval, i.e. `[`**`start`**`, end)`. Specifying + /// a `start` that occurs chronologically after `end` will result in an + /// error. + /// A datetime indicating the exclusive/open end of + /// the time interval, i.e. `[start, `**`end`**`)`. Specifying an `end` + /// that occurs chronologically before `start` will result in an + /// error. + public ResourceChangesRequestParametersInterval(System.DateTime start, System.DateTime end) + : base(start, end) + { + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public override void Validate() + { + base.Validate(); + } + } +} diff --git a/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/Models/ResourceSnapshotData.cs b/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/Models/ResourceSnapshotData.cs new file mode 100644 index 0000000000000..e9efc19681136 --- /dev/null +++ b/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/Models/ResourceSnapshotData.cs @@ -0,0 +1,83 @@ +// +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See License.txt in the project root for +// license information. +// +// Code generated by Microsoft (R) AutoRest Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is +// regenerated. +// + +namespace Microsoft.Azure.Management.ResourceGraph.Models +{ + using Newtonsoft.Json; + using System.Linq; + + /// + /// Data on a specific resource snapshot. + /// + public partial class ResourceSnapshotData + { + /// + /// Initializes a new instance of the ResourceSnapshotData class. + /// + public ResourceSnapshotData() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the ResourceSnapshotData class. + /// + /// The time when the snapshot was created. + /// The snapshot timestamp provides an approximation as to when a + /// modification to a resource was detected. There can be a difference + /// between the actual modification time and the detection time. This + /// is due to differences in how operations that modify a resource are + /// processed, versus how operation that record resource snapshots are + /// processed. + /// The resource snapshot content (in + /// resourceChangeDetails response only). + public ResourceSnapshotData(System.DateTime timestamp, object content = default(object)) + { + Timestamp = timestamp; + Content = content; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + /// + /// Gets or sets the time when the snapshot was created. + /// The snapshot timestamp provides an approximation as to when a + /// modification to a resource was detected. There can be a difference + /// between the actual modification time and the detection time. This + /// is due to differences in how operations that modify a resource are + /// processed, versus how operation that record resource snapshots are + /// processed. + /// + [JsonProperty(PropertyName = "timestamp")] + public System.DateTime Timestamp { get; set; } + + /// + /// Gets or sets the resource snapshot content (in + /// resourceChangeDetails response only). + /// + [JsonProperty(PropertyName = "content")] + public object Content { get; set; } + + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + //Nothing to validate + } + } +} diff --git a/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/ResourceGraphClient.cs b/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/ResourceGraphClient.cs index 7f7e15ecf0a98..f5e0e93fe6e76 100644 --- a/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/ResourceGraphClient.cs +++ b/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/ResourceGraphClient.cs @@ -541,5 +541,377 @@ private void Initialize() return _result; } + /// + /// List changes to a resource for a given time interval. + /// + /// + /// the parameters for this request for changes. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ResourceChangesWithHttpMessagesAsync(ResourceChangesRequestParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.ApiVersion"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ResourceChanges", tracingParameters); + } + // Construct URL + var _baseUrl = BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.ResourceGraph/resourceChanges").ToString(); + List _queryParameters = new List(); + if (ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (GenerateClientRequestId != null && GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = SafeJsonConvert.SerializeObject(parameters, SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + + /// + /// Get resource change details. + /// + /// + /// The parameters for this request for resource change details. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + /// + /// Thrown when the operation returned an invalid status code + /// + /// + /// Thrown when unable to deserialize the response + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// Thrown when a required parameter is null + /// + /// + /// A response object containing the response body and response headers. + /// + public async Task> ResourceChangeDetailsWithHttpMessagesAsync(ResourceChangeDetailsRequestParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) + { + if (ApiVersion == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "this.ApiVersion"); + } + if (parameters == null) + { + throw new ValidationException(ValidationRules.CannotBeNull, "parameters"); + } + if (parameters != null) + { + parameters.Validate(); + } + // Tracing + bool _shouldTrace = ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = ServiceClientTracing.NextInvocationId.ToString(); + Dictionary tracingParameters = new Dictionary(); + tracingParameters.Add("parameters", parameters); + tracingParameters.Add("cancellationToken", cancellationToken); + ServiceClientTracing.Enter(_invocationId, this, "ResourceChangeDetails", tracingParameters); + } + // Construct URL + var _baseUrl = BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "providers/Microsoft.ResourceGraph/resourceChangeDetails").ToString(); + List _queryParameters = new List(); + if (ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new HttpRequestMessage(); + HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new HttpMethod("POST"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (GenerateClientRequestId != null && GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", AcceptLanguage); + } + + + if (customHeaders != null) + { + foreach(var _header in customHeaders) + { + if (_httpRequest.Headers.Contains(_header.Key)) + { + _httpRequest.Headers.Remove(_header.Key); + } + _httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value); + } + } + + // Serialize Request + string _requestContent = null; + if(parameters != null) + { + _requestContent = SafeJsonConvert.SerializeObject(parameters, SerializationSettings); + _httpRequest.Content = new StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + if ((int)_statusCode != 200) + { + var ex = new ErrorResponseException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + ErrorResponse _errorBody = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (JsonException) + { + // Ignore the exception + } + ex.Request = new HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new AzureOperationResponse(); + _result.Request = _httpRequest; + _result.Response = _httpResponse; + if (_httpResponse.Headers.Contains("x-ms-request-id")) + { + _result.RequestId = _httpResponse.Headers.GetValues("x-ms-request-id").FirstOrDefault(); + } + // Deserialize Response + if ((int)_statusCode == 200) + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + try + { + _result.Body = SafeJsonConvert.DeserializeObject(_responseContent, DeserializationSettings); + } + catch (JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + if (_shouldTrace) + { + ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + } + } } diff --git a/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/ResourceGraphClientExtensions.cs b/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/ResourceGraphClientExtensions.cs index f9b1e8b4e9ca3..129430b7ca931 100644 --- a/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/ResourceGraphClientExtensions.cs +++ b/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/ResourceGraphClientExtensions.cs @@ -59,5 +59,73 @@ public static QueryResponse Resources(this IResourceGraphClient operations, Quer } } + /// + /// List changes to a resource for a given time interval. + /// + /// + /// The operations group for this extension method. + /// + /// + /// the parameters for this request for changes. + /// + public static ResourceChangeList ResourceChanges(this IResourceGraphClient operations, ResourceChangesRequestParameters parameters) + { + return operations.ResourceChangesAsync(parameters).GetAwaiter().GetResult(); + } + + /// + /// List changes to a resource for a given time interval. + /// + /// + /// The operations group for this extension method. + /// + /// + /// the parameters for this request for changes. + /// + /// + /// The cancellation token. + /// + public static async Task ResourceChangesAsync(this IResourceGraphClient operations, ResourceChangesRequestParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ResourceChangesWithHttpMessagesAsync(parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + + /// + /// Get resource change details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The parameters for this request for resource change details. + /// + public static ResourceChangeData ResourceChangeDetails(this IResourceGraphClient operations, ResourceChangeDetailsRequestParameters parameters) + { + return operations.ResourceChangeDetailsAsync(parameters).GetAwaiter().GetResult(); + } + + /// + /// Get resource change details. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The parameters for this request for resource change details. + /// + /// + /// The cancellation token. + /// + public static async Task ResourceChangeDetailsAsync(this IResourceGraphClient operations, ResourceChangeDetailsRequestParameters parameters, CancellationToken cancellationToken = default(CancellationToken)) + { + using (var _result = await operations.ResourceChangeDetailsWithHttpMessagesAsync(parameters, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + } } diff --git a/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/SdkInfo_ResourceGraphClient.cs b/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/SdkInfo_ResourceGraphClient.cs index 2344c75d535ee..0e7a24649ffa0 100644 --- a/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/SdkInfo_ResourceGraphClient.cs +++ b/src/SDKs/ResourceGraph/Management/Management.ResourceGraph/Generated/SdkInfo_ResourceGraphClient.cs @@ -20,20 +20,11 @@ public static IEnumerable> ApiInfo_ResourceGraphCl return new Tuple[] { new Tuple("ResourceGraph", "Operations", "2018-09-01-preview"), + new Tuple("ResourceGraph", "ResourceChangeDetails", "2018-09-01-preview"), + new Tuple("ResourceGraph", "ResourceChanges", "2018-09-01-preview"), new Tuple("ResourceGraph", "Resources", "2018-09-01-preview"), }.AsEnumerable(); } } - // BEGIN: Code Generation Metadata Section - public static readonly String AutoRestVersion = "latest"; - public static readonly String AutoRestBootStrapperVersion = "autorest@2.0.4283"; - public static readonly String AutoRestCmdExecuted = "cmd.exe /c autorest.cmd https://github.com/Azure/azure-rest-api-specs/blob/master/specification/resourcegraph/resource-manager/readme.md --csharp --version=latest --reflect-api-versions --csharp-sdks-folder=C:\\git\\azure-sdk-for-net\\src\\SDKs"; - public static readonly String GithubForkName = "Azure"; - public static readonly String GithubBranchName = "master"; - public static readonly String GithubCommidId = "15929694cc9babeb19c0e834f8babe23af323b75"; - public static readonly String CodeGenerationErrors = ""; - public static readonly String GithubRepoName = "azure-rest-api-specs"; - // END: Code Generation Metadata Section } } -