From d730e225938f587213fb902ccf3443dcbd930a27 Mon Sep 17 00:00:00 2001 From: Vaughn Dice Date: Thu, 25 Jul 2019 12:34:21 -0600 Subject: [PATCH] feat(bundle.go): add License field to Bundle struct per CNAB Spec 1.0 --- bundle/bundle.go | 1 + bundle/bundle_test.go | 1 + testdata/bundles/canonical-bundle.json | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/bundle/bundle.go b/bundle/bundle.go index fd7a2595..7cb6196c 100644 --- a/bundle/bundle.go +++ b/bundle/bundle.go @@ -29,6 +29,7 @@ type Bundle struct { Credentials map[string]Credential `json:"credentials,omitempty" mapstructure:"credentials"` Outputs *OutputsDefinition `json:"outputs,omitempty" mapstructure:"outputs"` Definitions definition.Definitions `json:"definitions,omitempty" mapstructure:"definitions"` + License string `json:"license,omitempty" mapstructure:"license"` // Custom extension metadata is a named collection of auxiliary data whose // meaning is defined outside of the CNAB specification. diff --git a/bundle/bundle_test.go b/bundle/bundle_test.go index 2702cc0f..33942a09 100644 --- a/bundle/bundle_test.go +++ b/bundle/bundle_test.go @@ -437,6 +437,7 @@ func TestBundleMarshallAllThings(t *testing.T) { Name: "testBundle", Description: "something", Version: "1.0", + License: "MIT License", Credentials: map[string]Credential{ "password": cred, }, diff --git a/testdata/bundles/canonical-bundle.json b/testdata/bundles/canonical-bundle.json index 5fcc47d5..3286fe2f 100644 --- a/testdata/bundles/canonical-bundle.json +++ b/testdata/bundles/canonical-bundle.json @@ -1 +1 @@ -{"credentials":{"password":{"description":"a password","env":"PASSWORD","path":"/cnab/app/path"}},"definitions":{"clientCert":{"contentEncoding":"base64","type":"string"},"enabledType":{"default":false,"type":"boolean"},"hostType":{"default":"locahost.localdomain","type":"string"},"portType":{"default":1234,"type":"integer"},"productKeyType":{"type":"string"},"replicaCountType":{"default":3,"type":"integer"}},"description":"something","images":{"server":{"description":"complicated","image":"nginx:1.0","imageType":"docker"}},"invocationImages":[{"image":"deislabs/invocation-image:1.0","imageType":"docker","labels":{"os":"Linux"}}],"name":"testBundle","outputs":{"fields":{"clientCert":{"definition":"clientCert","path":"/cnab/app/outputs/blah"}}},"parameters":{"fields":{"enabled":{"definition":"enabledType","destination":{"env":"ENABLED"}},"host":{"definition":"hostType","destination":{"env":"HOST"}},"port":{"definition":"portType","destination":{"env":"PORT"}},"productKey":{"definition":"productKeyType","destination":{"env":"PRODUCT_KEY"},"immutable":true},"replicaCount":{"definition":"replicaCountType","destination":{"env":"REPLICA_COUNT"}}},"required":["port","host"]},"schemaVersion":"v1.0.0-WD","version":"1.0"} \ No newline at end of file +{"credentials":{"password":{"description":"a password","env":"PASSWORD","path":"/cnab/app/path"}},"definitions":{"clientCert":{"contentEncoding":"base64","type":"string"},"enabledType":{"default":false,"type":"boolean"},"hostType":{"default":"locahost.localdomain","type":"string"},"portType":{"default":1234,"type":"integer"},"productKeyType":{"type":"string"},"replicaCountType":{"default":3,"type":"integer"}},"description":"something","images":{"server":{"description":"complicated","image":"nginx:1.0","imageType":"docker"}},"invocationImages":[{"image":"deislabs/invocation-image:1.0","imageType":"docker","labels":{"os":"Linux"}}],"license":"MIT License","name":"testBundle","outputs":{"fields":{"clientCert":{"definition":"clientCert","path":"/cnab/app/outputs/blah"}}},"parameters":{"fields":{"enabled":{"definition":"enabledType","destination":{"env":"ENABLED"}},"host":{"definition":"hostType","destination":{"env":"HOST"}},"port":{"definition":"portType","destination":{"env":"PORT"}},"productKey":{"definition":"productKeyType","destination":{"env":"PRODUCT_KEY"},"immutable":true},"replicaCount":{"definition":"replicaCountType","destination":{"env":"REPLICA_COUNT"}}},"required":["port","host"]},"schemaVersion":"v1.0.0-WD","version":"1.0"} \ No newline at end of file