Documentation ¶
Overview ¶
Package sty_shared
This is the STY-Holdings shared services ¶
NOTES:
None
COPYRIGHT & WARRANTY:
Copyright (c) 2022 STY-Holdings, inc All rights reserved. This software is the confidential and proprietary information of STY-Holdings, Inc. Use is subject to license terms. Unauthorized copying of this file, via any medium is strictly prohibited. Proprietary and confidential Written by <Replace with FULL_NAME> / syacko STY-Holdings, Inc. support@sty-holdings.com www.sty-holdings.com 01-2024 USA Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Package sty_shared
General description of the purpose of the go file.
RESTRICTIONS:
AWS functions: * Program must have access to a .awsServices/credentials file in the default location. * This will only access system parameters that start with '/sote' (ROOTPATH). * {Enter other restrictions here for AWS {Other catagories of restrictions} * {List of restrictions for the catagory
NOTES:
{Enter any additional notes that you believe will help the next developer.}
COPYRIGHT:
Copyright 2022 Licensed under the Apache License, Version 2.0 (the License); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an AS IS BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- func BuildInstanceName(method string, nodes ...string) (instanceName string, errorInfo pi.ErrorInfo)
- func BuildTemporaryFiles(tempDirectory string, config NATSConfiguration) (errorInfo pi.ErrorInfo)
- func GetConnection(instanceName string, config NATSConfiguration) (connPtr *nats.Conn, errorInfo pi.ErrorInfo)
- func RequestWithHeader(connectionPtr *nats.Conn, instanceName string, messagePtr *nats.Msg, ...) (responsePtr *nats.Msg, errorInfo pi.ErrorInfo)
- func SendReply(reply interface{}, msg *nats.Msg) (errorInfo pi.ErrorInfo)
- func Subscribe(connectionPtr *nats.Conn, instanceName, subject string, ...) (subscriptionPtr *nats.Subscription, errorInfo pi.ErrorInfo)
- func UnmarshalMessageData(functionName string, msg *nats.Msg, requestPtr any) (errorInfo pi.ErrorInfo)
- type MessageHandler
- type NATSConfiguration
- type NATSReply
- type NATSService
Constants ¶
const ( METHOD_DASHES = "dashes" METHOD_UNDERSCORES = "underscores" METHOD_BLANK = "" CREDENTIAL_FILENAME = "nats-credentials-filename" // Test constants TEST_CREDENTIALS_FILENAME = "/Users/syacko/workspace/styh-dev/src/albert/keys/local/.keys/natsSerices-savup-backend.key" TEST_MESSAGE_ENVIRONMENT = "local" TEST_MESSAGE_NAMESPACE = "nci" TEST_URL = "savup-local-0030.savup.com" TEST_PORT = 4222 TEST_PORT_EMPTY = "" TEST_TLS_CERT = "/Users/syacko/workspace/styh-dev/src/albert/keys/local/.keys/savup/STAR_savup_com/STAR_savup_com.crt" TEST_TLS_PRIVATE_KEY = "/Users/syacko/workspace/styh-dev/src/albert/keys/local/.keys/savup/STAR_savup_com/savup.com.key" TEST_TLS_CA_BUNDLE = "/Users/syacko/workspace/styh-dev/src/albert/keys/local/.keys/savup/STAR_savup_com/CAbundle.crt" // TEST_INVALID_URL = "invalid URL" )
Variables ¶
This section is empty.
Functions ¶
func BuildInstanceName ¶
func BuildInstanceName( method string, nodes ...string, ) ( instanceName string, errorInfo pi.ErrorInfo, )
BuildInstanceName - will create the NATS connection name with dashes, underscores between nodes or as provided. The method can be cn.METHOD_DASHES, cn.METHOD_UNDERSCORES, ctv.VAL_EMPTY, "dashes", "underscores" or ""
Customer Messages: None Errors: error returned by natsServices.Connect Verifications: None
func BuildTemporaryFiles ¶ added in v2024.7.7
func BuildTemporaryFiles( tempDirectory string, config NATSConfiguration, ) ( errorInfo pi.ErrorInfo, )
BuildTemporaryFiles - creates temporary files for Token. The function checks if the NATSCredentialsFilename is provided. If the value is empty, the function returns an error.
Customer Messages: None Errors: ErrRequiredArgumentMissing, returned from WriteFile Verifications: None
func GetConnection ¶
func GetConnection( instanceName string, config NATSConfiguration, ) ( connPtr *nats.Conn, errorInfo pi.ErrorInfo, )
GetConnection - will connect to a NATS leaf server with either a ssl or non-ssl connection. This connection function requires the user credentials file be provided.
Customer Messages: None Errors: error returned by natsSerices.Connect Verifications: None
func RequestWithHeader ¶ added in v2024.9.0
func RequestWithHeader( connectionPtr *nats.Conn, instanceName string, messagePtr *nats.Msg, timeOut time.Duration, ) ( responsePtr *nats.Msg, errorInfo pi.ErrorInfo, )
RequestWithHeader - will submit a request and wait for a response. Min timeOut is 2 seconds and the max is 5 seconds.
Customer Messages: None Errors: None Verifications: None
func SendReply ¶
SendReply - will take in an object, build a json object out of it, and send out the reply
Customer Messages: None Errors: None Verifications: None
func Subscribe ¶
func Subscribe( connectionPtr *nats.Conn, instanceName, subject string, handler nats.MsgHandler, ) ( subscriptionPtr *nats.Subscription, errorInfo pi.ErrorInfo, )
Subscribe - will create a NATS subscription
Customer Messages: None Errors: None Verifications: None
func UnmarshalMessageData ¶
func UnmarshalMessageData( functionName string, msg *nats.Msg, requestPtr any, ) (errorInfo pi.ErrorInfo)
UnmarshalMessageData - reads the message data into the pointer. The second argument must be a pointer. If you pass something else, the unmarshal will fail.
Customer Messages: None Errors: None Verifications: None
Types ¶
type MessageHandler ¶
type MessageHandler struct {
Handler nats.MsgHandler
}