Extends: ConfigParams
Description
Contains connection parameters to authenticate against Azure Functions and connect to specific Azure Function.
The class is able to compose and parse Azure Function connection parameters.
In addition to standard parameters CredentialParams may contain any number of custom parameters
Configuration parameters
- connections:
- uri: full connection uri with specific app and function name
- protocol: connection protocol
- app_name: alternative app name
- function_name: application function name
- credentials:
- auth_code: authorization code or null if using custom auth
Constructors
Creates an new instance of the connection parameters.
publicconstructor(values: any = null)
- values: any - (optional) an object to be converted into key-value pairs to initialize this connection.
Instance methods
getAppName
Gets the Azure app name.
publicgetAppName(): string
- returns: string - the Azure app name.
getAuthCode
Gets the Azure auth code.
publicgetAuthCode(): string
- returns: string - the Azure auth code.
getFunctionName
Gets the Azure function name.
publicgetFunctionName(): string
- returns: string - the Azure function name.
getFunctionUri
Gets the Azure function uri.
publicgetFunctionUri(): string
- returns: string - the Azure function uri.
getProtocol
Gets the Azure function connection protocol.
publicgetProtocol(): string
- returns: string - the Azure function connection protocol.
setAppName
Sets the Azure app name.
publicsetAppName(value: string)
- value: string - a new Azure app name.
setAuthCode
Sets the Azure auth code.
publicsetAuthCode(value: string)
- value: string - a new Azure auth code.
setFunctionName
Sets the Azure function name.
publicsetFunctionName(value: string)
- value: string - a new Azure function name.
setFunctionUri
Sets the Azure function uri.
publicsetFunctionUri(value: string)
- value: string - a new Azure function uri.
setProtocol
Sets the Azure function connection protocol.
publicsetProtocol(value: string)
- value: string - a new Azure function connection protocol.
validate
Validates this connection parameters
publicvalidate(context: IContext)
- context: IContext - (optional) a context to trace execution through a call chain.
Static methods
fromConfig
Validates this connection parameters
public staticfromConfig(config: ConfigParams): AzureFunctionConnectionParams
- config: ConfigParams - configuration parameters
- returns: AzureFunctionConnectionParams - the generated AzureFunctionConnectionParams object.
mergeConfigs
Retrieves AzureFunctionConnectionParams from multiple configuration parameters. The values are retrieves from “connection” and “credential” sections.
public staticmergeConfigs(…configs: ConfigParams[]): AzureFunctionConnectionParams
- config: string - a list with configuration parameters
- returns: AzureFunctionConnectionParams - the generated AzureFunctionConnectionParams object.
Examples
let connection = AzureFunctionConnectionParams.fromTuples(
"connection.uri", "http://myapp.azurewebsites.net/api/myfunction",
"connection.protocol", "http",
"connection.app_name", "myapp",
"connection.function_name", "myfunction",
"credential.auth_code", "code",
);
const uri = connection.getFunctionUri(); // Result: "http://myapp.azurewebsites.net/api/myfunction"
const protocol = connection.getAppName(); // Result: "http"
const appName = connection.getAppName(); // Result: "myapp"
const functionName = connection.getFunctionName(); // Result: "myfunction"
const authCode = connection.getAuthCode(); // Result: "code"