C# Class Google.PowerShell.Common.ActiveUserConfig

Class that represents the current active gcloud config. The active gcloud config is the config that is listed when running "gcloud config list". This active config can be changed if the user run commands like "gcloud config set account" or if certain CLOUDSDK_* environment variables are changed.
Mostra file Open project: GoogleCloudPlatform/google-cloud-powershell Class Usage Examples

Public Methods

Method Description
GetActiveUserConfig ( CancellationToken cancellationToken = default(CancellationToken), bool refreshConfig = false ) : Task

Gets the current active config. This value will be cached for the next call. If refreshConfig is true, however, we will refresh the cache. Everytime the cache is refreshed, a new access token will be generated for the current active config (even if there is no change in the current active config).

GetActiveUserToken ( CancellationToken cancellationToken, bool refresh = false ) : Task

Gets the token that belongs to the current active config. This value will be normally be cached as the current active user config is normally cached. If refresh is true or if the current token already expired, however, we will refresh the active user config to get a new token.

GetPropertyValue ( string key ) : Task

Returns a property of the configuration based on the given key.

Private Methods

Method Description
ActiveUserConfig ( string activeConfigJson ) : Newtonsoft.Json.Linq

Creates an active user config by parsing a JSON.

GetCurrentConfigurationFingerPrint ( ) : string

Returns fingerprint of the current configuration. The result will only be changed if there is either a change in the sentinel file (which is touched by gcloud any time the configuration is changed) or if there is a change in any CLOUDSDK_* environment variables.

Method Details

GetActiveUserConfig() public static method

Gets the current active config. This value will be cached for the next call. If refreshConfig is true, however, we will refresh the cache. Everytime the cache is refreshed, a new access token will be generated for the current active config (even if there is no change in the current active config).
public static GetActiveUserConfig ( CancellationToken cancellationToken = default(CancellationToken), bool refreshConfig = false ) : Task
cancellationToken System.Threading.CancellationToken
refreshConfig bool
return Task

GetActiveUserToken() public static method

Gets the token that belongs to the current active config. This value will be normally be cached as the current active user config is normally cached. If refresh is true or if the current token already expired, however, we will refresh the active user config to get a new token.
public static GetActiveUserToken ( CancellationToken cancellationToken, bool refresh = false ) : Task
cancellationToken System.Threading.CancellationToken
refresh bool
return Task

GetPropertyValue() public static method

Returns a property of the configuration based on the given key.
public static GetPropertyValue ( string key ) : Task
key string
return Task