// NewEc2 generate a new EC2 credentials pair for the given user in the given
// tenant.
NewEc2 generate a new EC2 credentials pair for the given user in the given
tenant.
// NewEc2 generate a new EC2 credentials pair for the given user in the given // tenant .
func (c *Client) NewEc2(userId, tenantId string) (*Ec2, error) {
	b := bytes.NewBufferString(fmt.Sprintf(`{"tenant_id": "%s"}`, tenantId))
	response, _ := c.do("POST", c.authUrl+"/users/"+userId+"/credentials/OS-EC2", b)
	defer response.Body.Close()
	result, _ := ioutil.ReadAll(response.Body)
	var data map[string]map[string]interface{}
	_ = json.Unmarshal(result, &data)
	ec2 := Ec2{
		Access: data["credential"]["access"].(string),
		Secret: data["credential"]["secret"].(string),
	}
	return &ec2, nil
}
func ( c * Client ) NewEc2 ( userId , tenantId string ) ( * Ec2 , error ) { b := bytes . NewBufferString ( fmt . Sprintf ( `{"tenant_id": "%s"}` , tenantId ) ) response , _ := c . do ( " " , c . authUrl + " " + userId + " " , b ) defer response . Body . Close ( ) result , _ := ioutil . ReadAll ( response . Body ) var data map [ string ] map [ string ] interface { } _ = json . Unmarshal ( result , & data ) ec2 := Ec2 { Access : data [ " " ] [ " " ] . ( string ) , Secret : data [ " " ] [ " " ] . ( string ) , } return & ec2 , nil }
NewEc2 generate a new EC2 credentials pair for the given user in the given
tenant.
NewEc2 generate a new EC2 credentials pair for the given user in the given tenant .