AzureFunctionConnectionResolver

Helper class used to retrieve Azure connection and credential parameters, validate them and compose a AzureFunctionConnectionParams value.

Inherits: IConfigurable, IReferenceable

Description

Helper class to retrieve Azure connection and credential parameters, validate them and compose a AzureFunctionConnectionParams value.

Configuration parameters

  • connections:
    • uri: full connection uri with specific app and function name
    • protocol: connection protocol
    • project_id: is your Google Cloud Platform project ID
    • region: is the region where your function is deployed
    • function_name: is the name of the HTTP function you deployed
  • credentials:
    • auth_token: Google-generated ID token or null if using custom auth

References

  • *:discovery:*:*:1.0 - (optional) IDiscovery services to resolve connection.
  • *:credential-store:*:*:1.0 - (optional) credential stores to resolve credentials.

Fields

_connectionResolver

Connection resolver.

protected _connectionResolver: ConnectionResolver

_credentialResolver

Credential resolver.

protected _credentialResolver: CredentialResolver

Instance methods

Configure

Configures a component by passing its configuration parameters.

public void Configure(ConfigParams config)

  • config: ConfigParams - configuration parameters to be set.

ResolveAsync

Resolves connection and credential parameters and generates a single AzureFunctionConnectionParams value.

public Task<AzureFunctionConnectionParams> ResolveAsync(IContext context)

  • context: IContext - (optional) a context to trace execution through a call chain.
  • returns: Task<AzureFunctionConnectionParams> - receives an AzureFunctionConnectionParams value or error.

SetReferences

Sets references to dependent components.

public void SetReferences(IReferences references)

  • references: IReferences - references to locate the component’s dependencies.

Examples

var config = ConfigParams.FromTuples(
    "connection.uri", "http://myapp.azurewebsites.net/api/myfunction",
    "connection.app_name", "myapp",
    "connection.function_name", "myfunction",
    "credential.auth_code", "XXXXXXXXXX",
);

var connectionResolver = new AzureFunctionConnectionResolver();
connectionResolver.Configure(config);
connectionResolver.SetReferences(references);

var connectionParams = await connectionResolver.ResolveAsync("123");

See also