Options
All
  • Public
  • Public/Protected
  • All
Menu

Class AwsConnectionParams

Contains connection parameters to authenticate against Amazon Web Services (AWS) and connect to specific AWS resource.

The class is able to compose and parse AWS resource ARNs.

Configuration parameters

  • access_id: application access id
  • client_id: alternative to access_id
  • access_key: application secret key
  • client_key: alternative to access_key
  • secret_key: alternative to access_key

In addition to standard parameters CredentialParams may contain any number of custom parameters

see

AwsConnectionResolver

Example

let connection = AwsConnectionParams.fromTuples(
    "region", "us-east-1",
    "access_id", "XXXXXXXXXXXXXXX",
    "secret_key", "XXXXXXXXXXXXXXX",
    "service", "s3",
    "bucket", "mybucket"
);

let region = connection.getRegion();                     // Result: "us-east-1"
let accessId = connection.getAccessId();                 // Result: "XXXXXXXXXXXXXXX"
let secretKey = connection.getAccessKey();               // Result: "XXXXXXXXXXXXXXX"
let pin = connection.getAsNullableString("bucket");      // Result: "mybucket"

Hierarchy

  • ConfigParams
    • AwsConnectionParams

Index

Constructors

constructor

  • Creates an new instance of the connection parameters.

    Parameters

    • Default value values: any = null

      (optional) an object to be converted into key-value pairs to initialize this connection.

    Returns AwsConnectionParams

Methods

addSection

  • addSection(section: string, sectionParams: ConfigParams): void
  • Adds 'sectionParams' to this ConfigParams object under the section named 'section'.

    Parameters

    • section: string

      name of the section, under which 'sectionParams' is to be added. The keys of 'sectionParams' will be renamed to "(section).<key's name>", when added to this ConfigParams object.

    • sectionParams: ConfigParams

      ConfigParams that are to be added under the section named 'section'.

    Returns void

append

  • append(map: any): void
  • Parameters

    • map: any

      map of items to append to this StringValueMap.

    Returns void

clear

  • clear(): any
  • Removes all values from this StringValueMap.

    Returns any

clone

  • clone(): any
  • Returns any

    a clone of this object.

get

  • get(key: string): string
  • Parameters

    • key: string

      key of the item to retrieve from this StringValueMap.

    Returns string

    the item stored by the given key.

getAccessId

  • getAccessId(): string

getAccessKey

  • getAccessKey(): string

getAccount

  • getAccount(): string

getArn

  • getArn(): string
  • Gets the AWS resource ARN. If the ARN is not defined it automatically generates it from other properties.

    Returns string

    the AWS resource ARN.

getAsArray

  • getAsArray(key: string): AnyValueArray
  • see

    [[AnyValueArray]]

    see

    [[AnyValueArray.fromValue]]

    Parameters

    • key: string

      key of the item to retrieve.

    Returns AnyValueArray

    the item with the given key as an AnyValueArray object.

getAsArrayWithDefault

  • getAsArrayWithDefault(key: string, defaultValue: AnyValueArray): AnyValueArray
  • see

    [[AnyValueArray]]

    see

    getAsNullableArray

    Parameters

    • key: string

      key of the item to retrieve.

    • defaultValue: AnyValueArray

      value to use if the item with the given key cannot be converted into an AnyValueArray.

    Returns AnyValueArray

    the item with the given key as an AnyValueArray object or 'defaultValue', if conversion is not possible.

getAsBoolean

  • getAsBoolean(key: string): boolean
  • Parameters

    • key: string

      key of the item to retrieve.

    Returns boolean

    the item with the given key as a boolean (or false as the default).

getAsBooleanWithDefault

  • getAsBooleanWithDefault(key: string, defaultValue: boolean): boolean
  • see

    [[BooleanConverter.toBooleanWithDefault]]

    Parameters

    • key: string

      key of the item to retrieve.

    • defaultValue: boolean

      value to return if conversion is not possible.

    Returns boolean

    the item with the given key as a boolean or the defaultValue (if conversion is not possible).

getAsDateTime

  • getAsDateTime(key: string): Date
  • Parameters

    • key: string

      key of the item to retrieve.

    Returns Date

    the item with the given key as a Datetime (or null as the default).

getAsDateTimeWithDefault

  • getAsDateTimeWithDefault(key: string, defaultValue: Date): Date
  • see

    [[DateTimeConverter.toDateTimeWithDefault]]

    Parameters

    • key: string

      key of the item to retrieve.

    • defaultValue: Date

      value to return if conversion is not possible.

    Returns Date

    the item with the given key as a Datetime or the defaultValue (if conversion is not possible).

