Пример #1
0
 internal JobSchedulingError(Models.JobSchedulingError protocolObject)
 {
     this.Category = UtilitiesInternal.MapEnum <Models.ErrorCategory, Common.ErrorCategory>(protocolObject.Category);
     this.Code     = protocolObject.Code;
     this.Details  = NameValuePair.ConvertFromProtocolCollectionReadOnly(protocolObject.Details);
     this.Message  = protocolObject.Message;
 }
 internal TaskFailureInformation(Models.TaskFailureInformation protocolObject)
 {
     this.Category = UtilitiesInternal.MapEnum <Models.ErrorCategory, Common.ErrorCategory>(protocolObject.Category);
     this.Code     = protocolObject.Code;
     this.Details  = NameValuePair.ConvertFromProtocolCollectionReadOnly(protocolObject.Details);
     this.Message  = protocolObject.Message;
 }
Пример #3
0
 internal NetworkSecurityGroupRule(Models.NetworkSecurityGroupRule protocolObject)
 {
     this.Access              = UtilitiesInternal.MapEnum <Models.NetworkSecurityGroupRuleAccess, Common.NetworkSecurityGroupRuleAccess>(protocolObject.Access);
     this.Priority            = protocolObject.Priority;
     this.SourceAddressPrefix = protocolObject.SourceAddressPrefix;
     this.SourcePortRanges    = UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.SourcePortRanges, o => o.ToList().AsReadOnly());
 }
Пример #4
0
        /// <summary>
        /// Return a protocol object of the requested type.
        /// </summary>
        /// <returns>The protocol object of the requested type.</returns>
        Models.TaskSchedulingPolicy ITransportObjectProvider <Models.TaskSchedulingPolicy> .GetTransportObject()
        {
            Models.TaskSchedulingPolicy result = new Models.TaskSchedulingPolicy()
            {
                NodeFillType = UtilitiesInternal.MapEnum <Common.ComputeNodeFillType, Models.ComputeNodeFillType>(this.ComputeNodeFillType),
            };

            return(result);
        }
Пример #5
0
 internal InboundNatPool(Models.InboundNATPool protocolObject)
 {
     this.BackendPort            = protocolObject.BackendPort;
     this.FrontendPortRangeEnd   = protocolObject.FrontendPortRangeEnd;
     this.FrontendPortRangeStart = protocolObject.FrontendPortRangeStart;
     this.Name = protocolObject.Name;
     this.NetworkSecurityGroupRules = NetworkSecurityGroupRule.ConvertFromProtocolCollectionReadOnly(protocolObject.NetworkSecurityGroupRules);
     this.Protocol = UtilitiesInternal.MapEnum <Models.InboundEndpointProtocol, Common.InboundEndpointProtocol>(protocolObject.Protocol);
 }
 internal InboundEndpoint(Models.InboundEndpoint protocolObject)
 {
     this.BackendPort     = protocolObject.BackendPort;
     this.FrontendPort    = protocolObject.FrontendPort;
     this.Name            = protocolObject.Name;
     this.Protocol        = UtilitiesInternal.MapEnum <Models.InboundEndpointProtocol, Common.InboundEndpointProtocol>(protocolObject.Protocol);
     this.PublicFqdn      = protocolObject.PublicFQDN;
     this.PublicIPAddress = protocolObject.PublicIPAddress;
 }
Пример #7
0
 internal TaskInformation(Models.TaskInformation protocolObject)
 {
     this.executionInformation = UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.ExecutionInfo, o => new TaskExecutionInformation(o).Freeze());
     this.jobId     = protocolObject.JobId;
     this.subtaskId = protocolObject.SubtaskId;
     this.taskId    = protocolObject.TaskId;
     this.taskState = UtilitiesInternal.MapEnum <Models.TaskState, Common.TaskState>(protocolObject.TaskState);
     this.taskUrl   = protocolObject.TaskUrl;
 }
