mirror of
https://github.com/nabbar/golib.git
synced 2025-11-03 01:43:40 +08:00
Package AWS :
- Config Model : add a config model with a golib RouerStatus Config Model to use a AWS connection for API with a request status health check - Config Interface : add function GetAccessKey to retrieve the accesskey value currently used into the current connection - function Walk (Object, version, ...) : fix bug with pointer of string not initialized Package Config : - interface Component : add status router pointer into the Init function to allow used a global router status for all component status registration as router status component Package Status : - move Status Config as an sub package of Package Status Package Errors : - add CamelCase const Package Logger : - fix following bump dependencies Global : - bump dependencies - change init of errors files : change function never call vy panic to prevent an error code collision
This commit is contained in:
@@ -35,14 +35,14 @@ import (
|
||||
sdkaws "github.com/aws/aws-sdk-go-v2/aws"
|
||||
sdkcrd "github.com/aws/aws-sdk-go-v2/credentials"
|
||||
libaws "github.com/nabbar/golib/aws"
|
||||
"github.com/nabbar/golib/errors"
|
||||
liberr "github.com/nabbar/golib/errors"
|
||||
)
|
||||
|
||||
func GetConfigModel() interface{} {
|
||||
return Model{}
|
||||
}
|
||||
|
||||
func NewConfigJsonUnmashal(p []byte) (libaws.Config, errors.Error) {
|
||||
func NewConfigJsonUnmashal(p []byte) (libaws.Config, liberr.Error) {
|
||||
c := Model{}
|
||||
if err := json.Unmarshal(p, &c); err != nil {
|
||||
return nil, ErrorConfigJsonUnmarshall.ErrorParent(err)
|
||||
@@ -55,6 +55,19 @@ func NewConfigJsonUnmashal(p []byte) (libaws.Config, errors.Error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
func NewConfigStatusJsonUnmashal(p []byte) (libaws.Config, liberr.Error) {
|
||||
c := ModelStatus{}
|
||||
if err := json.Unmarshal(p, &c); err != nil {
|
||||
return nil, ErrorConfigJsonUnmarshall.ErrorParent(err)
|
||||
}
|
||||
|
||||
return &awsModel{
|
||||
Model: c.Config,
|
||||
retryer: nil,
|
||||
mapRegion: nil,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func NewConfig(bucket, accessKey, secretKey string, endpoint *url.URL, region string) libaws.Config {
|
||||
return &awsModel{
|
||||
Model: Model{
|
||||
@@ -91,7 +104,7 @@ func (c *awsModel) Clone() libaws.Config {
|
||||
}
|
||||
}
|
||||
|
||||
func (c *awsModel) GetConfig(ctx context.Context, cli *http.Client) (*sdkaws.Config, errors.Error) {
|
||||
func (c *awsModel) GetConfig(ctx context.Context, cli *http.Client) (*sdkaws.Config, liberr.Error) {
|
||||
|
||||
cfg := sdkaws.NewConfig()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user