C# Class RightScale.netClient.Core.APIClientBase

Singleton instance API Client manages HTTP connections, authentication caching and all REST calls to the RightScale API
Inheritance: IDisposable
Exibir arquivo Open project: rs-services/RightScaleNetAPI

Public Methods

Method Description
Authenticate ( ) : bool

Default and base authentication call which pulls authentication data from the app.config or web.config for the specified keys. OAuth2 token is prioritized in front of username/password/accountid if specified.

Authenticate ( string oAuthRefreshToken ) : bool

Authentication method for http client that uses oAuth2 process for authenticating to RightScale API

Authenticate ( string oAuthRefreshToken, string accountID ) : bool

Authentication method for http client that uses oAuth2 process for authenticating to RightScale API

Authenticate ( string userName, string password, string accountID ) : bool

Legacy authentication method using username, password and accountID for authenticating to RightScale API

Authenticate ( string userName, string password, string accountID, string baseUrl ) : bool

Legacy authentication method using username, password and accountID for authenticating to RightScale API

Authenticate_Instance ( string api_instance_token ) : bool

Authentication process for instance-based RSAPI authentication

Delete ( string apiHref ) : bool

API Method to Delete a record within the RightScale system

Dispose ( ) : void

Dispose handles dispose of custom objects before disposing of the remainder of the object

InitWebClient ( ) : void

internal method to init web client

InitWebClient ( string shardBaseUrl ) : void

Public method to initialize the API caller specifically for an account that's on a distinct RightScale shard

setAPIBaseAddress ( string apiBaseUrl ) : void

Public method resets the API base address (shard) If it is changing, this will reinitialize the web client and force authentication again

Protected Methods

Method Description
Dispose ( bool disposing ) : void

IDisposable implementation guts

setAPIVersion ( string apiVer ) : void

Protected helper method for setting api version of the client

Private Methods

Method Description
CheckAuthenticationStatus ( ) : bool

Private method used to validate authentication status of singletion instance of API class

Delete ( string apiHref, string queryStringValue ) : bool

API Method to Delete a record within the RightScale system

Get ( string apiHref ) : string

Public GET process to hit RightScale API

Get ( string apiHref, string queryStringValue ) : string

GET process to hit RightScale API

InitAuthTimer ( ) : void

Method manages centralized logic for initializing the proactive authentication timeout process

Post ( string apiHref, string>.List parameterset, string returnHeaderName ) : List

Override to Post method without an output string

Post ( string postHref, string>.List postData, string returnHeaderName, string &contentOutput ) : List

Centralized method to handle post calls to RightScale API

Post ( string apiHref ) : bool

API method to perform a POST request to the RightScale API

Post ( string apiHref, string>.List postData ) : bool

API method to perform a POST request to the RightScale API

Post ( string apiHref, string headerName, string &outString ) : bool

API method to perform a POST request to the RightScale API

Put ( string putHref, string>.List putData ) : bool

PUT wrapper to make calls via HTTP to the RightScale API

SetOauthBearerToken ( string bearerToken ) : bool

Public method takes in oauth bearer token and authenticates the object if a bearer token is passed in. Ths process assumes that the bearer token is currently valid.

authTimer_Elapsed ( object sender, System.Timers.ElapsedEventArgs e ) : void

Tick method for AuthTimer resets authentication state of singleton api caller

getOauthHrefPath ( ) : string

Private helper method gets proper Oauth api href path

Method Details

Authenticate() public method

Default and base authentication call which pulls authentication data from the app.config or web.config for the specified keys. OAuth2 token is prioritized in front of username/password/accountid if specified.
public Authenticate ( ) : bool
return bool

Authenticate() public method

Authentication method for http client that uses oAuth2 process for authenticating to RightScale API
public Authenticate ( string oAuthRefreshToken ) : bool
oAuthRefreshToken string OAuth2 Token taken from RightScale Dashboard
return bool

Authenticate() public method

Authentication method for http client that uses oAuth2 process for authenticating to RightScale API
public Authenticate ( string oAuthRefreshToken, string accountID ) : bool
oAuthRefreshToken string OAuth2 Token taken from RightScale Dashboard
accountID string Account ID used for API 1.0 calls
return bool

Authenticate() public method

Legacy authentication method using username, password and accountID for authenticating to RightScale API
public Authenticate ( string userName, string password, string accountID ) : bool
userName string RightScale login user name
password string RightScale login password
accountID string RightScale Account ID to be programmatically accessed
return bool

Authenticate() public method

Legacy authentication method using username, password and accountID for authenticating to RightScale API
public Authenticate ( string userName, string password, string accountID, string baseUrl ) : bool
userName string RightScale login user name
password string RightScale login password
accountID string RightScale Account ID to be programmatically accessed
baseUrl string Distinct base URL for calling RightScale API
return bool

Authenticate_Instance() public method

Authentication process for instance-based RSAPI authentication
public Authenticate_Instance ( string api_instance_token ) : bool
api_instance_token string $env:RS_API_TOKEN value
return bool

Delete() public method

API Method to Delete a record within the RightScale system
public Delete ( string apiHref ) : bool
apiHref string API Href fragment corresponding to the API root
return bool

Dispose() public method

Dispose handles dispose of custom objects before disposing of the remainder of the object
public Dispose ( ) : void
return void

Dispose() protected method

IDisposable implementation guts
protected Dispose ( bool disposing ) : void
disposing bool determines that call is to dispose of resources
return void

InitWebClient() public method

internal method to init web client
public InitWebClient ( ) : void
return void

InitWebClient() public method

Public method to initialize the API caller specifically for an account that's on a distinct RightScale shard
public InitWebClient ( string shardBaseUrl ) : void
shardBaseUrl string base url of the shard the account is associated with
return void

setAPIBaseAddress() public method

Public method resets the API base address (shard) If it is changing, this will reinitialize the web client and force authentication again
public setAPIBaseAddress ( string apiBaseUrl ) : void
apiBaseUrl string Base URL to use for accessing RightScale API
return void

setAPIVersion() protected method

Protected helper method for setting api version of the client
protected setAPIVersion ( string apiVer ) : void
apiVer string String representing the API version to be used
return void