Пример #8
0
        /// <summary>
        /// Return a protocol object of the requested type.
        /// </summary>
        /// <returns>The protocol object of the requested type.</returns>
        Models.OutputFileUploadOptions ITransportObjectProvider <Models.OutputFileUploadOptions> .GetTransportObject()
        {
            Models.OutputFileUploadOptions result = new Models.OutputFileUploadOptions()
            {
                UploadCondition = UtilitiesInternal.MapEnum <Common.OutputFileUploadCondition, Models.OutputFileUploadCondition>(this.UploadCondition),
            };

            return(result);
        }
Пример #9
0
 internal AddTaskResult(Models.TaskAddResult protocolObject)
 {
     this.Error        = UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.Error, o => new BatchError(o).Freeze());
     this.ETag         = protocolObject.ETag;
     this.LastModified = protocolObject.LastModified;
     this.Location     = protocolObject.Location;
     this.Status       = UtilitiesInternal.MapEnum <Models.TaskAddStatus, Common.AddTaskStatus>(protocolObject.Status);
     this.TaskId       = protocolObject.TaskId;
 }
Пример #10
0
 internal StartTaskInformation(Models.StartTaskInformation protocolObject)
 {
     this.endTime         = protocolObject.EndTime;
     this.exitCode        = protocolObject.ExitCode;
     this.lastRetryTime   = protocolObject.LastRetryTime;
     this.retryCount      = protocolObject.RetryCount;
     this.schedulingError = UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.SchedulingError, o => new TaskSchedulingError(o).Freeze());
     this.startTime       = protocolObject.StartTime;
     this.state           = UtilitiesInternal.MapEnum <Models.StartTaskState, Common.StartTaskState>(protocolObject.State);
 }
        /// <summary>
        /// Return a protocol object of the requested type.
        /// </summary>
        /// <returns>The protocol object of the requested type.</returns>
        Models.BatchPoolIdentity ITransportObjectProvider <Models.BatchPoolIdentity> .GetTransportObject()
        {
            Models.BatchPoolIdentity result = new Models.BatchPoolIdentity()
            {
                Type = UtilitiesInternal.MapEnum <Common.PoolIdentityType, Models.PoolIdentityType>(this.Type),
                UserAssignedIdentities = UtilitiesInternal.ConvertToProtocolCollection(this.UserAssignedIdentities),
            };

            return(result);
        }
Пример #12
0
 internal JobReleaseTaskExecutionInformation(Models.JobReleaseTaskExecutionInformation protocolObject)
 {
     this.endTime              = protocolObject.EndTime;
     this.exitCode             = protocolObject.ExitCode;
     this.schedulingError      = UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.SchedulingError, o => new TaskSchedulingError(o).Freeze());
     this.startTime            = protocolObject.StartTime;
     this.state                = UtilitiesInternal.MapEnum <Models.JobReleaseTaskState, Common.JobReleaseTaskState>(protocolObject.State);
     this.taskRootDirectory    = protocolObject.TaskRootDirectory;
     this.taskRootDirectoryUrl = protocolObject.TaskRootDirectoryUrl;
 }
