Class: Stax::Cmd::Apigw

Inherits:
SubCommand show all
Defined in:
lib/stax/mixin/apigw.rb

Instance Method Summary collapse

Methods inherited from SubCommand

#info, stax_info, stax_info_tasks

Instance Method Details

#endpointsObject



53
54
55
56
57
58
59
60
61
62
# File 'lib/stax/mixin/apigw.rb', line 53

def endpoints
  stack_apis.each do |r|
    api = Aws::APIGateway.api(r.physical_resource_id)
    debug("Endpoints for API #{api.name} #{api.id}")
    print_table Aws::APIGateway.stages(api.id).map { |s|
      url = "https://#{api.id}.execute-api.#{aws_region}.amazonaws.com/#{s.stage_name}/"
      [s.stage_name, url]
    }.sort
  end
end

#lsObject



22
23
24
25
26
27
# File 'lib/stax/mixin/apigw.rb', line 22

def ls
  print_table stack_apis.map { |r|
    a = Aws::APIGateway.api(r.physical_resource_id)
    [a.name, a.id, a.endpoint_configuration.types.join(','), a.created_date, a.description]
  }
end

#resourcesObject



41
42
43
44
45
46
47
48
49
50
# File 'lib/stax/mixin/apigw.rb', line 41

def resources
  stack_apis.each do |r|
    api = Aws::APIGateway.api(r.physical_resource_id)
    debug("Resources for API #{api.name} #{api.id}")
    print_table Aws::APIGateway.resources(api.id).map { |r|
      methods = r.resource_methods&.keys&.join(',')
      [r.path, r.id, methods]
    }.sort
  end
end

#stagesObject



30
31
32
33
34
35
36
37
38
# File 'lib/stax/mixin/apigw.rb', line 30

def stages
  stack_apis.each do |r|
    api = Aws::APIGateway.api(r.physical_resource_id)
    debug("Stages for API #{api.name} #{api.id}")
    print_table Aws::APIGateway.stages(api.id).map { |s|
      [s.stage_name, s.deployment_id, s.created_date, s.last_updated_date, s.description]
    }
  end
end