123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109 |
- /*
- Package tokens provides information and interaction with the token API
- resource for the OpenStack Identity service.
- For more information, see:
- http://developer.openstack.org/api-ref-identity-v3.html#tokens-v3
- Example to Create a Token From a Username and Password
- authOptions := tokens.AuthOptions{
- UserID: "username",
- Password: "password",
- }
- token, err := tokens.Create(identityClient, authOptions).ExtractToken()
- if err != nil {
- panic(err)
- }
- Example to Create a Token From a Username, Password, and Domain
- authOptions := tokens.AuthOptions{
- UserID: "username",
- Password: "password",
- DomainID: "default",
- }
- token, err := tokens.Create(identityClient, authOptions).ExtractToken()
- if err != nil {
- panic(err)
- }
- authOptions = tokens.AuthOptions{
- UserID: "username",
- Password: "password",
- DomainName: "default",
- }
- token, err = tokens.Create(identityClient, authOptions).ExtractToken()
- if err != nil {
- panic(err)
- }
- Example to Create a Token From a Token
- authOptions := tokens.AuthOptions{
- TokenID: "token_id",
- }
- token, err := tokens.Create(identityClient, authOptions).ExtractToken()
- if err != nil {
- panic(err)
- }
- Example to Create a Token from a Username and Password with Project ID Scope
- scope := tokens.Scope{
- ProjectID: "0fe36e73809d46aeae6705c39077b1b3",
- }
- authOptions := tokens.AuthOptions{
- Scope: &scope,
- UserID: "username",
- Password: "password",
- }
- token, err = tokens.Create(identityClient, authOptions).ExtractToken()
- if err != nil {
- panic(err)
- }
- Example to Create a Token from a Username and Password with Domain ID Scope
- scope := tokens.Scope{
- DomainID: "default",
- }
- authOptions := tokens.AuthOptions{
- Scope: &scope,
- UserID: "username",
- Password: "password",
- }
- token, err = tokens.Create(identityClient, authOptions).ExtractToken()
- if err != nil {
- panic(err)
- }
- Example to Create a Token from a Username and Password with Project Name Scope
- scope := tokens.Scope{
- ProjectName: "project_name",
- DomainID: "default",
- }
- authOptions := tokens.AuthOptions{
- Scope: &scope,
- UserID: "username",
- Password: "password",
- }
- token, err = tokens.Create(identityClient, authOptions).ExtractToken()
- if err != nil {
- panic(err)
- }
- */
- package tokens
|