Documentation ¶
Index ¶
- Constants
- Variables
- func AuthorizeApplicationContext()
- func AuthorizeOrganizationContext(persist bool)
- func BuildConfigKeyWithID(keyPartial, id string) string
- func CacheAccessRefreshToken(token *ident.Token, id *string)
- func CacheCommands(cmd *cobra.Command)
- func CmdExists(cmd *cobra.Command, args []string) (bool, string)
- func CmdExistsOrExit(cmd *cobra.Command, args []string)
- func EtherscanBaseURL(networkID string) *string
- func FreeInput(label string, defaultValue string, validate func(string) error) string
- func InfrastructureCredentialsConfigFactory() map[string]interface{}
- func InitConfig()
- func InitWorkgroupContract(contractAddress string) *nchain.Contract
- func IsReleaseContext() bool
- func IsReleaseRepositoryContext() bool
- func ListContainers(docker *client.Client, stack string) []types.Container
- func LogContainer(docker *client.Client, containerID string) error
- func LogContainers(docker *client.Client, wg *sync.WaitGroup, stack string) error
- func PromptPagination(paginate bool, page uint64, rpp uint64) (uint64, uint64)
- func PurgeContainers(docker *client.Client, stack string, purgeVolumes bool)
- func PurgeNetwork(docker *client.Client, stack string)
- func RegisterWorkgroupOrganization(workgroupID string)
- func RequireAPIToken() string
- func RequireAccount(params map[string]interface{}) error
- func RequireApplication() error
- func RequireApplicationToken() string
- func RequireConnector(params map[string]interface{}) error
- func RequireContract(contractID, contractType *string, printCreationTxLink bool) (*nchain.Contract, error)
- func RequireInfrastructureFlags(cmd *cobra.Command, withImage bool)
- func RequireL1Network() error
- func RequireL2Network() error
- func RequireNetwork() error
- func RequireOrganization() error
- func RequireOrganizationEndpoints(fn func(), tunnelShutdownFn func(*string), ...)
- func RequireOrganizationKeypair(spec string) (*vault.Key, error)
- func RequireOrganizationVault() error
- func RequirePrivacyPolicyAgreement() bool
- func RequireTermsOfServiceAgreement() bool
- func RequireUserAccessToken() string
- func RequireVault() error
- func RequireWallet() error
- func RequireWorkgroup() error
- func ResolveOrganizationToken() (*ident.Token, error)
- func SHA256(str string) string
- func SelectInput(args []string, label string) string
- func StopContainers(docker *client.Client, stack string)
- type OrganizationMetadata
- type OrganizationType
- type OrganizationWorkgroupMetadata
- type WorkgroupConfig
- type WorkgroupMetadataLegal
- type WorkgroupType
Constants ¶
const ( ASCIIBanner = `` /* 521-byte string literal not displayed */ // Viper downcases key names, so hyphenating for better readability. // 'Partial' keys are to be combined with the application ID they are associated with. // and NOT used by themselves. AccessTokenConfigKey = "access-token" // user-scoped API access token key RefreshTokenConfigKey = "refresh-token" // user-scoped API refresh token key AccountConfigKeyPartial = "account" // app-scoped account ID key OrganizationConfigKeyPartial = "organization" // app-scoped organization ID key WalletConfigKeyPartial = "wallet" // app-scoped HD wallet ID key )
const DefaultPage = 1
const DefaultRpp = 25
const InfrastructureTargetAWS = "aws"
const InfrastructureTargetAzure = "azure"
Variables ¶
var ( ApplicationID string Application *ident.Application WorkgroupID string Workgroup *WorkgroupType OrganizationID string Organization *OrganizationType UserID string User *ident.User UserAccessToken string SubjectAccountID string AccountID string ConnectorID string ContractID string NetworkID string L2NetworkID string NodeID string WalletID string Manifest *provide.Manifest Verbose bool )
var ( EngineID string ProviderID string Region string TargetID string Image string HealthCheckPath string TaskRole string TCPIngressPorts string UDPIngressPorts string AWSAccessKeyID string AWSSecretAccessKey string AzureTenantID string AzureClientID string AzureClientSecret string )
var ApplicationAccessToken string
var BPIEndpoint string
var CfgFile string
var EmailValidation = func(input string) error { if input == "" { return errors.New("email is required") } re := regexp.MustCompile("^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$") if !re.MatchString(input) { return errors.New("invalid email") } return nil }
var ExposeBPITunnel bool
var ExposeMessagingTunnel bool
var ExposeWebsocketMessagingTunnel bool
var HexValidation = func(input string) error { re := regexp.MustCompile("^0x[0-9a-fA-F]{40}$") isHex := re.MatchString(input) if !isHex { return errors.New("input is not a Hex") } return nil }
var JSONValidation = func(input string) error { if len(input) < 1 { return errors.New("field cant be nil") } var js map[string]interface{} if json.Unmarshal([]byte(input), &js) != nil { return errors.New("invalid JSON") } return nil }
var MandatoryNumberValidation = func(input string) error { if len(input) < 1 { return errors.New("field cant be nil") } _, err := strconv.ParseFloat(input, 64) if err != nil { return errors.New("invalid number") } return nil }
var MandatoryValidation = func(input string) error { if input == "" { return errors.New("required") } return nil }
var MessagingEndpoint string
var NoValidation = func(input string) error { return nil }
var NumberValidation = func(input string) error { _, err := strconv.ParseFloat(input, 64) if err != nil { return errors.New("invalid number") } return nil }
var OrganizationAccessToken string
var OrganizationRefreshToken string
var ResolvedBaselineOrgAddress string // HACK
var Tunnel bool
var VaultID string
var WithoutTunnels bool
Functions ¶
func AuthorizeApplicationContext ¶
func AuthorizeApplicationContext()
func AuthorizeOrganizationContext ¶
func AuthorizeOrganizationContext(persist bool)
func BuildConfigKeyWithID ¶
BuildConfigKeyWithID combines the given key partial and ID according to a consistent convention. Returns an empty string if the given id is empty. Viper's getters likewise return empty strings when passed an empty string.
func CacheAccessRefreshToken ¶
func CacheCommands ¶
func CmdExistsOrExit ¶
func EtherscanBaseURL ¶
func InfrastructureCredentialsConfigFactory ¶
func InfrastructureCredentialsConfigFactory() map[string]interface{}
func InitWorkgroupContract ¶
func IsReleaseContext ¶
func IsReleaseContext() bool
IsReleaseContext returns true if `prvd` is run when `pwd` is the root of a Provide release
func IsReleaseRepositoryContext ¶
func IsReleaseRepositoryContext() bool
IsReleaseRepositoryContext is not yet used...
func LogContainers ¶
func PromptPagination ¶
func PurgeNetwork ¶
func RegisterWorkgroupOrganization ¶
func RegisterWorkgroupOrganization(workgroupID string)
func RequireAPIToken ¶
func RequireAPIToken() string
func RequireAccount ¶
RequireAccount is equivalent to a required --account flag
func RequireApplication ¶
func RequireApplication() error
RequireApplication is equivalent to a required --application flag
func RequireApplicationToken ¶
func RequireApplicationToken() string
func RequireConnector ¶
RequireConnector is equivalent to a required --connector flag
func RequireContract ¶
func RequireL1Network ¶
func RequireL1Network() error
RequireL1Network is equivalent to a required --network flag; but list options filtered to show only public l1 networks
func RequireL2Network ¶
func RequireL2Network() error
RequireL2Network is equivalent to a required --l2 flag; but list options filtered to show only public l2 networks
func RequireNetwork ¶
func RequireNetwork() error
RequireNetwork is equivalent to a required --network flag
func RequireOrganization ¶
func RequireOrganization() error
RequireOrganization is equivalent to a required --organization flag
func RequireOrganizationEndpoints ¶
func RequireOrganizationEndpoints(fn func(), tunnelShutdownFn func(*string), apiPort, messagingPort, websocketMessagingPort int)
RequireOrganizationEndpoints fn is the function to call after the tunnel has been established, prior to the runloop and signal handling is installed
func RequireOrganizationVault ¶
func RequireOrganizationVault() error
func RequirePrivacyPolicyAgreement ¶
func RequirePrivacyPolicyAgreement() bool
RequirePrivacyPolicyAgreement is equivalent to a required --privacy flag
func RequireTermsOfServiceAgreement ¶
func RequireTermsOfServiceAgreement() bool
RequireTermsOfServiceAgreement is equivalent to a required --terms flag
func RequireUserAccessToken ¶
func RequireUserAccessToken() string
func RequireWallet ¶
func RequireWallet() error
RequireWallet is equivalent to a required --wallet flag
func RequireWorkgroup ¶
func RequireWorkgroup() error
RequireWorkgroup is equivalent to a required --workgroup flag
func SelectInput ¶
func StopContainers ¶
Types ¶
type OrganizationMetadata ¶
type OrganizationMetadata struct { Address string `json:"address"` BPIEndpoint string `json:"bpi_endpoint"` Domain string `json:"domain"` MessagingEndpoint string `json:"messaging_endpoint"` Workgroups map[uuid.UUID]*OrganizationWorkgroupMetadata `json:"workgroups"` }
Organization metadata
type OrganizationType ¶
type OrganizationType struct { ident.Organization Metadata *OrganizationMetadata `json:"metadata"` }
Organization model; called OrganizationType because Organization is already declared in common
type OrganizationWorkgroupMetadata ¶
type OrganizationWorkgroupMetadata struct { BPIEndpoint *string `json:"bpi_endpoint"` MessagingEndpoint *string `json:"messaging_endpoint"` OperatorSeparationDegree uint32 `json:"operator_separation_degree"` Privacy *WorkgroupMetadataLegal `json:"privacy,omitempty"` SystemSecretIDs []*uuid.UUID `json:"system_secret_ids"` TOS *WorkgroupMetadataLegal `json:"tos,omitempty"` VaultID *uuid.UUID `json:"vault_id"` }
Organization workgroup metadata
type WorkgroupConfig ¶
type WorkgroupConfig struct { Environment *string `json:"environment"` L2NetworkID *uuid.UUID `json:"l2_network_id"` L3NetworkID *uuid.UUID `json:"l3_network_id"` OnboardingComplete bool `json:"onboarding_complete"` SystemSecretIDs []*uuid.UUID `json:"system_secret_ids"` VaultID *uuid.UUID `json:"vault_id"` WebhookSecret *string `json:"webhook_secret"` }
WorkgroupConfig is a baseline workgroup configuration object
type WorkgroupMetadataLegal ¶
type WorkgroupMetadataLegal struct { AgreedAt *time.Time `json:"agreed_at"` Signature *string `json:"signature"` }
Organization workgroup metadata legal data
type WorkgroupType ¶
type WorkgroupType struct { baseline.Workgroup Config *WorkgroupConfig `json:"config"` }
Workgroup is a baseline workgroup context; called WorkgroupType because Workgroup is already declared in common