diff --git a/src/StorageSync/StorageSync.Management.Sdk/Generated/CloudEndpointsOperations.cs b/src/StorageSync/StorageSync.Management.Sdk/Generated/CloudEndpointsOperations.cs index 9cc43a00a67e..078a5b896374 100644 --- a/src/StorageSync/StorageSync.Management.Sdk/Generated/CloudEndpointsOperations.cs +++ b/src/StorageSync/StorageSync.Management.Sdk/Generated/CloudEndpointsOperations.cs @@ -553,6 +553,37 @@ internal CloudEndpointsOperations (StorageSyncManagementClient client) return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } + /// + /// Patch a given CloudEndpoint. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Storage Sync Service resource. + /// + /// + /// Name of Sync Group resource. + /// + /// + /// Name of Cloud Endpoint object. + /// + /// + /// The interval for enumerating changes on the cloud endpoint. + /// + /// + /// Headers that will be added to request. + /// + /// + /// The cancellation token. + /// + public async System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, string syncGroupName, string cloudEndpointName, int? changeEnumerationIntervalDays = default(int?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + // Send Request + Microsoft.Rest.Azure.AzureOperationResponse _response = await BeginUpdateWithHttpMessagesAsync(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, changeEnumerationIntervalDays, customHeaders, cancellationToken).ConfigureAwait(false); + return await this.Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); + } + /// /// Delete a given CloudEndpoint. /// @@ -1259,7 +1290,10 @@ internal CloudEndpointsOperations (StorageSyncManagementClient client) { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters"); } - + if (parameters != null) + { + parameters.Validate(); + } if (this.Client.ApiVersion == null) { throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); @@ -1471,6 +1505,268 @@ internal CloudEndpointsOperations (StorageSyncManagementClient client) + } + /// + /// Patch a given CloudEndpoint. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Storage Sync Service resource. + /// + /// + /// Name of Sync Group resource. + /// + /// + /// Name of Cloud Endpoint object. + /// + /// + /// The interval for enumerating changes on the cloud endpoint. + /// + /// + /// 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 System.Threading.Tasks.Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, string syncGroupName, string cloudEndpointName, int? changeEnumerationIntervalDays = default(int?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + + + + + if (this.Client.ApiVersion == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.Client.ApiVersion"); + } + + + if (resourceGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "resourceGroupName"); + } + if (resourceGroupName != null) + { + if (resourceGroupName.Length > 90) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "resourceGroupName", 90); + } + if (resourceGroupName.Length < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinLength, "resourceGroupName", 1); + } + } + if (storageSyncServiceName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "storageSyncServiceName"); + } + + if (syncGroupName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "syncGroupName"); + } + + if (cloudEndpointName == null) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "cloudEndpointName"); + } + + CloudEndpointUpdateParameters properties = new CloudEndpointUpdateParameters(); + if(changeEnumerationIntervalDays != null) + { + properties.ChangeEnumerationIntervalDays = changeEnumerationIntervalDays; + } + // Tracing + bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled; + string _invocationId = null; + if (_shouldTrace) + { + _invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString(); + System.Collections.Generic.Dictionary tracingParameters = new System.Collections.Generic.Dictionary(); + tracingParameters.Add("resourceGroupName", resourceGroupName); + tracingParameters.Add("storageSyncServiceName", storageSyncServiceName); + tracingParameters.Add("syncGroupName", syncGroupName); + tracingParameters.Add("cloudEndpointName", cloudEndpointName); + + tracingParameters.Add("properties", properties); + + tracingParameters.Add("cancellationToken", cancellationToken); + Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "BeginUpdate", tracingParameters); + } + // Construct URL + + var _baseUrl = this.Client.BaseUri.AbsoluteUri; + var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.StorageSync/storageSyncServices/{storageSyncServiceName}/syncGroups/{syncGroupName}/cloudEndpoints/{cloudEndpointName}").ToString(); + _url = _url.Replace("{subscriptionId}", System.Uri.EscapeDataString(Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(this.Client.SubscriptionId, this.Client.SerializationSettings).Trim('"'))); + _url = _url.Replace("{resourceGroupName}", System.Uri.EscapeDataString(resourceGroupName)); + _url = _url.Replace("{storageSyncServiceName}", System.Uri.EscapeDataString(storageSyncServiceName)); + _url = _url.Replace("{syncGroupName}", System.Uri.EscapeDataString(syncGroupName)); + _url = _url.Replace("{cloudEndpointName}", System.Uri.EscapeDataString(cloudEndpointName)); + + System.Collections.Generic.List _queryParameters = new System.Collections.Generic.List(); + if (this.Client.ApiVersion != null) + { + _queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.Client.ApiVersion))); + } + if (_queryParameters.Count > 0) + { + _url += (_url.Contains("?") ? "&" : "?") + string.Join("&", _queryParameters); + } + // Create HTTP transport objects + var _httpRequest = new System.Net.Http.HttpRequestMessage(); + System.Net.Http.HttpResponseMessage _httpResponse = null; + _httpRequest.Method = new System.Net.Http.HttpMethod("PATCH"); + _httpRequest.RequestUri = new System.Uri(_url); + // Set Headers + if (this.Client.GenerateClientRequestId != null && this.Client.GenerateClientRequestId.Value) + { + _httpRequest.Headers.TryAddWithoutValidation("x-ms-client-request-id", System.Guid.NewGuid().ToString()); + } + if (this.Client.AcceptLanguage != null) + { + if (_httpRequest.Headers.Contains("accept-language")) + { + _httpRequest.Headers.Remove("accept-language"); + } + _httpRequest.Headers.TryAddWithoutValidation("accept-language", this.Client.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(properties != null) + { + _requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(properties, this.Client.SerializationSettings); + _httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8); + _httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8"); + } + // Set Credentials + if (this.Client.Credentials != null) + { + cancellationToken.ThrowIfCancellationRequested(); + await this.Client.Credentials.ProcessHttpRequestAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + } + // Send Request + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest); + } + cancellationToken.ThrowIfCancellationRequested(); + _httpResponse = await this.Client.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse); + } + + System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode; + cancellationToken.ThrowIfCancellationRequested(); + string _responseContent = null; + + if ((int)_statusCode != 200 && (int)_statusCode != 202) + { + var ex = new StorageSyncErrorException(string.Format("Operation returned an invalid status code '{0}'", _statusCode)); + try + { + _responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false); + StorageSyncError _errorBody = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + if (_errorBody != null) + { + ex.Body = _errorBody; + } + } + catch (Newtonsoft.Json.JsonException) + { + // Ignore the exception + } + ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent); + ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent); + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex); + } + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw ex; + } + // Create Result + var _result = new Microsoft.Rest.Azure.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 = Microsoft.Rest.Serialization.SafeJsonConvert.DeserializeObject(_responseContent, this.Client.DeserializationSettings); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the response.", _responseContent, ex); + } + } + try + { + _result.Headers = _httpResponse.GetHeadersAsJson().ToObject(Newtonsoft.Json.JsonSerializer.Create(this.Client.DeserializationSettings)); + } + catch (Newtonsoft.Json.JsonException ex) + { + _httpRequest.Dispose(); + if (_httpResponse != null) + { + _httpResponse.Dispose(); + } + throw new Microsoft.Rest.SerializationException("Unable to deserialize the headers.", _httpResponse.GetHeadersAsJson().ToString(), ex); + } + if (_shouldTrace) + { + Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result); + } + return _result; + + + + + } /// /// Delete a given CloudEndpoint. diff --git a/src/StorageSync/StorageSync.Management.Sdk/Generated/CloudEndpointsOperationsExtensions.cs b/src/StorageSync/StorageSync.Management.Sdk/Generated/CloudEndpointsOperationsExtensions.cs index f85e97ab88e1..a6f70cdc0962 100644 --- a/src/StorageSync/StorageSync.Management.Sdk/Generated/CloudEndpointsOperationsExtensions.cs +++ b/src/StorageSync/StorageSync.Management.Sdk/Generated/CloudEndpointsOperationsExtensions.cs @@ -160,6 +160,57 @@ public static CloudEndpoint Create(this ICloudEndpointsOperations operations, st } } /// + /// Patch a given CloudEndpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Storage Sync Service resource. + /// + /// + /// Name of Sync Group resource. + /// + /// + /// Name of Cloud Endpoint object. + /// + public static CloudEndpoint Update(this ICloudEndpointsOperations operations, string resourceGroupName, string storageSyncServiceName, string syncGroupName, string cloudEndpointName, int? changeEnumerationIntervalDays = default(int?)) + { + return ((ICloudEndpointsOperations)operations).UpdateAsync(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, changeEnumerationIntervalDays).GetAwaiter().GetResult(); + } + + /// + /// Patch a given CloudEndpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Storage Sync Service resource. + /// + /// + /// Name of Sync Group resource. + /// + /// + /// Name of Cloud Endpoint object. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task UpdateAsync(this ICloudEndpointsOperations operations, string resourceGroupName, string storageSyncServiceName, string syncGroupName, string cloudEndpointName, int? changeEnumerationIntervalDays = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.UpdateWithHttpMessagesAsync(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, changeEnumerationIntervalDays, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Delete a given CloudEndpoint. /// /// @@ -621,6 +672,57 @@ public static CloudEndpoint BeginCreate(this ICloudEndpointsOperations operation } } /// + /// Patch a given CloudEndpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Storage Sync Service resource. + /// + /// + /// Name of Sync Group resource. + /// + /// + /// Name of Cloud Endpoint object. + /// + public static CloudEndpoint BeginUpdate(this ICloudEndpointsOperations operations, string resourceGroupName, string storageSyncServiceName, string syncGroupName, string cloudEndpointName, int? changeEnumerationIntervalDays = default(int?)) + { + return ((ICloudEndpointsOperations)operations).BeginUpdateAsync(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, changeEnumerationIntervalDays).GetAwaiter().GetResult(); + } + + /// + /// Patch a given CloudEndpoint. + /// + /// + /// The operations group for this extension method. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Storage Sync Service resource. + /// + /// + /// Name of Sync Group resource. + /// + /// + /// Name of Cloud Endpoint object. + /// + /// + /// The cancellation token. + /// + public static async System.Threading.Tasks.Task BeginUpdateAsync(this ICloudEndpointsOperations operations, string resourceGroupName, string storageSyncServiceName, string syncGroupName, string cloudEndpointName, int? changeEnumerationIntervalDays = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) + { + using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, storageSyncServiceName, syncGroupName, cloudEndpointName, changeEnumerationIntervalDays, null, cancellationToken).ConfigureAwait(false)) + { + return _result.Body; + } + } + /// /// Delete a given CloudEndpoint. /// /// diff --git a/src/StorageSync/StorageSync.Management.Sdk/Generated/ICloudEndpointsOperations.cs b/src/StorageSync/StorageSync.Management.Sdk/Generated/ICloudEndpointsOperations.cs index ccce44567182..121a43f3f373 100644 --- a/src/StorageSync/StorageSync.Management.Sdk/Generated/ICloudEndpointsOperations.cs +++ b/src/StorageSync/StorageSync.Management.Sdk/Generated/ICloudEndpointsOperations.cs @@ -109,6 +109,41 @@ public partial interface ICloudEndpointsOperations /// System.Threading.Tasks.Task> CreateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, string syncGroupName, string cloudEndpointName, CloudEndpointCreateParameters parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Patch a given CloudEndpoint. + /// + /// + /// Patch a given CloudEndpoint. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Storage Sync Service resource. + /// + /// + /// Name of Sync Group resource. + /// + /// + /// Name of Cloud Endpoint object. + /// + /// + /// The interval for enumerating changes on the cloud endpoint. + /// + /// + /// The 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 + /// + System.Threading.Tasks.Task> UpdateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, string syncGroupName, string cloudEndpointName, int? changeEnumerationIntervalDays = default(int?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Delete a given CloudEndpoint. /// @@ -399,6 +434,41 @@ public partial interface ICloudEndpointsOperations /// System.Threading.Tasks.Task> BeginCreateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, string syncGroupName, string cloudEndpointName, CloudEndpointCreateParameters parameters, System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// + /// Patch a given CloudEndpoint. + /// + /// + /// Patch a given CloudEndpoint. + /// + /// + /// The name of the resource group. The name is case insensitive. + /// + /// + /// Name of Storage Sync Service resource. + /// + /// + /// Name of Sync Group resource. + /// + /// + /// Name of Cloud Endpoint object. + /// + /// + /// The interval for enumerating changes on the cloud endpoint. + /// + /// + /// The 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 + /// + System.Threading.Tasks.Task> BeginUpdateWithHttpMessagesAsync(string resourceGroupName, string storageSyncServiceName, string syncGroupName, string cloudEndpointName, int? changeEnumerationIntervalDays = default(int?), System.Collections.Generic.Dictionary> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)); + /// /// Delete a given CloudEndpoint. /// diff --git a/src/StorageSync/StorageSync.Management.Sdk/Generated/Models/CloudEndpoint.cs b/src/StorageSync/StorageSync.Management.Sdk/Generated/Models/CloudEndpoint.cs index b9d5acbc260b..76422d79ed71 100644 --- a/src/StorageSync/StorageSync.Management.Sdk/Generated/Models/CloudEndpoint.cs +++ b/src/StorageSync/StorageSync.Management.Sdk/Generated/Models/CloudEndpoint.cs @@ -69,7 +69,10 @@ public CloudEndpoint() /// Cloud endpoint change enumeration status /// - public CloudEndpoint(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string storageAccountResourceId = default(string), string azureFileShareName = default(string), string storageAccountTenantId = default(string), string partnershipId = default(string), string friendlyName = default(string), string backupEnabled = default(string), string provisioningState = default(string), string lastWorkflowId = default(string), string lastOperationName = default(string), CloudEndpointChangeEnumerationStatus changeEnumerationStatus = default(CloudEndpointChangeEnumerationStatus)) + + /// The interval for enumerating changes on the cloud endpoint. + /// + public CloudEndpoint(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string storageAccountResourceId = default(string), string azureFileShareName = default(string), string storageAccountTenantId = default(string), string partnershipId = default(string), string friendlyName = default(string), string backupEnabled = default(string), string provisioningState = default(string), string lastWorkflowId = default(string), string lastOperationName = default(string), CloudEndpointChangeEnumerationStatus changeEnumerationStatus = default(CloudEndpointChangeEnumerationStatus), int? changeEnumerationIntervalDays = default(int?)) : base(id, name, type, systemData) { @@ -83,6 +86,7 @@ public CloudEndpoint() this.LastWorkflowId = lastWorkflowId; this.LastOperationName = lastOperationName; this.ChangeEnumerationStatus = changeEnumerationStatus; + this.ChangeEnumerationIntervalDays = changeEnumerationIntervalDays; CustomInit(); } @@ -151,6 +155,12 @@ public CloudEndpoint() /// [Newtonsoft.Json.JsonProperty(PropertyName = "properties.changeEnumerationStatus")] public CloudEndpointChangeEnumerationStatus ChangeEnumerationStatus {get; private set; } + + /// + /// Gets or sets the interval for enumerating changes on the cloud endpoint. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.changeEnumerationIntervalDays")] + public int? ChangeEnumerationIntervalDays {get; set; } /// /// Validate the object. /// @@ -172,6 +182,17 @@ public virtual void Validate() { this.ChangeEnumerationStatus.Validate(); } + if (this.ChangeEnumerationIntervalDays != null) + { + if (this.ChangeEnumerationIntervalDays > 20) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.InclusiveMaximum, "ChangeEnumerationIntervalDays", 20); + } + if (this.ChangeEnumerationIntervalDays < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.InclusiveMinimum, "ChangeEnumerationIntervalDays", 1); + } + } } } } \ No newline at end of file diff --git a/src/StorageSync/StorageSync.Management.Sdk/Generated/Models/CloudEndpointCreateParameters.cs b/src/StorageSync/StorageSync.Management.Sdk/Generated/Models/CloudEndpointCreateParameters.cs index 3ee65e37debf..ac42ec062b8b 100644 --- a/src/StorageSync/StorageSync.Management.Sdk/Generated/Models/CloudEndpointCreateParameters.cs +++ b/src/StorageSync/StorageSync.Management.Sdk/Generated/Models/CloudEndpointCreateParameters.cs @@ -51,7 +51,10 @@ public CloudEndpointCreateParameters() /// Friendly Name /// - public CloudEndpointCreateParameters(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string storageAccountResourceId = default(string), string azureFileShareName = default(string), string storageAccountTenantId = default(string), string friendlyName = default(string)) + + /// The interval for enumerating changes on the cloud endpoint. + /// + public CloudEndpointCreateParameters(string id = default(string), string name = default(string), string type = default(string), SystemData systemData = default(SystemData), string storageAccountResourceId = default(string), string azureFileShareName = default(string), string storageAccountTenantId = default(string), string friendlyName = default(string), int? changeEnumerationIntervalDays = default(int?)) : base(id, name, type, systemData) { @@ -59,6 +62,7 @@ public CloudEndpointCreateParameters() this.AzureFileShareName = azureFileShareName; this.StorageAccountTenantId = storageAccountTenantId; this.FriendlyName = friendlyName; + this.ChangeEnumerationIntervalDays = changeEnumerationIntervalDays; CustomInit(); } @@ -91,5 +95,35 @@ public CloudEndpointCreateParameters() /// [Newtonsoft.Json.JsonProperty(PropertyName = "properties.friendlyName")] public string FriendlyName {get; set; } + + /// + /// Gets or sets the interval for enumerating changes on the cloud endpoint. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.changeEnumerationIntervalDays")] + public int? ChangeEnumerationIntervalDays {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + + + + if (this.ChangeEnumerationIntervalDays != null) + { + if (this.ChangeEnumerationIntervalDays > 20) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.InclusiveMaximum, "ChangeEnumerationIntervalDays", 20); + } + if (this.ChangeEnumerationIntervalDays < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.InclusiveMinimum, "ChangeEnumerationIntervalDays", 1); + } + } + } } } \ No newline at end of file diff --git a/src/StorageSync/StorageSync.Management.Sdk/Generated/Models/CloudEndpointCreateParametersProperties.cs b/src/StorageSync/StorageSync.Management.Sdk/Generated/Models/CloudEndpointCreateParametersProperties.cs index 60f687afb1ec..a7ed9e5799a5 100644 --- a/src/StorageSync/StorageSync.Management.Sdk/Generated/Models/CloudEndpointCreateParametersProperties.cs +++ b/src/StorageSync/StorageSync.Management.Sdk/Generated/Models/CloudEndpointCreateParametersProperties.cs @@ -35,13 +35,17 @@ public CloudEndpointCreateParametersProperties() /// Friendly Name /// - public CloudEndpointCreateParametersProperties(string storageAccountResourceId = default(string), string azureFileShareName = default(string), string storageAccountTenantId = default(string), string friendlyName = default(string)) + + /// The interval for enumerating changes on the cloud endpoint. + /// + public CloudEndpointCreateParametersProperties(string storageAccountResourceId = default(string), string azureFileShareName = default(string), string storageAccountTenantId = default(string), string friendlyName = default(string), int? changeEnumerationIntervalDays = default(int?)) { this.StorageAccountResourceId = storageAccountResourceId; this.AzureFileShareName = azureFileShareName; this.StorageAccountTenantId = storageAccountTenantId; this.FriendlyName = friendlyName; + this.ChangeEnumerationIntervalDays = changeEnumerationIntervalDays; CustomInit(); } @@ -74,5 +78,35 @@ public CloudEndpointCreateParametersProperties() /// [Newtonsoft.Json.JsonProperty(PropertyName = "friendlyName")] public string FriendlyName {get; set; } + + /// + /// Gets or sets the interval for enumerating changes on the cloud endpoint. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "changeEnumerationIntervalDays")] + public int? ChangeEnumerationIntervalDays {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + + + + + if (this.ChangeEnumerationIntervalDays != null) + { + if (this.ChangeEnumerationIntervalDays > 20) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.InclusiveMaximum, "ChangeEnumerationIntervalDays", 20); + } + if (this.ChangeEnumerationIntervalDays < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.InclusiveMinimum, "ChangeEnumerationIntervalDays", 1); + } + } + } } } \ No newline at end of file diff --git a/src/StorageSync/StorageSync.Management.Sdk/Generated/Models/CloudEndpointProperties.cs b/src/StorageSync/StorageSync.Management.Sdk/Generated/Models/CloudEndpointProperties.cs index a5c8d5a04e7e..7a2b0205f758 100644 --- a/src/StorageSync/StorageSync.Management.Sdk/Generated/Models/CloudEndpointProperties.cs +++ b/src/StorageSync/StorageSync.Management.Sdk/Generated/Models/CloudEndpointProperties.cs @@ -53,7 +53,10 @@ public CloudEndpointProperties() /// Cloud endpoint change enumeration status /// - public CloudEndpointProperties(string storageAccountResourceId = default(string), string azureFileShareName = default(string), string storageAccountTenantId = default(string), string partnershipId = default(string), string friendlyName = default(string), string backupEnabled = default(string), string provisioningState = default(string), string lastWorkflowId = default(string), string lastOperationName = default(string), CloudEndpointChangeEnumerationStatus changeEnumerationStatus = default(CloudEndpointChangeEnumerationStatus)) + + /// The interval for enumerating changes on the cloud endpoint. + /// + public CloudEndpointProperties(string storageAccountResourceId = default(string), string azureFileShareName = default(string), string storageAccountTenantId = default(string), string partnershipId = default(string), string friendlyName = default(string), string backupEnabled = default(string), string provisioningState = default(string), string lastWorkflowId = default(string), string lastOperationName = default(string), CloudEndpointChangeEnumerationStatus changeEnumerationStatus = default(CloudEndpointChangeEnumerationStatus), int? changeEnumerationIntervalDays = default(int?)) { this.StorageAccountResourceId = storageAccountResourceId; @@ -66,6 +69,7 @@ public CloudEndpointProperties() this.LastWorkflowId = lastWorkflowId; this.LastOperationName = lastOperationName; this.ChangeEnumerationStatus = changeEnumerationStatus; + this.ChangeEnumerationIntervalDays = changeEnumerationIntervalDays; CustomInit(); } @@ -134,6 +138,12 @@ public CloudEndpointProperties() /// [Newtonsoft.Json.JsonProperty(PropertyName = "changeEnumerationStatus")] public CloudEndpointChangeEnumerationStatus ChangeEnumerationStatus {get; private set; } + + /// + /// Gets or sets the interval for enumerating changes on the cloud endpoint. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "changeEnumerationIntervalDays")] + public int? ChangeEnumerationIntervalDays {get; set; } /// /// Validate the object. /// @@ -155,6 +165,17 @@ public virtual void Validate() { this.ChangeEnumerationStatus.Validate(); } + if (this.ChangeEnumerationIntervalDays != null) + { + if (this.ChangeEnumerationIntervalDays > 20) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.InclusiveMaximum, "ChangeEnumerationIntervalDays", 20); + } + if (this.ChangeEnumerationIntervalDays < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.InclusiveMinimum, "ChangeEnumerationIntervalDays", 1); + } + } } } } \ No newline at end of file diff --git a/src/StorageSync/StorageSync.Management.Sdk/Generated/Models/CloudEndpointUpdateParameters.cs b/src/StorageSync/StorageSync.Management.Sdk/Generated/Models/CloudEndpointUpdateParameters.cs new file mode 100644 index 000000000000..4cb836931332 --- /dev/null +++ b/src/StorageSync/StorageSync.Management.Sdk/Generated/Models/CloudEndpointUpdateParameters.cs @@ -0,0 +1,69 @@ +// 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.StorageSync.Models +{ + using System.Linq; + + /// + /// The parameters used when updating a cloud endpoint. + /// + [Microsoft.Rest.Serialization.JsonTransformation] + public partial class CloudEndpointUpdateParameters + { + /// + /// Initializes a new instance of the CloudEndpointUpdateParameters class. + /// + public CloudEndpointUpdateParameters() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudEndpointUpdateParameters class. + /// + + /// The interval for enumerating changes on the cloud endpoint. + /// + public CloudEndpointUpdateParameters(int? changeEnumerationIntervalDays = default(int?)) + + { + this.ChangeEnumerationIntervalDays = changeEnumerationIntervalDays; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the interval for enumerating changes on the cloud endpoint. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "properties.changeEnumerationIntervalDays")] + public int? ChangeEnumerationIntervalDays {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.ChangeEnumerationIntervalDays != null) + { + if (this.ChangeEnumerationIntervalDays > 20) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.InclusiveMaximum, "ChangeEnumerationIntervalDays", 20); + } + if (this.ChangeEnumerationIntervalDays < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.InclusiveMinimum, "ChangeEnumerationIntervalDays", 1); + } + } + } + } +} \ No newline at end of file diff --git a/src/StorageSync/StorageSync.Management.Sdk/Generated/Models/CloudEndpointUpdateProperties.cs b/src/StorageSync/StorageSync.Management.Sdk/Generated/Models/CloudEndpointUpdateProperties.cs new file mode 100644 index 000000000000..a4080c9f8886 --- /dev/null +++ b/src/StorageSync/StorageSync.Management.Sdk/Generated/Models/CloudEndpointUpdateProperties.cs @@ -0,0 +1,68 @@ +// 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.StorageSync.Models +{ + using System.Linq; + + /// + /// CloudEndpoint Update Properties object. + /// + public partial class CloudEndpointUpdateProperties + { + /// + /// Initializes a new instance of the CloudEndpointUpdateProperties class. + /// + public CloudEndpointUpdateProperties() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudEndpointUpdateProperties class. + /// + + /// The interval for enumerating changes on the cloud endpoint. + /// + public CloudEndpointUpdateProperties(int? changeEnumerationIntervalDays = default(int?)) + + { + this.ChangeEnumerationIntervalDays = changeEnumerationIntervalDays; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets the interval for enumerating changes on the cloud endpoint. + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "changeEnumerationIntervalDays")] + public int? ChangeEnumerationIntervalDays {get; set; } + /// + /// Validate the object. + /// + /// + /// Thrown if validation fails + /// + public virtual void Validate() + { + if (this.ChangeEnumerationIntervalDays != null) + { + if (this.ChangeEnumerationIntervalDays > 20) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.InclusiveMaximum, "ChangeEnumerationIntervalDays", 20); + } + if (this.ChangeEnumerationIntervalDays < 1) + { + throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.InclusiveMinimum, "ChangeEnumerationIntervalDays", 1); + } + } + } + } +} \ No newline at end of file diff --git a/src/StorageSync/StorageSync.Management.Sdk/Generated/Models/CloudEndpointsUpdateHeaders.cs b/src/StorageSync/StorageSync.Management.Sdk/Generated/Models/CloudEndpointsUpdateHeaders.cs new file mode 100644 index 000000000000..d428103147fa --- /dev/null +++ b/src/StorageSync/StorageSync.Management.Sdk/Generated/Models/CloudEndpointsUpdateHeaders.cs @@ -0,0 +1,85 @@ +// 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.StorageSync.Models +{ + using System.Linq; + + public partial class CloudEndpointsUpdateHeaders + { + /// + /// Initializes a new instance of the CloudEndpointsUpdateHeaders class. + /// + public CloudEndpointsUpdateHeaders() + { + CustomInit(); + } + + /// + /// Initializes a new instance of the CloudEndpointsUpdateHeaders class. + /// + + /// + /// + + /// + /// + + /// + /// + + /// + /// + + /// + /// + public CloudEndpointsUpdateHeaders(string xmsCorrelationRequestId = default(string), string xmsRequestId = default(string), string azureAsyncOperation = default(string), string location = default(string), int? retryAfter = default(int?)) + + { + this.XMSCorrelationRequestId = xmsCorrelationRequestId; + this.XMSRequestId = xmsRequestId; + this.AzureAsyncOperation = azureAsyncOperation; + this.Location = location; + this.RetryAfter = retryAfter; + CustomInit(); + } + + /// + /// An initialization method that performs custom operations like setting defaults + /// + partial void CustomInit(); + + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "x-ms-correlation-request-id")] + public string XMSCorrelationRequestId {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "x-ms-request-id")] + public string XMSRequestId {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Azure-AsyncOperation")] + public string AzureAsyncOperation {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Location")] + public string Location {get; set; } + + /// + /// Gets or sets + /// + [Newtonsoft.Json.JsonProperty(PropertyName = "Retry-After")] + public int? RetryAfter {get; set; } + } +} \ No newline at end of file diff --git a/src/StorageSync/StorageSync.Management.Sdk/Generated/StorageSyncManagementClient.cs b/src/StorageSync/StorageSync.Management.Sdk/Generated/StorageSyncManagementClient.cs index af7950a8dee6..04f46c80dca1 100644 --- a/src/StorageSync/StorageSync.Management.Sdk/Generated/StorageSyncManagementClient.cs +++ b/src/StorageSync/StorageSync.Management.Sdk/Generated/StorageSyncManagementClient.cs @@ -350,7 +350,7 @@ private void Initialize() this.ServerEndpoints = new ServerEndpointsOperations(this); this.Workflows = new WorkflowsOperations(this); this.BaseUri = new System.Uri("https://management.azure.com"); - this.ApiVersion = "2022-09-01"; + this.ApiVersion = "2025-12-01"; this.AcceptLanguage = "en-US"; this.LongRunningOperationRetryTimeout = 30; this.GenerateClientRequestId = true; diff --git a/src/StorageSync/StorageSync.Management.Sdk/README.md b/src/StorageSync/StorageSync.Management.Sdk/README.md index d4981ae672fc..2c7560a9d675 100644 --- a/src/StorageSync/StorageSync.Management.Sdk/README.md +++ b/src/StorageSync/StorageSync.Management.Sdk/README.md @@ -26,10 +26,10 @@ payload-flattening-threshold: 1 ### ``` yaml -commit: 2ec4c94bd944ea1230297b26ba6bbfa94becdcce +commit: 4a8dd2ded232e5b3e16f0428a0a23532688f522c input-file: - - https://github.com/Azure/azure-rest-api-specs/blob/$(commit)/specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2022-09-01/storagesync.json - + - https://github.com/ankushbindlish2/azure-rest-api-specs/blob/$(commit)/specification/storagesync/resource-manager/Microsoft.StorageSync/StorageSync/stable/2025-12-01/storagesync.json + output-folder: Generated namespace: Microsoft.Azure.Management.StorageSync diff --git a/src/StorageSync/StorageSync/Az.StorageSync.psd1 b/src/StorageSync/StorageSync/Az.StorageSync.psd1 index 22323711f68a..9de15b05a806 100644 --- a/src/StorageSync/StorageSync/Az.StorageSync.psd1 +++ b/src/StorageSync/StorageSync/Az.StorageSync.psd1 @@ -89,7 +89,7 @@ CmdletsToExport = 'Get-AzStorageSyncCloudEndpoint', 'Get-AzStorageSyncGroup', 'Set-AzStorageSyncServer', 'Set-AzStorageSyncServerEndpoint', 'Set-AzStorageSyncServerEndpointPermission', 'Set-AzStorageSyncService', 'Set-AzStorageSyncServiceIdentity', - 'Unregister-AzStorageSyncServer' + 'Unregister-AzStorageSyncServer','Set-AzStorageSyncCloudEndpoint' # Variables to export from this module # VariablesToExport = @() diff --git a/src/StorageSync/StorageSync/ChangeLog.md b/src/StorageSync/StorageSync/ChangeLog.md index e8ca794655a3..484852d76a39 100644 --- a/src/StorageSync/StorageSync/ChangeLog.md +++ b/src/StorageSync/StorageSync/ChangeLog.md @@ -18,6 +18,13 @@ - Additional information about change #1 --> ## Upcoming Release +* Added `ChangeEnumerationIntervalDays` parameter to `New-AzStorageSyncCloudEndpoint` cmdlet + - Allows customers to configure the interval in days between change enumeration operations for cloud endpoints + - Valid range: 1 to 20 days + - Optional parameter that provides control over change detection frequency +* Added `Set-AzStorageSyncCloudEndpoint` cmdlet + - Allows customers to update the `ChangeEnumerationIntervalDays` property of an existing cloud endpoint + - Valid range: 1 to 20 days ## Version 2.5.2 * Fixed security bug in checking tenant id for MI server registration diff --git a/src/StorageSync/StorageSync/CloudEndpoint/NewCloudEndpointCommand.cs b/src/StorageSync/StorageSync/CloudEndpoint/NewCloudEndpointCommand.cs index cf89de6d2a89..bb7f82df73b1 100644 --- a/src/StorageSync/StorageSync/CloudEndpoint/NewCloudEndpointCommand.cs +++ b/src/StorageSync/StorageSync/CloudEndpoint/NewCloudEndpointCommand.cs @@ -158,6 +158,16 @@ public class NewCloudEndpointCommand : StorageSyncClientCmdletBase [ValidateNotNullOrEmpty] public string StorageAccountTenantId { get; set; } + /// + /// Gets or sets the change enumeration interval day. + /// + /// The change enumeration interval day. + [Parameter(Mandatory = false, + ValueFromPipelineByPropertyName = false, + HelpMessage = HelpMessages.ChangeEnumerationIntervalDayParameter)] + [ValidateRange(1, 20)] + public int? ChangeEnumerationIntervalDay { get; set; } + /// /// Gets or sets as job. /// @@ -236,7 +246,8 @@ public override void ExecuteCmdlet() { StorageAccountResourceId = StorageAccountResourceId, AzureFileShareName = AzureFileShareName, - StorageAccountTenantId = (StorageAccountTenantId ?? AzureContext.Tenant.Id) + StorageAccountTenantId = (StorageAccountTenantId ?? AzureContext.Tenant.Id), + ChangeEnumerationIntervalDays = ChangeEnumerationIntervalDay }; string resourceGroupName = ResourceGroupName ?? ParentObject?.ResourceGroupName ?? parentResourceIdentifier.ResourceGroupName; diff --git a/src/StorageSync/StorageSync/CloudEndpoint/SetCloudEndpointCommand.cs b/src/StorageSync/StorageSync/CloudEndpoint/SetCloudEndpointCommand.cs new file mode 100644 index 000000000000..8e03d6e4cb57 --- /dev/null +++ b/src/StorageSync/StorageSync/CloudEndpoint/SetCloudEndpointCommand.cs @@ -0,0 +1,233 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + +using Microsoft.Azure.Commands.ResourceManager.Common.ArgumentCompleters; +using Microsoft.Azure.Commands.StorageSync.Common; +using Microsoft.Azure.Commands.StorageSync.Common.Extensions; +using Microsoft.Azure.Commands.StorageSync.Models; +using Microsoft.Azure.Commands.StorageSync.Properties; +using Microsoft.Azure.Management.Internal.Resources.Utilities.Models; +using Microsoft.Azure.Management.StorageSync; +using Microsoft.Azure.Management.StorageSync.Models; +using Microsoft.WindowsAzure.Commands.Utilities.Common; +using System; +using System.Management.Automation; +using StorageSyncModels = Microsoft.Azure.Management.StorageSync.Models; + +namespace Microsoft.Azure.Commands.StorageSync.CloudEndpoint +{ + /// + /// Class SetCloudEndpointCommand. + /// Implements the + /// + /// + [Cmdlet(VerbsCommon.Set, StorageSyncNouns.NounAzureRmStorageSyncCloudEndpoint, + DefaultParameterSetName = StorageSyncParameterSets.StringParameterSet, SupportsShouldProcess = true), OutputType(typeof(PSCloudEndpoint))] + public class SetCloudEndpointCommand : StorageSyncClientCmdletBase + { + /// + /// Gets or sets the name of the resource group. + /// + /// The name of the resource group. + [Parameter( + Position = 0, + ParameterSetName = StorageSyncParameterSets.StringParameterSet, + Mandatory = true, + ValueFromPipelineByPropertyName = false, + HelpMessage = HelpMessages.ResourceGroupNameParameter)] + [ResourceGroupCompleter] + [ValidateNotNullOrEmpty] + public string ResourceGroupName { get; set; } + + /// + /// Gets or sets the name of the storage sync service. + /// + /// The name of the storage sync service. + [Parameter( + Position = 1, + ParameterSetName = StorageSyncParameterSets.StringParameterSet, + Mandatory = true, + ValueFromPipelineByPropertyName = false, + HelpMessage = HelpMessages.StorageSyncServiceNameParameter)] + [ResourceNameCompleter("Microsoft.StorageSync/storageSyncServices", "ResourceGroupName")] + [ValidateNotNullOrEmpty] + [Alias(StorageSyncAliases.ParentNameAlias)] + public string StorageSyncServiceName { get; set; } + + /// + /// Gets or sets the name of the sync group. + /// + /// The name of the sync group. + [Parameter( + Position = 2, + ParameterSetName = StorageSyncParameterSets.StringParameterSet, + Mandatory = true, + ValueFromPipelineByPropertyName = false, + HelpMessage = HelpMessages.SyncGroupNameParameter)] + [ResourceNameCompleter("Microsoft.StorageSync/storageSyncServices/syncGroups", "ResourceGroupName", "StorageSyncServiceName")] + [ValidateNotNullOrEmpty] + public string SyncGroupName { get; set; } + + /// + /// Gets or sets the name. + /// + /// The name. + [Parameter(Position = 3, + ParameterSetName = StorageSyncParameterSets.StringParameterSet, + Mandatory = true, + ValueFromPipelineByPropertyName = false, + HelpMessage = HelpMessages.CloudEndpointNameParameter)] + [ValidateNotNullOrEmpty] + [ResourceNameCompleter("Microsoft.StorageSync/storageSyncServices/syncGroups/cloudEndpoints", "ResourceGroupName", "StorageSyncServiceName", "SyncGroupName")] + [Alias(StorageSyncAliases.CloudEndpointNameAlias)] + public string Name { get; set; } + + /// + /// Gets or sets the resource identifier. + /// + /// The resource identifier. + [Parameter(Mandatory = true, + Position = 0, + ParameterSetName = StorageSyncParameterSets.ResourceIdParameterSet, + ValueFromPipelineByPropertyName = true, + HelpMessage = HelpMessages.CloudEndpointResourceIdParameter)] + [ResourceIdCompleter(StorageSyncConstants.CloudEndpointType)] + public string ResourceId { get; set; } + + /// + /// Gets or sets the input object. + /// + /// The input object. + [Parameter( + Position = 0, + ParameterSetName = StorageSyncParameterSets.ObjectParameterSet, + Mandatory = true, + ValueFromPipeline = true, + HelpMessage = HelpMessages.CloudEndpointObjectParameter)] + [Alias(StorageSyncAliases.CloudEndpointAlias)] + public PSCloudEndpoint InputObject { get; set; } + + /// + /// Gets or sets the change enumeration interval day. + /// + /// The change enumeration interval day. + [Parameter( + Mandatory = false, + ValueFromPipelineByPropertyName = false, + HelpMessage = HelpMessages.ChangeEnumerationIntervalDayParameter)] + [ValidateRange(1, 20)] + public int? ChangeEnumerationIntervalDay { get; set; } + + /// + /// Gets or sets as job. + /// + /// As job. + [Parameter(Mandatory = false, HelpMessage = HelpMessages.AsJobParameter)] + public SwitchParameter AsJob { get; set; } + + /// + /// Gets or sets the target. + /// + /// The target. + protected override string Target => Name ?? ResourceId ?? InputObject?.CloudEndpointName; + + /// + /// Gets or sets the action message. + /// + /// The action message. + protected override string ActionMessage => $"Update CloudEndpoint: {Name ?? ResourceId ?? InputObject?.CloudEndpointName}"; + + /// + /// Executes the cmdlet. + /// + public override void ExecuteCmdlet() + { + base.ExecuteCmdlet(); + + ExecuteClientAction(() => + { + var resourceName = default(string); + var resourceGroupName = default(string); + var storageSyncServiceName = default(string); + var parentResourceName = default(string); + + if (this.IsParameterBound(c => c.InputObject)) + { + resourceName = InputObject.CloudEndpointName; + resourceGroupName = InputObject.ResourceGroupName; + parentResourceName = InputObject.SyncGroupName; + storageSyncServiceName = InputObject.StorageSyncServiceName; + } + else + { + if (this.IsParameterBound(c => c.ResourceId)) + { + var resourceIdentifier = new ResourceIdentifier(ResourceId); + resourceName = resourceIdentifier.ResourceName; + resourceGroupName = resourceIdentifier.ResourceGroupName; + parentResourceName = resourceIdentifier.GetParentResourceName(StorageSyncConstants.SyncGroupTypeName, 0); + storageSyncServiceName = resourceIdentifier.GetParentResourceName(StorageSyncConstants.StorageSyncServiceTypeName, 1); + } + else + { + resourceName = Name; + resourceGroupName = ResourceGroupName; + parentResourceName = SyncGroupName; + storageSyncServiceName = StorageSyncServiceName; + } + } + + // Get the existing cloud endpoint + StorageSyncModels.CloudEndpoint existingCloudEndpoint = StorageSyncClientWrapper.StorageSyncManagementClient.CloudEndpoints.Get( + resourceGroupName, + storageSyncServiceName, + parentResourceName, + resourceName); + + if (existingCloudEndpoint == null) + { + throw new PSArgumentException($"Cloud endpoint '{resourceName}' not found."); + } + + // Create update parameters with the existing values and new ChangeEnumerationIntervalDay + var updateParameters = new CloudEndpointUpdateParameters() + { + }; + + // Apply the update if parameter is provided + if (this.IsParameterBound(c => c.ChangeEnumerationIntervalDay)) + { + updateParameters.ChangeEnumerationIntervalDays = ChangeEnumerationIntervalDay; + } + else if (existingCloudEndpoint.ChangeEnumerationIntervalDays.HasValue) + { + updateParameters.ChangeEnumerationIntervalDays = existingCloudEndpoint.ChangeEnumerationIntervalDays; + } + + Target = string.Join("/", resourceGroupName, storageSyncServiceName, parentResourceName, resourceName); + if (ShouldProcess(Target, ActionMessage)) + { + StorageSyncModels.CloudEndpoint resource = StorageSyncClientWrapper.StorageSyncManagementClient.CloudEndpoints.Update( + resourceGroupName, + storageSyncServiceName, + parentResourceName, + resourceName, + updateParameters.ChangeEnumerationIntervalDays); + + WriteObject(resource); + } + }); + } + } +} diff --git a/src/StorageSync/StorageSync/Common/Converters/CloudEndpointConverter.cs b/src/StorageSync/StorageSync/Common/Converters/CloudEndpointConverter.cs index 8b3af98cbfe3..4f03477721ae 100644 --- a/src/StorageSync/StorageSync/Common/Converters/CloudEndpointConverter.cs +++ b/src/StorageSync/StorageSync/Common/Converters/CloudEndpointConverter.cs @@ -38,7 +38,8 @@ public class CloudEndpointConverter : ConverterBase /// Transforms the specified source. @@ -67,7 +68,8 @@ protected override PSCloudEndpoint Transform(StorageSyncModels.CloudEndpoint sou LastOperationName = source.LastOperationName, PartnershipId = source.PartnershipId, ProvisioningState = source.ProvisioningState, - ChangeEnumerationStatus = changeEnumerationStatus + ChangeEnumerationStatus = changeEnumerationStatus, + ChangeEnumerationIntervalDays = source.ChangeEnumerationIntervalDays }; } } diff --git a/src/StorageSync/StorageSync/Common/HelpMessages.cs b/src/StorageSync/StorageSync/Common/HelpMessages.cs index 1beb49c50bda..2f7f8ebe65f8 100644 --- a/src/StorageSync/StorageSync/Common/HelpMessages.cs +++ b/src/StorageSync/StorageSync/Common/HelpMessages.cs @@ -253,5 +253,10 @@ public class HelpMessages /// Storage sync service managed identity type parameter error. /// public const string StorageSyncServiceIdentityParameterError = "UserAssignIdentityId should only be specified when AssignIdentityType is UserAssigned or SystemAssignedUserAssigned."; + + /// + /// The change enumeration interval day parameter + /// + public const string ChangeEnumerationIntervalDayParameter = "Change Enumeration Interval Days. This parameter defines the interval in days between change enumeration operations for the cloud endpoint. Valid values range from 1 to 20 days."; } } diff --git a/src/StorageSync/StorageSync/Models/PSCloudEndpoint.cs b/src/StorageSync/StorageSync/Models/PSCloudEndpoint.cs index 51f41df050cf..1afcbe69678a 100644 --- a/src/StorageSync/StorageSync/Models/PSCloudEndpoint.cs +++ b/src/StorageSync/StorageSync/Models/PSCloudEndpoint.cs @@ -86,5 +86,10 @@ public class PSCloudEndpoint : PSResourceBase /// /// The change enumeration status. public PSCloudEndpointChangeEnumerationStatus ChangeEnumerationStatus { get; set; } + /// + /// Gets or sets the change enumeration interval days. + /// + /// The change enumeration interval days. + public int? ChangeEnumerationIntervalDays { get; set; } } } diff --git a/src/StorageSync/StorageSync/help/New-AzStorageSyncCloudEndpoint.md b/src/StorageSync/StorageSync/help/New-AzStorageSyncCloudEndpoint.md index ef3a18a7613d..50ee66b45961 100644 --- a/src/StorageSync/StorageSync/help/New-AzStorageSyncCloudEndpoint.md +++ b/src/StorageSync/StorageSync/help/New-AzStorageSyncCloudEndpoint.md @@ -16,24 +16,22 @@ This command creates an Azure File Sync cloud endpoint in a sync group. ``` New-AzStorageSyncCloudEndpoint [-ResourceGroupName] [-StorageSyncServiceName] [-SyncGroupName] -Name -StorageAccountResourceId -AzureFileShareName - [-StorageAccountTenantId ] [-AsJob] [-DefaultProfile ] - [-WhatIf] [-Confirm] [] + [-StorageAccountTenantId ] [-ChangeEnumerationIntervalDay ] [-AsJob] + [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ### ObjectParameterSet ``` New-AzStorageSyncCloudEndpoint [-ParentObject] -Name -StorageAccountResourceId - -AzureFileShareName [-StorageAccountTenantId ] [-AsJob] - [-DefaultProfile ] [-WhatIf] [-Confirm] - [] + -AzureFileShareName [-StorageAccountTenantId ] [-ChangeEnumerationIntervalDay ] + [-AsJob] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ### ParentStringParameterSet ``` New-AzStorageSyncCloudEndpoint [-ParentResourceId] -Name -StorageAccountResourceId - -AzureFileShareName [-StorageAccountTenantId ] [-AsJob] - [-DefaultProfile ] [-WhatIf] [-Confirm] - [] + -AzureFileShareName [-StorageAccountTenantId ] [-ChangeEnumerationIntervalDay ] + [-AsJob] [-DefaultProfile ] [-WhatIf] [-Confirm] [] ``` ## DESCRIPTION @@ -80,6 +78,21 @@ Accept pipeline input: False Accept wildcard characters: False ``` +### -ChangeEnumerationIntervalDay +Change Enumeration Interval Day. This parameter defines the interval in days between change enumeration operations for the cloud endpoint. Valid values range from 1 to 20 days. + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + ### -DefaultProfile The credentials, account, tenant, and subscription used for communication with Azure. diff --git a/src/StorageSync/StorageSync/help/Set-AzStorageSyncCloudEndpoint.md b/src/StorageSync/StorageSync/help/Set-AzStorageSyncCloudEndpoint.md new file mode 100644 index 000000000000..da91e0a1c5be --- /dev/null +++ b/src/StorageSync/StorageSync/help/Set-AzStorageSyncCloudEndpoint.md @@ -0,0 +1,238 @@ +--- +external help file: Microsoft.Azure.PowerShell.Cmdlets.StorageSync.dll-Help.xml +Module Name: Az.StorageSync +online version: https://learn.microsoft.com/powershell/module/Az.storagesync/set-Azstoragesynccloudendpoint +schema: 2.0.0 +--- + +# Set-AzStorageSyncCloudEndpoint + +## SYNOPSIS +This command allows for changes on the adjustable parameters of a cloud endpoint. + +## SYNTAX + +### StringParameterSet (Default) +``` +Set-AzStorageSyncCloudEndpoint [-ResourceGroupName] [-StorageSyncServiceName] + [-SyncGroupName] [-Name] [-ChangeEnumerationIntervalDay ] [-AsJob] + [-DefaultProfile ] [-WhatIf] [-Confirm] + [] +``` + +### ResourceIdParameterSet +``` +Set-AzStorageSyncCloudEndpoint [-ResourceId] [-ChangeEnumerationIntervalDay ] [-AsJob] + [-DefaultProfile ] [-WhatIf] [-Confirm] + [] +``` + +### ObjectParameterSet +``` +Set-AzStorageSyncCloudEndpoint [-InputObject] [-ChangeEnumerationIntervalDay ] + [-AsJob] [-DefaultProfile ] [-WhatIf] [-Confirm] + [] +``` + +## DESCRIPTION +This command allows for changes on the adjustable parameters of a cloud endpoint. Currently, it supports updating the ChangeEnumerationIntervalDay property, which controls the interval in days between change enumeration operations for the cloud endpoint. + +## EXAMPLES + +### Example 1 +```powershell +Set-AzStorageSyncCloudEndpoint -ResourceGroupName "myResourceGroup" -StorageSyncServiceName "myStorageSyncServiceName" -SyncGroupName "mySyncGroupName" -Name "myCloudEndpointName" -ChangeEnumerationIntervalDay 5 +``` + +This example updates the change enumeration interval to 5 days for the specified cloud endpoint. + +### Example 2 +```powershell +Get-AzStorageSyncCloudEndpoint -ResourceGroupName "myResourceGroup" -StorageSyncServiceName "myStorageSyncServiceName" -SyncGroupName "mySyncGroupName" | Set-AzStorageSyncCloudEndpoint -ChangeEnumerationIntervalDay 10 +``` + +This example retrieves a cloud endpoint and updates its change enumeration interval to 10 days using the pipeline. + +## PARAMETERS + +### -AsJob +Run cmdlet in the background + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ChangeEnumerationIntervalDay +Change Enumeration Interval Day. This parameter defines the interval in days between change enumeration operations for the cloud endpoint. Valid values range from 1 to 20 days. + +```yaml +Type: System.Int32 +Parameter Sets: (All) +Aliases: + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -DefaultProfile +The credentials, account, tenant, and subscription used for communication with Azure. + +```yaml +Type: Microsoft.Azure.Commands.Common.Authentication.Abstractions.Core.IAzureContextContainer +Parameter Sets: (All) +Aliases: AzContext, AzureRmContext, AzureCredential + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -InputObject +CloudEndpoint Object, normally passed through the pipeline. + +```yaml +Type: Microsoft.Azure.Commands.StorageSync.Models.PSCloudEndpoint +Parameter Sets: ObjectParameterSet +Aliases: CloudEndpoint + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByValue) +Accept wildcard characters: False +``` + +### -Name +Name of the CloudEndpoint. + +```yaml +Type: System.String +Parameter Sets: StringParameterSet +Aliases: CloudEndpointName + +Required: True +Position: 3 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceGroupName +Resource Group Name. + +```yaml +Type: System.String +Parameter Sets: StringParameterSet +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -ResourceId +CloudEndpoint Resource Id + +```yaml +Type: System.String +Parameter Sets: ResourceIdParameterSet +Aliases: + +Required: True +Position: 0 +Default value: None +Accept pipeline input: True (ByPropertyName) +Accept wildcard characters: False +``` + +### -StorageSyncServiceName +Name of the StorageSyncService. + +```yaml +Type: System.String +Parameter Sets: StringParameterSet +Aliases: ParentName + +Required: True +Position: 1 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -SyncGroupName +Name of the SyncGroup. + +```yaml +Type: System.String +Parameter Sets: StringParameterSet +Aliases: + +Required: True +Position: 2 +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -Confirm +Prompts you for confirmation before running the cmdlet. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: cf + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### -WhatIf +Shows what would happen if the cmdlet runs. The cmdlet is not run. + +```yaml +Type: System.Management.Automation.SwitchParameter +Parameter Sets: (All) +Aliases: wi + +Required: False +Position: Named +Default value: None +Accept pipeline input: False +Accept wildcard characters: False +``` + +### CommonParameters +This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see [about_CommonParameters](http://go.microsoft.com/fwlink/?LinkID=113216). + +## INPUTS + +### Microsoft.Azure.Commands.StorageSync.Models.PSCloudEndpoint + +### System.String + +## OUTPUTS + +### Microsoft.Azure.Commands.StorageSync.Models.PSCloudEndpoint + +## NOTES + +## RELATED LINKS