internal virtual UpdateServerResponse UpdateServer(UpdateServerRequest request) { var marshaller = UpdateServerRequestMarshaller.Instance; var unmarshaller = UpdateServerResponseUnmarshaller.Instance; return(Invoke <UpdateServerRequest, UpdateServerResponse>(request, marshaller, unmarshaller)); }
/// <summary> /// Initiates the asynchronous execution of the UpdateServer operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the UpdateServer operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/opsworkscm-2016-11-01/UpdateServer">REST API Reference for UpdateServer Operation</seealso> public virtual Task <UpdateServerResponse> UpdateServerAsync(UpdateServerRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var marshaller = UpdateServerRequestMarshaller.Instance; var unmarshaller = UpdateServerResponseUnmarshaller.Instance; return(InvokeAsync <UpdateServerRequest, UpdateServerResponse>(request, marshaller, unmarshaller, cancellationToken)); }
public void TestUpdateServerRequest() { UpdateServerRequest request = new UpdateServerRequest("new-name", IPAddress.Parse("10.0.0.1"), IPAddress.Parse("2607:f0d0:1002:51::4")); string expectedJson = @"{""server"":{""name"":""new-name"",""accessIPv4"":""10.0.0.1"",""accessIPv6"":""2607:f0d0:1002:51::4""}}"; string actual = JsonConvert.SerializeObject(request, Formatting.None); Assert.AreEqual(expectedJson, actual); }
internal virtual UpdateServerResponse UpdateServer(UpdateServerRequest request) { var options = new InvokeOptions(); options.RequestMarshaller = UpdateServerRequestMarshaller.Instance; options.ResponseUnmarshaller = UpdateServerResponseUnmarshaller.Instance; return(Invoke <UpdateServerResponse>(request, options)); }
public async Task <bool> Handle(UpdateServerRequest message, IOutputPort <UpdateServerResponse> outputPort)//, IOutputPort<CreateNewServerResponse> outputPort { var response = await _serverRepository.UpdateServer(new Server(message.Id, message.CreatedAt, message.CreatedBy, message.DeletedAt, message.DeletedBy, message.EndDate, message.IpAddress, message.IsDeleted, message.Name, message.StartDate, message.Status, message.UpdatedAt, message.UpdatedBy)); //outputPort.Handle(response.Success ? new CreateNewServerResponse(response.Id, true) : new CreateNewServerResponse(response.Errors.Select(e => e.Description))); return(response.Success); }
public UpdateServerResult UpdateServer(UpdateServerRequest request) { var index = Entries.FindIndex(e => e.Server.Name == request.ServerEntry.Server.Name); Entries[index] = request.ServerEntry; return(new UpdateServerResult { ServerEntry = request.ServerEntry }); }
/// <summary> /// Initiates the asynchronous execution of the UpdateServer operation. /// </summary> /// /// <param name="request">Container for the necessary parameters to execute the UpdateServer operation.</param> /// <param name="cancellationToken"> /// A cancellation token that can be used by other objects or threads to receive notice of cancellation. /// </param> /// <returns>The task object representing the asynchronous operation.</returns> /// <seealso href="http://docs.aws.amazon.com/goto/WebAPI/transfer-2018-11-05/UpdateServer">REST API Reference for UpdateServer Operation</seealso> public virtual Task <UpdateServerResponse> UpdateServerAsync(UpdateServerRequest request, System.Threading.CancellationToken cancellationToken = default(CancellationToken)) { var options = new InvokeOptions(); options.RequestMarshaller = UpdateServerRequestMarshaller.Instance; options.ResponseUnmarshaller = UpdateServerResponseUnmarshaller.Instance; return(InvokeAsync <UpdateServerResponse>(request, options, cancellationToken)); }
/// <summary> /// 修改云服务器 /// </summary> public UpdateServerResponse UpdateServer(UpdateServerRequest updateServerRequest) { Dictionary <string, string> urlParam = new Dictionary <string, string>(); urlParam.Add("server_id", updateServerRequest.ServerId.ToString()); string urlPath = HttpUtils.AddUrlPath("/v1/{project_id}/cloudservers/{server_id}", urlParam); SdkRequest request = HttpUtils.InitSdkRequest(urlPath, "application/json;charset=UTF-8", updateServerRequest); SdkResponse response = DoHttpRequest("PUT", request); return(JsonUtils.DeSerialize <UpdateServerResponse>(response)); }
/// <inheritdoc /> public bool UpdateServer(string cloudServerId, string name = null, string accessIPv4 = null, string accessIPv6 = null, string region = null, CloudIdentity identity = null) { var urlPath = new Uri(string.Format("{0}/servers/{1}", GetServiceEndpoint(identity, region), cloudServerId)); var requestJson = new UpdateServerRequest(name, accessIPv4, accessIPv6); var response = ExecuteRESTRequest <ServerDetailsResponse>(identity, urlPath, HttpMethod.PUT, requestJson); if (response == null || response.Data == null || response.Data.Server == null) { return(false); } if (response.StatusCode != 200 && response.StatusCode != 202) { return(false); } return(true); }
public UpdateServerResult UpdateServer(UpdateServerRequest request) { using (var context = new DataAccessContext()) { var broker = context.GetDeviceBroker(); var existing = broker.GetDeviceByName(request.ServerEntry.Server.Name); if (existing == null) { throw new ArgumentException(); } var ae = request.ServerEntry.Server; existing.AETitle = ae.AETitle; existing.HostName = ae.ScpParameters.HostName; existing.Port = ae.ScpParameters.Port; existing.Location = ae.Location; existing.Description = ae.Description; existing.IsPriorsServer = request.ServerEntry.IsPriorsServer; if (ae.StreamingParameters != null) { existing.StreamingHeaderPort = ae.StreamingParameters.HeaderServicePort; existing.StreamingImagePort = ae.StreamingParameters.WadoServicePort; } else { existing.StreamingHeaderPort = null; existing.StreamingImagePort = null; } existing.ExtensionData = request.ServerEntry.Data == null ? null : Serializer.SerializeServerExtensionData(request.ServerEntry.Data); context.Commit(); return(new UpdateServerResult { ServerEntry = existing.ToDataContract() }); } }
private static void UpdateServer(EcsClient client) { var req = new UpdateServerRequest { ServerId = "0bfacb9f-148a-4e39-8f6f-095a0600f141", Body = new UpdateServerRequestBody { Server = new UpdateServerOption { Name = "net_sdk-test-update", Hostname = "net.sdk.test.update.hostname", Description = "net-sdk test" } } }; try { var resp = client.UpdateServer(req); var respStatusCode = resp.HttpStatusCode; var server = resp.Server; Console.WriteLine(respStatusCode); Console.WriteLine(server.Id); } catch (RequestTimeoutException requestTimeoutException) { Console.WriteLine(requestTimeoutException.ErrorMessage); } catch (ServiceResponseException clientRequestException) { Console.WriteLine(clientRequestException.HttpStatusCode); Console.WriteLine(clientRequestException.ErrorCode); Console.WriteLine(clientRequestException.ErrorMsg); } catch (ConnectionException connectionException) { Console.WriteLine(connectionException.ErrorMessage); } }
public async Task <UpdateServerResponse> Update(UpdateServerRequest request) { var result = ServerRegistryResult.Ok; var record = await _repository.RetrieveByServerID(request.Server.Id); if (record == null || DateTime.UtcNow > record.DateExpire.ToUniversalTime()) { result = ServerRegistryResult.FailedNotRegistered; } if (result == ServerRegistryResult.Ok) { record.FromContract(request.Server); record.DateExpire = DateTime.UtcNow.Add(ServerRegistryTimeoutDuration); await _repository.Update(record); } return(new UpdateServerResponse { Result = result }); }
/// <summary> /// Adds a new server. /// </summary> public UpdateServerResponse Update(UpdateServerRequest server, string serverId) { try { var request = new RestRequest("/servers/{server_id}", Method.PUT) { RequestFormat = DataFormat.Json, JsonSerializer = new CustomSerializer() }; request.AddUrlSegment("server_id", serverId); request.AddBody(server); var result = restclient.Execute <UpdateServerResponse>(request); if (result.StatusCode != HttpStatusCode.OK) { throw new Exception(result.Content); } return(result.Data); } catch { throw; } }
public UpdateServerResult UpdateServer(UpdateServerRequest request) { return(Call(_real.UpdateServer, request)); }
public UpdateServerResult UpdateServer(UpdateServerRequest request) { return new UpdateServerResult(); }
public UpdateServerResult UpdateServer(UpdateServerRequest request) { var index = Entries.FindIndex(e => e.Server.Name == request.ServerEntry.Server.Name); Entries[index] = request.ServerEntry; return new UpdateServerResult { ServerEntry = request.ServerEntry }; }
public abstract UpdateServerResult UpdateServer(UpdateServerRequest request);
public UpdateServerResult UpdateServer(UpdateServerRequest request) { return(new UpdateServerResult()); }