github.com/huaweicloud/golangsdk@v0.0.0-20210831081626-d823fe11ceba/openstack/identity/v2/tokens/doc.go (about)

     1  /*
     2  Package tokens provides information and interaction with the token API
     3  resource for the OpenStack Identity service.
     4  
     5  For more information, see:
     6  http://developer.openstack.org/api-ref-identity-v2.html#identity-auth-v2
     7  
     8  Example to Create an Unscoped Token from a Password
     9  
    10  	authOpts := golangsdk.AuthOptions{
    11  		Username: "user",
    12  		Password: "pass"
    13  	}
    14  
    15  	token, err := tokens.Create(identityClient, authOpts).ExtractToken()
    16  	if err != nil {
    17  		panic(err)
    18  	}
    19  
    20  Example to Create a Token from a Tenant ID and Password
    21  
    22  	authOpts := golangsdk.AuthOptions{
    23  		Username: "user",
    24  		Password: "password",
    25  		TenantID: "fc394f2ab2df4114bde39905f800dc57"
    26  	}
    27  
    28  	token, err := tokens.Create(identityClient, authOpts).ExtractToken()
    29  	if err != nil {
    30  		panic(err)
    31  	}
    32  
    33  Example to Create a Token from a Tenant Name and Password
    34  
    35  	authOpts := golangsdk.AuthOptions{
    36  		Username:   "user",
    37  		Password:   "password",
    38  		TenantName: "tenantname"
    39  	}
    40  
    41  	token, err := tokens.Create(identityClient, authOpts).ExtractToken()
    42  	if err != nil {
    43  		panic(err)
    44  	}
    45  */
    46  package tokens