gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

doc.go (2285B)


      1 /*
      2  * MinIO Go Library for Amazon S3 Compatible Cloud Storage
      3  * Copyright 2017 MinIO, Inc.
      4  *
      5  * Licensed under the Apache License, Version 2.0 (the "License");
      6  * you may not use this file except in compliance with the License.
      7  * You may obtain a copy of the License at
      8  *
      9  *     http://www.apache.org/licenses/LICENSE-2.0
     10  *
     11  * Unless required by applicable law or agreed to in writing, software
     12  * distributed under the License is distributed on an "AS IS" BASIS,
     13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14  * See the License for the specific language governing permissions and
     15  * limitations under the License.
     16  */
     17 
     18 // Package credentials provides credential retrieval and management
     19 // for S3 compatible object storage.
     20 //
     21 // By default the Credentials.Get() will cache the successful result of a
     22 // Provider's Retrieve() until Provider.IsExpired() returns true. At which
     23 // point Credentials will call Provider's Retrieve() to get new credential Value.
     24 //
     25 // The Provider is responsible for determining when credentials have expired.
     26 // It is also important to note that Credentials will always call Retrieve the
     27 // first time Credentials.Get() is called.
     28 //
     29 // Example of using the environment variable credentials.
     30 //
     31 //	creds := NewFromEnv()
     32 //	// Retrieve the credentials value
     33 //	credValue, err := creds.Get()
     34 //	if err != nil {
     35 //	    // handle error
     36 //	}
     37 //
     38 // Example of forcing credentials to expire and be refreshed on the next Get().
     39 // This may be helpful to proactively expire credentials and refresh them sooner
     40 // than they would naturally expire on their own.
     41 //
     42 //	creds := NewFromIAM("")
     43 //	creds.Expire()
     44 //	credsValue, err := creds.Get()
     45 //	// New credentials will be retrieved instead of from cache.
     46 //
     47 // # Custom Provider
     48 //
     49 // Each Provider built into this package also provides a helper method to generate
     50 // a Credentials pointer setup with the provider. To use a custom Provider just
     51 // create a type which satisfies the Provider interface and pass it to the
     52 // NewCredentials method.
     53 //
     54 //	type MyProvider struct{}
     55 //	func (m *MyProvider) Retrieve() (Value, error) {...}
     56 //	func (m *MyProvider) IsExpired() bool {...}
     57 //
     58 //	creds := NewCredentials(&MyProvider{})
     59 //	credValue, err := creds.Get()
     60 package credentials