Skip to content

Commit

Permalink
update CRD
Browse files Browse the repository at this point in the history
  • Loading branch information
philbrookes committed Feb 16, 2018
1 parent 27d198c commit b20f69e
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 11 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@

cmd/mobile/mobile
mobile
coverage.out
integration.test
6 changes: 5 additions & 1 deletion artifacts/mobileclient.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
"spec": {
"name": "myapp",
"apiKey": "25113a4f-48b3-4dbb-b462-e2d388a475ac",
"clientType": "cordova"
"clientType": "cordova",
"excludedServices": [
"test",
"test2"
]
}
}
4 changes: 3 additions & 1 deletion artifacts/mobileclient.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,6 @@ Spec:
clientType: iOS
apiKey: 834d44f-d697-4c56-aec6-47940679f79a
name: app2

excludedServices:
- test1
test2
6 changes: 5 additions & 1 deletion artifacts/mobileclient_crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,8 @@ spec:
type: string
pattern: '(\w-)'
appIdentifier:
type: string
type: string
excludedServices:
type: array
items:
type: string
9 changes: 5 additions & 4 deletions pkg/apis/mobile/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ type MobileClientList struct {
}

type MobileClientSpec struct {
Name string `json:"name"`
ApiKey string `json:"apiKey"`
ClientType string `json:"clientType"`
AppIdentifier string `json:"appIdentifier"`
Name string `json:"name"`
ApiKey string `json:"apiKey"`
ClientType string `json:"clientType"`
AppIdentifier string `json:"appIdentifier"`
ExcludedServices []string `json:"excludedServices"`
}

// +genclient
Expand Down
8 changes: 4 additions & 4 deletions pkg/cmd/clients.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@ func (cc *ClientCmd) ListClientsCmd() *cobra.Command {
mClients := mobileClientList.(*v1alpha1.MobileClientList)
var data [][]string
for _, mClient := range mClients.Items {
data = append(data, []string{mClient.Name, mClient.Spec.Name, mClient.Spec.ClientType, mClient.Spec.AppIdentifier})
data = append(data, []string{mClient.Name, mClient.Spec.Name, mClient.Spec.ClientType, mClient.Spec.AppIdentifier, strings.Join(mClient.Spec.ExcludedServices, ", ")})
}
table := tablewriter.NewWriter(out)
table.AppendBulk(data)
table.SetHeader([]string{"ID", "Name", "ClientType", "AppIdentifier"})
table.SetHeader([]string{"ID", "Name", "ClientType", "AppIdentifier", "ExcludedServices"})
table.Render()
return nil
})
Expand Down Expand Up @@ -113,10 +113,10 @@ Run the "mobile get clients" command from this tool to get the client ID.`,
cc.Out.AddRenderer(command.Name(), "table", func(out io.Writer, mobileClient interface{}) error {
mClient := mobileClient.(*v1alpha1.MobileClient)
var data [][]string
data = append(data, []string{mClient.Name, mClient.Namespace, mClient.Spec.Name, mClient.Spec.ClientType, mClient.Spec.ApiKey, mClient.Spec.AppIdentifier})
data = append(data, []string{mClient.Name, mClient.Namespace, mClient.Spec.Name, mClient.Spec.ClientType, mClient.Spec.ApiKey, mClient.Spec.AppIdentifier, strings.Join(mClient.Spec.ExcludedServices, ", ")})
table := tablewriter.NewWriter(out)
table.AppendBulk(data)
table.SetHeader([]string{"ID", "Namespace", "Name", "ClientType", "ApiKey", "AppIdentifier"})
table.SetHeader([]string{"ID", "Namespace", "Name", "ClientType", "ApiKey", "AppIdentifier", "Excluded Services"})
table.Render()
return nil
})
Expand Down

0 comments on commit b20f69e

Please sign in to comment.