Documentation ¶
Overview ¶
*
- Copyright 2021 Napptive *
- 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 *
- https://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.
*
- Copyright 2021 Napptive *
- 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 *
- https://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 ¶
const AgentHeader = "agent"
AgentHeader with the key name for the agent payload.
const AgentValue = "catalog"
AgentValue with the value for the agent payload.
const AuthorizationHeader = "authorization"
AuthorizationHeader with the key name for the authorization payload.
const ContextTimeout = 5 * time.Minute
ContextTimeout with the default timeout for Napptive catalog operations.
const VersionHeader = "version"
VersionHeader with the key name for the version payload.
Variables ¶
This section is empty.
Functions ¶
func CheckNotEmpty ¶
CheckNotEmpty returns an error if the given attribute is empty.
func CheckPositive ¶
CheckPositive returns an error if the given value is less or equal than zero.
Types ¶
type AuthToken ¶
type AuthToken struct { // AuthEnable with a flag if the authentication is enabled or not AuthEnable bool // Token with the token to send Token string // Version with the version sent in the metadata Version string }
AuthToken with a struct to manage and send the token in the context metadata
func NewAuthToken ¶
NewContextHelper creates a ContextHelper with a given configuration.
func (*AuthToken) GetContext ¶
func (a *AuthToken) GetContext() (context.Context, context.CancelFunc)
GetContext returns a context depending if the metadata is enabled or not
type Config ¶
type Config struct { ConnectionConfig TokenConfig Version string Commit string Debug bool // PrinterType defines how results are to be shown. PrinterType string }
Config structure with all the options required by the service and service components.
type ConnectionConfig ¶
type ConnectionConfig struct { // ServerAddress with the dns/IP of the catalog-manager gRPC server. CatalogAddress string // ServerPort with the port of the catalog-manager gRPC server. CatalogPort int // AuthEnable with a flag to indicate if the authentication is enabled or not AuthEnable bool // UseTLS indicates that a TLS connection is expected with the Catalog Manager. UseTLS bool // SkipCertValidation flag that enables ignoring the validation step of the certificate presented by the server. SkipCertValidation bool }
ConnectionConfig contains the configuration elements related to the connection with the Catalog-Manager API.
func (*ConnectionConfig) GetEffectiveAddress ¶
func (cc *ConnectionConfig) GetEffectiveAddress() string
GetEffectiveAddress returns an address:port string.
func (*ConnectionConfig) IsValid ¶
func (cc *ConnectionConfig) IsValid() error
IsValid checks if the configuration options are valid.
func (*ConnectionConfig) Print ¶
func (cc *ConnectionConfig) Print()
Print the configuration using the application logger.
type TokenConfig ¶
type TokenConfig struct { // Token with the JWT. Token string // RefreshToken contains a JWT that can be used to renew the active JWT. Refresh string }
TokenConfig with a struct to load the JWT token