Пример #13
0
        internal static TTo?MapNullableEnum <TFrom, TTo>(TFrom?otherEnum)
            where TTo : struct
            where TFrom : struct
        {
            if (otherEnum == null)
            {
                return(null);
            }

            return(UtilitiesInternal.MapEnum <TFrom, TTo>(otherEnum.Value));
        }
        /// <summary>
        /// Return a protocol object of the requested type.
        /// </summary>
        /// <returns>The protocol object of the requested type.</returns>
        Models.NetworkSecurityGroupRule ITransportObjectProvider <Models.NetworkSecurityGroupRule> .GetTransportObject()
        {
            Models.NetworkSecurityGroupRule result = new Models.NetworkSecurityGroupRule()
            {
                Access              = UtilitiesInternal.MapEnum <Common.NetworkSecurityGroupRuleAccess, Models.NetworkSecurityGroupRuleAccess>(this.Access),
                Priority            = this.Priority,
                SourceAddressPrefix = this.SourceAddressPrefix,
            };

            return(result);
        }
 public PropertyContainer(Models.BatchPoolIdentity protocolObject) : base(BindingState.Bound)
 {
     this.TypeProperty = this.CreatePropertyAccessor(
         UtilitiesInternal.MapEnum <Models.PoolIdentityType, Common.PoolIdentityType>(protocolObject.Type),
         nameof(Type),
         BindingAccess.Read);
     this.UserAssignedIdentitiesProperty = this.CreatePropertyAccessor(
         UserAssignedIdentity.ConvertFromProtocolCollectionAndFreeze(protocolObject.UserAssignedIdentities),
         nameof(UserAssignedIdentities),
         BindingAccess.Read);
 }
 internal JobReleaseTaskExecutionInformation(Models.JobReleaseTaskExecutionInformation protocolObject)
 {
     this.ContainerInformation = UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.ContainerInfo, o => new TaskContainerExecutionInformation(o).Freeze());
     this.EndTime            = protocolObject.EndTime;
     this.ExitCode           = protocolObject.ExitCode;
     this.FailureInformation = UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.FailureInfo, o => new TaskFailureInformation(o).Freeze());
     this.Result             = UtilitiesInternal.MapNullableEnum <Models.TaskExecutionResult, Common.TaskExecutionResult>(protocolObject.Result);
     this.StartTime          = protocolObject.StartTime;
     this.State                = UtilitiesInternal.MapEnum <Models.JobReleaseTaskState, Common.JobReleaseTaskState>(protocolObject.State);
     this.TaskRootDirectory    = protocolObject.TaskRootDirectory;
     this.TaskRootDirectoryUrl = protocolObject.TaskRootDirectoryUrl;
 }
 internal StartTaskInformation(Models.StartTaskInformation protocolObject)
 {
     this.ContainerInformation = UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.ContainerInfo, o => new TaskContainerExecutionInformation(o).Freeze());
     this.EndTime            = protocolObject.EndTime;
     this.ExitCode           = protocolObject.ExitCode;
     this.FailureInformation = UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.FailureInfo, o => new TaskFailureInformation(o).Freeze());
     this.LastRetryTime      = protocolObject.LastRetryTime;
     this.Result             = UtilitiesInternal.MapNullableEnum <Models.TaskExecutionResult, Common.TaskExecutionResult>(protocolObject.Result);
     this.RetryCount         = protocolObject.RetryCount;
     this.StartTime          = protocolObject.StartTime;
     this.State = UtilitiesInternal.MapEnum <Models.StartTaskState, Common.StartTaskState>(protocolObject.State);
 }
Пример #18
0
        /// <summary>
        /// Return a protocol object of the requested type.
        /// </summary>
        /// <returns>The protocol object of the requested type.</returns>
        Models.NetworkSecurityGroupRule ITransportObjectProvider <Models.NetworkSecurityGroupRule> .GetTransportObject()
        {
            Models.NetworkSecurityGroupRule result = new Models.NetworkSecurityGroupRule()
            {
                Access              = UtilitiesInternal.MapEnum <Common.NetworkSecurityGroupRuleAccess, Models.NetworkSecurityGroupRuleAccess>(this.Access),
                Priority            = this.Priority,
                SourceAddressPrefix = this.SourceAddressPrefix,
                SourcePortRanges    = UtilitiesInternal.CreateObjectWithNullCheck(this.SourcePortRanges, o => o.ToList()),
            };

            return(result);
        }
