Class: ESP::ExternalAccount

Inherits:
Resource show all
Defined in:
lib/esp/resources/external_account.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Dirty

#changed_attributes, #original_attributes, #original_attributes=

Methods included from LoadWithOriginalAttributes

#load

Class Method Details

.allActiveResource::PaginatedCollection<ESP::ExternalAccount>

Return a paginated list



# File 'lib/esp/resources/external_account.rb', line 78

.create(attributes = {}) ⇒ ESP::ExternalAccount

Create an ExternalAccount. call-seq -> super.create(attributes={})

Examples:

 = ESP::ExternalAccount.create(arn: 'arn:from:aws', external_id: 'c40e6af4-a5a0-422a-9a42-3d7d236c3428', sub_organization_id: 4, team_id: 8)

Parameters:

  • attributes (Hash) (defaults to: {})

    Required hash of external account attributes.

    Valid Attributes

    See API documentation for valid arguments

Returns:



# File 'lib/esp/resources/external_account.rb', line 83

.find(id) ⇒ ESP::ExternalAccount .find(id, options = {}) ⇒ ESP::ExternalAccount

Find an ExternalAccount by id

call-seq -> super.find(id, options = {})

Overloads:

  • .find(id, options = {}) ⇒ ESP::ExternalAccount

    Parameters:

    • options (Hash) (defaults to: {})

      An optional hash of options.

      Valid Options

      include | The list of associated objects to return on the initial request.

      Valid Includable Associations

      See API documentation for valid arguments

Parameters:

  • id (Integer, Numberic, #to_i)

    Required ID of the external account to retrieve.

Returns:



# File 'lib/esp/resources/external_account.rb', line 60

.where(clauses = {}) ⇒ ActiveResource::PaginatedCollection<ESP::ExternalAccount>

Return a paginated ExternalAccount list filtered by search parameters

call-seq -> super.where(clauses = {})

Parameters:

  • clauses (Hash) (defaults to: {})

    A hash of attributes with appended predicates to search, sort and include.

    Valid Clauses

    See API documentation for valid arguments

Returns:



# File 'lib/esp/resources/external_account.rb', line 49

Instance Method Details

#destroyself

Delete an ExternalAccount

Returns:

  • (self)


# File 'lib/esp/resources/external_account.rb', line 107

#generate_external_idString

Helper to generate an external id. Called automatically when creating an ExternalAccount if external_id is not already set.

Returns:

  • (String)


27
28
29
# File 'lib/esp/resources/external_account.rb', line 27

def generate_external_id
  SecureRandom.uuid
end

#organizationESP::Organization

The organization the external account belongs to.

Returns:



6
# File 'lib/esp/resources/external_account.rb', line 6

belongs_to :organization, class_name: 'ESP::Organization'

#reportsActiveResource::PaginatedCollection<ESP::Report>

The collection of reports that belong to the team.



21
# File 'lib/esp/resources/external_account.rb', line 21

has_many :reports, class_name: 'ESP::Report'

#saveBoolean

Create or update an ExternalAccount.

Valid Attributes

See API documentation for valid arguments

Examples:

 = ESP::ExternalAccount.new(arn: 'arn:from:aws', external_id: 'c40e6af4-a5a0-422a-9a42-3d7d236c3428', sub_organization_id: 4, team_id: 8)
.save

Returns:

  • (Boolean)


# File 'lib/esp/resources/external_account.rb', line 95

#scan_intervalsActiveResource::PaginatedCollection<ESP::ScanInterval>

Returns a collection of scan_intervals for the external account

Examples:

 = ESP::ExternalAccount.find(345)
scan_intervals = .scan_intervals

Returns:



45
46
47
# File 'lib/esp/resources/external_account.rb', line 45

def scan_intervals
  ESP::ScanInterval.(id)
end

#sub_organizationESP::SubOrganization

The sub_organization the external account belongs to.



11
# File 'lib/esp/resources/external_account.rb', line 11

belongs_to :sub_organization, class_name: 'ESP::SubOrganization'

#teamESP::Team

The team the external account belongs to.

Returns:



16
# File 'lib/esp/resources/external_account.rb', line 16

belongs_to :team, class_name: 'ESP::Team'