getAsDouble

  • getAsDouble(key: string): number
  • Parameters

    • key: string

      key of the item to retrieve.

    Returns number

    the item with the given key as a double (or 0 as the default).

getAsDoubleWithDefault

  • getAsDoubleWithDefault(key: string, defaultValue: number): number
  • see

    [[DoubleConverter.toDoubleWithDefault]]

    Parameters

    • key: string

      key of the item to retrieve.

    • defaultValue: number

      value to return if conversion is not possible.

    Returns number

    the item with the given key as a double or the defaultValue (if conversion is not possible).

getAsFloat

  • getAsFloat(key: string): number
  • Parameters

    • key: string

      key of the item to retrieve.

    Returns number

    the item with the given key as a float (or 0 as the default).

getAsFloatWithDefault

  • getAsFloatWithDefault(key: string, defaultValue: number): number
  • see

    [[FloatConverter.toFloatWithDefault]]

    Parameters

    • key: string

      key of the item to retrieve.

    • defaultValue: number

      value to return if conversion is not possible.

    Returns number

    the item with the given key as a float or the defaultValue (if conversion is not possible).

getAsInteger

  • getAsInteger(key: string): number
  • Parameters

    • key: string

      key of the item to retrieve.

    Returns number

    the item with the given key as an integer (or 0 as the default).

getAsIntegerWithDefault

  • getAsIntegerWithDefault(key: string, defaultValue: number): number
  • see

    [[IntegerConverter.toIntegerWithDefault]]

    Parameters

    • key: string

      key of the item to retrieve.

    • defaultValue: number

      value to return if conversion is not possible.

    Returns number

    the item with the given key as an integer or the defaultValue (if conversion is not possible).

getAsLong

  • getAsLong(key: string): number
  • Parameters

    • key: string

      key of the item to retrieve.

    Returns number

    the item with the given key as a long (or 0 as the default).

getAsLongWithDefault

  • getAsLongWithDefault(key: string, defaultValue: number): number
  • see

    [[LongConverter.toLongWithDefault]]

    Parameters

    • key: string

      key of the item to retrieve.

    • defaultValue: number

      value to return if conversion is not possible.

    Returns number

    the item with the given key as a long or the defaultValue (if conversion is not possible).

getAsMap

  • getAsMap(key: string): AnyValueMap
  • see

    fromValue

    Parameters

    • key: string

      key of the item to retrieve.

    Returns AnyValueMap

    the item with the given key as an AnyValueMap object.

getAsMapWithDefault

  • getAsMapWithDefault(key: string, defaultValue: AnyValueMap): AnyValueMap
  • Parameters

    • key: string

      key of the item to retrieve.

    • defaultValue: AnyValueMap

      value to use if the item with the given key cannot be converted into an AnyValueMap.

    Returns AnyValueMap

    the item with the given key as an AnyValueMap object or 'defaultValue', if conversion is not possible.

getAsNullableArray

  • getAsNullableArray(key: string): AnyValueArray
  • see

    [[AnyValueArray]]

    see

    [[AnyValueArray.fromValue]]

    Parameters

    • key: string

      key of the item to retrieve.

    Returns AnyValueArray

    the item with the given key as a nullable AnyValueArray object (returns null if the item with the given key is null).

getAsNullableBoolean

  • getAsNullableBoolean(key: string): boolean
  • see

    [[BooleanConverter.toNullableBoolean]]

    Parameters

    • key: string

      key of the item to retrieve.

    Returns boolean

    the item with the given key as a nullable boolean.

getAsNullableDateTime

  • getAsNullableDateTime(key: string): Date
  • see

    [[DateTimeConverter.toNullableDateTime]]

    Parameters

    • key: string

      key of the item to retrieve.

    Returns Date

    the item with the given key as a nullable Datetime.

getAsNullableDouble

  • getAsNullableDouble(key: string): number
  • see

    [[DoubleConverter.toNullableDouble]]

    Parameters

    • key: string

      key of the item to retrieve.

    Returns number

    the item with the given key as a nullable double.

getAsNullableFloat

  • getAsNullableFloat(key: string): number
  • see

    [[FloatConverter.toNullableFloat]]

    Parameters

    • key: string

      key of the item to retrieve.

    Returns number

    the item with the given key as a nullable float.

getAsNullableInteger

  • getAsNullableInteger(key: string): number
  • see

    [[IntegerConverter.toNullableInteger]]

    Parameters

    • key: string

      key of the item to retrieve.

    Returns number

    the item with the given key as a nullable integer.