Пример #19
0
        /// <summary>
        /// Return a protocol object of the requested type.
        /// </summary>
        /// <returns>The protocol object of the requested type.</returns>
        Models.AutoPoolSpecification ITransportObjectProvider <Models.AutoPoolSpecification> .GetTransportObject()
        {
            Models.AutoPoolSpecification result = new Models.AutoPoolSpecification()
            {
                AutoPoolIdPrefix   = this.AutoPoolIdPrefix,
                KeepAlive          = this.KeepAlive,
                PoolLifetimeOption = UtilitiesInternal.MapEnum <Common.PoolLifetimeOption, Models.PoolLifetimeOption>(this.PoolLifetimeOption),
                Pool = UtilitiesInternal.CreateObjectWithNullCheck(this.PoolSpecification, (o) => o.GetTransportObject()),
            };

            return(result);
        }
Пример #20
0
        /// <summary>
        /// Return a protocol object of the requested type.
        /// </summary>
        /// <returns>The protocol object of the requested type.</returns>
        Models.InboundNATPool ITransportObjectProvider <Models.InboundNATPool> .GetTransportObject()
        {
            Models.InboundNATPool result = new Models.InboundNATPool()
            {
                BackendPort            = this.BackendPort,
                FrontendPortRangeEnd   = this.FrontendPortRangeEnd,
                FrontendPortRangeStart = this.FrontendPortRangeStart,
                Name = this.Name,
                NetworkSecurityGroupRules = UtilitiesInternal.ConvertToProtocolCollection(this.NetworkSecurityGroupRules),
                Protocol = UtilitiesInternal.MapEnum <Common.InboundEndpointProtocol, Models.InboundEndpointProtocol>(this.Protocol),
            };

            return(result);
        }
        /// <summary>
        /// Parse enum values for type AccessScope.
        /// </summary>
        /// <param name='value'>
        /// The value to parse.
        /// </param>
        /// <returns>
        /// The enum value.
        /// </returns>
        internal static Common.AccessScope ParseAccessScope(IList <Protocol.Models.AccessScope> value)
        {
            if (value == null)
            {
                return(Common.AccessScope.None);
            }

            Common.AccessScope flags = AccessScope.None;

            foreach (Protocol.Models.AccessScope visibility in value)
            {
                Common.AccessScope convertedEnum = UtilitiesInternal.MapEnum <Protocol.Models.AccessScope, Common.AccessScope>(visibility);

                flags |= convertedEnum;
            }

            return(flags);
        }
        /// <summary>
        /// Parse enum values for type CertificateVisibility.
        /// </summary>
        /// <param name='value'>
        /// The value to parse.
        /// </param>
        /// <returns>
        /// The enum value.
        /// </returns>
        internal static Common.CertificateVisibility?ParseCertificateVisibility(IList <Protocol.Models.CertificateVisibility> value)
        {
            if (value == null)
            {
                return(null);
            }

            Common.CertificateVisibility flags = CertificateVisibility.None;

            foreach (Protocol.Models.CertificateVisibility visibility in value)
            {
                Common.CertificateVisibility convertedEnum = UtilitiesInternal.MapEnum <Protocol.Models.CertificateVisibility, Common.CertificateVisibility>(visibility);

                flags |= convertedEnum;
            }

            return(flags);
        }
        /// <summary>
        /// Convert an enum of type AccessScope to a List of Protocol.Models.AccessScope.
        /// </summary>
        /// <param name='value'>
        /// The value to convert.
        /// </param>
        /// <returns>
        /// The enum value to convert into list format.
        /// </returns>
        internal static IList <Protocol.Models.AccessScope> AccessScopeToList(Common.AccessScope value)
        {
            List <Protocol.Models.AccessScope> result = new List <Protocol.Models.AccessScope>();

            IList <Common.AccessScope> enumValues = new List <Common.AccessScope>((Common.AccessScope[])Enum.GetValues(typeof(Common.AccessScope)));

            enumValues.Remove(Common.AccessScope.None); //None is an artifact of the OM so skip it

            foreach (Common.AccessScope enumValue in enumValues)
            {
                if (value.HasFlag(enumValue))
                {
                    Protocol.Models.AccessScope protoEnumValue = UtilitiesInternal.MapEnum <Common.AccessScope, Protocol.Models.AccessScope>(enumValue);
                    result.Add(protoEnumValue);
                }
            }

            return(result);
        }
