/// <summary>
        /// Deploys a new network in a designated data center location.
        /// The designated data center must be chosen from your available data centers list (See "List Data Centers (With Parameters)").
        /// The "location" property of the data center is used to identify it for network creation.
        /// The "name" property must be unique within your organization.
        /// </summary>
        /// <param name="client">The <see cref="ComputeApiClient"/> object.</param>
        /// <param name="networkName">A unique network name for the new network.</param>
        /// <param name="dataCentreLocation">The data centre location.</param>
        /// <param name="description">Optional. A decription for the network.</param>
        /// <returns>A status of the response.</returns>
        public static async Task <Status> CreateNetworkAsync(
            this IComputeApiClient client,
            string networkName,
            string dataCentreLocation,
            string description = null)
        {
            if (string.IsNullOrWhiteSpace(networkName))
            {
                throw new ArgumentException("argument cannot be null, empty or composed of whitespaces only!", "networkName");
            }
            if (string.IsNullOrWhiteSpace(dataCentreLocation))
            {
                throw new ArgumentException("argument cannot be null, empty or composed of whitespaces only!", "dataCentreLocation");
            }

            return
                (await
                 client.WebApi.ApiPostAsync <NewNetworkWithLocationType, Status>(
                     ApiUris.CreateNetwork(client.Account.OrganizationId),
                     new NewNetworkWithLocationType
            {
                name = networkName,
                location = dataCentreLocation,
                description = description
            }));
        }
예제 #2
0
        /// <summary>
        /// Starts the process of importing an OVF Package to become a new Customer Image for the supplied organization ID.
        /// This function takes the full name (including the “.mf” file suffix) of the manifest file identifying the OVF Package to import as a new Customer Image.
        /// </summary>
        /// <param name="client">The <see cref="ComputeApiClient"/> object</param>
        /// <param name="customerImageName"> 1-75 characters in length.
        /// The permitted character set is (within and excluding the quotes): “a-zA-Z0-9_+=# .,:;()-“.
        /// Note that the “space” character is permitted</param>
        /// <param name="ovfPackageName">References a manifest identifying an OVF Package on the organization’s FTPS account.
        /// Maximum length 75 characters.
        /// The permitted character set is (within and excluding the quotes): “a-zA-Z0-9_+=#.,:;()-“.
        /// Note that the “space” character is not permitted</param>
        /// <param name="networkLocation">Identifies the target data center location for the Customer Image.
        /// The target data center must reside within the same Geographic Region</param>
        /// <param name="description">0-255 characters in length.</param>
        /// <returns>Returns the ServerImageWithState object</returns>
        public static async Task<ServerImageWithStateType> ImportCustomerImageAsync(
            this IComputeApiClient client,
            string customerImageName,
            string ovfPackageName,
            string networkLocation,
            string description)
        {
			if (string.IsNullOrWhiteSpace(customerImageName))
				throw new ArgumentException("argument cannot be null, empty or composed of whitespaces only!", "customerImageName");
			if (string.IsNullOrWhiteSpace(ovfPackageName))
				throw new ArgumentException("argument cannot be null, empty or composed of whitespaces only!", "ovfPackageName");
			if (string.IsNullOrWhiteSpace(networkLocation))
				throw new ArgumentException("argument cannot be null, empty or composed of whitespaces only!", "networkLocation");
			
			return
                await
                client.WebApi.ApiPostAsync<NewImageImport, ServerImageWithStateType>(
                    ApiUris.ImportCustomerImage(client.Account.OrganizationId),
                    new NewImageImport
                        {
                            name = customerImageName,
                            location = networkLocation,
                            ovfPackage = ovfPackageName,
                            description = description
                        });
        }
 public static async Task <Status> ReleaseNetworkPublicIpAddressBlock(
     this IComputeApiClient client,
     string networkId,
     string ipBlockId)
 {
     return(await client.NetworkingLegacy.Network.ReleaseNetworkPublicIpAddressBlock(networkId, ipBlockId));
 }
 public static async Task <Status> InitiateBackup(
     this IComputeApiClient client,
     string serverId,
     BackupClientDetailsType backupClient)
 {
     return(await client.Backup.InitiateBackup(serverId, backupClient));
 }
		/// <summary>
		/// Initialises a new instance of the <see cref="ComputeServiceConnection"/> class.
		///     Create a new compute service connection.
		/// </summary>
		/// <param name="apiClient">
		/// The CaaS API client represented by the connection.
		/// </param>
		public ComputeServiceConnection(IComputeApiClient apiClient)
		{
			if (apiClient == null)
				throw new ArgumentNullException("apiClient");

			ApiClient = apiClient;
		}
 public static async Task <ServersResponseCollection> GetMcp2DeployedServers(
     this IComputeApiClient client,
     ServerListOptions options     = null,
     PageableRequest pagingOptions = null)
 {
     return(await client.ServerManagement.Server.GetMcp2DeployedServers(options, pagingOptions));
 }
