C# Class Skytap.Cloud.SkytapApi

Wrapper class for calling the various Skytap REST APIs.
Mostra file Open project: skytap/Skytap-TFS-Automation-Pack

Public Methods

Method Description
AttachVpnConnection ( Credentials credentials, string configUrl, string networkId, string vpnId ) : void

Attach an existing VPN to a configuration's network.

CheckConfigurationForDesiredState ( Credentials credentials, string testTargetConfigUrl, List desiredStates ) : void

Determine if a configuration is in an expected state, and throw an exception if it is not.

CheckConfigurationForDesiredState ( Credentials credentials, string testTargetConfigUrl, string desiredState ) : void

Determine if a configuration is in an expected state, and throw an exception if it is not.

ConnectVpn ( Credentials credentials, string configUrl, string networkId, string vpnId ) : void

After attaching, connect the VPN to the specified configuration and network.

CreateConfiguration ( Credentials credentials, string templateId, string configName = null ) : SkytapConfiguration

Create a new Skytap configuration based on the specified template and provide an optional name.

CreateIcnrConnection ( Credentials credentials, string sourceNetId, string targetNetId ) : string

Creates an ICNR connection between a source and target network.

DeleteIcnrConnection ( Credentials credentials, string icnrId ) : void

Deletes a specified ICNR connection.

DetachVpn ( Credentials credentials, string configUrl, string networkId, string vpnId ) : void

Detach a VPN connection. A VPN connection should be disconnected prior to detaching.

DisconnectVpn ( Credentials credentials, string configUrl, string networkId, string vpnId ) : void

Disconnect a VPN connection. This should be done prior to detaching a VPN.

GetConfiguration ( Credentials credentials, string configurationUrl, bool doRetries = true ) : string

Retrieves the XML that describes the specified Skytap configuration.

GetConfigurationState ( Credentials credentials, string configurationUrl ) : string

Gets the current state of the configuration, such as Running, Suspended, or Stopped.

This is a helper method that extracts the runstate out of the XML response, but you could just as easily use GetConfiguration to get the full response XML containing all properties.

GetNetworkIdInConfiguration ( Credentials credentials, string configId ) : string

Get the network ID associated with a Skytap configuration, which is useful for other companion calls that operate on a network.

GetVpns ( Credentials credentials ) : string

Get a global list of VPNs accessible by the user

SaveAsSkytapTemplate ( Credentials credentials, string testTargetConfigUrl ) : void

Save the specified configuration as a new Skytap template.

SetConfigurationState ( Credentials credentials, string configUrl, string state ) : void

Change the state of a configuration to a specified value, such as Suspended, Stopped, or Running.

ShutDownConfiguration ( Credentials credentials, string configUrlToDelete ) : void

Deletes a Skytap configuration, which is useful when a configuration was created for temporary use.

UpdateConfigurationName ( Credentials credentials, string configurationUrl, string newName ) : void

Change the name of a Skytap configuration.

Private Methods

Method Description
CreateSkytapWebRequest ( Credentials credentials, string url ) : HttpWebRequest
SendSkytapHttpRequest ( HttpWebRequest httpRequest ) : string

Method Details

AttachVpnConnection() public static method

Attach an existing VPN to a configuration's network.
public static AttachVpnConnection ( Credentials credentials, string configUrl, string networkId, string vpnId ) : void
credentials Skytap.Cloud.Utilities.Credentials Username and password for the user making the request.
configUrl string URL to the Skytap configuration that is associated with the VPN.
networkId string ID of the network to attach the VPN to.
vpnId string VPN ID to attach.
return void

CheckConfigurationForDesiredState() public static method

Determine if a configuration is in an expected state, and throw an exception if it is not.
public static CheckConfigurationForDesiredState ( Credentials credentials, string testTargetConfigUrl, List desiredStates ) : void
credentials Skytap.Cloud.Utilities.Credentials Username and password for the user making the request.
testTargetConfigUrl string Configuration to query for the desired state.
desiredStates List A list of states that are desired, such as a combination of /// Stopped, Suspended, or Running.
return void

CheckConfigurationForDesiredState() public static method

Determine if a configuration is in an expected state, and throw an exception if it is not.
public static CheckConfigurationForDesiredState ( Credentials credentials, string testTargetConfigUrl, string desiredState ) : void
credentials Skytap.Cloud.Utilities.Credentials Username and password for the user making the request.
testTargetConfigUrl string Configuration to query for the desired state.
desiredState string The desired state of the configuration, such as Stopped, Suspended, or Running.
return void

ConnectVpn() public static method

