internal ComputeNode( BatchClient parentBatchClient, string parentPoolId, Models.ComputeNode protocolObject, IEnumerable <BatchClientBehavior> baseBehaviors) { this.parentPoolId = parentPoolId; this.parentBatchClient = parentBatchClient; InheritUtil.InheritClientBehaviorsAndSetPublicProperty(this, baseBehaviors); this.propertyContainer = new PropertyContainer(protocolObject); }
/// <summary> /// Builds a ComputeNodeGetResponse object /// </summary> public static ProxyModels.ComputeNodeGetResponse CreateComputeNodeGetResponse(string computeNodeId) { ProxyModels.ComputeNodeGetResponse response = new ProxyModels.ComputeNodeGetResponse(); response.StatusCode = HttpStatusCode.OK; ProxyModels.ComputeNode computeNode = new ProxyModels.ComputeNode(); computeNode.Id = computeNodeId; response.ComputeNode = computeNode; return(response); }
/// <summary> /// Builds a ComputeNodeGetResponse object /// </summary> public static AzureOperationResponse <ProxyModels.ComputeNode, ProxyModels.ComputeNodeGetHeaders> CreateComputeNodeGetResponse(string computeNodeId) { var response = new AzureOperationResponse <ProxyModels.ComputeNode, ProxyModels.ComputeNodeGetHeaders>(); response.Response = new HttpResponseMessage(HttpStatusCode.OK); ProxyModels.ComputeNode computeNode = new ProxyModels.ComputeNode(); computeNode.Id = computeNodeId; response.Body = computeNode; return(response); }
/// <summary> /// Refreshes the current <see cref="ComputeNode"/>. /// </summary> /// <param name="detailLevel">The detail level for the refresh. If a detail level which omits the <see cref="Id"/> property is specified, refresh will fail.</param> /// <param name="additionalBehaviors">A collection of <see cref="BatchClientBehavior"/> instances that are applied to the Batch service request after the <see cref="CustomBehaviors"/>.</param> /// <param name="cancellationToken">A <see cref="CancellationToken"/> for controlling the lifetime of the asynchronous operation.</param> /// <returns>A <see cref="Task"/> representing the asynchronous refresh operation.</returns> public async Task RefreshAsync(DetailLevel detailLevel = null, IEnumerable <BatchClientBehavior> additionalBehaviors = null, CancellationToken cancellationToken = default(CancellationToken)) { // create the behavior managaer BehaviorManager bhMgr = new BehaviorManager(this.CustomBehaviors, additionalBehaviors, detailLevel); System.Threading.Tasks.Task <AzureOperationResponse <Models.ComputeNode, Models.ComputeNodeGetHeaders> > asyncTask = this.parentBatchClient.ProtocolLayer.GetComputeNode(this.parentPoolId, this.Id, bhMgr, cancellationToken); AzureOperationResponse <Models.ComputeNode, Models.ComputeNodeGetHeaders> response = await asyncTask.ConfigureAwait(continueOnCapturedContext : false); // get pool from response Models.ComputeNode newProtocolComputeNode = response.Body; this.propertyContainer = new PropertyContainer(newProtocolComputeNode); }
/// <summary> /// Builds a ComputeNodeListResponse object /// </summary> public static ProxyModels.ComputeNodeListResponse CreateComputeNodeListResponse(IEnumerable <string> computeNodeIds) { ProxyModels.ComputeNodeListResponse response = new ProxyModels.ComputeNodeListResponse(); response.StatusCode = HttpStatusCode.OK; List <ProxyModels.ComputeNode> computeNodes = new List <ProxyModels.ComputeNode>(); foreach (string id in computeNodeIds) { ProxyModels.ComputeNode computeNode = new ProxyModels.ComputeNode(); computeNode.Id = id; computeNodes.Add(computeNode); } response.ComputeNodes = computeNodes; return(response); }
/// <summary> /// Builds a ComputeNodeListResponse object /// </summary> public static AzureOperationResponse <IPage <ProxyModels.ComputeNode>, ProxyModels.ComputeNodeListHeaders> CreateComputeNodeListResponse(IEnumerable <string> computeNodeIds) { var response = new AzureOperationResponse <IPage <ProxyModels.ComputeNode>, ProxyModels.ComputeNodeListHeaders>(); response.Response = new HttpResponseMessage(HttpStatusCode.OK); List <ProxyModels.ComputeNode> computeNodes = new List <ProxyModels.ComputeNode>(); foreach (string id in computeNodeIds) { ProxyModels.ComputeNode computeNode = new ProxyModels.ComputeNode(); computeNode.Id = id; computeNodes.Add(computeNode); } response.Body = new MockPagedEnumerable <ProxyModels.ComputeNode>(computeNodes); return(response); }
public PropertyContainer(Models.ComputeNode protocolObject) : base(BindingState.Bound) { this.AffinityIdProperty = this.CreatePropertyAccessor( protocolObject.AffinityId, nameof(AffinityId), BindingAccess.Read); this.AllocationTimeProperty = this.CreatePropertyAccessor( protocolObject.AllocationTime, nameof(AllocationTime), BindingAccess.Read); this.CertificateReferencesProperty = this.CreatePropertyAccessor( CertificateReference.ConvertFromProtocolCollectionReadOnly(protocolObject.CertificateReferences), nameof(CertificateReferences), BindingAccess.Read); this.EndpointConfigurationProperty = this.CreatePropertyAccessor( UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.EndpointConfiguration, o => new ComputeNodeEndpointConfiguration(o).Freeze()), nameof(EndpointConfiguration), BindingAccess.Read); this.ErrorsProperty = this.CreatePropertyAccessor( ComputeNodeError.ConvertFromProtocolCollectionReadOnly(protocolObject.Errors), nameof(Errors), BindingAccess.Read); this.IdProperty = this.CreatePropertyAccessor( protocolObject.Id, nameof(Id), BindingAccess.Read); this.IPAddressProperty = this.CreatePropertyAccessor( protocolObject.IpAddress, nameof(IPAddress), BindingAccess.Read); this.IsDedicatedProperty = this.CreatePropertyAccessor( protocolObject.IsDedicated, nameof(IsDedicated), BindingAccess.Read); this.LastBootTimeProperty = this.CreatePropertyAccessor( protocolObject.LastBootTime, nameof(LastBootTime), BindingAccess.Read); this.NodeAgentInformationProperty = this.CreatePropertyAccessor( UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.NodeAgentInfo, o => new NodeAgentInformation(o).Freeze()), nameof(NodeAgentInformation), BindingAccess.Read); this.RecentTasksProperty = this.CreatePropertyAccessor( TaskInformation.ConvertFromProtocolCollectionReadOnly(protocolObject.RecentTasks), nameof(RecentTasks), BindingAccess.Read); this.RunningTasksCountProperty = this.CreatePropertyAccessor( protocolObject.RunningTasksCount, nameof(RunningTasksCount), BindingAccess.Read); this.RunningTaskSlotsCountProperty = this.CreatePropertyAccessor( protocolObject.RunningTaskSlotsCount, nameof(RunningTaskSlotsCount), BindingAccess.Read); this.SchedulingStateProperty = this.CreatePropertyAccessor( UtilitiesInternal.MapNullableEnum <Models.SchedulingState, Common.SchedulingState>(protocolObject.SchedulingState), nameof(SchedulingState), BindingAccess.Read); this.StartTaskProperty = this.CreatePropertyAccessor( UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.StartTask, o => new StartTask(o).Freeze()), nameof(StartTask), BindingAccess.Read); this.StartTaskInformationProperty = this.CreatePropertyAccessor( UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.StartTaskInfo, o => new StartTaskInformation(o).Freeze()), nameof(StartTaskInformation), BindingAccess.Read); this.StateProperty = this.CreatePropertyAccessor( UtilitiesInternal.MapNullableEnum <Models.ComputeNodeState, Common.ComputeNodeState>(protocolObject.State), nameof(State), BindingAccess.Read); this.StateTransitionTimeProperty = this.CreatePropertyAccessor( protocolObject.StateTransitionTime, nameof(StateTransitionTime), BindingAccess.Read); this.TotalTasksRunProperty = this.CreatePropertyAccessor( protocolObject.TotalTasksRun, nameof(TotalTasksRun), BindingAccess.Read); this.TotalTasksSucceededProperty = this.CreatePropertyAccessor( protocolObject.TotalTasksSucceeded, nameof(TotalTasksSucceeded), BindingAccess.Read); this.UrlProperty = this.CreatePropertyAccessor( protocolObject.Url, nameof(Url), BindingAccess.Read); this.VirtualMachineSizeProperty = this.CreatePropertyAccessor( protocolObject.VmSize, nameof(VirtualMachineSize), BindingAccess.Read); }
public static IEnumerable <Protocol.RequestInterceptor> CreateGetComputeNodeRequestInterceptor(Protocol.Models.ComputeNode nodeToReturn) { return(CreateGetRequestInterceptor <Protocol.Models.ComputeNodeGetOptions, Protocol.Models.ComputeNode, Protocol.Models.ComputeNodeGetHeaders>(nodeToReturn)); }
/// <summary> /// Builds a ComputeNodeListResponse object /// </summary> public static ProxyModels.ComputeNodeListResponse CreateComputeNodeListResponse(IEnumerable<string> computeNodeIds) { ProxyModels.ComputeNodeListResponse response = new ProxyModels.ComputeNodeListResponse(); response.StatusCode = HttpStatusCode.OK; List<ProxyModels.ComputeNode> computeNodes = new List<ProxyModels.ComputeNode>(); foreach (string id in computeNodeIds) { ProxyModels.ComputeNode computeNode = new ProxyModels.ComputeNode(); computeNode.Id = id; computeNodes.Add(computeNode); } response.ComputeNodes = computeNodes; return response; }
/// <summary> /// Builds a ComputeNodeGetResponse object /// </summary> public static ProxyModels.ComputeNodeGetResponse CreateComputeNodeGetResponse(string computeNodeId) { ProxyModels.ComputeNodeGetResponse response = new ProxyModels.ComputeNodeGetResponse(); response.StatusCode = HttpStatusCode.OK; ProxyModels.ComputeNode computeNode = new ProxyModels.ComputeNode(); computeNode.Id = computeNodeId; response.ComputeNode = computeNode; return response; }
public PropertyContainer(Models.ComputeNode protocolObject) : base(BindingState.Bound) { this.AffinityIdProperty = this.CreatePropertyAccessor( protocolObject.AffinityId, "AffinityId", BindingAccess.Read); this.AllocationTimeProperty = this.CreatePropertyAccessor( protocolObject.AllocationTime, "AllocationTime", BindingAccess.Read); this.CertificateReferencesProperty = this.CreatePropertyAccessor( CertificateReference.ConvertFromProtocolCollectionReadOnly(protocolObject.CertificateReferences), "CertificateReferences", BindingAccess.Read); this.ErrorsProperty = this.CreatePropertyAccessor( ComputeNodeError.ConvertFromProtocolCollectionReadOnly(protocolObject.Errors), "Errors", BindingAccess.Read); this.IdProperty = this.CreatePropertyAccessor( protocolObject.Id, "Id", BindingAccess.Read); this.IPAddressProperty = this.CreatePropertyAccessor( protocolObject.IpAddress, "IPAddress", BindingAccess.Read); this.LastBootTimeProperty = this.CreatePropertyAccessor( protocolObject.LastBootTime, "LastBootTime", BindingAccess.Read); this.RecentTasksProperty = this.CreatePropertyAccessor( TaskInformation.ConvertFromProtocolCollectionReadOnly(protocolObject.RecentTasks), "RecentTasks", BindingAccess.Read); this.RunningTasksCountProperty = this.CreatePropertyAccessor( protocolObject.RunningTasksCount, "RunningTasksCount", BindingAccess.Read); this.SchedulingStateProperty = this.CreatePropertyAccessor( UtilitiesInternal.MapNullableEnum<Models.SchedulingState, Common.SchedulingState>(protocolObject.SchedulingState), "SchedulingState", BindingAccess.Read); this.StartTaskProperty = this.CreatePropertyAccessor( UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.StartTask, o => new StartTask(o).Freeze()), "StartTask", BindingAccess.Read); this.StartTaskInformationProperty = this.CreatePropertyAccessor( UtilitiesInternal.CreateObjectWithNullCheck(protocolObject.StartTaskInfo, o => new StartTaskInformation(o).Freeze()), "StartTaskInformation", BindingAccess.Read); this.StateProperty = this.CreatePropertyAccessor( UtilitiesInternal.MapNullableEnum<Models.ComputeNodeState, Common.ComputeNodeState>(protocolObject.State), "State", BindingAccess.Read); this.StateTransitionTimeProperty = this.CreatePropertyAccessor( protocolObject.StateTransitionTime, "StateTransitionTime", BindingAccess.Read); this.TotalTasksRunProperty = this.CreatePropertyAccessor( protocolObject.TotalTasksRun, "TotalTasksRun", BindingAccess.Read); this.TotalTasksSucceededProperty = this.CreatePropertyAccessor( protocolObject.TotalTasksSucceeded, "TotalTasksSucceeded", BindingAccess.Read); this.UrlProperty = this.CreatePropertyAccessor( protocolObject.Url, "Url", BindingAccess.Read); this.VirtualMachineSizeProperty = this.CreatePropertyAccessor( protocolObject.VmSize, "VirtualMachineSize", BindingAccess.Read); }