autoidentity

This module contains the AutoIdentity class that provides information about the application execution environment.

class backpack.autoidentity.AutoIdentityData(*, ApplicationInstanceId, Name, Tags, DefaultRuntimeContextDevice, DefaultRuntimeContextDeviceName, CreatedTime, HealthStatus, Description)

Bases: BaseModel

Data class to store auto identity information.

Parameters:
  • ApplicationInstanceId (str) –

  • Name (str) –

  • Tags (Dict[str, str]) –

  • DefaultRuntimeContextDevice (str) –

  • DefaultRuntimeContextDeviceName (str) –

  • CreatedTime (datetime) –

  • HealthStatus (str) –

  • Description (str) –

application_instance_id: str

Application instance id.

application_name: str

Name of this application.

application_tags: Dict[str, str]

Tags associated with this application.

device_id: str

Device id of the appliance running this application.

device_name: str

Name of this application.

application_created_time: datetime

Application deployment time.

application_status: str

Health status of this application.

application_description: str

The description of this application.

classmethod for_test_environment(application_instance_id, application_name)

Initializes a dummy AutoIdentityData to be used in test environment.

Parameters:
  • application_instance_id (str) –

  • application_name (str) –

class backpack.autoidentity.AutoIdentityFetcher(device_region, application_instance_id=None, parent_logger=None)

Bases: object

AutoIdentity instance queries metadata of the current application instance.

The IAM policy associated with the Panorama Application Role of this app should grant the execution of panorama:ListApplicationInstances operation.

Parameters:
  • device_region (str) – The AWS region where this Panorama appliance is registered.

  • application_instance_id (Optional[str]) – The application instance id. If left to None, AutoIdentity will try to find the instance id in the environment variable.

  • parent_logger (Optional[Logger]) – If you want to connect the logger to a parent, specify it here.

get_data(retry_freq=None)

Fetches the auto identity data.

Parameters:

retry_freq (Optional[float]) – If set to a float number, AutoIdentity will keep retrying fetching the auto identity data from remote services if the status of the app was “NOT_AVAILABLE”. If set to None, will not retry.

Raises:

RuntimeError – if could not fetch the auto identity information, and retry_freq is set to None.

Return type:

AutoIdentityData