C# Class RightScale.netClient.Utility

Utility class provides a place to throw a bunch of useful repetitive tasks
Mostra file Open project: rs-services/RightScaleNetAPI

Public Methods

Method Description
BuildFilterString ( List filterSet ) : string

Static method takes a collection of name/value pairs and creates a properly formatted string representing a set of filters for a given RightScale API call

BuildGetQueryString ( string>.List qsData ) : string

Helper method builds a query string from a list of keyvaluepair(string,string) object

BuildInputString ( List inputSet ) : string

Static method takes a collection of name/value pairs and creates a properly formatted string representing a set of inputs for a server or deployment within the RightScale system

CheckFilterInput ( string inputName, List validFilters, List actualFilters ) : bool

Method checks to make sure that the filters defined are contained within the collection of valid filters defined

CheckStringHasValue ( string requiredString ) : bool

Method checks to ensure that the string passed in has a value

CheckStringInput ( string inputName, List validViews, string actualValue ) : bool

Method checks a string to ensure it's one of a specified set of values

CheckStringIsNumeric ( string numericString ) : bool

Method checks to ensure that the contents of the string are numeric

CheckStringRegex ( string inputName, string regularExpression, string actualValue ) : bool

Method checks a string against a regular expression to match it conforms to API Standards

FilterListToParameterSet ( List filterList ) : string>>.List

Private method to translate filter lists to convert to a parameter set

FormatInputCollection ( List inputSet ) : string>>.List

Helper method reformats inputs from simple key/value collection to proper API formatting. Also prepends text: in front of all inputs if it or another standard prefix is not in place

InstanceHref ( string cloudID, string objectID ) : string

Helper method returns properly formatted instance_href

StringArrayToParameterSet ( string paramStrings, string paramName ) : string>>.List

Private method to translate string arrays to convert to a parameter set

VolumeHref ( string cloudID, string objectID ) : string

Helper method returns properly formatted volume_href

accountGroupHrefByID ( string accountGroupID ) : string

Helper method returns a properly formatted account group href for a specific account group

accountHref ( string objectID ) : string

Helper method returns properly formatted account_href

addParameter ( int inputParameter, string parameterName, string>.List parameterSet ) : void

Helper method performs null/empty check on inputParameter and adds to parameterSet

addParameter ( string inputParameter, string parameterName, string>.List parameterSet ) : void

Helper method performs null/empty check on inputParameter and adds to parameterSet

cloudHref ( string objectID ) : string

Helper method returns properly formatted cloud_href

convertToKVP ( Hashtable htToConvert ) : List

Method converts hashtable to list of keyvaluepairs for use in RSAPI calls

datacenterHref ( string cloudID, string objectID ) : string

Helper method returns properly formatted datacenter_href

deploymentHref ( string objectID ) : string

Helper method returns properly formatted deployment_href

identityProviderHref ( string objectID ) : string

Helper method returns properly formatted identity_provider_href

imageHref ( string cloudID, string objectID ) : string

Helper method returns properly formatted image_href

instanceTypeHref ( string cloudID, string objectID ) : string

Helper method returns properly formatted instance_type_href

kernelImageHref ( string cloudID, string objectID ) : string

Helper method returns properly formatted kernel_image_href

multiCloudImageHref ( string objectID ) : string

Helper method returns properly formatted multi_cloud_image_href

ramdiskImageHref ( string cloudID, string objectID ) : string

Helper method returns properly formatted ramdisk_image_href

rightScriptHref ( string objectID ) : string

Helper method returns properly formatted right_script_href

securityGroupHref ( string cloudID, string objectID ) : string

Helper method returns properly formatted security_group_href

serverTemplateHref ( string objectID ) : string

Helper method returns properly formatted server_template_href

sshKeyHref ( string cloudID, string objectID ) : string

Helper method returns properly formatted ssh_key_href

subnetHref ( string cloudID, string objectID ) : string

Helper method returns properly formatted subnet_href

volumeSnapshotHref ( string cloudID, string volumeid, string objectid ) : string

Helper method returns a properly formatted volume snapshot href

