Skip to content

Commit

Permalink
fix: add default speed
Browse files Browse the repository at this point in the history
Signed-off-by: Ayush Rangwala <[email protected]>
  • Loading branch information
aayushrangwala committed Dec 19, 2023
1 parent 8453157 commit 8a9be52
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
3 changes: 2 additions & 1 deletion docs/metal_interconnections_create.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ metal interconnections create -n <name> [-m <metro>] [-r <redundancy> ] [-t <typ
-O, --organizationID string Org ID
-p, --projectID string project ID
-r, --redundancy string Website URL of the organization.
--service-token-type string Type of service token for shared connection. Enum: 'a_side', 'z_side'
-T, --service-token-type string Type of service token for shared connection. Enum: 'a_side', 'z_side'
--speed int32 the maximum speed of the interconnections (default 1000000000)
-t, --type string type of of interconnection.
--vlans int32Slice Array of int vLANs (default [])
--vrfs strings Array of strings VRF <uuid>.
Expand Down
9 changes: 7 additions & 2 deletions internal/interconnections/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ func (c *Client) Create() *cobra.Command {
var name, metro, redundancy, connType, projectID, organizationID, svcTokenType string
var vrfs []string
var vlans []int32
var speed int32

createInterconnectionsCmd := &cobra.Command{
Use: `create -n <name> [-m <metro>] [-r <redundancy> ] [-t <type> ] [-p <project_id> ] | [-O <organization_id> ]`,
Expand Down Expand Up @@ -44,6 +45,9 @@ func (c *Client) Create() *cobra.Command {
metal.VlanFabricVcCreateInputType(connType),
)
in.Vlans = vlans
// default speed
in.SetSpeed(speed)

createOrganizationInterconnectionRequest.
VlanFabricVcCreateInput = in
case vrfsFabricVcCreate(vrfs):
Expand Down Expand Up @@ -84,7 +88,8 @@ func (c *Client) Create() *cobra.Command {
createInterconnectionsCmd.Flags().StringVarP(&projectID, "projectID", "p", "", "project ID")
createInterconnectionsCmd.Flags().StringVarP(&organizationID, "organizationID", "O", "", "Org ID")
createInterconnectionsCmd.Flags().Int32SliceVar(&vlans, "vlans", []int32{}, "Array of int vLANs")
createInterconnectionsCmd.Flags().StringVar(&svcTokenType, "service-token-type", "", "Type of service token for shared connection. Enum: 'a_side', 'z_side'")
createInterconnectionsCmd.Flags().StringVarP(&svcTokenType, "service-token-type", "T", "", "Type of service token for shared connection. Enum: 'a_side', 'z_side'")
createInterconnectionsCmd.Flags().Int32Var(&speed, "speed", int32(1000000000), "the maximum speed of the interconnections")

_ = createInterconnectionsCmd.MarkFlagRequired("name")
_ = createInterconnectionsCmd.MarkFlagRequired("metro")
Expand Down Expand Up @@ -124,7 +129,7 @@ func validInputArgs(projectID, organizationID string, vlans []int32, vrfs []stri
return errors.New("could you provide at least either of projectID OR organizationID")
}

if vlanFabricVcCreate(vlans) || vrfsFabricVcCreate(vrfs) && svcTokenType == "" {
if (vlanFabricVcCreate(vlans) || vrfsFabricVcCreate(vrfs)) && svcTokenType == "" {
return errors.New("flag 'service-token-type' is required for vlan or vrfs fabric VC create")
}

Expand Down

0 comments on commit 8a9be52

Please sign in to comment.