diff --git a/go.mod b/go.mod index b2003d91..8b766586 100644 --- a/go.mod +++ b/go.mod @@ -5,7 +5,7 @@ go 1.19 require ( github.com/AlecAivazis/survey/v2 v2.3.5 github.com/MakeNowJust/heredoc/v2 v2.0.1 - github.com/OctopusDeploy/go-octopusdeploy/v2 v2.15.0 + github.com/OctopusDeploy/go-octopusdeploy/v2 v2.15.1 github.com/briandowns/spinner v1.19.0 github.com/google/uuid v1.3.0 github.com/hashicorp/go-multierror v1.1.1 diff --git a/go.sum b/go.sum index 6bf5f62d..3933efec 100644 --- a/go.sum +++ b/go.sum @@ -46,8 +46,8 @@ github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2 h1:+vx7roKuyA63n github.com/Netflix/go-expect v0.0.0-20220104043353-73e0943537d2/go.mod h1:HBCaDeC1lPdgDeDbhX8XFpy1jqjK0IBG8W5K+xYqA0w= github.com/OctopusDeploy/go-octopusdeploy/v2 v2.14.0 h1:BMFtEXFvzp+m942qRBfautdPE4V+jzWBFLSB2ShTDGc= github.com/OctopusDeploy/go-octopusdeploy/v2 v2.14.0/go.mod h1:2j9rwRfb5qUs9PEJ3W331W84kRaNge5bed4D7JR1ruU= -github.com/OctopusDeploy/go-octopusdeploy/v2 v2.15.0 h1:8R5q30r9oGJKclKbXDZdWHjyZdosYjqKQsiSaK6E9L8= -github.com/OctopusDeploy/go-octopusdeploy/v2 v2.15.0/go.mod h1:2j9rwRfb5qUs9PEJ3W331W84kRaNge5bed4D7JR1ruU= +github.com/OctopusDeploy/go-octopusdeploy/v2 v2.15.1 h1:AJ/UhXqHpFZOK2EtdSBvqTseIDb9VxqXS9Rosneco8w= +github.com/OctopusDeploy/go-octopusdeploy/v2 v2.15.1/go.mod h1:2j9rwRfb5qUs9PEJ3W331W84kRaNge5bed4D7JR1ruU= github.com/briandowns/spinner v1.19.0 h1:s8aq38H+Qju89yhp89b4iIiMzMm8YN3p6vGpwyh/a8E= github.com/briandowns/spinner v1.19.0/go.mod h1:mQak9GHqbspjC/5iUx3qMlIho8xBS/ppAL/hX5SmPJU= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= diff --git a/pkg/cmd/target/azure-web-app/azure-web-app.go b/pkg/cmd/target/azure-web-app/azure-web-app.go index 555fe271..d935c608 100644 --- a/pkg/cmd/target/azure-web-app/azure-web-app.go +++ b/pkg/cmd/target/azure-web-app/azure-web-app.go @@ -3,6 +3,7 @@ package azure_web_app import ( "fmt" cmdCreate "github.com/OctopusDeploy/cli/pkg/cmd/target/azure-web-app/create" + cmdList "github.com/OctopusDeploy/cli/pkg/cmd/target/azure-web-app/list" "github.com/OctopusDeploy/cli/pkg/constants" "github.com/OctopusDeploy/cli/pkg/factory" "github.com/spf13/cobra" @@ -16,7 +17,7 @@ func NewCmdAzureWebApp(f factory.Factory) *cobra.Command { Example: fmt.Sprintf("$ %s deployment-target azure-web-app list", constants.ExecutableName), } - //cmd.AddCommand(cmdList.NewCmdList(f)) + cmd.AddCommand(cmdList.NewCmdList(f)) cmd.AddCommand(cmdCreate.NewCmdCreate(f)) return cmd } diff --git a/pkg/cmd/target/azure-web-app/list/list.go b/pkg/cmd/target/azure-web-app/list/list.go new file mode 100644 index 00000000..6d82cfb8 --- /dev/null +++ b/pkg/cmd/target/azure-web-app/list/list.go @@ -0,0 +1,30 @@ +package list + +import ( + "fmt" + "github.com/MakeNowJust/heredoc/v2" + "github.com/OctopusDeploy/cli/pkg/cmd" + "github.com/OctopusDeploy/cli/pkg/cmd/target/list" + "github.com/OctopusDeploy/cli/pkg/constants" + "github.com/OctopusDeploy/cli/pkg/factory" + "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/machines" + "github.com/spf13/cobra" +) + +func NewCmdList(f factory.Factory) *cobra.Command { + cmd := &cobra.Command{ + Use: "list", + Short: "List Azure Web App deployment targets in an instance of Octopus Deploy", + Long: "List Azure Web App deployment targets in an instance of Octopus Deploy.", + Example: fmt.Sprintf(heredoc.Doc(` + $ %s deployment-target azure-web-app list + `), constants.ExecutableName), + RunE: func(c *cobra.Command, args []string) error { + dependencies := cmd.NewDependencies(f, c) + options := list.NewListOptions(dependencies, c, machines.MachinesQuery{DeploymentTargetTypes: []string{"AzureWebApp"}}) + return list.ListRun(options) + }, + } + + return cmd +} diff --git a/pkg/cmd/target/cloud-region/cloud-region.go b/pkg/cmd/target/cloud-region/cloud-region.go index cae2030e..73f3623e 100644 --- a/pkg/cmd/target/cloud-region/cloud-region.go +++ b/pkg/cmd/target/cloud-region/cloud-region.go @@ -3,6 +3,7 @@ package cloud_region import ( "fmt" cmdCreate "github.com/OctopusDeploy/cli/pkg/cmd/target/cloud-region/create" + cmdList "github.com/OctopusDeploy/cli/pkg/cmd/target/cloud-region/list" "github.com/OctopusDeploy/cli/pkg/constants" "github.com/OctopusDeploy/cli/pkg/factory" "github.com/spf13/cobra" @@ -17,5 +18,6 @@ func NewCmdCloudRegion(f factory.Factory) *cobra.Command { } cmd.AddCommand(cmdCreate.NewCmdCreate(f)) + cmd.AddCommand(cmdList.NewCmdList(f)) return cmd } diff --git a/pkg/cmd/target/cloud-region/list/list.go b/pkg/cmd/target/cloud-region/list/list.go new file mode 100644 index 00000000..fbf18b7a --- /dev/null +++ b/pkg/cmd/target/cloud-region/list/list.go @@ -0,0 +1,30 @@ +package list + +import ( + "fmt" + "github.com/MakeNowJust/heredoc/v2" + "github.com/OctopusDeploy/cli/pkg/cmd" + "github.com/OctopusDeploy/cli/pkg/cmd/target/list" + "github.com/OctopusDeploy/cli/pkg/constants" + "github.com/OctopusDeploy/cli/pkg/factory" + "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/machines" + "github.com/spf13/cobra" +) + +func NewCmdList(f factory.Factory) *cobra.Command { + cmd := &cobra.Command{ + Use: "list", + Short: "List Cloud Region deployment targets in an instance of Octopus Deploy", + Long: "List Cloud Region deployment targets in an instance of Octopus Deploy.", + Example: fmt.Sprintf(heredoc.Doc(` + $ %s deployment-target cloud-region list + `), constants.ExecutableName), + RunE: func(c *cobra.Command, args []string) error { + dependencies := cmd.NewDependencies(f, c) + options := list.NewListOptions(dependencies, c, machines.MachinesQuery{DeploymentTargetTypes: []string{"CloudRegion"}}) + return list.ListRun(options) + }, + } + + return cmd +} diff --git a/pkg/cmd/target/delete/delete.go b/pkg/cmd/target/delete/delete.go index 606c0256..280aa3ef 100644 --- a/pkg/cmd/target/delete/delete.go +++ b/pkg/cmd/target/delete/delete.go @@ -17,13 +17,13 @@ import ( type DeleteOptions struct { *cmd.Dependencies - *shared.GetAllTargetsOptions + *shared.GetTargetsOptions } func NewDeleteOptions(dependencies *cmd.Dependencies) *DeleteOptions { return &DeleteOptions{ - Dependencies: dependencies, - GetAllTargetsOptions: shared.NewGetAllTargetsOptions(dependencies), + Dependencies: dependencies, + GetTargetsOptions: shared.NewGetTargetsOptionsForAllTargets(dependencies), } } @@ -48,7 +48,7 @@ func NewCmdDelete(f factory.Factory) *cobra.Command { idOrName := args[0] opts := NewDeleteOptions(deps) - targets, err := opts.GetAllTargetsCallback() + targets, err := opts.GetTargetsCallback() if err != nil { return err } @@ -81,7 +81,7 @@ func NewCmdDelete(f factory.Factory) *cobra.Command { } func deleteRun(opts *DeleteOptions) error { - itemToDelete, err := selectors.Select(opts.Ask, "Select the deployment target you wish to delete:", opts.GetAllTargetsCallback, func(target *machines.DeploymentTarget) string { return target.Name }) + itemToDelete, err := selectors.Select(opts.Ask, "Select the deployment target you wish to delete:", opts.GetTargetsCallback, func(target *machines.DeploymentTarget) string { return target.Name }) if err != nil { return err } diff --git a/pkg/cmd/target/list/list.go b/pkg/cmd/target/list/list.go new file mode 100644 index 00000000..1abfac92 --- /dev/null +++ b/pkg/cmd/target/list/list.go @@ -0,0 +1,148 @@ +package list + +import ( + "fmt" + "github.com/MakeNowJust/heredoc/v2" + "github.com/OctopusDeploy/cli/pkg/cmd" + "github.com/OctopusDeploy/cli/pkg/cmd/target/shared" + "github.com/OctopusDeploy/cli/pkg/constants" + "github.com/OctopusDeploy/cli/pkg/factory" + "github.com/OctopusDeploy/cli/pkg/output" + "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/machines" + "github.com/spf13/cobra" + "strings" +) + +type ListOptions struct { + *cobra.Command + *cmd.Dependencies + *shared.GetTargetsOptions +} + +type Entity struct { + Id string `json:"Id"` + Name string `json:"Name"` +} + +func NewListOptions(dependencies *cmd.Dependencies, command *cobra.Command, query machines.MachinesQuery) *ListOptions { + return &ListOptions{ + Command: command, + Dependencies: dependencies, + GetTargetsOptions: shared.NewGetTargetsOptions(dependencies, query), + } +} + +func NewCmdList(f factory.Factory) *cobra.Command { + cmd := &cobra.Command{ + Use: "list", + Short: "List deployment targets in an instance of Octopus Deploy", + Long: "List deployment targets in an instance of Octopus Deploy.", + Example: fmt.Sprintf(heredoc.Doc(` + $ %s deployment-target list + `), constants.ExecutableName), + RunE: func(c *cobra.Command, args []string) error { + return ListRun(NewListOptions(cmd.NewDependencies(f, c), c, machines.MachinesQuery{})) + }, + } + + return cmd +} + +func ListRun(opts *ListOptions) error { + allTargets, err := opts.GetTargetsCallback() + if err != nil { + return err + } + + type TargetAsJson struct { + Id string `json:"Id"` + Name string `json:"Name"` + Type string `json:"Type"` + Roles []string `json:"Roles"` + Environments []Entity `json:"Environments"` + Tenants []Entity `json:"Tenants"` + TenantTags []string `json:"TenantTags"` + } + + environmentMap, err := GetEnvironmentMap(opts, err) + if err != nil { + return err + } + + tenantMap, err := GetTenantMap(opts, err) + if err != nil { + return err + } + + return output.PrintArray(allTargets, opts.Command, output.Mappers[*machines.DeploymentTarget]{ + Json: func(item *machines.DeploymentTarget) any { + environments := resolveEntities(item.EnvironmentIDs, environmentMap) + tenants := resolveEntities(item.TenantIDs, tenantMap) + return TargetAsJson{ + Id: item.GetID(), + Name: item.Name, + Type: shared.CommunicationStyleToDeploymentTargetTypeMap[item.Endpoint.GetCommunicationStyle()], + Roles: item.Roles, + Environments: environments, + Tenants: tenants, + TenantTags: item.TenantTags, + } + }, + Table: output.TableDefinition[*machines.DeploymentTarget]{ + Header: []string{"NAME", "TYPE", "ROLES", "ENVIRONMENTS", "TENANTS", "TAGS"}, + Row: func(item *machines.DeploymentTarget) []string { + environmentNames := resolveValues(item.EnvironmentIDs, environmentMap) + tenantNames := resolveValues(item.TenantIDs, tenantMap) + return []string{output.Bold(item.Name), shared.CommunicationStyleToDescriptionMap[item.Endpoint.GetCommunicationStyle()], formatAsList(item.Roles), formatAsList(environmentNames), formatAsList(tenantNames), formatAsList(item.TenantTags)} + }, + }, + Basic: func(item *machines.DeploymentTarget) string { + return item.Name + }, + }) +} + +func resolveValues(keys []string, lookup map[string]string) []string { + var values []string + for _, key := range keys { + values = append(values, lookup[key]) + } + return values +} + +func resolveEntities(keys []string, lookup map[string]string) []Entity { + var entities []Entity + for _, k := range keys { + entities = append(entities, Entity{Id: k, Name: lookup[k]}) + } + + return entities +} + +func GetEnvironmentMap(opts *ListOptions, err error) (map[string]string, error) { + environmentMap := make(map[string]string) + allEnvs, err := opts.Client.Environments.GetAll() + if err != nil { + return nil, err + } + for _, e := range allEnvs { + environmentMap[e.GetID()] = e.GetName() + } + return environmentMap, nil +} + +func GetTenantMap(opts *ListOptions, err error) (map[string]string, error) { + tenantMap := make(map[string]string) + allEnvs, err := opts.Client.Tenants.GetAll() + if err != nil { + return nil, err + } + for _, e := range allEnvs { + tenantMap[e.GetID()] = e.Name + } + return tenantMap, nil +} + +func formatAsList(items []string) string { + return strings.Join(items, ",") +} diff --git a/pkg/cmd/target/listening-tentacle/list/list.go b/pkg/cmd/target/listening-tentacle/list/list.go new file mode 100644 index 00000000..9d8dee3f --- /dev/null +++ b/pkg/cmd/target/listening-tentacle/list/list.go @@ -0,0 +1,30 @@ +package list + +import ( + "fmt" + "github.com/MakeNowJust/heredoc/v2" + "github.com/OctopusDeploy/cli/pkg/cmd" + "github.com/OctopusDeploy/cli/pkg/cmd/target/list" + "github.com/OctopusDeploy/cli/pkg/constants" + "github.com/OctopusDeploy/cli/pkg/factory" + "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/machines" + "github.com/spf13/cobra" +) + +func NewCmdList(f factory.Factory) *cobra.Command { + cmd := &cobra.Command{ + Use: "list", + Short: "List Listening Tentacle deployment targets in an instance of Octopus Deploy", + Long: "List Listening Tentacle deployment targets in an instance of Octopus Deploy.", + Example: fmt.Sprintf(heredoc.Doc(` + $ %s deployment-target listening-tentacle list + `), constants.ExecutableName), + RunE: func(c *cobra.Command, args []string) error { + dependencies := cmd.NewDependencies(f, c) + options := list.NewListOptions(dependencies, c, machines.MachinesQuery{DeploymentTargetTypes: []string{"TentaclePassive"}}) + return list.ListRun(options) + }, + } + + return cmd +} diff --git a/pkg/cmd/target/listening-tentacle/listening-tentacle.go b/pkg/cmd/target/listening-tentacle/listening-tentacle.go index 0f6a378d..e89a140f 100644 --- a/pkg/cmd/target/listening-tentacle/listening-tentacle.go +++ b/pkg/cmd/target/listening-tentacle/listening-tentacle.go @@ -4,6 +4,7 @@ import ( "fmt" cmdCreate "github.com/OctopusDeploy/cli/pkg/cmd/target/listening-tentacle/create" + cmdList "github.com/OctopusDeploy/cli/pkg/cmd/target/listening-tentacle/list" "github.com/OctopusDeploy/cli/pkg/constants" "github.com/OctopusDeploy/cli/pkg/factory" "github.com/spf13/cobra" @@ -17,7 +18,7 @@ func NewCmdListeningTentacle(f factory.Factory) *cobra.Command { Example: fmt.Sprintf("$ %s deployment-target listening-tenatacle list", constants.ExecutableName), } - //cmd.AddCommand(cmdList.NewCmdList(f)) + cmd.AddCommand(cmdList.NewCmdList(f)) cmd.AddCommand(cmdCreate.NewCmdCreate(f)) return cmd } diff --git a/pkg/cmd/target/polling-tentacle/list/list.go b/pkg/cmd/target/polling-tentacle/list/list.go new file mode 100644 index 00000000..701ca6f2 --- /dev/null +++ b/pkg/cmd/target/polling-tentacle/list/list.go @@ -0,0 +1,30 @@ +package list + +import ( + "fmt" + "github.com/MakeNowJust/heredoc/v2" + "github.com/OctopusDeploy/cli/pkg/cmd" + "github.com/OctopusDeploy/cli/pkg/cmd/target/list" + "github.com/OctopusDeploy/cli/pkg/constants" + "github.com/OctopusDeploy/cli/pkg/factory" + "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/machines" + "github.com/spf13/cobra" +) + +func NewCmdList(f factory.Factory) *cobra.Command { + cmd := &cobra.Command{ + Use: "list", + Short: "List Polling Tentacle deployment targets in an instance of Octopus Deploy", + Long: "List Polling Tentacle deployment targets in an instance of Octopus Deploy.", + Example: fmt.Sprintf(heredoc.Doc(` + $ %s deployment-target polling-tentacle list + `), constants.ExecutableName), + RunE: func(c *cobra.Command, args []string) error { + dependencies := cmd.NewDependencies(f, c) + options := list.NewListOptions(dependencies, c, machines.MachinesQuery{DeploymentTargetTypes: []string{"TentacleActive"}}) + return list.ListRun(options) + }, + } + + return cmd +} diff --git a/pkg/cmd/target/polling-tentacle/polling-tentacle.go b/pkg/cmd/target/polling-tentacle/polling-tentacle.go new file mode 100644 index 00000000..db7348f9 --- /dev/null +++ b/pkg/cmd/target/polling-tentacle/polling-tentacle.go @@ -0,0 +1,22 @@ +package polling_tentacle + +import ( + "fmt" + + cmdList "github.com/OctopusDeploy/cli/pkg/cmd/target/polling-tentacle/list" + "github.com/OctopusDeploy/cli/pkg/constants" + "github.com/OctopusDeploy/cli/pkg/factory" + "github.com/spf13/cobra" +) + +func NewCmdPollingTentacle(f factory.Factory) *cobra.Command { + cmd := &cobra.Command{ + Use: "polling-tentacle ", + Short: "Manage polling tentacle deployment targets", + Long: "Work with Octopus Deploy polling tentacle deployment targets.", + Example: fmt.Sprintf("$ %s deployment-target polling-tenatacle list", constants.ExecutableName), + } + + cmd.AddCommand(cmdList.NewCmdList(f)) + return cmd +} diff --git a/pkg/cmd/target/shared/comms.go b/pkg/cmd/target/shared/comms.go new file mode 100644 index 00000000..a9da1f1c --- /dev/null +++ b/pkg/cmd/target/shared/comms.go @@ -0,0 +1,26 @@ +package shared + +var CommunicationStyleToDescriptionMap = map[string]string{ + "TentaclePassive": "Listening Tentacle", + "TentacleActive": "Polling Tentacle", + "Ssh": "SSH Connection", + "OfflineDrop": "Offline Package Drop", + "AzureWebApp": "Azure Web App", + "AzureCloudService": "Azure Cloud Service", + "AzureServiceFabricCluster": "Service Fabric Cluster", + "Kubernetes": "Kubernetes Cluster", + "None": "Cloud Region", + "StepPackage": "Step Package", +} + +var CommunicationStyleToDeploymentTargetTypeMap = map[string]string{ + "TentaclePassive": "TentaclePassive", + "TentacleActive": "TentacleActive", + "Ssh": "Ssh", + "OfflineDrop": "OfflineDrop", + "AzureWebApp": "AzureWebApp", + "AzureCloudService": "AzureCloudService", + "AzureServiceFabricCluster": "AzureServiceFabricCluster", + "Kubernetes": "Kubernetes", + "None": "CloudRegion", +} diff --git a/pkg/cmd/target/shared/target.go b/pkg/cmd/target/shared/target.go index d5822238..99ad7a22 100644 --- a/pkg/cmd/target/shared/target.go +++ b/pkg/cmd/target/shared/target.go @@ -4,26 +4,37 @@ import ( "github.com/OctopusDeploy/cli/pkg/cmd" "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/client" "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/machines" + "math" ) -type GetAllTargetsCallback func() ([]*machines.DeploymentTarget, error) +type GetTargetsCallback func() ([]*machines.DeploymentTarget, error) -type GetAllTargetsOptions struct { - GetAllTargetsCallback +type GetTargetsOptions struct { + GetTargetsCallback } -func NewGetAllTargetsOptions(dependencies *cmd.Dependencies) *GetAllTargetsOptions { - return &GetAllTargetsOptions{ - GetAllTargetsCallback: func() ([]*machines.DeploymentTarget, error) { - return getAllTargets(*dependencies.Client) +func NewGetTargetsOptions(dependencies *cmd.Dependencies, query machines.MachinesQuery) *GetTargetsOptions { + return &GetTargetsOptions{ + GetTargetsCallback: func() ([]*machines.DeploymentTarget, error) { + return GetAllTargets(*dependencies.Client, query) }, } } -func getAllTargets(client client.Client) ([]*machines.DeploymentTarget, error) { - res, err := client.Machines.GetAll() +func NewGetTargetsOptionsForAllTargets(dependencies *cmd.Dependencies) *GetTargetsOptions { + return &GetTargetsOptions{ + GetTargetsCallback: func() ([]*machines.DeploymentTarget, error) { + return GetAllTargets(*dependencies.Client, machines.MachinesQuery{}) + }, + } +} + +func GetAllTargets(client client.Client, query machines.MachinesQuery) ([]*machines.DeploymentTarget, error) { + query.Skip = 0 + query.Take = math.MaxInt32 + res, err := client.Machines.Get(query) if err != nil { return nil, err } - return res, nil + return res.Items, nil } diff --git a/pkg/cmd/target/ssh/list/list.go b/pkg/cmd/target/ssh/list/list.go new file mode 100644 index 00000000..a91b6d81 --- /dev/null +++ b/pkg/cmd/target/ssh/list/list.go @@ -0,0 +1,30 @@ +package list + +import ( + "fmt" + "github.com/MakeNowJust/heredoc/v2" + "github.com/OctopusDeploy/cli/pkg/cmd" + "github.com/OctopusDeploy/cli/pkg/cmd/target/list" + "github.com/OctopusDeploy/cli/pkg/constants" + "github.com/OctopusDeploy/cli/pkg/factory" + "github.com/OctopusDeploy/go-octopusdeploy/v2/pkg/machines" + "github.com/spf13/cobra" +) + +func NewCmdList(f factory.Factory) *cobra.Command { + cmd := &cobra.Command{ + Use: "list", + Short: "List SSH deployment targets in an instance of Octopus Deploy", + Long: "List SSH deployment targets in an instance of Octopus Deploy.", + Example: fmt.Sprintf(heredoc.Doc(` + $ %s deployment-target ssh list + `), constants.ExecutableName), + RunE: func(c *cobra.Command, args []string) error { + dependencies := cmd.NewDependencies(f, c) + options := list.NewListOptions(dependencies, c, machines.MachinesQuery{DeploymentTargetTypes: []string{"Ssh"}}) + return list.ListRun(options) + }, + } + + return cmd +} diff --git a/pkg/cmd/target/ssh/ssh.go b/pkg/cmd/target/ssh/ssh.go index a6fb4b35..a2b63576 100644 --- a/pkg/cmd/target/ssh/ssh.go +++ b/pkg/cmd/target/ssh/ssh.go @@ -4,6 +4,7 @@ import ( "fmt" cmdCreate "github.com/OctopusDeploy/cli/pkg/cmd/target/ssh/create" + cmdList "github.com/OctopusDeploy/cli/pkg/cmd/target/ssh/list" "github.com/OctopusDeploy/cli/pkg/constants" "github.com/OctopusDeploy/cli/pkg/factory" "github.com/spf13/cobra" @@ -18,5 +19,6 @@ func NewCmdSsh(f factory.Factory) *cobra.Command { } cmd.AddCommand(cmdCreate.NewCmdCreate(f)) + cmd.AddCommand(cmdList.NewCmdList(f)) return cmd } diff --git a/pkg/cmd/target/target.go b/pkg/cmd/target/target.go index 24c3067a..a284898c 100644 --- a/pkg/cmd/target/target.go +++ b/pkg/cmd/target/target.go @@ -5,7 +5,10 @@ import ( cmdAzureWebApp "github.com/OctopusDeploy/cli/pkg/cmd/target/azure-web-app" cmdCloudRegion "github.com/OctopusDeploy/cli/pkg/cmd/target/cloud-region" cmdDelete "github.com/OctopusDeploy/cli/pkg/cmd/target/delete" + cmdList "github.com/OctopusDeploy/cli/pkg/cmd/target/list" cmdListeningTentacle "github.com/OctopusDeploy/cli/pkg/cmd/target/listening-tentacle" + cmdPollingTentacle "github.com/OctopusDeploy/cli/pkg/cmd/target/polling-tentacle" + cmdSsh "github.com/OctopusDeploy/cli/pkg/cmd/target/ssh" "github.com/OctopusDeploy/cli/pkg/constants" "github.com/OctopusDeploy/cli/pkg/constants/annotations" @@ -25,10 +28,13 @@ func NewCmdDeploymentTarget(f factory.Factory) *cobra.Command { } cmd.AddCommand(cmdListeningTentacle.NewCmdListeningTentacle(f)) + cmd.AddCommand(cmdPollingTentacle.NewCmdPollingTentacle(f)) cmd.AddCommand(cmdSsh.NewCmdSsh(f)) cmd.AddCommand(cmdCloudRegion.NewCmdCloudRegion(f)) cmd.AddCommand(cmdDelete.NewCmdDelete(f)) cmd.AddCommand(cmdAzureWebApp.NewCmdAzureWebApp(f)) + cmd.AddCommand(cmdDelete.NewCmdDelete(f)) + cmd.AddCommand(cmdList.NewCmdList(f)) return cmd }