/// <summary> /// The create server farm. /// </summary> /// <param name="networkId"> /// The network id. /// </param> /// <param name="name"> /// The name. /// </param> /// <param name="predictor"> /// The predictor. /// </param> /// <param name="realServers"> /// The real servers. /// </param> /// <param name="probeId"> /// The probe id. /// </param> /// <returns> /// The <see cref="Task"/>. /// </returns> public async Task <Status> CreateServerFarm( string networkId, string name, ServerFarmPredictorType predictor, NewServerFarmRealServer[] realServers, string probeId = null) { var newserverfarm = new NewServerFarm { name = name, predictor = predictor, realServer = realServers }; if (!string.IsNullOrEmpty(probeId)) { newserverfarm.probeId = probeId; } Status status = await this._apiClient.PostAsync <NewServerFarm, Status>( ApiUris.CreateOrGetVipServerFarm(this._apiClient.OrganizationId, networkId), newserverfarm); return(status); }
public static async Task <Status> ModifyServerFarm( this IComputeApiClient client, string networkId, string serverFarmId, ServerFarmPredictorType predictor) { return(await client.NetworkingLegacy.NetworkVip.ModifyServerFarm(networkId, serverFarmId, predictor)); }
public static async Task <Status> CreateServerFarm( this IComputeApiClient client, string networkId, string name, ServerFarmPredictorType predictor, string realServerId, int realServerPort = 0, string probeId = null) { return(await client.NetworkingLegacy.NetworkVip.CreateServerFarm(networkId, name, predictor, realServerId, realServerPort, probeId)); }
/// <summary> /// The create server farm. /// </summary> /// <param name="networkId"> /// The network id. /// </param> /// <param name="name"> /// The name. /// </param> /// <param name="predictor"> /// The predictor. /// </param> /// <param name="rServerId"> /// The r server id. /// </param> /// <param name="rServerPort"> /// The r server port. /// </param> /// <param name="probeId"> /// The probe id. /// </param> /// <returns> /// The <see cref="Task"/>. /// </returns> public async Task <Status> CreateServerFarm( string networkId, string name, ServerFarmPredictorType predictor, string rServerId, int rServerPort = 0, string probeId = null) { var newserverfarm = new NewServerFarm { name = name, predictor = predictor, }; var realserver = new NewServerFarmRealServer { id = rServerId }; if (rServerPort > 0) { realserver.port = rServerPort.ToString(CultureInfo.InvariantCulture); } newserverfarm.realServer = new[] { realserver }; if (!string.IsNullOrEmpty(probeId)) { newserverfarm.probeId = probeId; } Status status = await this._apiClient.PostAsync <NewServerFarm, Status>( ApiUris.CreateOrGetVipServerFarm(this._apiClient.OrganizationId, networkId), newserverfarm); return(status); }
/// <summary> /// The modify server farm. /// </summary> /// <param name="networkId"> /// The network id. /// </param> /// <param name="serverFarmId"> /// The server farm id. /// </param> /// <param name="predictor"> /// The predictor. /// </param> /// <returns> /// The <see cref="Task"/>. /// </returns> public async Task <Status> ModifyServerFarm(string networkId, string serverFarmId, ServerFarmPredictorType predictor) { var parameters = new Dictionary <string, string> { { "predictor", predictor.ToString() } }; // build the query string string poststring = parameters.ToQueryString(); Status status = await this._apiClient.PostAsync <Status>( ApiUris.GetVipServerFarm(this._apiClient.OrganizationId, networkId, serverFarmId), poststring); return(status); }
/// <summary> /// Modify a ServerFarm /// </summary> /// <param name="client"> /// The <see cref="IComputeApiClient"/> object. /// </param> /// <param name="networkId"> /// The network id /// </param> /// <param name="serverFarmId"> /// The server farm id /// </param> /// <param name="predictor"> /// Either LEAST_CONNECTIONS or ROUND_ROBIN /// </param> /// <returns> /// The <see cref="Task"/>. /// </returns> public static async Task<Status> ModifyServerFarm(this IComputeApiClient client, string networkId, string serverFarmId, ServerFarmPredictorType predictor ) { var parameters = new Dictionary<string, string> {{"predictor", predictor.ToString()}}; // build the query string string poststring = parameters.ToQueryString(); Status status = await client.WebApi.ApiPostAsync<Status>( ApiUris.GetVipServerFarm(client.Account.OrganizationId, networkId, serverFarmId), poststring); return status; }
/// <summary> /// Create a server farm from network VIP /// </summary> /// <param name="client"> /// The <see cref="IComputeApiClient"/> object. /// </param> /// <param name="networkId"> /// The network id /// </param> /// <param name="name"> /// The server farm name /// </param> /// <param name="predictor"> /// The server farm predictor /// </param> /// <param name="rServerId"> /// The first real server Id /// </param> /// <param name="rServerPort"> /// The first real server port /// </param> /// <param name="probeId"> /// The probe id /// </param> /// <returns> /// The <see cref="Task"/>. /// </returns> public static async Task<Status> CreateServerFarm(this IComputeApiClient client, string networkId, string name, ServerFarmPredictorType predictor, string rServerId, int rServerPort = 0, string probeId = null) { var newserverfarm = new NewServerFarm { name = name, predictor = predictor, }; var realserver = new NewServerFarmRealServer {id = rServerId}; if (rServerPort > 0) realserver.port = rServerPort.ToString(CultureInfo.InvariantCulture); newserverfarm.realServer = new[] {realserver}; if (!string.IsNullOrEmpty(probeId)) newserverfarm.probeId = probeId; Status status = await client.WebApi.ApiPostAsync<NewServerFarm, Status>( ApiUris.CreateOrGetVipServerFarm(client.Account.OrganizationId, networkId), newserverfarm); return status; }
public static async Task<Status> ModifyServerFarm( this IComputeApiClient client, string networkId, string serverFarmId, ServerFarmPredictorType predictor) { return await client.NetworkingLegacy.NetworkVip.ModifyServerFarm(networkId, serverFarmId, predictor); }
public static async Task<Status> CreateServerFarm( this IComputeApiClient client, string networkId, string name, ServerFarmPredictorType predictor, string realServerId, int realServerPort = 0, string probeId = null) { return await client.NetworkingLegacy.NetworkVip.CreateServerFarm(networkId, name, predictor, realServerId, realServerPort, probeId); }