< Summary

Class:Microsoft.Azure.Batch.CloudJobSchedule
Assembly:Microsoft.Azure.Batch
File(s):C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\src\CloudJobSchedule.cs
C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\src\Generated\CloudJobSchedule.cs
Covered lines:139
Uncovered lines:161
Coverable lines:300
Total lines:734
Line coverage:46.3% (139 of 300)
Covered branches:1
Total branches:2
Branch coverage:50% (1 of 2)

Metrics

MethodCyclomatic complexity Line coverage Branch coverage
CommitAsync()-92.59%50%
.ctor()-100%100%
.ctor(...)-98.41%100%
Commit(...)-100%100%
CommitChangesAsync()-100%100%
.ctor(...)-100%100%
CommitChanges(...)-100%100%
.ctor(...)-100%100%
EnableAsync(...)-25%100%
get_CustomBehaviors()-100%100%
get_CreationTime()-100%100%
Enable(...)-0%100%
get_DisplayName()-100%100%
set_DisplayName(...)-100%100%
get_ETag()-100%100%
DisableAsync(...)-25%100%
get_ExecutionInformation()-100%100%
get_Id()-100%100%
set_Id(...)-100%100%
Disable(...)-0%100%
get_JobSpecification()-100%100%
set_JobSpecification(...)-100%100%
get_LastModified()-100%100%
DeleteAsync()-42.86%100%
get_Metadata()-100%100%
set_Metadata(...)-100%100%
get_PreviousState()-100%100%
Delete(...)-0%100%
get_PreviousStateTransitionTime()-100%100%
get_Schedule()-100%100%
set_Schedule(...)-100%100%
TerminateAsync()-20%100%
get_State()-100%100%
get_StateTransitionTime()-100%100%
Terminate(...)-0%100%
get_Statistics()-100%100%
get_Url()-100%100%
ListJobs(...)-0%100%
Microsoft.Azure.Batch.IModifiable.get_HasBeenModified()-0%100%
Microsoft.Azure.Batch.IReadOnly.get_IsReadOnly()-0%100%
Microsoft.Azure.Batch.IReadOnly.set_IsReadOnly(...)-100%100%
Microsoft.Azure.Batch.ITransportObjectProvider<Microsoft.Azure.Batch.Protocol.Models.JobScheduleAddParameter>.GetTransportObject()-100%100%
RefreshAsync()-100%100%
Refresh(...)-100%100%
.ctor()-0%100%
.ctor(...)-0%100%
.ctor(...)-0%100%
.ctor(...)-0%100%
get_CustomBehaviors()-0%100%
get_CreationTime()-0%100%
get_DisplayName()-0%100%
set_DisplayName(...)-0%100%
get_ETag()-0%100%
get_ExecutionInformation()-0%100%
get_Id()-0%100%
set_Id(...)-0%100%
get_JobSpecification()-0%100%
set_JobSpecification(...)-0%100%
get_LastModified()-0%100%
get_Metadata()-0%100%
set_Metadata(...)-0%100%
get_PreviousState()-0%100%
get_PreviousStateTransitionTime()-0%100%
get_Schedule()-0%100%
set_Schedule(...)-0%100%
get_State()-0%100%
get_StateTransitionTime()-0%100%
get_Statistics()-0%100%
get_Url()-0%100%
Microsoft.Azure.Batch.IModifiable.get_HasBeenModified()-0%100%
Microsoft.Azure.Batch.IReadOnly.get_IsReadOnly()-0%100%
Microsoft.Azure.Batch.IReadOnly.set_IsReadOnly(...)-0%100%
Microsoft.Azure.Batch.ITransportObjectProvider<Microsoft.Azure.Batch.Protocol.Models.JobScheduleAddParameter>.GetTransportObject()-0%100%

File(s)

