Skip to content

Commit

Permalink
fix(directlink): Renamed the directlinkapisv1 to directlinkv1
Browse files Browse the repository at this point in the history
  • Loading branch information
ajay-malhotra1 committed Jul 27, 2020
1 parent 0f0a1db commit 3b37e1d
Show file tree
Hide file tree
Showing 7 changed files with 596 additions and 652 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ The IBM Cloud Networking Go SDK allows developers to programmatically interact w
| Service Name | Package name |
| ---------------------------------------------------------------------------------------------- | --------------------------- |
| [Transit Gateway Service](https://cloud.ibm.com/docs/transit-gateway) | transitgatewayapisv1 |
| [Direct Link Service](https://cloud.ibm.com/apidocs/direct_link) | directlinkapisv1 |
| [Direct Link Service](https://cloud.ibm.com/apidocs/direct_link?code=go) | directlinkv1 |
| [CIS: Cache](https://cloud.ibm.com/apidocs/cis/cache) | cachingapiv1 |
| [CIS: IP](https://cloud.ibm.com/apidocs/cis/ip) | cisipapiv1 |
| [CIS: Custom Pages](https://cloud.ibm.com/apidocs/cis) | custompagesv1 |
Expand Down Expand Up @@ -101,7 +101,7 @@ Go application, like this:
```go
import (
"github.com/IBM/networking-go-sdk/transitgatewayapisv1"
"github.com/IBM/networking-go-sdk/directlinkapisv1"
"github.com/IBM/networking-go-sdk/directlinkv1"
"github.com/IBM/networking-go-sdk/cachingapiv1"
"github.com/IBM/networking-go-sdk/cisipapiv1"
"github.com/IBM/networking-go-sdk/custompagesv1"
Expand Down
Binary file modified directlink.env.enc
Binary file not shown.
File renamed without changes.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
* limitations under the License.
*/

package directlinkapisv1_test
package directlinkv1_test

/*
How to run this test:
go test -v ./directlinkapisv1
go test -v ./directlinkv1
*/

import (
Expand All @@ -29,14 +29,13 @@ import (
"time"

"github.com/IBM/go-sdk-core/v4/core"
"github.com/IBM/networking-go-sdk/directlinkapisv1"
"github.com/go-openapi/strfmt"
"github.com/IBM/networking-go-sdk/directlinkv1"
"github.com/joho/godotenv"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)

var _ = Describe(`DirectLinkApisV1`, func() {
var _ = Describe(`DirectLinkV1`, func() {
err := godotenv.Load("../directlink.env")
It(`Successfully loading .env file`, func() {
Expect(err).To(BeNil())
Expand All @@ -47,23 +46,22 @@ var _ = Describe(`DirectLinkApisV1`, func() {
URL: "https://iam.test.cloud.ibm.com/identity/token",
}

version := strfmt.Date(time.Now())
version := time.Now().Format("2006-01-02")
serviceURL := os.Getenv("SERVICE_URL")
options := &directlinkapisv1.DirectLinkApisV1Options{
ServiceName: "DirectLinkApisV1_Mocking",
options := &directlinkv1.DirectLinkV1Options{
ServiceName: "DirectLinkV1_Mocking",
Authenticator: authenticator,
URL: serviceURL,
Version: &version,
}

service, err := directlinkapisv1.NewDirectLinkApisV1UsingExternalConfig(options)
It(`Successfully created DirectLinkApisV1 service instance`, func() {
service, err := directlinkv1.NewDirectLinkV1UsingExternalConfig(options)
It(`Successfully created DirectLinkV1 service instance`, func() {
Expect(err).To(BeNil())
})

timestamp := time.Now().Unix()

Describe("Direct Link Gateways", func() {
timestamp := time.Now().Unix()
gatewayName := "GO-INT-SDK-" + strconv.FormatInt(timestamp, 10)
updatedGatewayName := "GO-INT-SDK-PATCH-" + strconv.FormatInt(timestamp, 10)
bgpAsn := int64(64999)
Expand Down Expand Up @@ -351,6 +349,7 @@ var _ = Describe(`DirectLinkApisV1`, func() {
portId := ""
portLocationDisplayName := ""
portLocationName := ""
timestamp := time.Now().Unix()

It("List ports and save the id of the first port", func() {
listPortsOptions := service.NewListPortsOptions()
Expand All @@ -365,8 +364,7 @@ var _ = Describe(`DirectLinkApisV1`, func() {
It("create connect gateway", func() {
gatewayName = "GO-INT-SDK-CONNECT-" + strconv.FormatInt(timestamp, 10)
portIdentity, _ := service.NewGatewayPortIdentity(portId)
gateway, _ := service.NewGatewayTemplateGatewayTypeConnectTemplate(bgpAsn, bgpBaseCidr, global, metered, gatewayName,
speedMbps, "connect", portIdentity)
gateway, _ := service.NewGatewayTemplateGatewayTypeConnectTemplate(bgpAsn, bgpBaseCidr, global, metered, gatewayName, speedMbps, "connect", portIdentity)
createGatewayOptions := service.NewCreateGatewayOptions(gateway)
result, detailedResponse, err := service.CreateGateway(createGatewayOptions)

Expand Down Expand Up @@ -517,6 +515,7 @@ var _ = Describe(`DirectLinkApisV1`, func() {
listOfferingTypeLocationCrossConnectRoutersOptions := service.NewListOfferingTypeLocationCrossConnectRoutersOptions("dedicated", os.Getenv("OT_DEDICATED_LOCATION_NAME"))

result, detailedResponse, err := service.ListOfferingTypeLocationCrossConnectRouters(listOfferingTypeLocationCrossConnectRoutersOptions)

Expect(err).To(BeNil())
Expect(detailedResponse.StatusCode).To(Equal(200))
Expect(len(result.CrossConnectRouters)).Should(BeNumerically(">", 0))
Expand All @@ -541,6 +540,7 @@ var _ = Describe(`DirectLinkApisV1`, func() {
listOfferingTypeLocationCrossConnectRoutersOptions := service.NewListOfferingTypeLocationCrossConnectRoutersOptions("connect", os.Getenv("OT_CONNECT_LOCATION_NAME"))

result, detailedResponse, err := service.ListOfferingTypeLocationCrossConnectRouters(listOfferingTypeLocationCrossConnectRoutersOptions)

Expect(err).NotTo(BeNil())
Expect(err.Error()).To(Equal("The supplied OfferingType is not supported for this call"))
Expect(detailedResponse.StatusCode).To(Equal(400))
Expand Down Expand Up @@ -645,6 +645,7 @@ var _ = Describe(`DirectLinkApisV1`, func() {
})

Describe("Direct Link Virtual Connections", func() {
timestamp := time.Now().Unix()
gatewayName := "GO-INT-VC-SDK-" + strconv.FormatInt(timestamp, 10)
bgpAsn := int64(64999)
bgpBaseCidr := "169.254.0.0/16"
Expand Down Expand Up @@ -682,7 +683,7 @@ var _ = Describe(`DirectLinkApisV1`, func() {

It("Successfully create a CLASSIC virtual connection", func() {
vcName := "GO-INT-CLASSIC-VC-SDK-" + strconv.FormatInt(timestamp, 10)
createGatewayVCOptions := service.NewCreateGatewayVirtualConnectionOptions(os.Getenv("GATEWAY_ID"), vcName, directlinkapisv1.CreateGatewayVirtualConnectionOptions_Type_Classic)
createGatewayVCOptions := service.NewCreateGatewayVirtualConnectionOptions(os.Getenv("GATEWAY_ID"), vcName, directlinkv1.CreateGatewayVirtualConnectionOptions_Type_Classic)
result, detailedResponse, err := service.CreateGatewayVirtualConnection(createGatewayVCOptions)
Expect(err).To(BeNil())
Expect(detailedResponse.StatusCode).To(Equal(201))
Expand All @@ -691,7 +692,7 @@ var _ = Describe(`DirectLinkApisV1`, func() {

Expect(*result.ID).NotTo(Equal(""))
Expect(*result.Name).To(Equal(vcName))
Expect(*result.Type).To(Equal(directlinkapisv1.CreateGatewayVirtualConnectionOptions_Type_Classic))
Expect(*result.Type).To(Equal(directlinkv1.CreateGatewayVirtualConnectionOptions_Type_Classic))
Expect(*result.CreatedAt).NotTo(Equal(""))
Expect(*result.Status).To(Equal("pending"))
})
Expand All @@ -705,15 +706,15 @@ var _ = Describe(`DirectLinkApisV1`, func() {

Expect(*result.ID).To(Equal(os.Getenv("CLASSIC_VC_ID")))
Expect(*result.Name).To(Equal(vcName))
Expect(*result.Type).To(Equal(directlinkapisv1.CreateGatewayVirtualConnectionOptions_Type_Classic))
Expect(*result.Type).To(Equal(directlinkv1.CreateGatewayVirtualConnectionOptions_Type_Classic))
Expect(*result.CreatedAt).NotTo(Equal(""))
Expect(*result.Status).To(Equal("pending"))
})

It("Successfully create a Gen 2 VPC virtual connection", func() {
vcName := "GO-INT-GEN2-VPC-VC-SDK-" + strconv.FormatInt(timestamp, 10)
vpcCrn := os.Getenv("GEN2_VPC_CRN")
createGatewayVCOptions := service.NewCreateGatewayVirtualConnectionOptions(os.Getenv("GATEWAY_ID"), vcName, directlinkapisv1.CreateGatewayVirtualConnectionOptions_Type_Vpc)
createGatewayVCOptions := service.NewCreateGatewayVirtualConnectionOptions(os.Getenv("GATEWAY_ID"), vcName, directlinkv1.CreateGatewayVirtualConnectionOptions_Type_Vpc)
createGatewayVCOptionsWithNetworkID := createGatewayVCOptions.SetNetworkID(vpcCrn)
result, detailedResponse, err := service.CreateGatewayVirtualConnection(createGatewayVCOptionsWithNetworkID)
Expect(err).To(BeNil())
Expand All @@ -726,7 +727,7 @@ var _ = Describe(`DirectLinkApisV1`, func() {
Expect(*result.Name).To(Equal(vcName))
Expect(*result.CreatedAt).NotTo(Equal(""))
Expect(*result.Status).To(Equal("pending"))
Expect(*result.Type).To(Equal(directlinkapisv1.CreateGatewayVirtualConnectionOptions_Type_Vpc))
Expect(*result.Type).To(Equal(directlinkv1.CreateGatewayVirtualConnectionOptions_Type_Vpc))
Expect(*result.NetworkID).To(Equal(vpcCrn))
})

Expand All @@ -740,7 +741,7 @@ var _ = Describe(`DirectLinkApisV1`, func() {
Expect(*result.Name).To(Equal("GO-INT-GEN2-VPC-VC-SDK-" + strconv.FormatInt(timestamp, 10)))
Expect(*result.CreatedAt).NotTo(Equal(""))
Expect(*result.Status).To(Equal("pending"))
Expect(*result.Type).To(Equal(directlinkapisv1.CreateGatewayVirtualConnectionOptions_Type_Vpc))
Expect(*result.Type).To(Equal(directlinkv1.CreateGatewayVirtualConnectionOptions_Type_Vpc))
Expect(*result.NetworkID).To(Equal(os.Getenv("GEN2_VPC_CRN")))
})

Expand All @@ -759,12 +760,12 @@ var _ = Describe(`DirectLinkApisV1`, func() {
Expect(*vc.Name).To(Equal("GO-INT-GEN2-VPC-VC-SDK-" + strconv.FormatInt(timestamp, 10)))
Expect(*vc.CreatedAt).NotTo(Equal(""))
Expect(*vc.Status).To(Equal("pending"))
Expect(*vc.Type).To(Equal(directlinkapisv1.CreateGatewayVirtualConnectionOptions_Type_Vpc))
Expect(*vc.Type).To(Equal(directlinkv1.CreateGatewayVirtualConnectionOptions_Type_Vpc))
Expect(*vc.NetworkID).To(Equal(os.Getenv("GEN2_VPC_CRN")))
} else {
Expect(*vc.ID).To(Equal(os.Getenv("CLASSIC_VC_ID")))
Expect(*vc.Name).To(Equal("GO-INT-CLASSIC-VC-SDK-" + strconv.FormatInt(timestamp, 10)))
Expect(*vc.Type).To(Equal(directlinkapisv1.CreateGatewayVirtualConnectionOptions_Type_Classic))
Expect(*vc.Type).To(Equal(directlinkv1.CreateGatewayVirtualConnectionOptions_Type_Classic))
Expect(*vc.CreatedAt).NotTo(Equal(""))
Expect(*vc.Status).To(Equal("pending"))
}
Expand All @@ -786,15 +787,15 @@ var _ = Describe(`DirectLinkApisV1`, func() {
Expect(*result.Name).To(Equal(vcName))
Expect(*result.CreatedAt).NotTo(Equal(""))
Expect(*result.Status).To(Equal("pending"))
Expect(*result.Type).To(Equal(directlinkapisv1.CreateGatewayVirtualConnectionOptions_Type_Vpc))
Expect(*result.Type).To(Equal(directlinkv1.CreateGatewayVirtualConnectionOptions_Type_Vpc))
Expect(*result.NetworkID).To(Equal(os.Getenv("GEN2_VPC_CRN")))
})

It("Fail to Update a virtual connection status", func() {
gatewayId := os.Getenv("GATEWAY_ID")
vcId := os.Getenv("GEN2_VPC_VC_ID")
patchGatewayOptions := service.NewUpdateGatewayVirtualConnectionOptions(gatewayId, vcId)
patchGatewayOptions = patchGatewayOptions.SetStatus(directlinkapisv1.UpdateGatewayVirtualConnectionOptions_Status_Rejected)
patchGatewayOptions = patchGatewayOptions.SetStatus(directlinkv1.UpdateGatewayVirtualConnectionOptions_Status_Rejected)

result, detailedResponse, err := service.UpdateGatewayVirtualConnection(patchGatewayOptions)

Expand Down Expand Up @@ -891,6 +892,7 @@ var _ = Describe(`DirectLinkApisV1`, func() {
})

Describe("LOA and Completion Notice", func() {
timestamp := time.Now().Unix()
gatewayName := "GO-INT-LOA-SDK-" + strconv.FormatInt(timestamp, 10)
bgpAsn := int64(64999)
bgpBaseCidr := "169.254.0.0/16"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
* limitations under the License.
*/

package directlinkapisv1_test
package directlinkv1_test

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"testing"
)

func TestDirectLinkApisV1(t *testing.T) {
func TestDirectLinkV1(t *testing.T) {
RegisterFailHandler(Fail)
RunSpecs(t, "DirectLinkApisV1 Suite")
RunSpecs(t, "DirectLinkV1 Suite")
}
Loading

0 comments on commit 3b37e1d

Please sign in to comment.