private PSResourceModel CreateResourceModel()
        {
            if (this.IsParameterBound(c => c.UnlimitedBandwidth))
            {
                Bandwidth = UnlimitedBandwidth ? 0 : 20;
            }


            var days          = new List <string>(this.DaysOfWeek);
            var resourceModel = new ResourceModel(
                this.StartTime,
                this.StopTime,
                Bandwidth,
                days,
                null,
                this.Name
                );

            return(new PSResourceModel(
                       BandwidthSchedulesOperationsExtensions.CreateOrUpdate(
                           this.DataBoxEdgeManagementClient.BandwidthSchedules,
                           this.DeviceName,
                           this.Name,
                           resourceModel,
                           this.ResourceGroupName)));
        }
Exemple #2
0
        private PSResourceModel UpdateResourceModel()
        {
            var resourceModel = GetResourceModel();

            if (this.DaysOfWeek != null && this.DaysOfWeek.Length != 0)
            {
                var days = new List <string>(this.DaysOfWeek);
                resourceModel.Days = days;
            }

            if (this.Bandwidth > 0)
            {
                resourceModel.RateInMbps = Bandwidth;
            }

            if (UnlimitedBandwidth)
            {
                resourceModel.RateInMbps = 0;
            }


            if (!string.IsNullOrEmpty(this.StartTime))
            {
                resourceModel.Start = this.StartTime;
            }

            if (!string.IsNullOrEmpty(this.StartTime))
            {
                resourceModel.Stop = this.StopTime;
            }

            return(new PSResourceModel(
                       BandwidthSchedulesOperationsExtensions.CreateOrUpdate(
                           this.DataBoxEdgeManagementClient.BandwidthSchedules,
                           this.DeviceName,
                           this.Name,
                           resourceModel,
                           this.ResourceGroupName)));
        }