예제 #7
0
 public static async Task <ImageExportType> ExportCustomerImage(
     this IComputeApiClient client,
     ImagesWithDiskSpeedImage image,
     string ovfPrefix)
 {
     return(await client.ImportExportCustomerImage.ExportCustomerImage(image, ovfPrefix));
 }
        /// <summary>
        /// Modifies the backup client on the specified server.
        /// </summary>
        /// <param name="client">The <see cref="ComputeApiClient"/> object</param>
        /// <param name="serverId">The server id</param>
        /// <param name="backupClient">The backup client to modify</param>
        /// <param name="storagePolicy">The storage policy to modify</param>
        /// <param name="schedulePolicy">The schedule policy to modify</param>
        /// <param name="alertingType">The alerting type to modify</param>
        /// <returns>The status of the request</returns>
        public static async Task <Status> ModifyBackupClientAsync(
            this IComputeApiClient client,
            string serverId,
            BackupClientDetailsType backupClient,
            BackupStoragePolicy storagePolicy,
            BackupSchedulePolicy schedulePolicy,
            AlertingType alertingType)
        {
            if (backupClient == null)
            {
                throw new ArgumentNullException("backupClient", "argument cannot be null!");
            }
            if (storagePolicy == null)
            {
                throw new ArgumentNullException("storagePolicy", "argument cannot be null!");
            }
            if (schedulePolicy == null)
            {
                throw new ArgumentNullException("schedulePolicy", "argument cannot be null!");
            }

            return
                (await
                 client.WebApi.ApiPostAsync <ModifyBackupClient, Status>(
                     ApiUris.ModifyBackupClient(client.Account.OrganizationId, serverId, backupClient.id),
                     new ModifyBackupClient
            {
                schedulePolicyName = schedulePolicy.name,
                storagePolicyName = storagePolicy.name,
                alerting = alertingType
            }));
        }
 public static async Task <AclRuleType> CreateAclRule(
     this IComputeApiClient client,
     string networkId,
     string aclRuleName,
     int position,
     AclActionType action,
     AclProtocolType protocol,
     PortRangeTypeType portRangeType,
     IPAddress sourceIpAddress = null,
     IPAddress sourceNetmask   = null,
     IPAddress destIpAddress   = null,
     IPAddress destNetmask     = null,
     int port1       = 0,
     int port2       = 0,
     AclType aclType = AclType.OUTSIDE_ACL)
 {
     return
         (await
          client.NetworkingLegacy.Network.CreateAclRule(
              networkId,
              aclRuleName,
              position,
              action,
              protocol,
              portRangeType,
              sourceIpAddress,
              sourceNetmask,
              destIpAddress,
              destNetmask,
              port1,
              port2,
              aclType));
 }
예제 #10
0
 public static async Task <Status> RemoveRealServer(
     this IComputeApiClient client,
     string networkId,
     string realServerId)
 {
     return(await client.NetworkingLegacy.NetworkVip.RemoveRealServer(networkId, realServerId));
 }
예제 #11
0
 public static async Task <Status> RemovePersistenceProfile(
     this IComputeApiClient client,
     string networkId,
     string persistenceProfileId)
 {
     return(await client.NetworkingLegacy.NetworkVip.RemovePersistenceProfile(networkId, persistenceProfileId));
 }
예제 #12
0
 public static async Task <Status> CreateVip(
     this IComputeApiClient client,
     string networkId,
     string name,
     int port,
     VipProtocol protocol,
     VipTargetType targetType,
     string targetId,
     bool replyToIcmp,
     bool inService,
     string ipAddress = "")
 {
     return
         (await
          client.NetworkingLegacy.NetworkVip.CreateVip(
              networkId,
              name,
              port,
              protocol,
              targetType,
              targetId,
              replyToIcmp,
              inService,
              ipAddress));
 }
예제 #13
0
 public static async Task <Status> RemoveServerFarm(
     this IComputeApiClient client,
     string networkId,
     string serverFarmId)
 {
     return(await client.NetworkingLegacy.NetworkVip.RemoveServerFarm(networkId, serverFarmId));
 }
 public static async Task <Status> CancelBackupJob(
     this IComputeApiClient client,
     string serverId,
     BackupClientDetailsType backupClient)
 {
     return(await client.Backup.CancelBackupJob(serverId, backupClient));
 }
