class Stax::Cmd::Apigw

Public Instance Methods

endpoints() click to toggle source
# 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
ls() click to toggle source
# 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
resources() click to toggle source
# 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
stack_apis() click to toggle source
# File lib/stax/mixin/apigw.rb, line 16
def stack_apis
  Aws::Cfn.resources_by_type(my.stack_name, 'AWS::ApiGateway::RestApi')
end
stages() click to toggle source
# 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