After attaching, connect the VPN to the specified configuration and network.
public static ConnectVpn ( Credentials credentials, string configUrl, string networkId, string vpnId ) : void
credentials Credentials Username and password for the user making the request.
configUrl string URL to the Skytap configuration that is associated with the VPN.
networkId string ID of the network to attach the VPN to.
vpnId string VPN ID to attach.
return void

CreateConfiguration() public static method

Create a new Skytap configuration based on the specified template and provide an optional name.
public static CreateConfiguration ( Credentials credentials, string templateId, string configName = null ) : SkytapConfiguration
credentials Credentials Username and password for the user making the request.
templateId string ID of the template to base the new configuration on.
configName string Optional name of the new configuration.
return SkytapConfiguration

CreateIcnrConnection() public static method

Creates an ICNR connection between a source and target network.
public static CreateIcnrConnection ( Credentials credentials, string sourceNetId, string targetNetId ) : string
credentials Credentials Username and password for the user making the request.
sourceNetId string Source Skytap network ID that the connection starts from.
targetNetId string Target Skytap network ID that the connection goes to.
return string

DeleteIcnrConnection() public static method

Deletes a specified ICNR connection.
public static DeleteIcnrConnection ( Credentials credentials, string icnrId ) : void
credentials Credentials Username and password for the user making the request.
icnrId string ID of the ICNR connection to remove.
return void

DetachVpn() public static method

Detach a VPN connection. A VPN connection should be disconnected prior to detaching.
public static DetachVpn ( Credentials credentials, string configUrl, string networkId, string vpnId ) : void
credentials Credentials Username and password for the user making the request.
configUrl string URL to the Skytap configuration that is associated with the VPN.
networkId string ID of the network containing the VPN to detach.
vpnId string VPN ID to detach.
return void

DisconnectVpn() public static method

Disconnect a VPN connection. This should be done prior to detaching a VPN.
public static DisconnectVpn ( Credentials credentials, string configUrl, string networkId, string vpnId ) : void
credentials Credentials Username and password for the user making the request.
configUrl string URL to the Skytap configuration that is associated with the VPN.
networkId string ID of the network containing the VPN to disconnect.
vpnId string VPN ID to disconnect.
return void

GetConfiguration() public static method

Retrieves the XML that describes the specified Skytap configuration.
public static GetConfiguration ( Credentials credentials, string configurationUrl, bool doRetries = true ) : string
credentials Credentials Username and password for the user making the request.
configurationUrl string URL of the configuration to query.
doRetries bool Whether or not to retry the call if it fails.
return string

GetConfigurationState() public static method

Gets the current state of the configuration, such as Running, Suspended, or Stopped.
This is a helper method that extracts the runstate out of the XML response, but you could just as easily use GetConfiguration to get the full response XML containing all properties.
public static GetConfigurationState ( Credentials credentials, string configurationUrl ) : string
credentials Credentials Username and password for the user making the request.
configurationUrl string URL of the configuration to query.
return string

GetNetworkIdInConfiguration() public static method

Get the network ID associated with a Skytap configuration, which is useful for other companion calls that operate on a network.
public static GetNetworkIdInConfiguration ( Credentials credentials, string configId ) : string
credentials Credentials Username and password for the user making the request.
configId string The configuration identifier to query.
return string

GetVpns() public static method

Get a global list of VPNs accessible by the user
public static GetVpns ( Credentials credentials ) : string
credentials Credentials Username and password for the user making the request.
return string

SaveAsSkytapTemplate() public static method

Save the specified configuration as a new Skytap template.
public static SaveAsSkytapTemplate ( Credentials credentials, string testTargetConfigUrl ) : void
credentials Credentials Username and password for the user making the request.
testTargetConfigUrl string URL of the configuration to turn into a template.
return void

SetConfigurationState() public static method

Change the state of a configuration to a specified value, such as Suspended, Stopped, or Running.
public static SetConfigurationState ( Credentials credentials, string configUrl, string state ) : void
credentials Credentials Username and password for the user making the request.
configUrl string Configuration whose state is to be modified.
state string State to transition to, such as Suspended, Stopped, or Running.
return void

ShutDownConfiguration() public static method

Deletes a Skytap configuration, which is useful when a configuration was created for temporary use.
public static ShutDownConfiguration ( Credentials credentials, string configUrlToDelete ) : void
credentials Credentials Username and password for the user making the request.
configUrlToDelete string URL of the configuration to be shutdown/deleted.
return void

UpdateConfigurationName() public static method

Change the name of a Skytap configuration.
public static UpdateConfigurationName ( Credentials credentials, string configurationUrl, string newName ) : void
credentials Credentials Username and password for the user making the request.
configurationUrl string The configuration identifier to change
newName string New name of the configuration (basic string; not sure of length restrictions)
return void