Skip to content

Commit f5588b4

Browse files
ran gofmt -w find . -name '*.go' | grep -v vendor | grep -v testhelpers
1 parent d368ffe commit f5588b4

23 files changed

Lines changed: 514 additions & 513 deletions

plugin/commands/ipsec/detail.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -113,13 +113,13 @@ func (cmd *DetailCommand) Run(args []string) error {
113113
return nil
114114
}
115115

116-
//Yields a mask for a tunnel context
117-
//All exposed properties on the tunnel context service are included inthe constructed mask. Additional joins may be requested.
118-
//addressTranslations: Whether to join the context's address translation entries.
119-
//internalSubnets: Whether to join the context's internal subnet associations.
120-
//remoteSubnets: Whether to join the context's remote subnet associations.
121-
//staticSubnets: Whether to join the context's statically routed subnet associations.
122-
//serviceSubnets: Whether to join the SoftLayer service network subnets.
116+
// Yields a mask for a tunnel context
117+
// All exposed properties on the tunnel context service are included inthe constructed mask. Additional joins may be requested.
118+
// addressTranslations: Whether to join the context's address translation entries.
119+
// internalSubnets: Whether to join the context's internal subnet associations.
120+
// remoteSubnets: Whether to join the context's remote subnet associations.
121+
// staticSubnets: Whether to join the context's statically routed subnet associations.
122+
// serviceSubnets: Whether to join the SoftLayer service network subnets.
123123
func GetTunnelContextMask(addressTranslation, internalSubnets, remoteSubnets, statusSubnets, serviceSubnets bool) string {
124124
mask := "id,accountId,advancedConfigurationFlag,createDate,customerPeerIpAddress,modifyDate,name,friendlyName,internalPeerIpAddress" +
125125
",phaseOneAuthentication,phaseOneDiffieHellmanGroup,phaseOneEncryption,phaseOneKeylife" +

plugin/commands/order/item_list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ func (cmd *ItemListCommand) Run(args []string) error {
6363
return nil
6464
}
6565

66-
//"""sorts the items into a dictionary of categories, with a list of items"""
66+
// """sorts the items into a dictionary of categories, with a list of items"""
6767
func sortItems(items []datatypes.Product_Item) map[string][]datatypes.Product_Item {
6868

6969
sortedItems := make(map[string][]datatypes.Product_Item)

plugin/commands/search/search.go

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,23 @@ package search
22

33
import (
44
"fmt"
5-
"strings"
65
"github.com/IBM-Cloud/ibm-cloud-cli-sdk/plugin"
76
"github.com/spf13/cobra"
7+
"strings"
88

99
"github.com/softlayer/softlayer-go/datatypes"
1010
. "github.ibm.com/SoftLayer/softlayer-cli/plugin/i18n"
1111
"github.ibm.com/SoftLayer/softlayer-cli/plugin/managers"
1212
"github.ibm.com/SoftLayer/softlayer-cli/plugin/metadata"
13-
13+
1414
"github.ibm.com/SoftLayer/softlayer-cli/plugin/utils"
1515
)
1616

1717
type SearchCommand struct {
1818
*metadata.SoftlayerCommand
1919
SearchManager managers.SearchManager
2020
Command *cobra.Command
21-
Query string
21+
Query string
2222
}
2323

2424
func SetupCobraCommands(sl *metadata.SoftlayerCommand) *cobra.Command {
@@ -35,8 +35,8 @@ Examples::
3535
sl search --query 'test.com'
3636
sl search --query '_objectType:SoftLayer_Virtual_Guest test.com'
3737
`),
38-
Args: metadata.NoArgs,
39-
RunE: func(cmd *cobra.Command, args []string) error {
38+
Args: metadata.NoArgs,
39+
RunE: func(cmd *cobra.Command, args []string) error {
4040
return thisCmd.Run(args)
4141
},
4242
}
@@ -56,7 +56,9 @@ func SearchNamespace() plugin.Namespace {
5656
func (cmd *SearchCommand) Run(args []string) error {
5757

5858
results, err := cmd.SearchManager.AdvancedSearch("", cmd.Query)
59-
if err != nil { return err}
59+
if err != nil {
60+
return err
61+
}
6062
if cmd.GetOutputFlag() == "JSON" {
6163
return utils.PrintPrettyJSON(cmd.UI, results)
6264
}
@@ -102,29 +104,29 @@ func parseMatchedTerms(searchResult datatypes.Container_Search_Result) string {
102104
return strings.Join(searchResult.MatchedTerms, "\n")
103105
}
104106
func parseVirtual_Guest(resource datatypes.Virtual_Guest) string {
105-
return fmt.Sprintf(T("ID") + ": %d\n" + T("FQDN") + ": %s\n", *resource.Id, *resource.FullyQualifiedDomainName)
107+
return fmt.Sprintf(T("ID")+": %d\n"+T("FQDN")+": %s\n", *resource.Id, *resource.FullyQualifiedDomainName)
106108
}
107109
func parseEvent_Log(resource datatypes.Event_Log) string {
108-
return fmt.Sprintf(T("ID") + ": %s\n" + T("Event") + ": %s\n", *resource.TraceId, *resource.EventName)
110+
return fmt.Sprintf(T("ID")+": %s\n"+T("Event")+": %s\n", *resource.TraceId, *resource.EventName)
109111
}
110112
func parseVirtual_DedicatedHost(resource datatypes.Virtual_DedicatedHost) string {
111-
return fmt.Sprintf(T("ID") + ": %d\n" + T("Name") + ": %s\n", *resource.Id, *resource.Name)
113+
return fmt.Sprintf(T("ID")+": %d\n"+T("Name")+": %s\n", *resource.Id, *resource.Name)
112114
}
113115
func parseHardware(resource datatypes.Hardware) string {
114-
return fmt.Sprintf(T("ID") + ": %d\n" + T("FQDN") + ": %s\n", *resource.Id, *resource.FullyQualifiedDomainName)
116+
return fmt.Sprintf(T("ID")+": %d\n"+T("FQDN")+": %s\n", *resource.Id, *resource.FullyQualifiedDomainName)
115117
}
116118
func parseNetwork_Application_Delivery_Controller(resource datatypes.Network_Application_Delivery_Controller) string {
117-
return fmt.Sprintf(T("ID") + ": %d\n" + T("Name") + ": %s\n", *resource.Id, *resource.Name)
119+
return fmt.Sprintf(T("ID")+": %d\n"+T("Name")+": %s\n", *resource.Id, *resource.Name)
118120
}
119121
func parseNetwork_Subnet_IpAddress(resource datatypes.Network_Subnet_IpAddress) string {
120-
return fmt.Sprintf(T("ID") + ": %d\n" + T("Ip Address") + ": %s\n", *resource.Id, *resource.IpAddress)
122+
return fmt.Sprintf(T("ID")+": %d\n"+T("Ip Address")+": %s\n", *resource.Id, *resource.IpAddress)
121123
}
122124
func parseNetwork_Vlan(resource datatypes.Network_Vlan) string {
123-
return fmt.Sprintf(T("ID") + ": %d\n" + T("VLAN") + ": %d\n", *resource.Id, *resource.VlanNumber)
125+
return fmt.Sprintf(T("ID")+": %d\n"+T("VLAN")+": %d\n", *resource.Id, *resource.VlanNumber)
124126
}
125127
func parseNetwork_Vlan_Firewall(resource datatypes.Network_Vlan_Firewall) string {
126-
return fmt.Sprintf(T("ID") + ": %d\n" + T("Ip Address") + ": %s\n", *resource.Id, *resource.PrimaryIpAddress)
128+
return fmt.Sprintf(T("ID")+": %d\n"+T("Ip Address")+": %s\n", *resource.Id, *resource.PrimaryIpAddress)
127129
}
128130
func parseTicket(resource datatypes.Ticket) string {
129-
return fmt.Sprintf(T("ID") + ": %d\n" + T("Subject") + ": %s\n", *resource.Id, *resource.Title)
130-
}
131+
return fmt.Sprintf(T("ID")+": %d\n"+T("Subject")+": %s\n", *resource.Id, *resource.Title)
132+
}

plugin/commands/search/search_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ var _ = Describe("Test search commands", func() {
5353
if utils.StringInSlice(commandName, arrayCommands) != -1 {
5454
available = true
5555
}
56-
Expect(available).To(BeTrue(), commandName + " not found in ibmcloud sl " + commands.Name())
56+
Expect(available).To(BeTrue(), commandName+" not found in ibmcloud sl "+commands.Name())
5757
})
5858
}
5959
})
@@ -83,7 +83,7 @@ var _ = Describe("Test search commands", func() {
8383
Expect(err.Error()).To(ContainSubstring("Search Error: Search Error (HTTP 500)"))
8484
})
8585
It("Basic Search Command with query", func() {
86-
err := testhelpers.RunCobraCommand(cliCommand , "-q", `"_objectTpye:SoftLayer_Virtual_Guest test.com`)
86+
err := testhelpers.RunCobraCommand(cliCommand, "-q", `"_objectTpye:SoftLayer_Virtual_Guest test.com`)
8787
Expect(err).NotTo(HaveOccurred())
8888
Expect(fakeUI.Outputs()).To(ContainSubstring("SoftLayer_Network_Vlan"))
8989
Expect(fakeUI.Outputs()).To(ContainSubstring("VLAN |match| ID: 675037"))

plugin/commands/search/types.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
package search
22

33
import (
4-
54
"bytes"
6-
"strconv"
75
"github.com/spf13/cobra"
6+
"strconv"
87

98
"github.com/IBM-Cloud/ibm-cloud-cli-sdk/bluemix/terminal"
109

1110
. "github.ibm.com/SoftLayer/softlayer-cli/plugin/i18n"
1211
"github.ibm.com/SoftLayer/softlayer-cli/plugin/managers"
1312
"github.ibm.com/SoftLayer/softlayer-cli/plugin/metadata"
1413
"github.ibm.com/SoftLayer/softlayer-cli/plugin/utils"
15-
1614
)
1715

1816
type SearchTypesCommand struct {

plugin/commands/search/types_test.go

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package search_test
22

33
import (
4-
54
"github.com/IBM-Cloud/ibm-cloud-cli-sdk/testhelpers/terminal"
65
. "github.com/onsi/ginkgo/v2"
76
. "github.com/onsi/gomega"
@@ -15,11 +14,11 @@ import (
1514

1615
var _ = Describe("search types", func() {
1716
var (
18-
fakeUI *terminal.FakeUI
19-
cliCommand *search.SearchTypesCommand
20-
fakeSession *session.Session
21-
slCommand *metadata.SoftlayerCommand
22-
fakeHandler *testhelpers.FakeTransportHandler
17+
fakeUI *terminal.FakeUI
18+
cliCommand *search.SearchTypesCommand
19+
fakeSession *session.Session
20+
slCommand *metadata.SoftlayerCommand
21+
fakeHandler *testhelpers.FakeTransportHandler
2322
// fakeSearchManager *testhelpers.FakeSearchManager
2423
)
2524
BeforeEach(func() {

plugin/managers/dedicatedhost.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const (
3232

3333
var existDatacenter = false
3434

35-
//Manages SoftLayer Dedicated host.
35+
// Manages SoftLayer Dedicated host.
3636
type DedicatedHostManager interface {
3737
ListGuests(identifier int, cpu int, domain string, hostname string, memory int, tags []string, mask string) ([]datatypes.Virtual_Guest, error)
3838
GenerateOrderTemplate(size, hostname, domain, datacenter string, billing string, routerId int) (datatypes.Container_Product_Order_Virtual_DedicatedHost, error)
@@ -64,8 +64,8 @@ func NewDedicatedhostManager(session *session.Session) *dedicatedhostManager {
6464
}
6565
}
6666

67-
//Cancel an instance immediately, deleting all its data.
68-
//id: the instance ID to cancel
67+
// Cancel an instance immediately, deleting all its data.
68+
// id: the instance ID to cancel
6969
func (d dedicatedhostManager) CancelGuests(id int) ([]StatusInfo, error) {
7070
guests, err := d.VirtualDedicatedHost.Id(id).GetGuests()
7171
var listCaneledGuests []StatusInfo
@@ -88,7 +88,7 @@ func (d dedicatedhostManager) CancelGuests(id int) ([]StatusInfo, error) {
8888
return listCaneledGuests, nil
8989
}
9090

91-
//Deletes a guest and returns 'Cancelled' or and Exception message
91+
// Deletes a guest and returns 'Cancelled' or and Exception message
9292
func (d dedicatedhostManager) DeleteGuest(Id int) (string, error) {
9393
status := "Cancelled"
9494
_, err := d.VirtualGuestService.Id(Id).DeleteObject()
@@ -98,13 +98,13 @@ func (d dedicatedhostManager) DeleteGuest(Id int) (string, error) {
9898
return status, nil
9999
}
100100

101-
//Retrieve a list of all virtual servers on the dedicated host.
102-
//integer identifier: The identifier of a dedicated host.
103-
//integer cpus: filter based on number of CPUS.
104-
//string domain: filter based on domain.
105-
//string hostname: filter based on hostname.
106-
//integer memory: filter based on amount of memory.
107-
//list tags: filter based on list of tags.
101+
// Retrieve a list of all virtual servers on the dedicated host.
102+
// integer identifier: The identifier of a dedicated host.
103+
// integer cpus: filter based on number of CPUS.
104+
// string domain: filter based on domain.
105+
// string hostname: filter based on hostname.
106+
// integer memory: filter based on amount of memory.
107+
// list tags: filter based on list of tags.
108108
func (d dedicatedhostManager) ListGuests(identifier int, cpu int, domain string, hostname string, memory int, tags []string, mask string) ([]datatypes.Virtual_Guest, error) {
109109
filters := filter.New()
110110
if cpu != 0 {
@@ -134,17 +134,17 @@ func (d dedicatedhostManager) ListGuests(identifier int, cpu int, domain string,
134134
return guestList, nil
135135
}
136136

137-
//Get details about a dedicatedhost instance.
138-
//id: the instance ID
139-
//mask: mask of properties
137+
// Get details about a dedicatedhost instance.
138+
// id: the instance ID
139+
// mask: mask of properties
140140
func (d dedicatedhostManager) GetInstance(id int, mask string) (datatypes.Virtual_DedicatedHost, error) {
141141
if mask == "" {
142142
mask = DEDICATEDHOST_DETAIL_MASK
143143
}
144144
return d.VirtualDedicatedHost.Id(id).Mask(mask).GetObject()
145145
}
146146

147-
//Generate dedicated host payload.
147+
// Generate dedicated host payload.
148148
func (d dedicatedhostManager) GenerateOrderTemplate(size, hostname, domain, datacenter string, billing string, routerId int) (datatypes.Container_Product_Order_Virtual_DedicatedHost, error) {
149149
mask := "items[keyName,capacity,description,attributes[id,attributeTypeKeyName],itemCategory[id,categoryCode],softwareDescription[id,referenceCode,longDescription],prices],activePresets,regions[location[location[priceGroups]]]"
150150
packages, err := d.PackageService.Mask(mask).Filter(filter.Path("keyName").Eq("DEDICATED_HOST").Build()).GetAllObjects()
@@ -187,17 +187,17 @@ func (d dedicatedhostManager) GenerateOrderTemplate(size, hostname, domain, data
187187
return order, nil
188188
}
189189

190-
//Verify the dedicated host order.
190+
// Verify the dedicated host order.
191191
func (d dedicatedhostManager) VerifyInstanceCreation(orderTemplate datatypes.Container_Product_Order_Virtual_DedicatedHost) (datatypes.Container_Product_Order, error) {
192192
return d.OrderService.VerifyOrder(&orderTemplate)
193193
}
194194

195-
//Order a dedicated host.
195+
// Order a dedicated host.
196196
func (d dedicatedhostManager) OrderInstance(orderTemplate datatypes.Container_Product_Order_Virtual_DedicatedHost) (datatypes.Container_Product_Order_Receipt, error) {
197197
return d.OrderService.PlaceOrder(&orderTemplate, sl.Bool(false))
198198
}
199199

200-
//Get the package related to simple dedicatedhost ordering
200+
// Get the package related to simple dedicatedhost ordering
201201
func (d dedicatedhostManager) GetPackage() (datatypes.Product_Package, error) {
202202
mask := "items[id,description,prices,capacity,keyName,itemCategory[categoryCode],bundleItems[capacity,keyName,categories[categoryCode],hardwareGenericComponentModel[id,hardwareComponentType[keyName]]]],regions[location[location[priceGroups]]]"
203203
filters := filter.New()
@@ -212,7 +212,7 @@ func (d dedicatedhostManager) GetPackage() (datatypes.Product_Package, error) {
212212
return packages[0], nil
213213
}
214214

215-
//Returns valid options for ordering hardware.
215+
// Returns valid options for ordering hardware.
216216
func (d dedicatedhostManager) GetCreateOptions(productPackage datatypes.Product_Package) map[string]map[string]string {
217217
//locations
218218
locations := make(map[string]string)
@@ -237,7 +237,7 @@ func (d dedicatedhostManager) GetCreateOptions(productPackage datatypes.Product_
237237
}
238238
}
239239

240-
//Get the private vlans in the account.
240+
// Get the private vlans in the account.
241241
func (d dedicatedhostManager) GetVlansOptions(datacenter string, flavor string, productPackage datatypes.Product_Package) ([]datatypes.Network_Vlan, error) {
242242
maskVlans := "primaryRouter[datacenter]"
243243
maskItemPrices := "pricingLocationGroup[locations]"

0 commit comments

Comments
 (0)