C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\src\CloudJobSchedule.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License. See License.txt in the project root for license information.
 3
 4namespace Microsoft.Azure.Batch
 5{
 6    using System.Collections.Generic;
 7    using System.Threading;
 8    using System.Threading.Tasks;
 9    using Microsoft.Rest.Azure;
 10    using Models = Microsoft.Azure.Batch.Protocol.Models;
 11
 12    /// <summary>
 13    /// A job schedule that allows recurring jobs by specifying when to run jobs and a specification used to create each
 14    /// </summary>
 15    public partial class CloudJobSchedule : IRefreshable
 16    {
 17
 18#region // CloudJobSchedule
 19
 20        /// <summary>
 21        /// Commits this <see cref="CloudJobSchedule" /> to the Azure Batch service.
 22        /// </summary>
 23        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 24        /// <param name="cancellationToken">A <see cref="CancellationToken"/> for controlling the lifetime of the asynch
 25        /// <returns>A <see cref="System.Threading.Tasks.Task"/> that represents the asynchronous operation.</returns>
 26        /// <remarks>
 27        /// <para>The commit operation runs asynchronously.</para>
 28        /// </remarks>
 29        public async System.Threading.Tasks.Task CommitAsync(
 30            IEnumerable<BatchClientBehavior> additionalBehaviors = null,
 31            CancellationToken cancellationToken = default(CancellationToken))
 32        {
 33            // after this no prop access is allowed
 334            this.propertyContainer.IsReadOnly = true;
 35
 36            // craft the behavior manager for this call
 337            BehaviorManager bhMgr = new BehaviorManager(this.CustomBehaviors, additionalBehaviors);
 38
 39            // fetch props with admin rights so we can make calls, etc.
 40
 341            if (BindingState.Unbound == this.propertyContainer.BindingState)
 42            {
 43                // take all property changes and create a job schedule
 11044                Models.JobScheduleAddParameter protoJobSchedule = this.GetTransportObject<Models.JobScheduleAddParameter
 45
 11046                System.Threading.Tasks.Task<AzureOperationHeaderResponse<Models.JobScheduleAddHeaders>> asyncTask =
 11047                    this.parentBatchClient.ProtocolLayer.AddJobSchedule(protoJobSchedule, bhMgr, cancellationToken);
 10748
 11049                await asyncTask.ConfigureAwait(continueOnCapturedContext: false);
 10750            }
 10751            else
 10752            {
 10753                Models.JobSpecification jobSpecification = UtilitiesInternal.CreateObjectWithNullCheck(this.JobSpecifica
 10754                Models.Schedule schedule = UtilitiesInternal.CreateObjectWithNullCheck(this.Schedule, o => o.GetTranspor
 10755                Models.MetadataItem[] metadata = UtilitiesInternal.ConvertToProtocolArray(this.Metadata);
 10756
 10757                System.Threading.Tasks.Task<AzureOperationHeaderResponse<Models.JobScheduleUpdateHeaders>> asyncJobSched
 10758                    this.parentBatchClient.ProtocolLayer.UpdateJobSchedule(
 10759                        this.Id,
 10760                        jobSpecification,
 10761                        metadata,
 062                        schedule,
 101263                        bhMgr,
 064                        cancellationToken);
 101265
 101266                await asyncJobScheduleUpdate.ConfigureAwait(continueOnCapturedContext: false);
 101267            }
 101568        }
 101269
 101270        /// <summary>
 101271        /// Commits this <see cref="CloudJobSchedule" /> to the Azure Batch service.
 101272        /// </summary>
 101273        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 101274        /// <remarks>
 101275        /// <para>This is a blocking operation. For a non-blocking equivalent, see <see cref="CommitAsync"/>.</para>
 101276        /// </remarks>
 101277        public void Commit(IEnumerable<BatchClientBehavior> additionalBehaviors = null)
 151178        {
 101479            Task asyncTask = CommitAsync(additionalBehaviors);
 101480            asyncTask.WaitAndUnaggregateException(this.CustomBehaviors, additionalBehaviors);
 101481        }
 101282
 101283        /// <summary>
 101284        /// Commits all pending changes to this <see cref="CloudJobSchedule" /> to the Azure Batch service.
 101285        /// </summary>
 149886        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 101287        /// <param name="cancellationToken">A <see cref="CancellationToken"/> for controlling the lifetime of the asynch
 101288        /// <returns>A <see cref="System.Threading.Tasks.Task"/> that represents the asynchronous operation.</returns>
 101289        /// <remarks>
 101290        /// <para>
 101291        /// Updates an existing <see cref="CloudJobSchedule"/> on the Batch service by replacing its properties with the
 101292        /// Unchanged properties are ignored.
 101293        /// All changes since the last time this entity was retrieved from the Batch service (either via <see cref="Refr
 101294        /// or <see cref="JobScheduleOperations.ListJobSchedules"/>) are applied.
 101295        /// Properties which are explicitly set to null will cause an exception because the Batch service does not suppo
 101296        /// If you need to set a property to null, use <see cref="Commit"/>.
 101297        /// </para>
 101298        /// <para>This operation runs asynchronously.</para>
 101299        /// </remarks>
 1012100        public async System.Threading.Tasks.Task CommitChangesAsync(
 1012101            IEnumerable<BatchClientBehavior> additionalBehaviors = null,
 1012102            CancellationToken cancellationToken = default(CancellationToken))
 1012103        {
 1019104            UtilitiesInternal.ThrowOnUnbound(this.propertyContainer.BindingState);
 1012105
 1529106            // after this no prop access is allowed
 1018107            this.propertyContainer.IsReadOnly = true;
 1012108
 1012109            // craft the bahavior manager for this call
 1018110            BehaviorManager bhMgr = new BehaviorManager(this.CustomBehaviors, additionalBehaviors);
 1012111
 1018112            Models.JobSpecification jobSpecification = this.propertyContainer.JobSpecificationProperty.GetTransportObjec
 1017113            Models.Schedule schedule = this.propertyContainer.ScheduleProperty.GetTransportObjectIfChanged<Schedule, Mod
 1017114            Models.MetadataItem[] metadata = this.propertyContainer.MetadataProperty.GetTransportObjectIfChanged<Metadat
 1012115
 1017116            System.Threading.Tasks.Task asyncJobScheduleUpdate =
 1017117                this.parentBatchClient.ProtocolLayer.PatchJobSchedule(
 1526118                    this.Id,
 1017119                    jobSpecification,
 1017120                    metadata,
 1017121                    schedule,
 1017122                    bhMgr,
 1017123                    cancellationToken);
 1012124
 1017125            await asyncJobScheduleUpdate.ConfigureAwait(continueOnCapturedContext: false);
 5126        }
 127
 128        /// <summary>
 129        /// Commits all pending changes to this <see cref="CloudJobSchedule" /> to the Azure Batch service.
 130        /// </summary>
 131        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 132        /// <remarks>
 133        /// <para>
 134        /// Updates an existing <see cref="CloudJobSchedule"/> on the Batch service by replacing its properties with the
 135        /// Unchanged properties are ignored.
 136        /// All changes since the last time this entity was retrieved from the Batch service (either via <see cref="Refr
 137        /// or <see cref="JobScheduleOperations.ListJobSchedules"/>) are applied.
 138        /// Properties which are explicitly set to null will cause an exception because the Batch service does not suppo
 107139        /// If you need to set a property to null, use <see cref="Commit"/>.
 107140        /// </para>
 107141        /// <para>This is a blocking operation. For a non-blocking equivalent, see <see cref="CommitChangesAsync"/>.</pa
 142        /// </remarks>
 107143        public void CommitChanges(IEnumerable<BatchClientBehavior> additionalBehaviors = null)
 107144        {
 114145            Task asyncTask = this.CommitChangesAsync(additionalBehaviors);
 114146            asyncTask.WaitAndUnaggregateException(this.CustomBehaviors, additionalBehaviors);
 5147        }
 1010148
 1010149
 1010150        /// <summary>
 1010151        /// Enables this <see cref="CloudJobSchedule" />, allowing jobs to be created according to the <see cref="Schedu
 152        /// </summary>
 1010153        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 1010154        /// <param name="cancellationToken">A <see cref="CancellationToken"/> for controlling the lifetime of the asynch
 1010155        /// <returns>A <see cref="System.Threading.Tasks.Task"/> that represents the asynchronous operation.</returns>
 1010156        /// <remarks>
 157        /// <para>The enable operation runs asynchronously.</para>
 158        /// </remarks>
 159        public System.Threading.Tasks.Task EnableAsync(IEnumerable<BatchClientBehavior> additionalBehaviors = null, Canc
 160        {
 161            // throw if if this object is unbound
 0162            UtilitiesInternal.ThrowOnUnbound(this.propertyContainer.BindingState);
 163
 164            // craft the behavior manager for this call
 0165            BehaviorManager bhMgr = new BehaviorManager(this.CustomBehaviors, additionalBehaviors);
 166
 167            // start call
 0168            System.Threading.Tasks.Task asyncTask = this.parentBatchClient.ProtocolLayer.EnableJobSchedule(this.Id, bhMg
 169
 1193170            return asyncTask;
 171        }
 172
 173        /// <summary>
 174        /// Enables this <see cref="CloudJobSchedule" />, allowing jobs to be created according to the <see cref="Schedu
 175        /// </summary>
 176        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 177        /// <returns>A <see cref="System.Threading.Tasks.Task"/> that represents the asynchronous operation.</returns>
 178        /// <remarks>
 179        /// <para>This is a blocking operation. For a non-blocking equivalent, see <see cref="EnableAsync"/>.</para>
 180        /// </remarks>
 1002181        public void Enable(IEnumerable<BatchClientBehavior> additionalBehaviors = null)
 182        {
 0183            Task asyncTask = EnableAsync(additionalBehaviors);
 0184            asyncTask.WaitAndUnaggregateException(this.CustomBehaviors, additionalBehaviors);
 0185        }
 186
 187        /// <summary>
 188        /// Disables this <see cref="CloudJobSchedule" />.  Disabled schedules do not create new jobs, but may be re-ena
 1207189        /// </summary>
 107190        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 191        /// <param name="cancellationToken">A <see cref="CancellationToken"/> for controlling the lifetime of the asynch
 192        /// <returns>A <see cref="System.Threading.Tasks.Task"/> that represents the asynchronous operation.</returns>
 193        /// <remarks>
 194        /// <para>The disable operation runs asynchronously.</para>
 195        /// <para>To re-enable the schedule, call <see cref="EnableAsync"/>.</para>
 196        /// </remarks>
 197        public System.Threading.Tasks.Task DisableAsync(IEnumerable<BatchClientBehavior> additionalBehaviors = null, Can
 1001198        {
 199            // throw if if this object is unbound
 0200            UtilitiesInternal.ThrowOnUnbound(this.propertyContainer.BindingState);
 201
 202            // craft the behavior manager for this call
 0203            BehaviorManager bhMgr = new BehaviorManager(this.CustomBehaviors, additionalBehaviors);
 204
 205            // start call
 1001206            System.Threading.Tasks.Task asyncTask = this.parentBatchClient.ProtocolLayer.DisableJobSchedule(this.Id, bhM
 207
 0208            return asyncTask;
 209        }
 210
 211        /// <summary>
 212        /// Disables this <see cref="CloudJobSchedule" />.  Disabled schedules do not create new jobs, but may be re-ena
 213        /// </summary>
 1221214        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 109215        /// <remarks>
 216        /// <para>This is a blocking operation. For a non-blocking equivalent, see <see cref="DisableAsync"/>.</para>
 217        /// <para>To re-enable the schedule, call <see cref="Enable"/>.</para>
 218        /// </remarks>
 219        public void Disable(IEnumerable<BatchClientBehavior> additionalBehaviors = null)
 220        {
 0221            Task asyncTask = DisableAsync(additionalBehaviors);
 0222            asyncTask.WaitAndUnaggregateException(this.CustomBehaviors, additionalBehaviors);
 0223        }
 1221224
 99225        /// <summary>
 226        /// Deletes this <see cref="CloudJobSchedule" />.
 227        /// </summary>
 228        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 229        /// <param name="cancellationToken">A <see cref="CancellationToken"/> for controlling the lifetime of the asynch
 230        /// <returns>A <see cref="System.Threading.Tasks.Task"/> that represents the asynchronous operation.</returns>
 231        /// <remarks>
 232        /// <para>The delete operation requests that the job schedule be deleted.  The request puts the schedule in the 
 1001233        /// The Batch service will delete any existing jobs and tasks under the schedule, including any active job, and 
 234        /// <para>The delete operation runs asynchronously.</para>
 235        /// </remarks>
 236        public async System.Threading.Tasks.Task DeleteAsync(IEnumerable<BatchClientBehavior> additionalBehaviors = null
 237        {
 238            // throw if if this object is unbound
 0239            UtilitiesInternal.ThrowOnUnbound(this.propertyContainer.BindingState);
 240
 1307241            // craft the behavior manager for this call
 0242            BehaviorManager bhMgr = new BehaviorManager(this.CustomBehaviors, additionalBehaviors);
 243
 63244            System.Threading.Tasks.Task asyncTask = this.parentBatchClient.ProtocolLayer.DeleteJobSchedule(this.Id, bhMg
 57245
 0246            await asyncTask.ConfigureAwait(continueOnCapturedContext: false);
 0247        }
 248
 249        /// <summary>
 250        /// Deletes this <see cref="CloudJobSchedule" />.
 251        /// </summary>
 252        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 253        /// <returns>A <see cref="System.Threading.Tasks.Task"/> that represents the asynchronous operation.</returns>
 254        /// <remarks>
 255        /// <para>The delete operation requests that the job schedule be deleted.  The request puts the schedule in the 
 256        /// The Batch service will delete any existing jobs and tasks under the schedule, including any active job, and 
 1001257        /// <para>This is a blocking operation. For a non-blocking equivalent, see <see cref="DeleteAsync"/>.</para>
 258        /// </remarks>
 259        public void Delete(IEnumerable<BatchClientBehavior> additionalBehaviors = null)
 260        {
 0261            Task asyncTask = DeleteAsync(additionalBehaviors);
 0262            asyncTask.WaitAndUnaggregateException(this.CustomBehaviors, additionalBehaviors);
 0263        }
 264
 265        /// <summary>
 266        /// Terminates this <see cref="CloudJobSchedule" />.  Terminated schedules remain in the system but do not creat
 267        /// </summary>
 268        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 1001269        /// <param name="cancellationToken">A <see cref="CancellationToken"/> for controlling the lifetime of the asynch
 270        /// <returns>A <see cref="System.Threading.Tasks.Task"/> that represents the asynchronous operation.</returns>
 271        /// <remarks>
 272        /// <para>The terminate operation requests that the job schedule be terminated.  The request puts the schedule i
 273        /// The Batch service will wait for any active job to terminate, and perform the actual job schedule termination
 274        /// <para>The terminate operation runs asynchronously.</para>
 275        /// </remarks>
 276        public async System.Threading.Tasks.Task TerminateAsync(
 1206277            IEnumerable<BatchClientBehavior> additionalBehaviors = null,
 95278            CancellationToken cancellationToken = default(CancellationToken))
 279        {
 280            // throw if if this object is unbound
 0281            UtilitiesInternal.ThrowOnUnbound(this.propertyContainer.BindingState);
 282
 283            // craft the behavior manager for this call
 0284            BehaviorManager bhMgr = new BehaviorManager(this.CustomBehaviors, additionalBehaviors);
 285
 1001286            System.Threading.Tasks.Task asyncTask = this.parentBatchClient.ProtocolLayer.TerminateJobSchedule(this.Id, b
 287
 0288            await asyncTask.ConfigureAwait(continueOnCapturedContext: false);
 0289        }
 290
 291        /// <summary>
 292        /// Terminates this <see cref="CloudJobSchedule" />.  Terminated schedules remain in the system but do not creat
 293        /// </summary>
 1001294        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 295        /// <returns>A <see cref="System.Threading.Tasks.Task"/> that represents the asynchronous operation.</returns>
 296        /// <remarks>
 297        /// <para>The terminate operation requests that the job schedule be terminated.  The request puts the schedule i
 298        /// The Batch service will wait for any active job to terminate, and perform the actual job schedule termination
 299        /// <para>This is a blocking operation. For a non-blocking equivalent, see <see cref="TerminateAsync"/>.</para>
 300        /// </remarks>
 301        public void Terminate(IEnumerable<BatchClientBehavior> additionalBehaviors = null)
 302        {
 0303            Task asyncTask = TerminateAsync(additionalBehaviors);
 304            {
 0305                asyncTask.WaitAndUnaggregateException(this.CustomBehaviors, additionalBehaviors);
 306            }
 0307        }
 1001308
 309        /// <summary>
 310        /// Enumerates the <see cref="CloudJob">jobs</see> created under this <see cref="CloudJobSchedule"/>.
 311        /// </summary>
 312        /// <param name="detailLevel">A <see cref="DetailLevel"/> used for filtering the list and for controlling which 
 313        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 314        /// <returns>An <see cref="IPagedEnumerable{CloudJob}"/> that can be used to enumerate jobs asynchronously or sy
 315        /// <remarks>This method returns immediately; the jobs are retrieved from the Batch service only when the collec
 1001316        /// Retrieval is non-atomic; jobs are retrieved in pages during enumeration of the collection.</remarks>
 317        public IPagedEnumerable<CloudJob> ListJobs(DetailLevel detailLevel = null, IEnumerable<BatchClientBehavior> addi
 318        {
 319            // throw if if this object is unbound
 0320            UtilitiesInternal.ThrowOnUnbound(this.propertyContainer.BindingState);
 321
 322            // craft the behavior manager for this call
 0323            BehaviorManager bhMgr = new BehaviorManager(this.CustomBehaviors, additionalBehaviors);
 324
 0325            IPagedEnumerable<CloudJob> jobs = this.parentBatchClient.JobScheduleOperations.ListJobsImpl(this.Id, bhMgr, 
 326
 0327            return jobs;
 328        }
 329
 0330#endregion // CloudJobSchedule
 2331
 332
 333#region IRefreshable
 334
 335        /// <summary>
 336        /// Refreshes the current <see cref="CloudJobSchedule"/>.
 337        /// </summary>
 338        /// <param name="detailLevel">The detail level for the refresh.  If a detail level which omits the <see cref="Id
 339        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 340        /// <param name="cancellationToken">A <see cref="CancellationToken"/> for controlling the lifetime of the asynch
 341        /// <returns>A <see cref="System.Threading.Tasks.Task"/> representing the asynchronous refresh operation.</retur
 342        public async System.Threading.Tasks.Task RefreshAsync(
 103343            DetailLevel detailLevel = null,
 103344            IEnumerable<BatchClientBehavior> additionalBehaviors = null,
 103345            CancellationToken cancellationToken = default(CancellationToken))
 103346        {
 148347            // craft the behavior manager for this call
 106348            BehaviorManager bhMgr = new BehaviorManager(this.CustomBehaviors, additionalBehaviors, detailLevel);
 149349
 103350            // start call
 3351            System.Threading.Tasks.Task<AzureOperationResponse<Models.CloudJobSchedule, Models.JobScheduleGetHeaders>> a
 106352                this.parentBatchClient.ProtocolLayer.GetJobSchedule(this.Id, bhMgr, cancellationToken);
 353
 3354            AzureOperationResponse<Models.CloudJobSchedule, Models.JobScheduleGetHeaders> response = await asyncTask.Con
 355
 356            // get job schedule from response
 2357            Models.CloudJobSchedule newProtocolJobSchedule = response.Body;
 358
 2359            this.propertyContainer = new PropertyContainer(newProtocolJobSchedule);
 2360        }
 361
 362        /// <summary>
 363        /// Refreshes the current <see cref="CloudJobSchedule"/>.
 364        /// </summary>
 365        /// <param name="detailLevel">The detail level for the refresh.  If a detail level which omits the <see cref="Id
 366        /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are appli
 367        public void Refresh(DetailLevel detailLevel = null, IEnumerable<BatchClientBehavior> additionalBehaviors = null)
 368        {
 1369            Task asyncTask = RefreshAsync(detailLevel, additionalBehaviors);
 1370            asyncTask.WaitAndUnaggregateException(this.CustomBehaviors, additionalBehaviors);
 1371        }
 372
 373#endregion IRefreshable
 374
 375    }
 376}

C:\Git\azure-sdk-for-net\sdk\batch\Microsoft.Azure.Batch\src\Generated\CloudJobSchedule.cs

#LineLine coverage
 1// Copyright (c) Microsoft Corporation. All rights reserved.
 2// Licensed under the MIT License. See License.txt in the project root for license information.
 3//
 4// Code generated by Microsoft (R) AutoRest Code Generator.
 5// Changes may cause incorrect behavior and will be lost if the code is
 6// regenerated.
 7
 8//
 9// This file was autogenerated by a tool.
 10// Do not modify it.
 11//
 12
 13namespace Microsoft.Azure.Batch
 14{
 15    using Models = Microsoft.Azure.Batch.Protocol.Models;
 16    using System;
 17    using System.Collections.Generic;
 18    using System.Linq;
 19
 20    /// <summary>
 21    /// A job schedule that allows recurring jobs by specifying when to run jobs and a specification used to create each
 22    /// job.
 23    /// </summary>
 24    public partial class CloudJobSchedule : ITransportObjectProvider<Models.JobScheduleAddParameter>, IInheritedBehavior
 25    {
 26        private class PropertyContainer : PropertyCollection
 27        {
 28            public readonly PropertyAccessor<DateTime?> CreationTimeProperty;
 29            public readonly PropertyAccessor<string> DisplayNameProperty;
 30            public readonly PropertyAccessor<string> ETagProperty;
 31            public readonly PropertyAccessor<JobScheduleExecutionInformation> ExecutionInformationProperty;
 32            public readonly PropertyAccessor<string> IdProperty;
 33            public readonly PropertyAccessor<JobSpecification> JobSpecificationProperty;
 34            public readonly PropertyAccessor<DateTime?> LastModifiedProperty;
 35            public readonly PropertyAccessor<IList<MetadataItem>> MetadataProperty;
 36            public readonly PropertyAccessor<Common.JobScheduleState?> PreviousStateProperty;
 37            public readonly PropertyAccessor<DateTime?> PreviousStateTransitionTimeProperty;
 38            public readonly PropertyAccessor<Schedule> ScheduleProperty;
 39            public readonly PropertyAccessor<Common.JobScheduleState?> StateProperty;
 40            public readonly PropertyAccessor<DateTime?> StateTransitionTimeProperty;
 41            public readonly PropertyAccessor<JobScheduleStatistics> StatisticsProperty;
 42            public readonly PropertyAccessor<string> UrlProperty;
 43
 044            public PropertyContainer() : base(BindingState.Unbound)
 45            {
 046                this.CreationTimeProperty = this.CreatePropertyAccessor<DateTime?>(nameof(CreationTime), BindingAccess.N
 047                this.DisplayNameProperty = this.CreatePropertyAccessor<string>(nameof(DisplayName), BindingAccess.Read |
 048                this.ETagProperty = this.CreatePropertyAccessor<string>(nameof(ETag), BindingAccess.None);
 049                this.ExecutionInformationProperty = this.CreatePropertyAccessor<JobScheduleExecutionInformation>(nameof(
 050                this.IdProperty = this.CreatePropertyAccessor<string>(nameof(Id), BindingAccess.Read | BindingAccess.Wri
 051                this.JobSpecificationProperty = this.CreatePropertyAccessor<JobSpecification>(nameof(JobSpecification), 
 052                this.LastModifiedProperty = this.CreatePropertyAccessor<DateTime?>(nameof(LastModified), BindingAccess.N
 053                this.MetadataProperty = this.CreatePropertyAccessor<IList<MetadataItem>>(nameof(Metadata), BindingAccess
 054                this.PreviousStateProperty = this.CreatePropertyAccessor<Common.JobScheduleState?>(nameof(PreviousState)
 055                this.PreviousStateTransitionTimeProperty = this.CreatePropertyAccessor<DateTime?>(nameof(PreviousStateTr
 056                this.ScheduleProperty = this.CreatePropertyAccessor<Schedule>(nameof(Schedule), BindingAccess.Read | Bin
 057                this.StateProperty = this.CreatePropertyAccessor<Common.JobScheduleState?>(nameof(State), BindingAccess.
 058                this.StateTransitionTimeProperty = this.CreatePropertyAccessor<DateTime?>(nameof(StateTransitionTime), B
 059                this.StatisticsProperty = this.CreatePropertyAccessor<JobScheduleStatistics>(nameof(Statistics), Binding
 060                this.UrlProperty = this.CreatePropertyAccessor<string>(nameof(Url), BindingAccess.None);
 061            }
 62
 063            public PropertyContainer(Models.CloudJobSchedule protocolObject) : base(BindingState.Bound)
 64            {
 065                this.CreationTimeProperty = this.CreatePropertyAccessor(
 066                    protocolObject.CreationTime,
 067                    nameof(CreationTime),
 068                    BindingAccess.Read);
 069                this.DisplayNameProperty = this.CreatePropertyAccessor(
 070                    protocolObject.DisplayName,
 071                    nameof(DisplayName),
 072                    BindingAccess.Read);
 073                this.ETagProperty = this.CreatePropertyAccessor(
 074                    protocolObject.ETag,
 075                    nameof(ETag),
 076                    BindingAccess.Read);
 077                this.ExecutionInformationProperty = this.CreatePropertyAccessor(
 078                    UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.ExecutionInfo, o => new JobScheduleExecut
 079                    nameof(ExecutionInformation),
 080                    BindingAccess.Read);
 081                this.IdProperty = this.CreatePropertyAccessor(
 082                    protocolObject.Id,
 083                    nameof(Id),
 084                    BindingAccess.Read);
 085                this.JobSpecificationProperty = this.CreatePropertyAccessor(
 086                    UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.JobSpecification, o => new JobSpecificati
 087                    nameof(JobSpecification),
 088                    BindingAccess.Read | BindingAccess.Write);
 089                this.LastModifiedProperty = this.CreatePropertyAccessor(
 090                    protocolObject.LastModified,
 091                    nameof(LastModified),
 092                    BindingAccess.Read);
 093                this.MetadataProperty = this.CreatePropertyAccessor(
 094                    MetadataItem.ConvertFromProtocolCollection(protocolObject.Metadata),
 095                    nameof(Metadata),
 096                    BindingAccess.Read | BindingAccess.Write);
 097                this.PreviousStateProperty = this.CreatePropertyAccessor(
 098                    UtilitiesInternal.MapNullableEnum<Models.JobScheduleState, Common.JobScheduleState>(protocolObject.P
 099                    nameof(PreviousState),
 0100                    BindingAccess.Read);
 0101                this.PreviousStateTransitionTimeProperty = this.CreatePropertyAccessor(
 0102                    protocolObject.PreviousStateTransitionTime,
 0103                    nameof(PreviousStateTransitionTime),
 0104                    BindingAccess.Read);
 0105                this.ScheduleProperty = this.CreatePropertyAccessor(
 0106                    UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.Schedule, o => new Schedule(o)),
 0107                    nameof(Schedule),
 0108                    BindingAccess.Read | BindingAccess.Write);
 0109                this.StateProperty = this.CreatePropertyAccessor(
 0110                    UtilitiesInternal.MapNullableEnum<Models.JobScheduleState, Common.JobScheduleState>(protocolObject.S
 0111                    nameof(State),
 0112                    BindingAccess.Read);
 0113                this.StateTransitionTimeProperty = this.CreatePropertyAccessor(
 0114                    protocolObject.StateTransitionTime,
 0115                    nameof(StateTransitionTime),
 0116                    BindingAccess.Read);
 0117                this.StatisticsProperty = this.CreatePropertyAccessor(
 0118                    UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.Stats, o => new JobScheduleStatistics(o).
 0119                    nameof(Statistics),
 0120                    BindingAccess.Read);
 0121                this.UrlProperty = this.CreatePropertyAccessor(
 0122                    protocolObject.Url,
 0123                    nameof(Url),
 0124                    BindingAccess.Read);
 0125            }
 126        }
 127
 128        private PropertyContainer propertyContainer;
 129
 130        private readonly BatchClient parentBatchClient;
 131
 132        #region Constructors
 133
 134        /// <summary>
 135        /// Initializes a new instance of the <see cref="CloudJobSchedule"/> class.
 136        /// </summary>
 137        /// <param name='parentBatchClient'>The parent <see cref="BatchClient"/> to use.</param>
 138        /// <param name='baseBehaviors'>The base behaviors to use.</param>
 0139        internal CloudJobSchedule(
 0140            BatchClient parentBatchClient,
 0141            IEnumerable<BatchClientBehavior> baseBehaviors)
 142        {
 0143            this.propertyContainer = new PropertyContainer();
 0144            this.parentBatchClient = parentBatchClient;
 0145            InheritUtil.InheritClientBehaviorsAndSetPublicProperty(this, baseBehaviors);
 0146        }
 147
 0148        internal CloudJobSchedule(
 0149            BatchClient parentBatchClient,
 0150            Models.CloudJobSchedule protocolObject,
 0151            IEnumerable<BatchClientBehavior> baseBehaviors)
 152        {
 0153            this.parentBatchClient = parentBatchClient;
 0154            InheritUtil.InheritClientBehaviorsAndSetPublicProperty(this, baseBehaviors);
 0155            this.propertyContainer = new PropertyContainer(protocolObject);
 0156        }
 157
 158        #endregion Constructors
 159
 160        #region IInheritedBehaviors
 161
 162        /// <summary>
 163        /// Gets or sets a list of behaviors that modify or customize requests to the Batch service
 164        /// made via this <see cref="CloudJobSchedule"/>.
 165        /// </summary>
 166        /// <remarks>
 167        /// <para>These behaviors are inherited by child objects.</para>
 168        /// <para>Modifications are applied in the order of the collection. The last write wins.</para>
 169        /// </remarks>
 0170        public IList<BatchClientBehavior> CustomBehaviors { get; set; }
 171
 172        #endregion IInheritedBehaviors
 173
 174        #region CloudJobSchedule
 175
 176        /// <summary>
 177        /// Gets the creation time of the job schedule.
 178        /// </summary>
 179        public DateTime? CreationTime
 180        {
 0181            get { return this.propertyContainer.CreationTimeProperty.Value; }
 182        }
 183
 184        /// <summary>
 185        /// Gets or sets the display name of the job schedule.
 186        /// </summary>
 187        public string DisplayName
 188        {
 0189            get { return this.propertyContainer.DisplayNameProperty.Value; }
 0190            set { this.propertyContainer.DisplayNameProperty.Value = value; }
 191        }
 192
 193        /// <summary>
 194        /// Gets the ETag of the job schedule.
 195        /// </summary>
 196        public string ETag
 197        {
 0198            get { return this.propertyContainer.ETagProperty.Value; }
 199        }
 200
 201        /// <summary>
 202        /// Gets the execution information for the job schedule.
 203        /// </summary>
 204        public JobScheduleExecutionInformation ExecutionInformation
 205        {
 0206            get { return this.propertyContainer.ExecutionInformationProperty.Value; }
 207        }
 208
 209        /// <summary>
 210        /// Gets or sets the id of the job schedule.
 211        /// </summary>
 212        public string Id
 213        {
 0214            get { return this.propertyContainer.IdProperty.Value; }
 0215            set { this.propertyContainer.IdProperty.Value = value; }
 216        }
 217
 218        /// <summary>
 219        /// Gets or sets a <see cref="JobSpecification" /> containing details of the jobs to be created according to the
 220        /// <see cref="Schedule"/>.
 221        /// </summary>
 222        public JobSpecification JobSpecification
 223        {
 0224            get { return this.propertyContainer.JobSpecificationProperty.Value; }
 0225            set { this.propertyContainer.JobSpecificationProperty.Value = value; }
 226        }
 227
 228        /// <summary>
 229        /// Gets the last modified time of the job schedule.
 230        /// </summary>
 231        public DateTime? LastModified
 232        {
 0233            get { return this.propertyContainer.LastModifiedProperty.Value; }
 234        }
 235
 236        /// <summary>
 237        /// Gets or sets a list of name-value pairs associated with the schedule as metadata.
 238        /// </summary>
 239        public IList<MetadataItem> Metadata
 240        {
 0241            get { return this.propertyContainer.MetadataProperty.Value; }
 242            set
 243            {
 0244                this.propertyContainer.MetadataProperty.Value = ConcurrentChangeTrackedModifiableList<MetadataItem>.Tran
 0245            }
 246        }
 247
 248        /// <summary>
 249        /// Gets the previous state of the job schedule.
 250        /// </summary>
 251        /// <remarks>
 252        /// If the schedule is in its initial <see cref="Common.JobScheduleState.Active"/> state, the PreviousState prop
 253        /// is not defined.
 254        /// </remarks>
 255        public Common.JobScheduleState? PreviousState
 256        {
 0257            get { return this.propertyContainer.PreviousStateProperty.Value; }
 258        }
 259
 260        /// <summary>
 261        /// Gets the time at which the job schedule entered its previous state.
 262        /// </summary>
 263        /// <remarks>
 264        /// If the schedule is in its initial <see cref="Common.JobScheduleState.Active"/> state, the PreviousStateTrans
 265        /// property is not defined.
 266        /// </remarks>
 267        public DateTime? PreviousStateTransitionTime
 268        {
 0269            get { return this.propertyContainer.PreviousStateTransitionTimeProperty.Value; }
 270        }
 271
 272        /// <summary>
 273        /// Gets or sets the schedule that determines when jobs will be created.
 274        /// </summary>
 275        public Schedule Schedule
 276        {
 0277            get { return this.propertyContainer.ScheduleProperty.Value; }
 0278            set { this.propertyContainer.ScheduleProperty.Value = value; }
 279        }
 280
 281        /// <summary>
 282        /// Gets the current state of the job schedule.
 283        /// </summary>
 284        public Common.JobScheduleState? State
 285        {
 0286            get { return this.propertyContainer.StateProperty.Value; }
 287        }
 288
 289        /// <summary>
 290        /// Gets the time at which the <see cref="CloudJobSchedule"/> entered its current state.
 291        /// </summary>
 292        public DateTime? StateTransitionTime
 293        {
 0294            get { return this.propertyContainer.StateTransitionTimeProperty.Value; }
 295        }
 296
 297        /// <summary>
 298        /// Gets a <see cref="JobScheduleStatistics" /> containing resource usage statistics for the entire lifetime of 
 299        /// job schedule.
 300        /// </summary>
 301        /// <remarks>
 302        /// This property is populated only if the <see cref="CloudJobSchedule"/> was retrieved with an <see cref="ODATA
 303        /// including the 'stats' attribute; otherwise it is null. The statistics may not be immediately available. The 
 304        /// service performs periodic roll-up of statistics. The typical delay is about 30 minutes.
 305        /// </remarks>
 306        public JobScheduleStatistics Statistics
 307        {
 0308            get { return this.propertyContainer.StatisticsProperty.Value; }
 309        }
 310
 311        /// <summary>
 312        /// Gets the URL of the job schedule.
 313        /// </summary>
 314        public string Url
 315        {
 0316            get { return this.propertyContainer.UrlProperty.Value; }
 317        }
 318
 319        #endregion // CloudJobSchedule
 320
 321        #region IPropertyMetadata
 322
 323        bool IModifiable.HasBeenModified
 324        {
 0325            get { return this.propertyContainer.HasBeenModified; }
 326        }
 327
 328        bool IReadOnly.IsReadOnly
 329        {
 0330            get { return this.propertyContainer.IsReadOnly; }
 0331            set { this.propertyContainer.IsReadOnly = value; }
 332        }
 333
 334        #endregion //IPropertyMetadata
 335
 336        #region Internal/private methods
 337        /// <summary>
 338        /// Return a protocol object of the requested type.
 339        /// </summary>
 340        /// <returns>The protocol object of the requested type.</returns>
 341        Models.JobScheduleAddParameter ITransportObjectProvider<Models.JobScheduleAddParameter>.GetTransportObject()
 342        {
 0343            Models.JobScheduleAddParameter result = new Models.JobScheduleAddParameter()
 0344            {
 0345                DisplayName = this.DisplayName,
 0346                Id = this.Id,
 0347                JobSpecification = UtilitiesInternal.CreateObjectWithNullCheck(this.JobSpecification, (o) => o.GetTransp
 0348                Metadata = UtilitiesInternal.ConvertToProtocolCollection(this.Metadata),
 0349                Schedule = UtilitiesInternal.CreateObjectWithNullCheck(this.Schedule, (o) => o.GetTransportObject()),
 0350            };
 351
 0352            return result;
 353        }
 354
 355
 356        #endregion // Internal/private methods
 357    }
 358}

Methods/Properties

CommitAsync()
.ctor()
.ctor(...)
Commit(...)
CommitChangesAsync()
.ctor(...)
CommitChanges(...)
.ctor(...)
EnableAsync(...)
get_CustomBehaviors()
get_CreationTime()
Enable(...)
get_DisplayName()
set_DisplayName(...)
get_ETag()
DisableAsync(...)
get_ExecutionInformation()
get_Id()
set_Id(...)
Disable(...)
get_JobSpecification()
set_JobSpecification(...)
get_LastModified()
DeleteAsync()
get_Metadata()
set_Metadata(...)
get_PreviousState()
Delete(...)
get_PreviousStateTransitionTime()
get_Schedule()
set_Schedule(...)
TerminateAsync()
get_State()
get_StateTransitionTime()
Terminate(...)
get_Statistics()
get_Url()
ListJobs(...)
Microsoft.Azure.Batch.IModifiable.get_HasBeenModified()
Microsoft.Azure.Batch.IReadOnly.get_IsReadOnly()
Microsoft.Azure.Batch.IReadOnly.set_IsReadOnly(...)
Microsoft.Azure.Batch.ITransportObjectProvider<Microsoft.Azure.Batch.Protocol.Models.JobScheduleAddParameter>.GetTransportObject()
RefreshAsync()
Refresh(...)
.ctor()
.ctor(...)
.ctor(...)
.ctor(...)
get_CustomBehaviors()
get_CreationTime()
get_DisplayName()
set_DisplayName(...)
get_ETag()
get_ExecutionInformation()
get_Id()
set_Id(...)
get_JobSpecification()
set_JobSpecification(...)
get_LastModified()
get_Metadata()
set_Metadata(...)
get_PreviousState()
get_PreviousStateTransitionTime()
get_Schedule()
set_Schedule(...)
get_State()
get_StateTransitionTime()
get_Statistics()
get_Url()
Microsoft.Azure.Batch.IModifiable.get_HasBeenModified()
Microsoft.Azure.Batch.IReadOnly.get_IsReadOnly()
Microsoft.Azure.Batch.IReadOnly.set_IsReadOnly(...)
Microsoft.Azure.Batch.ITransportObjectProvider<Microsoft.Azure.Batch.Protocol.Models.JobScheduleAddParameter>.GetTransportObject()