Skip to content

Commit

Permalink
Update Subnets on LoadBalancer
Browse files Browse the repository at this point in the history
  • Loading branch information
SunithaGudisagarIBM1 committed Sep 8, 2022
1 parent 4c19e32 commit 97bf42b
Show file tree
Hide file tree
Showing 11 changed files with 82,559 additions and 3 deletions.
23 changes: 23 additions & 0 deletions common/github.com/IBM/vpc-go-sdk/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Makefile

all: build lint tidy

travis-ci: build lint tidy test-unit

build:
go build ./vpcv1

test-unit:
go test `go list ./... | grep vpcv1` -v -tags=unit

test-integration:
go test `go list ./... | grep vpcv1` -v -tags=integration -skipForMockTesting -testCount

test-examples:
go test `go list ./... | grep vpcv1` -v -tags=examples

lint:
golangci-lint --timeout=2m run

tidy:
go mod tidy
53 changes: 53 additions & 0 deletions common/github.com/IBM/vpc-go-sdk/common/headers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package common

import (
"fmt"
"runtime"
)

const (
HEADER_NAME_USER_AGENT = "User-Agent"

SDK_NAME = "vpc-go-sdk"
)

//
// GetSdkHeaders - returns the set of SDK-specific headers to be included in an outgoing request.
//
// This function is invoked by generated service methods (i.e. methods which implement the REST API operations
// defined within the API definition). The purpose of this function is to give the SDK implementor the opportunity
// to provide SDK-specific HTTP headers that will be sent with an outgoing REST API request.
// This function is invoked for each invocation of a generated service method,
// so the set of HTTP headers could be request-specific.
// As an optimization, if your SDK will be returning the same set of HTTP headers for each invocation of this
// function, it is recommended that you initialize the returned map just once (perhaps by using
// lazy initialization) and simply return it each time the function is invoked, instead of building it each time
// as in the example below.
//
// Parameters:
// serviceName - the name of the service as defined in the API definition (e.g. "MyService1")
// serviceVersion - the version of the service as defined in the API definition (e.g. "V1")
// operationId - the operationId as defined in the API definition (e.g. getContext)
//
// Returns:
// a Map which contains the set of headers to be included in the REST API request
//
func GetSdkHeaders(serviceName string, serviceVersion string, operationId string) map[string]string {
sdkHeaders := make(map[string]string)

sdkHeaders[HEADER_NAME_USER_AGENT] = GetUserAgentInfo()

return sdkHeaders
}

var userAgent string = fmt.Sprintf("%s-%s %s", SDK_NAME, Version, GetSystemInfo())

func GetUserAgentInfo() string {
return userAgent
}

var systemInfo = fmt.Sprintf("(arch=%s; os=%s; go.version=%s)", runtime.GOARCH, runtime.GOOS, runtime.Version())

func GetSystemInfo() string {
return systemInfo
}
25 changes: 25 additions & 0 deletions common/github.com/IBM/vpc-go-sdk/common/headers_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package common

import (
"github.com/stretchr/testify/assert"
"strings"
"testing"
)

func TestGetSystemInfo(t *testing.T) {
var sysinfo = GetSystemInfo()
assert.NotNil(t, sysinfo)
assert.True(t, strings.Contains(sysinfo, "arch="))
assert.True(t, strings.Contains(sysinfo, "os="))
assert.True(t, strings.Contains(sysinfo, "go.version="))
}

func TestGetSdkHeaders(t *testing.T) {
var headers = GetSdkHeaders("myService", "v123", "myOperation")
assert.NotNil(t, headers)

var foundIt bool

_, foundIt = headers[HEADER_NAME_USER_AGENT]
assert.True(t, foundIt)
}
4 changes: 4 additions & 0 deletions common/github.com/IBM/vpc-go-sdk/common/version.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package common

// Version of the SDK
const Version = "0.6.0"
11 changes: 11 additions & 0 deletions common/github.com/IBM/vpc-go-sdk/go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module github.com/IBM/vpc-go-sdk

go 1.14

require (
github.com/IBM/go-sdk-core/v5 v5.7.2
github.com/go-openapi/strfmt v0.20.2
github.com/onsi/ginkgo v1.14.2
github.com/onsi/gomega v1.10.5
github.com/stretchr/testify v1.7.0
)
208 changes: 208 additions & 0 deletions common/github.com/IBM/vpc-go-sdk/go.sum

Large diffs are not rendered by default.

Loading

0 comments on commit 97bf42b

Please sign in to comment.