From ef00d704c3b5a4f15abb1666cd2aa5c7d3a89cb6 Mon Sep 17 00:00:00 2001 From: Gildas Cherruel Date: Thu, 13 Jun 2024 14:10:34 +0900 Subject: [PATCH 1/9] Unit Test: Open Messaging Integration name for testing can be configured in the environment --- openmessaging_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openmessaging_test.go b/openmessaging_test.go index f93ed33..7b2469a 100644 --- a/openmessaging_test.go +++ b/openmessaging_test.go @@ -75,7 +75,7 @@ func (suite *OpenMessagingSuite) SetupSuite() { Token: token, }, }) - suite.IntegrationName = "TEST-GO-PURECLOUD" + suite.IntegrationName = core.GetEnvAsString("PURECLOUD_INTEGRATION_NAME", "TEST-GO-PURECLOUD") suite.Require().NotNil(suite.Client, "GCloudCX Client is nil") } From dccfe394e9ef524b106d89bb76811fbac0e13a94 Mon Sep 17 00:00:00 2001 From: Gildas Cherruel Date: Thu, 13 Jun 2024 14:10:58 +0900 Subject: [PATCH 2/9] Redact errors --- biography.go | 2 +- user.go | 14 +++++++++----- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/biography.go b/biography.go index 66cc80a..901ee86 100644 --- a/biography.go +++ b/biography.go @@ -21,5 +21,5 @@ func (biography Biography) Redact() interface{} { if len(biography.Spouse) > 0 { redacted.Spouse = logger.RedactWithHash(biography.Spouse) } - return &redacted + return redacted } diff --git a/user.go b/user.go index 222ed3b..28db376 100644 --- a/user.go +++ b/user.go @@ -145,22 +145,26 @@ func (user User) Redact() interface{} { if len(user.PrimaryContact) > 0 { redacted.PrimaryContact = make([]*Contact, len(user.PrimaryContact)) for i, contact := range user.PrimaryContact { - redacted.PrimaryContact[i] = contact.Redact().(*Contact) + redactedContact := contact.Redact().(Contact) + redacted.PrimaryContact[i] = &redactedContact } } if len(user.Addresses) > 0 { redacted.Addresses = make([]*Contact, len(user.Addresses)) for i, contact := range user.Addresses { - redacted.Addresses[i] = contact.Redact().(*Contact) + redactedContact := contact.Redact().(Contact) + redacted.Addresses[i] = &redactedContact } } if user.Manager != nil { - redacted.Manager = user.Manager.Redact().(*User) + redactedUser := user.Manager.Redact().(User) + redacted.Manager = &redactedUser } if user.Biography != nil { - redacted.Biography = user.Biography.Redact().(*Biography) + redactedBiography := user.Biography.Redact().(Biography) + redacted.Biography = &redactedBiography } - return &redacted + return redacted } // MarshalJSON marshals this into JSON From 38fc15d8e3f3aca01efce2391bc23aa751fe9661 Mon Sep 17 00:00:00 2001 From: Gildas Cherruel Date: Thu, 13 Jun 2024 14:11:41 +0900 Subject: [PATCH 3/9] Access Token creation with funcs --- access_token.go | 97 +++++++++++++++++++++++++++++++++++++++++++- access_token_test.go | 37 +++++------------ 2 files changed, 106 insertions(+), 28 deletions(-) diff --git a/access_token.go b/access_token.go index ed5c5c4..a1619c0 100644 --- a/access_token.go +++ b/access_token.go @@ -6,6 +6,9 @@ import ( "time" "github.com/gildas/go-core" + "github.com/gildas/go-errors" + "github.com/gildas/go-logger" + "github.com/google/uuid" "github.com/gorilla/securecookie" ) @@ -13,9 +16,10 @@ import ( // // It must be obtained via an AuthorizationGrant type AccessToken struct { + ID uuid.UUID `json:"id" db:"key"` Type string `json:"tokenType"` Token string `json:"token"` - ExpiresOn time.Time `json:"tokenExpires"` // UTC! + ExpiresOn time.Time `json:"expiresOn"` // UTC! } // UpdatedAccessToken describes an updated Access Token @@ -32,6 +36,46 @@ var ( secureCookie = securecookie.New(hashKey, blockKey) ) +// NewAccessToken creates a new AccessToken +func NewAccessToken(token string, expiresOn time.Time) *AccessToken { + return &AccessToken{ + ID: uuid.New(), + Type: "Bearer", + Token: token, + ExpiresOn: expiresOn, + } +} + +// NewAccessTokenWithType creates a new AccessToken with a type +func NewAccessTokenWithType(tokenType, token string, expiresOn time.Time) *AccessToken { + return &AccessToken{ + ID: uuid.New(), + Type: tokenType, + Token: token, + ExpiresOn: expiresOn, + } +} + +// NewAccessTokenWithDuration creates a new AccessToken that expires in a given duration +func NewAccessTokenWithDuration(token string, expiresIn time.Duration) *AccessToken { + return &AccessToken{ + ID: uuid.New(), + Type: "Bearer", + Token: token, + ExpiresOn: time.Now().UTC().Add(expiresIn), + } +} + +// NewAccessTokenWithDurationAndType creates a new AccessToken with a type and that expires in a given duration +func NewAccessTokenWithDurationAndType(tokenType, token string, expiresIn time.Duration) *AccessToken { + return &AccessToken{ + ID: uuid.New(), + Type: tokenType, + Token: token, + ExpiresOn: time.Now().UTC().Add(expiresIn), + } +} + // Reset resets the Token so it is expired and empty func (token *AccessToken) Reset() { token.Type = "" @@ -76,6 +120,57 @@ func (token AccessToken) ExpiresIn() time.Duration { return token.ExpiresOn.Sub(time.Now().UTC()) } +// Redact redacts sensitive information +// +// implements logger.Redactable +func (token AccessToken) Redact() any { + redacted := token + redacted.Token = logger.RedactWithHash(token.Token) + return redacted +} + +// String gets a string representation of this AccessToken func (token AccessToken) String() string { return token.Type + " " + token.Token } + +// MarshalJSON marshals this into JSON +// +// implements json.Marshaler +func (token AccessToken) MarshalJSON() ([]byte, error) { + type surrogate AccessToken + + data, err := json.Marshal(struct { + ID core.UUID `json:"id"` + surrogate + ExpiresOn core.Time `json:"expiresOn"` + }{ + ID: core.UUID(token.ID), + surrogate: surrogate(token), + ExpiresOn: core.Time(token.ExpiresOn), + }) + return data, errors.JSONMarshalError.Wrap(err) +} + +// UnmarshalJSON decodes JSON +// +// implements json.Unmarshaler +func (token *AccessToken) UnmarshalJSON(payload []byte) (err error) { + type surrogate AccessToken + + var inner struct { + ID core.UUID `json:"id"` + surrogate + ExpiresOn core.Time `json:"expiresOn"` + } + if err = json.Unmarshal(payload, &inner); err != nil { + return errors.JSONUnmarshalError.Wrap(err) + } + *token = AccessToken(inner.surrogate) + token.ID = uuid.UUID(inner.ID) + token.ExpiresOn = inner.ExpiresOn.AsTime() + if token.ID == uuid.Nil { + token.ID = uuid.New() + } + return nil +} diff --git a/access_token_test.go b/access_token_test.go index 70bf9c7..df9e9a1 100644 --- a/access_token_test.go +++ b/access_token_test.go @@ -2,6 +2,7 @@ package gcloudcx_test import ( "encoding/json" + "fmt" "testing" "time" @@ -11,13 +12,8 @@ import ( ) func TestCanMarshallAccessToken(t *testing.T) { - token := gcloudcx.AccessToken{ - Type: "Bearer", - Token: "Very Long String", - ExpiresOn: time.Date(1996, 9, 23, 0, 0, 0, 0, time.UTC), - } - - expected := `{"tokenType": "Bearer", "token": "Very Long String", "tokenExpires": "1996-09-23T00:00:00Z"}` + token := gcloudcx.NewAccessToken("Very Long String", time.Date(1996, 9, 23, 0, 0, 0, 0, time.UTC)) + expected := fmt.Sprintf(`{"id": "%s", "tokenType": "Bearer", "token": "Very Long String", "expiresOn": "1996-09-23T00:00:00Z"}`, token.ID) data, err := json.Marshal(token) require.Nil(t, err, "Failed to marshall token") require.NotEmpty(t, data, "Failed to marshall token") @@ -25,11 +21,11 @@ func TestCanMarshallAccessToken(t *testing.T) { } func TestCanUnmarshallAccessToken(t *testing.T) { - source := `{"tokenType": "Bearer", "token": "Very Long String", "tokenExpires": "1996-09-23T00:00:00Z"}` + source := `{"tokenType": "Bearer", "token": "Very Long String", "expiresOn": "1996-09-23T00:00:00Z"}` token := gcloudcx.AccessToken{} - err := json.Unmarshal([]byte(source), &token) require.Nil(t, err, "Failed to unmarshall token") + assert.NotNil(t, token.ID, "Token ID should not be nil") assert.Equal(t, "Bearer", token.Type) assert.Equal(t, "Very Long String", token.Token) assert.Equal(t, time.Date(1996, 9, 23, 0, 0, 0, 0, time.UTC), token.ExpiresOn) @@ -37,27 +33,18 @@ func TestCanUnmarshallAccessToken(t *testing.T) { } func TestCanTellExpirationOfAccessToken(t *testing.T) { - token := gcloudcx.AccessToken{ - Type: "Bearer", - Token: "Very Long String", - ExpiresOn: time.Now().UTC().Add(2 * time.Hour), - } + token := gcloudcx.NewAccessTokenWithDurationAndType("Very Long String", "Bearer", 2*time.Hour) assert.False(t, token.IsExpired(), "Token should not be expired") assert.True(t, 1*time.Hour < token.ExpiresIn(), "Token should expire in an hour at least") - token.ExpiresOn = time.Now().UTC().AddDate(0, 0, -1) + token = gcloudcx.NewAccessTokenWithType("Bearer", "Very Long String", time.Date(1996, 9, 23, 0, 0, 0, 0, time.UTC)) assert.True(t, token.IsExpired(), "Token should be expired") assert.True(t, time.Duration(0) == token.ExpiresIn(), "Token should expire in 0") } func TestCanResetAccessToken(t *testing.T) { - token := gcloudcx.AccessToken{ - Type: "Bearer", - Token: "Very Long String", - ExpiresOn: time.Now().UTC().Add(2 * time.Hour), - } - + token := gcloudcx.NewAccessTokenWithDuration("Very Long String", 2*time.Hour) token.Reset() assert.Empty(t, token.Token, "The Token string should be empty") assert.Empty(t, token.Type, "The Token type should be empty") @@ -66,12 +53,8 @@ func TestCanResetAccessToken(t *testing.T) { } func TestCanResetGrantAccessToken(t *testing.T) { - token := gcloudcx.AccessToken{ - Type: "Bearer", - Token: "Very Long String", - ExpiresOn: time.Now().UTC().Add(2 * time.Hour), - } - client := gcloudcx.NewClient(&gcloudcx.ClientOptions{}).SetAuthorizationGrant(&gcloudcx.ClientCredentialsGrant{Token: token}) + token := gcloudcx.NewAccessTokenWithDuration("Very Long String", 2*time.Hour) + client := gcloudcx.NewClient(&gcloudcx.ClientOptions{}).SetAuthorizationGrant(&gcloudcx.ClientCredentialsGrant{Token: *token}) assert.Equal(t, "Bearer", client.Grant.AccessToken().Type) assert.Equal(t, "Very Long String", client.Grant.AccessToken().Token) From ef7128bb40d8833711eeb9c15f9fc90911dcb555 Mon Sep 17 00:00:00 2001 From: Gildas Cherruel Date: Thu, 13 Jun 2024 14:12:25 +0900 Subject: [PATCH 4/9] a context with a logger can be passed when creating a client --- client.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/client.go b/client.go index 614223a..427429b 100644 --- a/client.go +++ b/client.go @@ -27,6 +27,7 @@ type Client struct { // ClientOptions contains the options to create a new Client type ClientOptions struct { + Context context.Context Region string OrganizationID uuid.UUID DeploymentID uuid.UUID @@ -47,6 +48,9 @@ func NewClient(options *ClientOptions) *Client { if options.RequestTimeout < 2*time.Second { options.RequestTimeout = 10 * time.Second } + if log, err := logger.FromContext(options.Context); err == nil && options.Logger == nil { + options.Logger = log + } client := Client{ Proxy: options.Proxy, DeploymentID: options.DeploymentID, From 8a023d0c5ae8c67260ba1052d635b1add2b20e6f Mon Sep 17 00:00:00 2001 From: Gildas Cherruel Date: Thu, 13 Jun 2024 19:43:55 +0900 Subject: [PATCH 5/9] better logging --- access_token.go | 4 +++- auth_clientcredentials.go | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/access_token.go b/access_token.go index a1619c0..90d8e5e 100644 --- a/access_token.go +++ b/access_token.go @@ -125,7 +125,9 @@ func (token AccessToken) ExpiresIn() time.Duration { // implements logger.Redactable func (token AccessToken) Redact() any { redacted := token - redacted.Token = logger.RedactWithHash(token.Token) + if len(redacted.Token) > 0 { + redacted.Token = logger.RedactWithHash(token.Token) + } return redacted } diff --git a/auth_clientcredentials.go b/auth_clientcredentials.go index bdbd111..7b5e76f 100644 --- a/auth_clientcredentials.go +++ b/auth_clientcredentials.go @@ -34,7 +34,7 @@ func (grant *ClientCredentialsGrant) GetID() uuid.UUID { // // Implements Authorizable func (grant *ClientCredentialsGrant) Authorize(context context.Context, client *Client) (err error) { - log := client.GetLogger(context).Child(nil, "authorize", "grant", "client_credentials") + log := client.GetLogger(context).Child("client", "authorize", "grant", "client_credentials", "token", grant.Token.ID) log.Infof("Authenticating with %s using Client Credentials grant", client.Region) @@ -78,7 +78,7 @@ func (grant *ClientCredentialsGrant) Authorize(context context.Context, client * log.Debugf("New %s token expires on %s", grant.Token.Type, grant.Token.ExpiresOn) if grant.TokenUpdated != nil { - log.Debugf("Sending new token to TokenUpdated chan") + log.Debugf("Sending new token to TokenUpdated Go channel") grant.TokenUpdated <- UpdatedAccessToken{ AccessToken: grant.Token, CustomData: grant.CustomData, From 6ea68c35a473a676a92fd4397548bf15a1035bb6 Mon Sep 17 00:00:00 2001 From: Gildas Cherruel Date: Thu, 13 Jun 2024 19:44:28 +0900 Subject: [PATCH 6/9] Integration Client mus tbe public so it can be updated --- openmessaging_integration.go | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/openmessaging_integration.go b/openmessaging_integration.go index a0440f4..51efb77 100644 --- a/openmessaging_integration.go +++ b/openmessaging_integration.go @@ -30,7 +30,7 @@ type OpenMessagingIntegration struct { CreateStatus string `json:"createStatus,omitempty"` // Initiated, Completed, Error CreateError *ErrorBody `json:"createError,omitempty"` Status string `json:"status,omitempty"` // Active, Inactive - client *Client `json:"-"` + Client *Client `json:"-"` logger *logger.Logger `json:"-"` } @@ -55,7 +55,7 @@ func (integration *OpenMessagingIntegration) Initialize(parameters ...interface{ case uuid.UUID: integration.ID = parameter case *Client: - integration.client = parameter + integration.Client = parameter case *logger.Logger: integration.logger = parameter.Child("integration", "integration", "id", integration.ID) } @@ -107,7 +107,7 @@ func (client *Client) CreateOpenMessagingIntegration(context context.Context, na if err != nil { return nil, err } - integration.client = client + integration.Client = client integration.logger = client.Logger.Child("openmessagingintegration", "openmessagingintegration", "id", integration.ID) return &integration, nil } @@ -119,7 +119,7 @@ func (integration *OpenMessagingIntegration) Delete(context context.Context) err if integration.ID == uuid.Nil { return nil } - return integration.client.Delete( + return integration.Client.Delete( integration.logger.ToContext(context), NewURI("/conversations/messaging/integrations/open/%s", integration.ID), nil, @@ -128,7 +128,7 @@ func (integration *OpenMessagingIntegration) Delete(context context.Context) err func (integration *OpenMessagingIntegration) Refresh(ctx context.Context) error { var value OpenMessagingIntegration - if err := integration.client.Get(ctx, integration.GetURI(), &value); err != nil { + if err := integration.Client.Get(ctx, integration.GetURI(), &value); err != nil { return err } integration.Name = value.Name @@ -155,7 +155,7 @@ func (integration *OpenMessagingIntegration) Update(context context.Context, nam return errors.ArgumentMissing.With("webhookURL") } response := &OpenMessagingIntegration{} - err := integration.client.Patch( + err := integration.Client.Patch( integration.logger.ToContext(context), NewURI("/conversations/messaging/integrations/open/%s", integration.ID), struct { @@ -184,7 +184,7 @@ func (integration *OpenMessagingIntegration) GetRoutingMessageRecipient(context if !integration.IsCreated() { return nil, errors.CreationFailed.With("integration", integration.ID) } - return Fetch[RoutingMessageRecipient](context, integration.client, integration) + return Fetch[RoutingMessageRecipient](context, integration.Client, integration) } // SendInboundTextMessage sends an Open Message text message from the middleware to GENESYS Cloud @@ -214,7 +214,7 @@ func (integration *OpenMessagingIntegration) SendInboundTextMessage(context cont // TODO: attributes and metadata should be of a new type Metadata that containd a map and a []string for keysToRedact result := OpenMessageText{} - err = integration.client.Post( + err = integration.Client.Post( integration.logger.ToContext(context), NewURI("/conversations/messages/%s/inbound/open/message", integration.ID), message, @@ -255,7 +255,7 @@ func (integration *OpenMessagingIntegration) SendInboundReceipt(context context. } result := OpenMessageReceipt{} - err = integration.client.Post( + err = integration.Client.Post( integration.logger.ToContext(context), NewURI("/conversations/messages/%s/inbound/open/receipt", integration.ID), receipt, @@ -286,7 +286,7 @@ func (integration *OpenMessagingIntegration) SendInboundEvents(context context.C return "", err } result := OpenMessageEvents{} - err = integration.client.Post( + err = integration.Client.Post( integration.logger.ToContext(context), NewURI("/conversations/messages/%s/inbound/open/event", integration.ID), events, @@ -307,7 +307,7 @@ func (integration *OpenMessagingIntegration) SendOutboundMessage(context context return nil, errors.ArgumentMissing.With("ID") } result := &AgentlessMessageResult{} - err := integration.client.Post( + err := integration.Client.Post( integration.logger.ToContext(context), "/conversations/messages/agentless", AgentlessMessage{ @@ -333,7 +333,7 @@ func (integration *OpenMessagingIntegration) GetMessageData(context context.Cont return nil, errors.ArgumentMissing.With("messageID") } data := &OpenMessageData{} - err := integration.client.Get( + err := integration.Client.Get( integration.logger.ToContext(context), NewURI("/conversations/messages/%s/details", message.GetID()), data, @@ -341,7 +341,7 @@ func (integration *OpenMessagingIntegration) GetMessageData(context context.Cont if err != nil { return nil, err } - data.Conversation.client = integration.client + data.Conversation.client = integration.Client data.Conversation.logger = integration.logger.Child("conversation", "conversation", "id", data.Conversation.ID) return data, nil } From 1ce5999b7a15bbfc5d0bd0af4558dd420d7cf23e Mon Sep 17 00:00:00 2001 From: Gildas Cherruel Date: Thu, 13 Jun 2024 20:40:44 +0900 Subject: [PATCH 7/9] More Redact errors --- openmessaging_channel.go | 3 ++- openmessaging_from.go | 2 +- openmessaging_message_events.go | 2 +- openmessaging_message_receipt.go | 2 +- openmessaging_message_structured.go | 2 +- openmessaging_message_text.go | 2 +- openmessaging_messagedata.go | 5 +++-- 7 files changed, 10 insertions(+), 8 deletions(-) diff --git a/openmessaging_channel.go b/openmessaging_channel.go index 21503c9..d9cd4d6 100644 --- a/openmessaging_channel.go +++ b/openmessaging_channel.go @@ -28,7 +28,8 @@ type OpenMessageChannel struct { func (channel OpenMessageChannel) Redact() interface{} { redacted := channel if channel.From != nil { - redacted.From = channel.From.Redact().(*OpenMessageFrom) + redactedFrom := channel.From.Redact().(OpenMessageFrom) + redacted.From = &redactedFrom } if len(channel.KeysToRedact) > 0 { redacted.CustomAttributes = make(map[string]string, len(channel.CustomAttributes)) diff --git a/openmessaging_from.go b/openmessaging_from.go index efbbfcc..4776934 100644 --- a/openmessaging_from.go +++ b/openmessaging_from.go @@ -27,7 +27,7 @@ func (from OpenMessageFrom) Redact() interface{} { if len(from.Nickname) > 0 { redacted.Nickname = logger.RedactWithHash(from.Nickname) } - return &redacted + return redacted } // Validate checks if the object is valid diff --git a/openmessaging_message_events.go b/openmessaging_message_events.go index cb55d8b..cd0e805 100644 --- a/openmessaging_message_events.go +++ b/openmessaging_message_events.go @@ -54,7 +54,7 @@ func (message OpenMessageEvents) Redact() interface{} { redacted.Metadata[key] = logger.RedactWithHash(value) } } - return &redacted + return redacted } // MarshalJSON marshals this into JSON diff --git a/openmessaging_message_receipt.go b/openmessaging_message_receipt.go index 1f0dcb1..aa62d9d 100644 --- a/openmessaging_message_receipt.go +++ b/openmessaging_message_receipt.go @@ -101,7 +101,7 @@ func (message OpenMessageReceipt) Redact() interface{} { redacted.Metadata[key] = logger.RedactWithHash(value) } } - return &redacted + return redacted } // MarshalJSON marshals this into JSON diff --git a/openmessaging_message_structured.go b/openmessaging_message_structured.go index b327c68..b8b5b20 100644 --- a/openmessaging_message_structured.go +++ b/openmessaging_message_structured.go @@ -55,7 +55,7 @@ func (message OpenMessageStructured) Redact() interface{} { redacted.Metadata[key] = logger.RedactWithHash(value) } } - return &redacted + return redacted } // MarshalJSON marshals this into JSON diff --git a/openmessaging_message_text.go b/openmessaging_message_text.go index 92c4bd9..b7b083d 100644 --- a/openmessaging_message_text.go +++ b/openmessaging_message_text.go @@ -55,7 +55,7 @@ func (message OpenMessageText) Redact() interface{} { redacted.Metadata[key] = logger.RedactWithHash(value) } } - return &redacted + return redacted } // MarshalJSON marshals this into JSON diff --git a/openmessaging_messagedata.go b/openmessaging_messagedata.go index 92f246c..a81b100 100644 --- a/openmessaging_messagedata.go +++ b/openmessaging_messagedata.go @@ -33,7 +33,8 @@ type OpenMessageData struct { func (messageData OpenMessageData) Redact() interface{} { redacted := messageData if messageData.CreatedBy != nil { - redacted.CreatedBy = messageData.CreatedBy.Redact().(*User) + redactedUser := messageData.CreatedBy.Redact().(User) + redacted.CreatedBy = &redactedUser } if messageData.NormalizedMessage != nil { redacted.NormalizedMessage = messageData.NormalizedMessage.Redact().(OpenMessage) @@ -41,7 +42,7 @@ func (messageData OpenMessageData) Redact() interface{} { if core.GetEnvAsBool("REDACT_MESSAGE_TEXT", true) && len(messageData.Text) > 0 { redacted.Text = logger.RedactWithHash(messageData.Text) } - return &redacted + return redacted } // MarshalJSON marshals this into JSON From 52829215f7974b4fa3d25e8da724aa670394f437 Mon Sep 17 00:00:00 2001 From: Gildas Cherruel Date: Fri, 14 Jun 2024 07:31:07 +0900 Subject: [PATCH 8/9] Updated modules --- go.mod | 28 ++++++++++++++-------------- go.sum | 56 ++++++++++++++++++++++++++++---------------------------- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/go.mod b/go.mod index 56b76a2..27ed098 100644 --- a/go.mod +++ b/go.mod @@ -13,15 +13,15 @@ require ( github.com/google/uuid v1.6.0 github.com/gorilla/mux v1.8.1 github.com/gorilla/securecookie v1.1.2 - github.com/gorilla/websocket v1.5.1 + github.com/gorilla/websocket v1.5.2 github.com/joho/godotenv v1.5.1 github.com/matoous/go-nanoid/v2 v2.1.0 github.com/stretchr/testify v1.9.0 ) require ( - cloud.google.com/go v0.113.0 // indirect - cloud.google.com/go/auth v0.4.2 // indirect + cloud.google.com/go v0.115.0 // indirect + cloud.google.com/go/auth v0.5.1 // indirect cloud.google.com/go/auth/oauth2adapt v0.2.2 // indirect cloud.google.com/go/compute/metadata v0.3.0 // indirect cloud.google.com/go/logging v1.10.0 // indirect @@ -37,7 +37,7 @@ require ( github.com/google/s2a-go v0.1.7 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect github.com/googleapis/gax-go/v2 v2.12.4 // indirect - github.com/huandu/xstrings v1.4.0 // indirect + github.com/huandu/xstrings v1.5.0 // indirect github.com/imdario/mergo v0.3.16 // indirect github.com/mitchellh/copystructure v1.2.0 // indirect github.com/mitchellh/reflectwalk v1.0.2 // indirect @@ -50,18 +50,18 @@ require ( go.opentelemetry.io/otel v1.27.0 // indirect go.opentelemetry.io/otel/metric v1.27.0 // indirect go.opentelemetry.io/otel/trace v1.27.0 // indirect - golang.org/x/crypto v0.23.0 // indirect - golang.org/x/net v0.25.0 // indirect - golang.org/x/oauth2 v0.20.0 // indirect + golang.org/x/crypto v0.24.0 // indirect + golang.org/x/net v0.26.0 // indirect + golang.org/x/oauth2 v0.21.0 // indirect golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.20.0 // indirect - golang.org/x/text v0.15.0 // indirect + golang.org/x/sys v0.21.0 // indirect + golang.org/x/text v0.16.0 // indirect golang.org/x/time v0.5.0 // indirect - google.golang.org/api v0.181.0 // indirect - google.golang.org/genproto v0.0.0-20240521202816-d264139d666e // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20240521202816-d264139d666e // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240521202816-d264139d666e // indirect + google.golang.org/api v0.184.0 // indirect + google.golang.org/genproto v0.0.0-20240610135401-a8a62080eff3 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20240610135401-a8a62080eff3 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240610135401-a8a62080eff3 // indirect google.golang.org/grpc v1.64.0 // indirect - google.golang.org/protobuf v1.34.1 // indirect + google.golang.org/protobuf v1.34.2 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect ) diff --git a/go.sum b/go.sum index 8583f03..290203f 100644 --- a/go.sum +++ b/go.sum @@ -1,8 +1,8 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= -cloud.google.com/go v0.113.0 h1:g3C70mn3lWfckKBiCVsAshabrDg01pQ0pnX1MNtnMkA= -cloud.google.com/go v0.113.0/go.mod h1:glEqlogERKYeePz6ZdkcLJ28Q2I6aERgDDErBg9GzO8= -cloud.google.com/go/auth v0.4.2 h1:sb0eyLkhRtpq5jA+a8KWw0W70YcdVca7KJ8TM0AFYDg= -cloud.google.com/go/auth v0.4.2/go.mod h1:Kqvlz1cf1sNA0D+sYJnkPQOP+JMHkuHeIgVmCRtZOLc= +cloud.google.com/go v0.115.0 h1:CnFSK6Xo3lDYRoBKEcAtia6VSC837/ZkJuRduSFnr14= +cloud.google.com/go v0.115.0/go.mod h1:8jIM5vVgoAEoiVxQ/O4BFTfHqulPZgs/ufEzMcFMdWU= +cloud.google.com/go/auth v0.5.1 h1:0QNO7VThG54LUzKiQxv8C6x1YX7lUrzlAa1nVLF8CIw= +cloud.google.com/go/auth v0.5.1/go.mod h1:vbZT8GjzDf3AVqCcQmqeeM32U9HBFc32vVVAbwDsa6s= cloud.google.com/go/auth/oauth2adapt v0.2.2 h1:+TTV8aXpjeChS9M+aTtN/TjdQnzJvmzKFt//oWu7HX4= cloud.google.com/go/auth/oauth2adapt v0.2.2/go.mod h1:wcYjgpZI9+Yu7LyYBg4pqSiaRkfEK3GQcpb7C/uyF1Q= cloud.google.com/go/compute/metadata v0.3.0 h1:Tz+eQXMEqDIKRsmY3cHTL6FVaynIjX2QxYC4trgAKZc= @@ -88,11 +88,11 @@ github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/gorilla/securecookie v1.1.2 h1:YCIWL56dvtr73r6715mJs5ZvhtnY73hBvEF8kXD8ePA= github.com/gorilla/securecookie v1.1.2/go.mod h1:NfCASbcHqRSY+3a8tlWJwsQap2VX5pwzwo4h3eOamfo= -github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= -github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= +github.com/gorilla/websocket v1.5.2 h1:qoW6V1GT3aZxybsbC6oLnailWnB+qTMVwMreOso9XUw= +github.com/gorilla/websocket v1.5.2/go.mod h1:0n9H61RBAcf5/38py2MCYbxzPIY9rOkpvvMT24Rqs30= github.com/huandu/xstrings v1.3.3/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= -github.com/huandu/xstrings v1.4.0 h1:D17IlohoQq4UcpqD7fDk80P7l+lwAmlFaBHgOipl2FU= -github.com/huandu/xstrings v1.4.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= +github.com/huandu/xstrings v1.5.0 h1:2ag3IFq9ZDANvthTwTiqSSZLjDc+BedvHPAp5tJy2TI= +github.com/huandu/xstrings v1.5.0/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE= github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= @@ -150,8 +150,8 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACk golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.3.0/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= -golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= -golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= +golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= +golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= @@ -167,11 +167,11 @@ golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwY golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= -golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= -golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= +golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= +golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/oauth2 v0.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo= -golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= +golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -187,8 +187,8 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= -golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= +golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= @@ -196,8 +196,8 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= -golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= +golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -209,19 +209,19 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -google.golang.org/api v0.181.0 h1:rPdjwnWgiPPOJx3IcSAQ2III5aX5tCer6wMpa/xmZi4= -google.golang.org/api v0.181.0/go.mod h1:MnQ+M0CFsfUwA5beZ+g/vCBCPXvtmZwRz2qzZk8ih1k= +google.golang.org/api v0.184.0 h1:dmEdk6ZkJNXy1JcDhn/ou0ZUq7n9zropG2/tR4z+RDg= +google.golang.org/api v0.184.0/go.mod h1:CeDTtUEiYENAf8PPG5VZW2yNp2VM3VWbCeTioAZBTBA= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo= -google.golang.org/genproto v0.0.0-20240521202816-d264139d666e h1:axIBUGXSVho2zB+3tJj8l9Qvm/El5vVYPYqhGA5PmJM= -google.golang.org/genproto v0.0.0-20240521202816-d264139d666e/go.mod h1:gOvX/2dWTqh+u3+IHjFeCxinlz5AZ5qhOufbQPub/dE= -google.golang.org/genproto/googleapis/api v0.0.0-20240521202816-d264139d666e h1:SkdGTrROJl2jRGT/Fxv5QUf9jtdKCQh4KQJXbXVLAi0= -google.golang.org/genproto/googleapis/api v0.0.0-20240521202816-d264139d666e/go.mod h1:LweJcLbyVij6rCex8YunD8DYR5VDonap/jYl3ZRxcIU= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240521202816-d264139d666e h1:Elxv5MwEkCI9f5SkoL6afed6NTdxaGoAo39eANBwHL8= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240521202816-d264139d666e/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= +google.golang.org/genproto v0.0.0-20240610135401-a8a62080eff3 h1:8RTI1cmuvdY9J7q/jpJWEj5UfgWjhV5MCoXaYmwLBYQ= +google.golang.org/genproto v0.0.0-20240610135401-a8a62080eff3/go.mod h1:qb66gsewNb7Ghv1enkhJiRfYGWUklv3n6G8UvprOhzA= +google.golang.org/genproto/googleapis/api v0.0.0-20240610135401-a8a62080eff3 h1:QW9+G6Fir4VcRXVH8x3LilNAb6cxBGLa6+GM4hRwexE= +google.golang.org/genproto/googleapis/api v0.0.0-20240610135401-a8a62080eff3/go.mod h1:kdrSS/OiLkPrNUpzD4aHgCq2rVuC/YRxok32HXZ4vRE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240610135401-a8a62080eff3 h1:9Xyg6I9IWQZhRVfCWjKK+l6kI0jHcPesVlMnT//aHNo= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240610135401-a8a62080eff3/go.mod h1:EfXuqaE1J41VCDicxHzUDm+8rk+7ZdXzHV0IhO/I6s0= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg= google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= @@ -238,8 +238,8 @@ google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= google.golang.org/protobuf v1.25.0/go.mod h1:9JNX74DMeImyA3h4bdi1ymwjUzf21/xIlbajtzgsN7c= -google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg= -google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= +google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6hg= +google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33q108Sa+fhmuc+sWQYwY= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= From 5727628a24660de5e3ab4bfa2e6a02d5813275ae Mon Sep 17 00:00:00 2001 From: Gildas Cherruel Date: Fri, 14 Jun 2024 07:34:39 +0900 Subject: [PATCH 9/9] Bumped to version 0.9.1 --- version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version.go b/version.go index 4a14726..05cbb07 100644 --- a/version.go +++ b/version.go @@ -4,7 +4,7 @@ package gcloudcx var commit string // VERSION is the version of this application -var VERSION = "0.9.0" + commit +var VERSION = "0.9.1" + commit // APP is the name of the application const APP string = "GCloudCX Client"