/// <summary>
        /// Executes the cmdlet.
        /// </summary>
        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.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 if (this.IsParameterBound(c => c.InputObject))
                {
                    resourceName           = InputObject.ServerEndpointName;
                    resourceGroupName      = InputObject.ResourceGroupName;
                    parentResourceName     = InputObject.SyncGroupName;
                    storageSyncServiceName = InputObject.StorageSyncServiceName;
                }
                else
                {
                    resourceName           = Name;
                    resourceGroupName      = ResourceGroupName;
                    parentResourceName     = SyncGroupName;
                    storageSyncServiceName = StorageSyncServiceName;
                }

                var updateParameters = new ServerEndpointUpdateParameters()
                {
                    CloudTiering           = CloudTiering.IsPresent ? StorageSyncConstants.CloudTieringOn : StorageSyncConstants.CloudTieringOff,
                    VolumeFreeSpacePercent = VolumeFreeSpacePercent,
                    TierFilesOlderThanDays = TierFilesOlderThanDays,
                    OfflineDataTransfer    = OfflineDataTransfer.IsPresent ? "on" : "off"
                };

                Target = string.Join("/", resourceGroupName, storageSyncServiceName, parentResourceName, resourceName);
                if (ShouldProcess(Target, ActionMessage))
                {
                    ServerEndpoint resource = StorageSyncClientWrapper.StorageSyncManagementClient.ServerEndpoints.Update(
                        resourceGroupName,
                        storageSyncServiceName,
                        parentResourceName,
                        resourceName,
                        updateParameters);

                    WriteObject(resource);
                }
            });
        }
 /// <summary>
 /// Patch a given ServerEndpoint.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group. The name is case insensitive.
 /// </param>
 /// <param name='storageSyncServiceName'>
 /// Name of Storage Sync Service resource.
 /// </param>
 /// <param name='syncGroupName'>
 /// Name of Sync Group resource.
 /// </param>
 /// <param name='serverEndpointName'>
 /// Name of Server Endpoint object.
 /// </param>
 /// <param name='parameters'>
 /// Any of the properties applicable in PUT request.
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <ServerEndpoint> BeginUpdateAsync(this IServerEndpointsOperations operations, string resourceGroupName, string storageSyncServiceName, string syncGroupName, string serverEndpointName, ServerEndpointUpdateParameters parameters = default(ServerEndpointUpdateParameters), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.BeginUpdateWithHttpMessagesAsync(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, parameters, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }
        /// <summary>
        /// Executes the cmdlet.
        /// </summary>
        public override void ExecuteCmdlet()
        {
            base.ExecuteCmdlet();

            ExecuteClientAction(() =>
            {
                var resourceName           = default(string);
                var resourceGroupName      = default(string);
                var storageSyncServiceName = default(string);
                var parentResourceName     = default(string);

                var updateParameters = new ServerEndpointUpdateParameters();

                if (this.IsParameterBound(c => c.InputObject))
                {
                    resourceName           = InputObject.ServerEndpointName;
                    resourceGroupName      = InputObject.ResourceGroupName;
                    parentResourceName     = InputObject.SyncGroupName;
                    storageSyncServiceName = InputObject.StorageSyncServiceName;

                    updateParameters.CloudTiering           = InputObject.CloudTiering;
                    updateParameters.VolumeFreeSpacePercent = InputObject.VolumeFreeSpacePercent;
                    updateParameters.TierFilesOlderThanDays = InputObject.TierFilesOlderThanDays;
                    updateParameters.OfflineDataTransfer    = InputObject.OfflineDataTransfer;
                }
                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;
                    }
                }

                if (this.IsParameterBound(c => c.CloudTiering))
                {
                    updateParameters.CloudTiering = CloudTiering.ToBool() ? StorageSyncConstants.CloudTieringOn : StorageSyncConstants.CloudTieringOff;
                }
                if (this.IsParameterBound(c => c.VolumeFreeSpacePercent))
                {
                    updateParameters.VolumeFreeSpacePercent = VolumeFreeSpacePercent;
                }
                if (this.IsParameterBound(c => c.TierFilesOlderThanDays))
                {
                    updateParameters.TierFilesOlderThanDays = TierFilesOlderThanDays;
                }
                if (this.IsParameterBound(c => c.OfflineDataTransfer))
                {
                    updateParameters.OfflineDataTransfer = OfflineDataTransfer.ToBool() ? StorageSyncConstants.OfflineDataTransferOn : StorageSyncConstants.OfflineDataTransferOff;
                }

                if (this.IsParameterBound(c => c.LocalCacheMode))
                {
                    updateParameters.LocalCacheMode = LocalCacheMode;
                }

                Target = string.Join("/", resourceGroupName, storageSyncServiceName, parentResourceName, resourceName);
                if (ShouldProcess(Target, ActionMessage))
                {
                    ServerEndpoint resource = StorageSyncClientWrapper.StorageSyncManagementClient.ServerEndpoints.Update(
                        resourceGroupName,
                        storageSyncServiceName,
                        parentResourceName,
                        resourceName,
                        updateParameters);

                    WriteObject(resource);
                }
            });
        }
 /// <summary>
 /// Patch a given ServerEndpoint.
 /// </summary>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='resourceGroupName'>
 /// The name of the resource group. The name is case insensitive.
 /// </param>
 /// <param name='storageSyncServiceName'>
 /// Name of Storage Sync Service resource.
 /// </param>
 /// <param name='syncGroupName'>
 /// Name of Sync Group resource.
 /// </param>
 /// <param name='serverEndpointName'>
 /// Name of Server Endpoint object.
 /// </param>
 /// <param name='parameters'>
 /// Any of the properties applicable in PUT request.
 /// </param>
 public static ServerEndpoint BeginUpdate(this IServerEndpointsOperations operations, string resourceGroupName, string storageSyncServiceName, string syncGroupName, string serverEndpointName, ServerEndpointUpdateParameters parameters = default(ServerEndpointUpdateParameters))
 {
     return(operations.BeginUpdateAsync(resourceGroupName, storageSyncServiceName, syncGroupName, serverEndpointName, parameters).GetAwaiter().GetResult());
 }