Module: Furikake::Resources::VpcEndpoint

Defined in:
lib/furikake/resources/vpc_endpoint.rb

Class Method Summary collapse

Class Method Details

.get_resourcesObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/furikake/resources/vpc_endpoint.rb', line 21

def get_resources
  ec2 = Aws::EC2::Client.new
  params = {}
  endpoints = []
  loop do
    res = ec2.describe_vpc_endpoints(params)
    res.vpc_endpoints.each do |e|
      endpoint = []
      endpoint << e.vpc_endpoint_id
      endpoint << e.vpc_endpoint_type
      endpoint << e.vpc_id
      endpoint << e.state
      endpoints << endpoint
    end
    break if res.next_token.nil?
    params[:next_token] = res.next_token
  end

  endpoints
end

.reportObject



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/furikake/resources/vpc_endpoint.rb', line 4

def report
  resources = get_resources
  headers = ['ID', 'Type', 'VPC ID', 'State']
  if resources.empty?
    info = 'N/A'
  else
    info = MarkdownTables.make_table(headers, resources, is_rows: true, align: 'l')
  end
  documents = "### VPC Endpoint\n\n\#{info}\n"
  
  documents
end