Пример #24
0
 public PropertyContainer(Models.AutoPoolSpecification protocolObject) : base(BindingState.Bound)
 {
     this.AutoPoolIdPrefixProperty = this.CreatePropertyAccessor(
         protocolObject.AutoPoolIdPrefix,
         nameof(AutoPoolIdPrefix),
         BindingAccess.Read | BindingAccess.Write);
     this.KeepAliveProperty = this.CreatePropertyAccessor(
         protocolObject.KeepAlive,
         nameof(KeepAlive),
         BindingAccess.Read | BindingAccess.Write);
     this.PoolLifetimeOptionProperty = this.CreatePropertyAccessor(
         UtilitiesInternal.MapEnum <Models.PoolLifetimeOption, Common.PoolLifetimeOption>(protocolObject.PoolLifetimeOption),
         nameof(PoolLifetimeOption),
         BindingAccess.Read | BindingAccess.Write);
     this.PoolSpecificationProperty = this.CreatePropertyAccessor(
         UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.Pool, o => new PoolSpecification(o)),
         nameof(PoolSpecification),
         BindingAccess.Read | BindingAccess.Write);
 }
Пример #25
0
        /// <summary>
        /// Convert an enum of type CertificateVisibility to a List of Protocol.Models.CertificateVisibility.
        /// </summary>
        /// <param name='value'>
        /// The value to convert.
        /// </param>
        /// <returns>
        /// The enum value to convert into list format.
        /// </returns>
        internal static IList <Protocol.Models.CertificateVisibility?> CertificateVisibilityToList(Common.CertificateVisibility?value)
        {
            List <Protocol.Models.CertificateVisibility?> result = new List <Protocol.Models.CertificateVisibility?>();

            if (value.HasValue)
            {
                IList <Common.CertificateVisibility> enumValues = new List <Common.CertificateVisibility>(
                    (Common.CertificateVisibility[])Enum.GetValues(typeof(Common.CertificateVisibility)));

                enumValues.Remove(Common.CertificateVisibility.None); //None is an artifact of the OM so skip it

                foreach (Common.CertificateVisibility enumValue in enumValues)
                {
                    if (value.Value.HasFlag(enumValue))
                    {
                        Protocol.Models.CertificateVisibility protoEnumValue = UtilitiesInternal.MapEnum <Common.CertificateVisibility, Protocol.Models.CertificateVisibility>(enumValue);
                        result.Add(protoEnumValue);
                    }
                }
            }

            return(result);
        }
Пример #26
0
 internal OutputFileUploadOptions(Models.OutputFileUploadOptions protocolObject)
 {
     this.UploadCondition = UtilitiesInternal.MapEnum <Models.OutputFileUploadCondition, Common.OutputFileUploadCondition>(protocolObject.UploadCondition);
 }
 internal NetworkSecurityGroupRule(Models.NetworkSecurityGroupRule protocolObject)
 {
     this.Access              = UtilitiesInternal.MapEnum <Models.NetworkSecurityGroupRuleAccess, Common.NetworkSecurityGroupRuleAccess>(protocolObject.Access);
     this.Priority            = protocolObject.Priority;
     this.SourceAddressPrefix = protocolObject.SourceAddressPrefix;
 }
Пример #28
0
 internal TaskSchedulingPolicy(Models.TaskSchedulingPolicy protocolObject)
 {
     this.ComputeNodeFillType = UtilitiesInternal.MapEnum <Models.ComputeNodeFillType, Common.ComputeNodeFillType>(protocolObject.NodeFillType);
 }