예제 #15
0
 public static async Task <ServerFarmDetails> GetServerFarmDetails(
     this IComputeApiClient client,
     string networkId,
     string serverFarmId)
 {
     return(await client.NetworkingLegacy.NetworkVip.GetServerFarmDetails(networkId, serverFarmId));
 }
예제 #16
0
 public static async Task <Status> CreateProbe(this IComputeApiClient client,
                                               string networkId,
                                               string name,
                                               ProbeType type,
                                               int port,
                                               int probeIntervalSeconds,
                                               int errorCountBeforeServerFail,
                                               int successCountBeforeServerEnable,
                                               int failedProbeIntervalSeconds,
                                               int maxReplyWaitSeconds,
                                               int statusCodeLowerBound,
                                               int statusCodeUpperBound,
                                               ProbeRequestMethod requestMethod,
                                               string requestUrl,
                                               string matchContent)
 {
     return
         (await
          client.NetworkingLegacy.NetworkVip.CreateProbe(
              networkId,
              name,
              type,
              port,
              probeIntervalSeconds,
              errorCountBeforeServerFail,
              successCountBeforeServerEnable,
              failedProbeIntervalSeconds,
              maxReplyWaitSeconds,
              statusCodeLowerBound,
              statusCodeUpperBound,
              requestMethod,
              requestUrl,
              matchContent));
 }
 public static async Task <Status> SetServertoVipNetworkPublicIpAddressBlock(
     this IComputeApiClient client,
     string networkId,
     string ipBlockId,
     bool enable)
 {
     return(await client.NetworkingLegacy.Network.SetServertoVipNetworkPublicIpAddressBlock(networkId, ipBlockId, enable));
 }
예제 #18
0
 public static async Task <Status> AddProbeToServerFarm(
     this IComputeApiClient client,
     string networkId,
     string serverFarmId,
     string probeId)
 {
     return(await client.NetworkingLegacy.NetworkVip.AddProbeToServerFarm(networkId, serverFarmId, probeId));
 }
예제 #19
0
 public static async Task <Status> ModifyServerFarm(
     this IComputeApiClient client,
     string networkId,
     string serverFarmId,
     ServerFarmPredictorType predictor)
 {
     return(await client.NetworkingLegacy.NetworkVip.ModifyServerFarm(networkId, serverFarmId, predictor));
 }
예제 #20
0
 public static async Task <Status> ModifyRealServer(
     this IComputeApiClient client,
     string networkId,
     string realServerId,
     bool inService)
 {
     return(await client.NetworkingLegacy.NetworkVip.ModifyRealServer(networkId, realServerId, inService));
 }
예제 #21
0
 /// <summary>
 /// Gets the OVF Packages that have been uploaded to the FTPS account for the supplied organization ID.
 /// An empty list will be returned if no OVF Packages have been uploaded by the organization.
 /// </summary>
 /// <param name="client">The <see cref="ComputeApiClient"/> object</param>
 /// <returns>The OVF Packages</returns>
 public static async Task<OvfPackages> GetOvfPackagesAsync(
     this IComputeApiClient client)
 {
     return
         await
         client.WebApi.ApiGetAsync<OvfPackages>(
             ApiUris.GetOvfPackages(client.Account.OrganizationId));
 }
 public static async Task <NatRuleType> CreateNatRule(
     this IComputeApiClient client,
     string networkId,
     string natRuleName,
     IPAddress sourceIp)
 {
     return(await client.NetworkingLegacy.Network.CreateNatRule(networkId, natRuleName, sourceIp));
 }
 public static async Task <Status> CreateNetwork(
     this IComputeApiClient client,
     string networkName,
     string dataCentreLocation,
     string description = null)
 {
     return(await client.NetworkingLegacy.Network.CreateNetwork(networkName, dataCentreLocation, description));
 }
		/// <summary>
		/// Dispose of resources being used by the CaaS API connection.
		/// </summary>
		public void Dispose()
		{
			if (ApiClient != null)
			{
				ApiClient.Dispose();
				ApiClient = null;
			}
		}
 public static async Task <Status> ModifyNetwork(
     this IComputeApiClient client,
     string networkId,
     string name,
     string description)
 {
     return(await client.NetworkingLegacy.Network.ModifyNetwork(networkId, name, description));
 }
