// awsDefaultSubnetsHandler turns the list of default public/private subnets.
awsDefaultSubnetsHandler turns the list of default public/private subnets.
// awsDefaultSubnetsHandler turns the list of default public / private subnets .
func awsDefaultSubnetsHandler(w http.ResponseWriter, req *http.Request, _ *Context) error {
	awsSession, err := awsSessionFromRequest(req)
	if err != nil {
		return fromAWSErr(err)
	}
	input := struct {
		VpcCIDR string `json:"vpcCIDR"`
	}{}
	if err := json.NewDecoder(req.Body).Decode(&input); err != nil {
		return newBadRequestError("Could not unmarshal input: %s", err)
	}
	publicSubnets, privateSubnets, err := paws.GetDefaultSubnets(awsSession, input.VpcCIDR)
	if err != nil {
		return newBadRequestError("Could not get default subnets: %s", err)
	}
	response := struct {
		Public  []paws.VPCSubnet `json:"public"`
		Private []paws.VPCSubnet `json:"private"`
	}{publicSubnets, privateSubnets}
	return writeJSONResponse(w, req, http.StatusOK, response)
}
func awsDefaultSubnetsHandler ( w http . ResponseWriter , req * http . Request , _ * Context ) error { awsSession , err := awsSessionFromRequest ( req ) if err != nil { return fromAWSErr ( err ) } input := struct { VpcCIDR string `json:"vpcCIDR"` } { } if err := json . NewDecoder ( req . Body ) . Decode ( & input ) ; err != nil { return newBadRequestError ( " " , err ) } publicSubnets , privateSubnets , err := paws . GetDefaultSubnets ( awsSession , input . VpcCIDR ) if err != nil { return newBadRequestError ( " " , err ) } response := struct { Public [ ] paws . VPCSubnet `json:"public"` Private [ ] paws . VPCSubnet `json:"private"` } { publicSubnets , privateSubnets } return writeJSONResponse ( w , req , http . StatusOK , response ) }
awsDefaultSubnetsHandler turns the list of default public/private subnets.
awsDefaultSubnetsHandler turns the list of default public / private subnets .