volumeTypeHref ( string cloudID ) : string

Helper method returns a properly formatted volume type href

volumeTypeHrefByID ( string cloudID, string volumeTypeID ) : string

Helper method returns a properly formatted volume type href for a specific volume type

Method Details

BuildFilterString() public static method

Static method takes a collection of name/value pairs and creates a properly formatted string representing a set of filters for a given RightScale API call
public static BuildFilterString ( List filterSet ) : string
filterSet List list of key value pairs to be built into a filter string when passing filters to the RightScale API
return string

BuildGetQueryString() public static method

Helper method builds a query string from a list of keyvaluepair(string,string) object
public static BuildGetQueryString ( string>.List qsData ) : string
qsData string>.List list of keyvaluepairs to turn into a query string
return string

BuildInputString() public static method

Static method takes a collection of name/value pairs and creates a properly formatted string representing a set of inputs for a server or deployment within the RightScale system
public static BuildInputString ( List inputSet ) : string
inputSet List list of key value pairs to be built into an input string when passing inputs to the RightScale API
return string

CheckFilterInput() public static method

Method checks to make sure that the filters defined are contained within the collection of valid filters defined
public static CheckFilterInput ( string inputName, List validFilters, List actualFilters ) : bool
inputName string friendly input name used to identify input when throwing exceptions
validFilters List List of strings identifying all valid filter names
actualFilters List collection of filters to test
return bool

CheckStringHasValue() public static method

Method checks to ensure that the string passed in has a value
public static CheckStringHasValue ( string requiredString ) : bool
requiredString string string to check
return bool

CheckStringInput() public static method

Method checks a string to ensure it's one of a specified set of values
public static CheckStringInput ( string inputName, List validViews, string actualValue ) : bool
inputName string name of the input to be identified when throwing errors
validViews List list of strings representing valid values
actualValue string string to test - must be one of those specified in
return bool

CheckStringIsNumeric() public static method

Method checks to ensure that the contents of the string are numeric
public static CheckStringIsNumeric ( string numericString ) : bool
numericString string String to check to make sure it only contains numbers
return bool

CheckStringRegex() public static method

Method checks a string against a regular expression to match it conforms to API Standards
public static CheckStringRegex ( string inputName, string regularExpression, string actualValue ) : bool
inputName string name of the input to be identified when throwing errors
regularExpression string regular expression to match string against
actualValue string string to test - must match the regularExpression specified
return bool

FilterListToParameterSet() public static method

Private method to translate filter lists to convert to a parameter set
public static FilterListToParameterSet ( List filterList ) : string>>.List
filterList List list of filters to push to a parameter set
return string>>.List

FormatInputCollection() public static method

Helper method reformats inputs from simple key/value collection to proper API formatting. Also prepends text: in front of all inputs if it or another standard prefix is not in place
public static FormatInputCollection ( List inputSet ) : string>>.List
inputSet List Raw key/value set of inputs
return string>>.List

InstanceHref() public static method

Helper method returns properly formatted instance_href
public static InstanceHref ( string cloudID, string objectID ) : string
cloudID string Cloud ID where Instance can be found
objectID string Instance ID
return string

StringArrayToParameterSet() public static method

Private method to translate string arrays to convert to a parameter set
public static StringArrayToParameterSet ( string paramStrings, string paramName ) : string>>.List
paramStrings string
paramName string
return string>>.List

VolumeHref() public static method

Helper method returns properly formatted volume_href
public static VolumeHref ( string cloudID, string objectID ) : string
cloudID string ID of Cloud where Volume can be found
objectID string ID of Volume
return string

accountGroupHrefByID() public static method

Helper method returns a properly formatted account group href for a specific account group
public static accountGroupHrefByID ( string accountGroupID ) : string
accountGroupID string ID of account group
return string

accountHref() public static method

Helper method returns properly formatted account_href
public static accountHref ( string objectID ) : string
objectID string AccountID
return string

addParameter() public static method

Helper method performs null/empty check on inputParameter and adds to parameterSet
public static addParameter ( int inputParameter, string parameterName, string>.List parameterSet ) : void
inputParameter int
parameterName string
parameterSet string>.List
return void

