Documentation
¶
Index ¶
- func AgbotAddBusinessPolicy(org, userPw, agbot, polOrg string)
- func AgbotAddPattern(org, userPw, agbot, patternOrg, pattern, nodeOrg string)
- func AgbotList(org string, userPw string, agbot string, namesOnly bool)
- func AgbotListBusinessPolicy(org, userPw, agbot string)
- func AgbotListPatterns(org, userPw, agbot, patternOrg, pattern, nodeOrg string)
- func AgbotRemoveBusinessPolicy(org, userPw, agbot, PolOrg string)
- func AgbotRemovePattern(org, userPw, agbot, patternOrg, pattern, nodeOrg string)
- func BusinessAddPolicy(org string, credToUse string, policy string, jsonFilePath string)
- func BusinessListPolicy(org string, credToUse string, policy string, namesOnly bool)
- func BusinessNewPolicy()
- func BusinessRemovePolicy(org string, credToUse string, policy string, force bool)
- func BusinessUpdatePolicy(org string, credToUse string, policyName string, filePath string)
- func CatalogPatternList(credOrg string, userPw string, displayShort bool, displayLong bool)
- func CatalogServiceList(credOrg string, userPw string, displayShort bool, displayLong bool)
- func NodeAddPolicy(org string, credToUse string, node string, jsonFilePath string)
- func NodeConfirm(org, node, token string, nodeIdTok string)
- func NodeCreate(org, nodeIdTok, node, token, userPw, email string, arch string, ...)
- func NodeList(org string, credToUse string, node string, namesOnly bool)
- func NodeListErrors(org string, credToUse string, node string, long bool)
- func NodeListPolicy(org string, credToUse string, node string)
- func NodeRemove(org, credToUse, node string, force bool)
- func NodeRemovePolicy(org, credToUse, node string, force bool)
- func NodeSetToken(org, credToUse, node, token string)
- func NodeUpdate(org string, credToUse string, node string, filePath string)
- func NodeUpdatePolicy(org, credToUse, node string, jsonfile string)
- func PatternList(org string, userPw string, pattern string, namesOnly bool)
- func PatternListKey(org, userPw, pattern, keyName string)
- func PatternPublish(org, userPw, jsonFilePath, keyFilePath, pubKeyFilePath, patName string)
- func PatternRemove(org, userPw, pattern string, force bool)
- func PatternRemoveKey(org, userPw, pattern, keyName string)
- func PatternUpdate(org string, userPw string, pattern string, filePath string)
- func PatternVerify(org, userPw, pattern, keyFilePath string)
- func ServiceAddPolicy(org string, credToUse string, service string, jsonFilePath string)
- func ServiceList(credOrg, userPw, service string, namesOnly bool)
- func ServiceListAuth(org, userPw, service string, authId uint)
- func ServiceListKey(org, userPw, service, keyName string)
- func ServiceListPolicy(org string, credToUse string, service string)
- func ServiceNewPolicy()
- func ServicePublish(org, userPw, jsonFilePath, keyFilePath, pubKeyFilePath string, ...)
- func ServiceRemove(org, userPw, service string, force bool)
- func ServiceRemoveAuth(org, userPw, service string, authId uint)
- func ServiceRemoveKey(org, userPw, service, keyName string)
- func ServiceRemovePolicy(org string, credToUse string, service string, force bool)
- func ServiceVerify(org, userPw, service, keyFilePath string)
- func Status(org, userPw string)
- func UserCreate(org, userPwCreds, user, pw, email string, isAdmin bool)
- func UserList(org, userPwCreds, theUser string, allUsers, namesOnly bool)
- func UserRemove(org, userPwCreds, user string, force bool)
- func UserSetAdmin(org, userPwCreds, user string, isAdmin bool)
- func Version(org, userPw string)
- type AbstractServiceFile
- type CatalogPatternWithMediumInfo
- type CatalogServiceWithMediumInfo
- type DeploymentConfig
- type DeploymentOverrides
- type EventLog
- type ExchangeAgbotPatterns
- type ExchangeAgbots
- type ExchangeNodes
- type ExchangePatterns
- type ExchangeUsers
- type GetServicesResponse
- type NodeExchangePatchToken
- type PatternFile
- type PatternInput
- type PatternOutput
- type ServedBusinessPolicy
- type ServedPattern
- type ServiceChoice
- type ServiceChoiceFile
- type ServiceDockAuthExch
- type ServiceExch
- type ServiceFile
- func (sf *ServiceFile) ConvertToDeploymentDescription(agreementService bool) (*DeploymentConfig, *containermessage.DeploymentDescription, error)
- func (sf *ServiceFile) DefinesVariable(name string) string
- func (sf *ServiceFile) GetArch() string
- func (sf *ServiceFile) GetOrg() string
- func (sf *ServiceFile) GetURL() string
- func (sf *ServiceFile) GetUserInputs() []exchange.UserInput
- func (sf *ServiceFile) GetVersion() string
- func (sf *ServiceFile) HasDependencies() bool
- func (sf *ServiceFile) IsDependent(deps []exchange.ServiceDependency) bool
- func (sf *ServiceFile) RequiredVariablesAreSet(setVars map[string]interface{}) error
- func (sf *ServiceFile) SignAndPublish(org, userPw, jsonFilePath, keyFilePath, pubKeyFilePath string, ...)
- func (sf *ServiceFile) SupportVersionRange()
- type ServiceOverrides
- type ServicePolicyFile
- type ServiceReference
- type ServiceReferenceFile
- type UserExchangePatchAdmin
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AgbotAddBusinessPolicy ¶
func AgbotAddBusinessPolicy(org, userPw, agbot, polOrg string)
Add the business policy to the agot supporting list. Currently all the patterns are open to all the nodes within the same organization.
func AgbotAddPattern ¶
func AgbotAddPattern(org, userPw, agbot, patternOrg, pattern, nodeOrg string)
func AgbotListBusinessPolicy ¶
func AgbotListBusinessPolicy(org, userPw, agbot string)
func AgbotListPatterns ¶
func AgbotListPatterns(org, userPw, agbot, patternOrg, pattern, nodeOrg string)
func AgbotRemoveBusinessPolicy ¶
func AgbotRemoveBusinessPolicy(org, userPw, agbot, PolOrg string)
Remove the business policy from the agot supporting list. Currently only supporting removing all the policies from a organization.
func AgbotRemovePattern ¶
func AgbotRemovePattern(org, userPw, agbot, patternOrg, pattern, nodeOrg string)
func BusinessAddPolicy ¶
BusinessAddPolicy will add a new policy or overwrite an existing policy byt he same name in the Horizon Exchange
func BusinessListPolicy ¶
BusinessListPolicy lists all the policies in the org or only the specified policy if one is given
func BusinessNewPolicy ¶
func BusinessNewPolicy()
Display an empty business policy template as an object.
func BusinessRemovePolicy ¶
BusinessRemovePolicy will remove an existing business policy in the Horizon Exchange
func BusinessUpdatePolicy ¶
BusinessUpdatePolicy will replace a single attribute of a business policy in the Horizon Exchange
func CatalogPatternList ¶
List the public pattern resources for orgType:IBM.
func CatalogServiceList ¶
List the public service resources for orgType:IBM. The userPw can be the userId:password auth or the nodeId:token auth.
func NodeAddPolicy ¶
func NodeConfirm ¶
func NodeCreate ¶
func NodeListErrors ¶
NodeListErrors Displays the node errors currently surfaced to the exchange
func NodeListPolicy ¶
func NodeRemove ¶
func NodeRemovePolicy ¶
func NodeSetToken ¶
func NodeSetToken(org, credToUse, node, token string)
func NodeUpdatePolicy ¶
func PatternList ¶
List the pattern resources for the given org. The userPw can be the userId:password auth or the nodeId:token auth.
func PatternListKey ¶
func PatternListKey(org, userPw, pattern, keyName string)
List the public keys that can be used to verify the deployment_overrides_signature for a pattern. The userPw can be the userId:password auth or the nodeId:token auth.
func PatternPublish ¶
func PatternPublish(org, userPw, jsonFilePath, keyFilePath, pubKeyFilePath, patName string)
PatternPublish signs the MS def and puts it in the exchange
func PatternRemove ¶
func PatternRemoveKey ¶
func PatternRemoveKey(org, userPw, pattern, keyName string)
func PatternVerify ¶
func PatternVerify(org, userPw, pattern, keyFilePath string)
Verify that the deployment_overrides_signature is valid for the given key. The userPw can be the userId:password auth or the nodeId:token auth.
func ServiceAddPolicy ¶
ServiceAddPolicy adds a policy or replaces an existing policy for the service in the Horizon Exchange
func ServiceList ¶
List the the service resources for the given org. The userPw can be the userId:password auth or the nodeId:token auth.
func ServiceListAuth ¶
List the docker auth that can be used to get the images for the service The userPw can be the userId:password auth or the nodeId:token auth.
func ServiceListKey ¶
func ServiceListKey(org, userPw, service, keyName string)
List the public keys for a service that can be used to verify the deployment signature for the service The userPw can be the userId:password auth or the nodeId:token auth.
func ServiceListPolicy ¶
ServiceListPolicy lists the policy for the service in the Horizon Exchange
func ServiceNewPolicy ¶
func ServiceNewPolicy()
Display an empty service policy template as an object.
func ServicePublish ¶
func ServicePublish(org, userPw, jsonFilePath, keyFilePath, pubKeyFilePath string, dontTouchImage bool, pullImage bool, registryTokens []string, overwrite bool, servicePolicyFilePath string)
ServicePublish signs the MS def and puts it in the exchange
func ServiceRemove ¶
func ServiceRemoveAuth ¶
func ServiceRemoveKey ¶
func ServiceRemoveKey(org, userPw, service, keyName string)
func ServiceRemovePolicy ¶
ServiceRemovePolicy removes the service policy in the exchange
func ServiceVerify ¶
func ServiceVerify(org, userPw, service, keyFilePath string)
ServiceVerify verifies the deployment strings of the specified service resource in the exchange. The userPw can be the userId:password auth or the nodeId:token auth.
func UserCreate ¶
func UserRemove ¶
func UserSetAdmin ¶
Types ¶
type AbstractServiceFile ¶
type CatalogPatternWithMediumInfo ¶
type CatalogPatternWithMediumInfo struct {
Description string `json:"description"`
}
type DeploymentConfig ¶
type DeploymentConfig struct {
Services map[string]*containermessage.Service `json:"services"`
}
func ConvertToDeploymentConfig ¶
func ConvertToDeploymentConfig(deployment interface{}) *DeploymentConfig
Take the deployment field, which we have told the json unmarshaller was unknown type (so we can handle both escaped string and struct) and turn it into the DeploymentConfig struct we really want.
func (DeploymentConfig) CLIString ¶
func (dc DeploymentConfig) CLIString() string
func (DeploymentConfig) CanStartStop ¶
func (dc DeploymentConfig) CanStartStop() error
A validation method. Is there enough info in the deployment config to start a container? If not, the missing info is returned in the error message. Note that when there is a complete absence of deployment config metadata, that's ok too for services.
func (DeploymentConfig) HasAnyServices ¶
func (dc DeploymentConfig) HasAnyServices() bool
func (DeploymentConfig) String ¶
func (dc DeploymentConfig) String() string
type DeploymentOverrides ¶
type DeploymentOverrides struct {
Services map[string]ServiceOverrides `json:"services"`
}
func ConvertToDeploymentOverrides ¶
func ConvertToDeploymentOverrides(deployment interface{}) *DeploymentOverrides
Take the deployment overrides field, which we have told the json unmarshaller was unknown type (so we can handle both escaped string and struct) and turn it into the DeploymentOverrides struct we really want.
type EventLog ¶
type EventLog struct { Id string `json:"record_id"` // unique primary key for records Timestamp string `json:"timestamp"` // converted to "yyyy-mm-dd hh:mm:ss" format Severity string `json:"severity"` // info, warning or error Message string `json:"message"` EventCode string `json:"event_code"` SourceType string `json:"source_type"` // the type of the source. It can be agreement, service, image, workload etc. Source *json.RawMessage `json:"event_source"` // source involved for this event. }
Format for outputting eventlog objects
type ExchangeAgbotPatterns ¶
type ExchangeAgbotPatterns struct {
Patterns map[string]interface{} `json:"patterns"`
}
type ExchangeAgbots ¶
type ExchangeAgbots struct { LastIndex int `json:"lastIndex"` Agbots map[string]interface{} `json:"agbots"` }
We only care about handling the agbot names, so the rest is left as interface{} and will be passed from the exchange to the display
type ExchangeNodes ¶
type ExchangeNodes struct { LastIndex int `json:"lastIndex"` Nodes map[string]interface{} `json:"nodes"` }
We only care about handling the node names, so the rest is left as interface{} and will be passed from the exchange to the display
type ExchangePatterns ¶
type ExchangePatterns struct { Patterns map[string]PatternOutput `json:"patterns"` LastIndex int `json:"lastIndex"` }
todo: only using these instead of exchange.GetPatternResponse because exchange.Pattern is missing the LastUpdated field
type ExchangeUsers ¶
type GetServicesResponse ¶
type GetServicesResponse struct { Services map[string]ServiceExch `json:"services"` LastIndex int `json:"lastIndex"` }
type NodeExchangePatchToken ¶
type NodeExchangePatchToken struct {
Token string `json:"token"`
}
type PatternFile ¶
type PatternFile struct { Name string `json:"name,omitempty"` Org string `json:"org,omitempty"` // optional Label string `json:"label"` Description string `json:"description,omitempty"` Public bool `json:"public"` Services []ServiceReferenceFile `json:"services"` AgreementProtocols []exchange.AgreementProtocol `json:"agreementProtocols,omitempty"` UserInput []policy.UserInput `json:"userInput,omitempty"` }
type PatternInput ¶
type PatternInput struct { Label string `json:"label"` Description string `json:"description,omitempty"` Public bool `json:"public"` Services []ServiceReference `json:"services,omitempty"` AgreementProtocols []exchange.AgreementProtocol `json:"agreementProtocols,omitempty"` UserInput []policy.UserInput `json:"userInput,omitempty"` }
type PatternOutput ¶
type PatternOutput struct { Owner string `json:"owner"` Label string `json:"label"` Description string `json:"description"` Public bool `json:"public"` Services []ServiceReference `json:"services"` AgreementProtocols []exchange.AgreementProtocol `json:"agreementProtocols"` UserInput []policy.UserInput `json:"userInput,omitempty"` LastUpdated string `json:"lastUpdated"` }
type ServedBusinessPolicy ¶
type ServedPattern ¶
type ServiceChoice ¶
type ServiceChoice struct { Version string `json:"version"` // the version of the service Priority exchange.WorkloadPriority `json:"priority,omitempty"` // the highest priority service is tried first for an agreement, if it fails, the next priority is tried. Priority 1 is the highest, priority 2 is next, etc. Upgrade exchange.UpgradePolicy `json:"upgradePolicy,omitempty"` DeploymentOverrides string `json:"deployment_overrides,omitempty"` // env var overrides for the service DeploymentOverridesSignature string `json:"deployment_overrides_signature,omitempty"` // signature of env var overrides }
type ServiceChoiceFile ¶
type ServiceChoiceFile struct { Version string `json:"version"` // the version of the service Priority *exchange.WorkloadPriority `json:"priority,omitempty"` // the highest priority service is tried first for an agreement, if it fails, the next priority is tried. Priority 1 is the highest, priority 2 is next, etc. Upgrade *exchange.UpgradePolicy `json:"upgradePolicy,omitempty"` DeploymentOverrides interface{} `json:"deployment_overrides,omitempty"` // env var overrides for the service DeploymentOverridesSignature string `json:"deployment_overrides_signature,omitempty"` // signature of env var overrides }
type ServiceDockAuthExch ¶
type ServiceExch ¶
type ServiceExch struct { Owner string `json:"owner,omitempty"` Label string `json:"label"` Description string `json:"description"` Public bool `json:"public"` Documentation string `json:"documentation"` URL string `json:"url"` Version string `json:"version"` Arch string `json:"arch"` Sharable string `json:"sharable"` MatchHardware map[string]interface{} `json:"matchHardware"` RequiredServices []exchange.ServiceDependency `json:"requiredServices"` UserInputs []exchange.UserInput `json:"userInput"` Deployment string `json:"deployment"` DeploymentSignature string `json:"deploymentSignature"` LastUpdated string `json:"lastUpdated,omitempty"` }
This is used as the input/output to the exchange to create/read the service. The main differences are: no org, deployment is an escaped string, and optional owner and last updated
type ServiceFile ¶
type ServiceFile struct { Org string `json:"org"` // optional Label string `json:"label"` Description string `json:"description"` Public bool `json:"public"` Documentation string `json:"documentation"` URL string `json:"url"` Version string `json:"version"` Arch string `json:"arch"` Sharable string `json:"sharable"` MatchHardware map[string]interface{} `json:"matchHardware,omitempty"` RequiredServices []exchange.ServiceDependency `json:"requiredServices"` UserInputs []exchange.UserInput `json:"userInput"` Deployment interface{} `json:"deployment"` // interface{} because pre-signed services can be stringified json DeploymentSignature string `json:"deploymentSignature,omitempty"` }
This is used when reading json file the user gives us as input to create the service struct
func (*ServiceFile) ConvertToDeploymentDescription ¶
func (sf *ServiceFile) ConvertToDeploymentDescription(agreementService bool) (*DeploymentConfig, *containermessage.DeploymentDescription, error)
Convert the Deployment Configuration to a full Deployment Description.
func (*ServiceFile) DefinesVariable ¶
func (sf *ServiceFile) DefinesVariable(name string) string
Returns true if the service definition userinputs define the variable.
func (*ServiceFile) GetArch ¶
func (sf *ServiceFile) GetArch() string
func (*ServiceFile) GetOrg ¶
func (sf *ServiceFile) GetOrg() string
func (*ServiceFile) GetURL ¶
func (sf *ServiceFile) GetURL() string
func (*ServiceFile) GetUserInputs ¶
func (sf *ServiceFile) GetUserInputs() []exchange.UserInput
func (*ServiceFile) GetVersion ¶
func (sf *ServiceFile) GetVersion() string
func (*ServiceFile) HasDependencies ¶
func (sf *ServiceFile) HasDependencies() bool
Returns true if the service definition has required services.
func (*ServiceFile) IsDependent ¶
func (sf *ServiceFile) IsDependent(deps []exchange.ServiceDependency) bool
Return true if the service definition is a dependency in the input list of service references.
func (*ServiceFile) RequiredVariablesAreSet ¶
func (sf *ServiceFile) RequiredVariablesAreSet(setVars map[string]interface{}) error
Verify that non default user inputs are set in the input map.
func (*ServiceFile) SignAndPublish ¶
func (sf *ServiceFile) SignAndPublish(org, userPw, jsonFilePath, keyFilePath, pubKeyFilePath string, dontTouchImage bool, pullImage bool, registryTokens []string, promptForOverwrite bool)
Sign and publish the service definition. This is a function that is reusable across different hzn commands.
func (*ServiceFile) SupportVersionRange ¶
func (sf *ServiceFile) SupportVersionRange()
type ServiceOverrides ¶
type ServiceOverrides struct {
Environment []string `json:"environment,omitempty"`
}
These 5 structs are used when reading json file the user gives us as input to create the pattern struct
type ServicePolicyFile ¶
type ServicePolicyFile struct { Properties externalpolicy.PropertyList `json:"properties"` Constraints externalpolicy.ConstraintExpression `json:"constraints"` }
type ServiceReference ¶
type ServiceReference struct { ServiceURL string `json:"serviceUrl"` // refers to a service definition in the exchange ServiceOrg string `json:"serviceOrgid"` // the org holding the service definition ServiceArch string `json:"serviceArch"` // the hardware architecture of the service definition AgreementLess bool `json:"agreementLess,omitempty"` // a special case where this service will also be required by others ServiceVersions []ServiceChoice `json:"serviceVersions,omitempty"` // a list of service version for rollback DataVerify exchange.DataVerification `json:"dataVerification,omitempty"` // policy for verifying that the node is sending data NodeH *exchange.NodeHealth `json:"nodeHealth,omitempty"` // this needs to be a ptr so it will be omitted if not specified, so exchange will default it }
type ServiceReferenceFile ¶
type ServiceReferenceFile struct { ServiceURL string `json:"serviceUrl"` // refers to a service definition in the exchange ServiceOrg string `json:"serviceOrgid"` // the org holding the service definition ServiceArch string `json:"serviceArch"` // the hardware architecture of the service definition AgreementLess bool `json:"agreementLess,omitempty"` // a special case where this service will also be required by others ServiceVersions []ServiceChoiceFile `json:"serviceVersions"` // a list of service version for rollback DataVerify *exchange.DataVerification `json:"dataVerification,omitempty"` // policy for verifying that the node is sending data NodeH *exchange.NodeHealth `json:"nodeHealth,omitempty"` // this needs to be a ptr so it will be omitted if not specified, so exchange will default it }
type UserExchangePatchAdmin ¶
type UserExchangePatchAdmin struct {
Admin bool `json:"admin"`
}