getAsNullableLong

  • getAsNullableLong(key: string): number
  • see

    [[LongConverter.toNullableLong]]

    Parameters

    • key: string

      key of the item to retrieve.

    Returns number

    the item with the given key as a nullable long.

getAsNullableMap

  • getAsNullableMap(key: string): AnyValueMap
  • see

    fromValue

    Parameters

    • key: string

      key of the item to retrieve.

    Returns AnyValueMap

    the item with the given key as a nullable AnyValueMap object (returns null if the item with the given key is null).

getAsNullableString

  • getAsNullableString(key: string): string
  • see

    [[StringConverter.toNullableString]]

    Parameters

    • key: string

      key of the item to retrieve.

    Returns string

    the item with the given key as a nullable string.

getAsNullableType

  • getAsNullableType<T>(type: TypeCode, key: string): T
  • Converts the item with the given key into a nullable object of type 'type' using [[TypeConverter.toNullableType]] and returns it.

    see

    [[TypeConverter.toNullableType]]

    Type parameters

    • T

    Parameters

    • type: TypeCode

      the TypeCode to be used in TypeConverter.toNullableType(TypeCode, value);

    • key: string

      key of the item to retrieve.

    Returns T

    the item with the given key as a nullable object of type 'type'.

getAsObject

  • getAsObject(key?: string): any
  • Parameters

    • Optional key: string

      key of the item to retrieve.

    Returns any

    the item with the given key without any conversions or all items (if 'key' is undefined or omitted).

getAsString

  • getAsString(key: string): string
  • Parameters

    • key: string

      key of the item to retrieve.

    Returns string

    the item with the given key as a string (or null as the default).

getAsStringWithDefault

  • getAsStringWithDefault(key: string, defaultValue: string): string
  • see

    [[StringConverter.toStringWithDefault]]

    Parameters

    • key: string

      key of the item to retrieve.

    • defaultValue: string

      value to return if conversion is not possible.

    Returns string

    the item with the given key as a string or the defaultValue (if conversion is not possible).

getAsType

  • getAsType<T>(type: TypeCode, key: string): T
  • Converts the item with the given key into an object of type 'type' using [[TypeConverter.toTypeWithDefault]] and returns it.

    see

    getAsTypeWithDefault

    Type parameters

    • T

    Parameters

    • type: TypeCode

      the TypeCode to be used in TypeConverter.toTypeWithDefault(TypeCode, value, null);

    • key: string

      key of the item to retrieve.

    Returns T

    the item with the given key as an object of type 'type' (or null as the default).

getAsTypeWithDefault

  • getAsTypeWithDefault<T>(type: TypeCode, key: string, defaultValue: T): T
  • Converts the item with the given key into an object of type 'type' using [[TypeConverter.toTypeWithDefault]] and returns it.

    see

    [[TypeConverter.toTypeWithDefault]]

    Type parameters

    • T

    Parameters

    • type: TypeCode

      the TypeCode to be used in TypeConverter.toTypeWithDefault(TypeCode, value, defaultValue);

    • key: string
    • defaultValue: T

      value to return if conversion is not possible.

    Returns T

    the item with the given key as an object of type 'type' or the defaultValue, if conversion is not possible.

getAsValue

  • getAsValue(key: string): AnyValue
  • see

    [[AnyValue]]

    see

    [[AnyValue.constructor]]

    Parameters

    • key: string

      key of the item to retrieve.

    Returns AnyValue

    the item with the given key as an AnyValue object.

getKeys

  • getKeys(): string[]
  • Returns string[]

    all of the keys that are contained in this StringValueMap as a list of strings.

getPartition

  • getPartition(): string

getRegion

  • getRegion(): string

getResource

  • getResource(): string

getResourceType

  • getResourceType(): string

getSection

  • getSection(section: string): ConfigParams
  • Parameters

    • section: string

      name of the section to retrieve configuration parameters from.

    Returns ConfigParams

    all configuration parameters that belong to the section named 'section'.

    Example key "Section-1.Subsection-1-1.Key-1-1-1" contains the section named "Section-1". Calling getSection("Section-1") would return a ConfigParams object containing the key "Subsection-1-1.Key-1-1-1"

getSectionNames

  • getSectionNames(): string[]
  • Returns string[]

    the names of all sections that are present in this object's complex keys.

    Example key "Section-1.Subsection-1-1.Key-1-1-1" contains the section named "Section-1".

getService

  • getService(): string

length

  • length(): number
  • Returns number

    the number of key-value pairs stored in this StringValueMap.

