Account

This module exposes the Account class, which provides an entrypoint into interacting with the cloud accounts of your profile. Check-out its attributes and methods to learn more on what you can do with it!

Account

class nops_sdk.account.account.Account(id, name='', client=None)

Bases: object

Designates a cloud account

Parameters
  • id (str) – the id of an account as assigned by nOps

  • name (Optional[str]) – name of the account

  • client (Optional[nops_sdk.client.client.Client]) – the client to which this account belongs

Return type

None

__init__(id, name='', client=None)
Parameters
Return type

None

client: Optional[nops_sdk.client.client.Client] = None
classmethod from_raw(api_response)

Build an Account object from raw API response

Parameters

api_response (dict) –

Returns

Account

Return type

nops_sdk.account.account.Account

Get related Resource of a given AWS Resource

Parameters

resource_id (str) – The AWS id of the resource

Returns

an instance of Resource with populated related_resources

Return type

Resource

Examples

>>> from nops_sdk.account import Account
note: you'll need to provide your own account and resource ids.
>>> account = Account(id="10963")
>>> resource_with_relations = account.get_related_resources(resource_id="i-07f6c6d7441264685")
>>> resource_with_relations.related_resources
{'vpc': VPC (aws_id=vpc-f4f4288d), 'security_groups': [SecurityGroup (aws_id=sg-d02aaba2)], 'subnets': [SubNet (aws_id=subnet-8c4db8e8)]}
id: str
name: Optional[str] = ''