addParameter() public static method

Helper method performs null/empty check on inputParameter and adds to parameterSet
public static addParameter ( string inputParameter, string parameterName, string>.List parameterSet ) : void
inputParameter string
parameterName string
parameterSet string>.List
return void

cloudHref() public static method

Helper method returns properly formatted cloud_href
public static cloudHref ( string objectID ) : string
objectID string CloudID
return string

convertToKVP() public static method

Method converts hashtable to list of keyvaluepairs for use in RSAPI calls
public static convertToKVP ( Hashtable htToConvert ) : List
htToConvert System.Collections.Hashtable Hashtable to convert
return List

datacenterHref() public static method

Helper method returns properly formatted datacenter_href
public static datacenterHref ( string cloudID, string objectID ) : string
cloudID string Cloud ID where datacenter can be found
objectID string Datacenter ID
return string

deploymentHref() public static method

Helper method returns properly formatted deployment_href
public static deploymentHref ( string objectID ) : string
objectID string Deployment ID
return string

identityProviderHref() public static method

Helper method returns properly formatted identity_provider_href
public static identityProviderHref ( string objectID ) : string
objectID string ID of the Identity Provider being referenced
return string

imageHref() public static method

Helper method returns properly formatted image_href
public static imageHref ( string cloudID, string objectID ) : string
cloudID string Cloud ID were image can be found
objectID string Image ID
return string

instanceTypeHref() public static method

Helper method returns properly formatted instance_type_href
public static instanceTypeHref ( string cloudID, string objectID ) : string
cloudID string Cloud ID where instanceType can be found
objectID string InstanceType ID
return string

kernelImageHref() public static method

Helper method returns properly formatted kernel_image_href
public static kernelImageHref ( string cloudID, string objectID ) : string
cloudID string Cloud ID where Kernel Image can be found
objectID string KernelImage ID
return string

multiCloudImageHref() public static method

Helper method returns properly formatted multi_cloud_image_href
public static multiCloudImageHref ( string objectID ) : string
objectID string MultiCloudImage ID
return string

ramdiskImageHref() public static method

Helper method returns properly formatted ramdisk_image_href
public static ramdiskImageHref ( string cloudID, string objectID ) : string
cloudID string Cloud ID where ramdisk image can be found
objectID string RamdiskImage ID
return string

rightScriptHref() public static method

Helper method returns properly formatted right_script_href
public static rightScriptHref ( string objectID ) : string
objectID string RightScript ID
return string

securityGroupHref() public static method

Helper method returns properly formatted security_group_href
public static securityGroupHref ( string cloudID, string objectID ) : string
cloudID string Cloud ID where Security Group can be found
objectID string Security Group ID
return string

serverTemplateHref() public static method

Helper method returns properly formatted server_template_href
public static serverTemplateHref ( string objectID ) : string
objectID string ServerTempalte ID
return string

sshKeyHref() public static method

Helper method returns properly formatted ssh_key_href
public static sshKeyHref ( string cloudID, string objectID ) : string
cloudID string Cloud ID where SSH Key can be found
objectID string SshKey ID
return string

subnetHref() public static method

Helper method returns properly formatted subnet_href
public static subnetHref ( string cloudID, string objectID ) : string
cloudID string Cloud ID where subnet can be found
objectID string Subnet ID
return string

volumeSnapshotHref() public static method

Helper method returns a properly formatted volume snapshot href
public static volumeSnapshotHref ( string cloudID, string volumeid, string objectid ) : string
cloudID string CloudID
volumeid string VolumeID
objectid string Snapshot ID
return string

volumeTypeHref() public static method

Helper method returns a properly formatted volume type href
public static volumeTypeHref ( string cloudID ) : string
cloudID string ID of Cloud
return string

volumeTypeHrefByID() public static method

Helper method returns a properly formatted volume type href for a specific volume type
public static volumeTypeHrefByID ( string cloudID, string volumeTypeID ) : string
cloudID string ID of Cloud
volumeTypeID string VolumeType ID
return string