override

  • override(configParams: ConfigParams): ConfigParams
  • Overrides the configuration parameters stored in this object with the ones in 'configParams'. If a configuration is already set in this ConfigParams object, it will be overwritten by the value in 'configParams' with the same key.

    see

    setDefaults

    Parameters

    • configParams: ConfigParams

      configuration parameters to override the parameters of this object with.

    Returns ConfigParams

    ConfigParams object with overridden parameters.

put

  • put(key: string, value: any): any
  • Parameters

    • key: string

      the key by which to insert the given value.

    • value: any

      the value to insert into this StringValueMap by the given key.

    Returns any

remove

  • remove(key: string): void
  • Parameters

    • key: string

      key of the item to remove.

    Returns void

setAccessId

  • setAccessId(value: string): void

setAccessKey

  • setAccessKey(value: string): void

setAccount

  • setAccount(value: string): void

setArn

  • setArn(value: string): void
  • Sets the AWS resource ARN. When it sets the value, it automatically parses the ARN and sets individual parameters.

    Parameters

    • value: string

      a new AWS resource ARN.

    Returns void

setAsObject

  • setAsObject(key: any, value?: any): void
  • see

    [[MapConverter.toMap]]

    Parameters

    • key: any

      the key by which to set the 'value' passed.

    • Optional value: any

      the value to set in this StringValueMap with the given 'key'. If 'key' is omitted, then this StringValueMap will be set (cleared and filled anew) using 'value'. In this case 'value' will be converted to a map using "MapConverter.toMap(value)" and set to this StringValueMap.

    Returns void

setDefaults

  • setDefaults(defaultConfigParams: ConfigParams): ConfigParams
  • Sets the default configurations for this ConfigParams object, based on the default configuration parameters passed in 'defaultConfigParams'. If a configuration is already set in this ConfigParams object, it will not be overwritten by the default value in 'defaultConfigParams' with the same key.

    see

    override

    Parameters

    • defaultConfigParams: ConfigParams

      the default configuration parameters to use.

    Returns ConfigParams

    this ConfigParams object with the newly set defaults.

setPartition

  • setPartition(value: string): void

setRegion

  • setRegion(value: string): void

setResource

  • setResource(value: string): void

setResourceType

  • setResourceType(value: string): void

setService

  • setService(value: string): void

toString

  • toString(): string
  • Returns string

    this StringValueMap as a semicolon-separated values string.

    Example: "key1=value1;key2;key3=value3".

validate

  • validate(correlationId: string): ConfigException
  • Validates this connection parameters

    Parameters

    • correlationId: string

      (optional) transaction id to trace execution through call chain.

    Returns ConfigException

    a ConfigException or null if validation passed successfully.

Static fromConfig

Static fromMaps

  • fromMaps(...maps: any[]): StringValueMap
  • Static method for creating a StringValueMap using the maps passed as parameters.

    Parameters

    • Rest ...maps: any[]

      the maps passed to this method to create a StringValueMap with.

    Returns StringValueMap

    the StringValueMap created.

Static fromString

  • Creates a new AwsConnectionParams object filled with key-value pairs serialized as a string.

    Parameters

    • line: string

      a string with serialized key-value pairs as "key1=value1;key2=value2;..." Example: "Key1=123;Key2=ABC;Key3=2016-09-16T00:00:00.00Z"

    Returns AwsConnectionParams

    a new AwsConnectionParams object.

Static fromTuples

  • fromTuples(...tuples: any[]): ConfigParams
  • Static method that creates a ConfigParams object using the tuples passed to the method.

    see

    [[StringValueMap.fromTuplesArray]]

    Parameters

    • Rest ...tuples: any[]

      the tuples to convert to a ConfigParams object.

    Returns ConfigParams

    the generated ConfigParams.

Static fromTuplesArray

  • fromTuplesArray(tuples: any[]): StringValueMap
  • Static method for creating a StringValueMap from an array of tuples.

    Parameters

    • tuples: any[]

      the key-value tuples array to initialize the new StringValueMap with.

    Returns StringValueMap

    the StringValueMap created and filled by the 'tuples' array provided.

Static fromValue

  • fromValue(value: any): ConfigParams
  • Static method that creates a ConfigParams object based on the values that are stored in the 'value' object's properties.

    see

    [[RecursiveObjectReader.getProperties]]

    Parameters

    • value: any

      configuration parameters in the form of an object with properties.

    Returns ConfigParams

    generated ConfigParams.

Static mergeConfigs

  • Retrieves AwsConnectionParams from multiple configuration parameters. The values are retrieves from "connection" and "credential" sections.

    see

    fromConfig

    Parameters

    • Rest ...configs: ConfigParams[]

      a list with configuration parameters

    Returns AwsConnectionParams

    the generated AwsConnectionParams object.

Generated using TypeDoc