github.com/gophercloud/gophercloud@v1.11.0/openstack/identity/v3/extensions/ec2tokens/doc.go (about)

     1  /*
     2  Package tokens provides information and interaction with the EC2 token API
     3  resource for the OpenStack Identity service.
     4  
     5  For more information, see:
     6  https://docs.openstack.org/api-ref/identity/v2-ext/
     7  
     8  Example to Create a Token From an EC2 access and secret keys
     9  
    10  	var authOptions tokens.AuthOptionsBuilder
    11  	authOptions = &ec2tokens.AuthOptions{
    12  		Access: "a7f1e798b7c2417cba4a02de97dc3cdc",
    13  		Secret: "18f4f6761ada4e3795fa5273c30349b9",
    14  	}
    15  
    16  	token, err := ec2tokens.Create(identityClient, authOptions).ExtractToken()
    17  	if err != nil {
    18  		panic(err)
    19  	}
    20  
    21  Example to auth a client using EC2 access and secret keys
    22  
    23  	client, err := openstack.NewClient("http://localhost:5000/v3")
    24  	if err != nil {
    25  		panic(err)
    26  	}
    27  
    28  	var authOptions tokens.AuthOptionsBuilder
    29  	authOptions = &ec2tokens.AuthOptions{
    30  		Access:      "a7f1e798b7c2417cba4a02de97dc3cdc",
    31  		Secret:      "18f4f6761ada4e3795fa5273c30349b9",
    32  		AllowReauth: true,
    33  	}
    34  
    35  	err = openstack.AuthenticateV3(client, authOptions, gophercloud.EndpointOpts{})
    36  	if err != nil {
    37  		panic(err)
    38  	}
    39  */
    40  package ec2tokens