예제 #26
0
 /// <summary>
 ///		Dispose of resources being used by the CaaS API connection.
 /// </summary>
 public void Dispose()
 {
     if (ApiClient != null)
     {
         ApiClient.Dispose();
         ApiClient = null;
     }
 }
        /// <summary>
        /// Disable the backup service from the server.
        /// <remarks>Note the server MUST not have any clients</remarks>
        /// </summary>
        /// <param name="client">The <see cref="ComputeApiClient"/> object</param>
        /// <param name="serverId">The server id</param>
        /// <returns>The status of the request</returns>
        public static async Task <Status> DisableBackupAsync(this IComputeApiClient client, string serverId)
        {
            if (string.IsNullOrWhiteSpace(serverId))
            {
                throw new ArgumentException("argument cannot be null, empty or composed of whitespaces only!", "serverId");
            }

            return(await client.WebApi.ApiGetAsync <Status>(ApiUris.DisableBackup(client.Account.OrganizationId, serverId)));
        }
예제 #28
0
 public static async Task <Status> CreateRealServer(
     this IComputeApiClient client,
     string networkId,
     string name,
     string serverId,
     bool inService)
 {
     return(await client.NetworkingLegacy.NetworkVip.CreateRealServer(networkId, name, serverId, inService));
 }
예제 #29
0
 public static async Task <Status> ModifyVip(
     this IComputeApiClient client,
     string networkId,
     string vipId,
     bool replyToIcmp,
     bool inService)
 {
     return(await client.NetworkingLegacy.NetworkVip.ModifyVip(networkId, vipId, replyToIcmp, inService));
 }
예제 #30
0
        /// <summary>
        /// This function identifies the Customer Image Imports that are in progress for the supplied organization ID.
        /// </summary>
        /// <param name="client">The <see cref="ComputeApiClient"/> object</param>
        /// <returns>The customer image imports currently in progress</returns>
		public static async Task<IReadOnlyCollection<ServerImageWithStateType>> GetCustomerImagesImportsAsync(
            this IComputeApiClient client)
        {
            var imports =
                await
                client.WebApi.ApiGetAsync<ServerImagesWithState>(
                    ApiUris.GetCustomerImageImports(client.Account.OrganizationId));
            return imports.serverImageWithState;
        }
예제 #31
0
        /// <summary>
        ///		Create a new compute service connection.
        /// </summary>
        /// <param name="apiClient">
        ///		The CaaS API client represented by the connection.
        /// </param>
        public ComputeServiceConnection(IComputeApiClient apiClient)
        {
            if (apiClient == null)
            {
                throw new ArgumentNullException("apiClient");
            }

            ApiClient = apiClient;
        }
 public static async Task <Status> ModifyBackupClient(
     this IComputeApiClient client,
     string serverId,
     BackupClientDetailsType backupClient,
     BackupStoragePolicy storagePolicy,
     BackupSchedulePolicy schedulePolicy,
     AlertingType alertingType)
 {
     return(await client.Backup.ModifyBackupClient(serverId, backupClient, storagePolicy, schedulePolicy, alertingType));
 }
		/// <summary>
		/// Initialises a new instance of the <see cref="NetworkSubnetController"/> class. 
		/// Initializes a new instance of the <see cref="ServerController"/> class.
		/// </summary>
		/// <param name="apiClient">
		/// The API client.
		/// </param>
		public NetworkSubnetController(Func<Uri, IComputeApiClient> apiClient)
        {
            _computeClient = apiClient(ConfigurationHelpers.GetApiUri());
        }
		/// <summary>
		/// Initialises a new instance of the <see cref="CaaSAuthenticationMiddleWare"/> class. 
		/// Initializes a new instance of the CaaSAuthenticationMiddleWare class. 
		/// </summary>
		/// <remarks>
		/// 	Anthony, 4/13/2015. 
		/// </remarks>
		/// <param name="next">
		/// 			The next. 
		/// </param>
		/// <param name="apiClient">
		/// 	The API client. 
		/// </param>
		public CaaSAuthenticationMiddleWare(OwinMiddleware next, Func<Uri, IComputeApiClient> apiClient)
			: base(next)
		{
			_apiClient = apiClient(ConfigurationHelpers.GetApiUri());
		}
		/// <summary>
		/// Initialises a new instance of the <see cref="ServerActionController"/> class. 
		/// 	Initializes a new instance of the <see cref="ServerController"/> class. 
		/// </summary>
		/// <remarks>
		/// 	Anthony, 4/13/2015. 
		/// </remarks>
		/// <param name="apiClient">
		/// 	The API client. 
		/// </param>
		public ServerActionController(Func<Uri, IComputeApiClient> apiClient)
        {
            _computeClient = apiClient(ConfigurationHelpers.GetApiUri());
        }