Skip to content

Commit

Permalink
Releasing v2.7.0 (#135)
Browse files Browse the repository at this point in the history
releasing go sdk v2.7.0
  • Loading branch information
jasonyin authored Oct 18, 2018
1 parent efb53d1 commit 893b72e
Show file tree
Hide file tree
Showing 315 changed files with 6,770 additions and 737 deletions.
21 changes: 18 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@ All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](http://keepachangelog.com/)

## 2.7.0 - 2018-10-18
### Added
- Support for cost tracking tags in the Identity service
- Support for generating and downloading wallets in the Database service
- Support for creating a standalone backup from an on-premises database in the Database service
- Support for db version and additional connection strings in the Autonomous Transaction Processing and Autonomous Data Warehouse resources of the Database service
- Support for copying volume backups across regions in the Block Storage service
- Support for deleting compartments in the Identity service
- Support for reboot migration for virtual machines in the Compute service
- Support for Instance Pools and Instance Configurations in the Compute service

### Fixed
- The signing algorithm does not lower case the header fields [Github issue 132](https://github.com/oracle/oci-go-sdk/issues/132)
- Raw configuration provider does not check for empty strings [Github issue 134](https://github.com/oracle/oci-go-sdk/issues/134)

## 2.6.0 - 2018-10-04
### Added
- Support for trusted partner images through application listings and subscriptions in the Compute service
Expand All @@ -30,14 +45,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
- Support for resizing an offline volume in the Block Storage service
- Nil interface when polymorphic json response object is null

## 2.2.0 - 2018-07-26
## 2.2.0 - 2018-08-09
### Added
- Support for fault domains in the Compute service
- A sample showing how to use Search service from the SDK is available on [Github](https://github.com/oracle/oci-go-sdk/tree/master/example/example_resourcesearch_test.go)

## 2.1.0 - 2018-07-26
### Added
- Support for the OCI Search service
- Support for the Search service
- Support for specifying a backup policy when creating a boot volume in the Block Storage service

### Fixed
Expand Down Expand Up @@ -207,7 +222,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
## 1.3.0 - 2018-04-19
### Added
- Support for retry on OCI service APIs. Example can be found on [Github](https://github.com/oracle/oci-go-sdk/tree/master/example/example_retry_test.go)
- Support for retry on Oracle Cloud Infrastructure service APIs. Example can be found on [Github](https://github.com/oracle/oci-go-sdk/tree/master/example/example_retry_test.go)
- Support for tagging DbSystem and Database resources in the Database Service
- Support for filtering by DbSystemId in ListDbVersions operation in Database Service
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ type ConfigurationProvider interface {
```

### Making a request
To make a request to an OCI service, create a client for the service and then use the client to call a function from the service.
To make a request to an Oracle Cloud Infrastructure service, create a client for the service and then use the client to call a function from the service.

- *Creating a client*: All packages provide a function to create clients, using the naming convention `New<ServiceName>ClientWithConfigurationProvider`,
such as `NewVirtualNetworkClientWithConfigurationProvider` or `NewIdentityClientWithConfigurationProvider`. To create a new client,
Expand Down
4 changes: 3 additions & 1 deletion common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ package common
import (
"fmt"
"strings"
"regexp"
)

//Region type for regions
Expand Down Expand Up @@ -45,8 +46,9 @@ func StringToRegion(stringRegion string) (r Region) {

// canStringBeRegion test if the string can be a region, if it can, returns the string as is, otherwise it
// returns an error
var blankRegex = regexp.MustCompile("\\s")
func canStringBeRegion(stringRegion string) (region string, err error) {
if strings.Contains(stringRegion, " ") || stringRegion == "" {
if blankRegex.MatchString(stringRegion) || stringRegion == "" {
return "", fmt.Errorf("region can not be empty or have spaces")
}
return stringRegion, nil
Expand Down
9 changes: 9 additions & 0 deletions common/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,14 +80,23 @@ func (p rawConfigurationProvider) KeyID() (keyID string, err error) {
}

func (p rawConfigurationProvider) TenancyOCID() (string, error) {
if p.tenancy == "" {
return "", fmt.Errorf("tenancy OCID can not be empty")
}
return p.tenancy, nil
}

func (p rawConfigurationProvider) UserOCID() (string, error) {
if p.user == "" {
return "", fmt.Errorf("user OCID can not be empty")
}
return p.user, nil
}

func (p rawConfigurationProvider) KeyFingerprint() (string, error) {
if p.fingerprint == "" {
return "", fmt.Errorf("fingerprint can not be empty")
}
return p.fingerprint, nil
}

Expand Down
32 changes: 32 additions & 0 deletions common/configuration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,33 @@ func TestRawConfigurationProvider(t *testing.T) {

}

func TestBadRawConfigurationProvider(t *testing.T) {
var (
testTenancy = ""
testUser = ""
testRegion = ""
testFingerprint = ""
)

c := NewRawConfigurationProvider(testTenancy, testUser, testRegion, testFingerprint, "", nil)

_, err := c.UserOCID()
assert.Error(t, err)

_, err = c.KeyFingerprint()
assert.Error(t, err)

_, err = c.Region()
assert.Error(t, err)

_, err = c.PrivateRSAKey()
assert.Error(t, err)

_, err = c.KeyID()
assert.Error(t, err)

}

func TestRawConfigurationProvider_BadRegion(t *testing.T) {
var (
testTenancy = "ocid1.tenancy.oc1..aaaaaaaaxf3fuazos"
Expand Down Expand Up @@ -824,7 +851,12 @@ func TestIsRegionValid(t *testing.T) {
{"single trailing string", "aasb ", true},
{"trailing string", "aasb ", true},
{"single trailing and leading", " aasb ", true},
{"tab", "aasb ", true},
{"carriage return", "\raasb", true},
{"new line", "aasb\n", true},
{"feed", "aa\fsb", true},
{"trailing and leading", " aasb ", true},

}

for _, tIO := range testIO {
Expand Down
4 changes: 2 additions & 2 deletions common/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,15 @@ var sdkDateType = reflect.TypeOf(SDKDate{})
var sdkDateTypePtr = reflect.TypeOf(&SDKDate{})

//Formats for sdk supported time representations
const sdkTimeFormat = time.RFC3339
const sdkTimeFormat = time.RFC3339Nano
const rfc1123OptionalLeadingDigitsInDay = "Mon, _2 Jan 2006 15:04:05 MST"
const sdkDateFormat = "2006-01-02"

func tryParsingTimeWithValidFormatsForHeaders(data []byte, headerName string) (t time.Time, err error) {
header := strings.ToLower(headerName)
switch header {
case "lastmodified", "date":
t, err = tryParsing(data, time.RFC3339, time.RFC1123, rfc1123OptionalLeadingDigitsInDay, time.RFC850, time.ANSIC)
t, err = tryParsing(data, time.RFC3339Nano, time.RFC3339, time.RFC1123, rfc1123OptionalLeadingDigitsInDay, time.RFC850, time.ANSIC)
return
default: //By default we parse with RFC3339
t, err = time.Parse(sdkTimeFormat, string(data))
Expand Down
1 change: 1 addition & 0 deletions common/http_signer.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ func (signer ociRequestSigner) getSigningString(request *http.Request) string {
signingParts := make([]string, len(signingHeaders))
for i, part := range signingHeaders {
var value string
part = strings.ToLower(part)
switch part {
case "(request-target)":
value = getRequestTarget(request)
Expand Down
22 changes: 22 additions & 0 deletions common/http_signer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,28 @@ func TestOCIRequestSigner_SigningString(t *testing.T) {
assert.Equal(t, expectedSigningString, signature)
}

func TestOCIRequestSigner_SigningString_Uppercase(t *testing.T) {
s := ociRequestSigner{
KeyProvider: testKeyProvider{},
GenericHeaders: []string{"Date", "(Request-target)", "host"},
ShouldHashBody: defaultBodyHashPredicate,
BodyHeaders: defaultBodyHeaders}

url, _ := url.Parse(testURL)
r := http.Request{
Proto: "HTTP/1.1",
ProtoMajor: 1,
ProtoMinor: 1,
Header: make(http.Header),
URL: url,
}
r.Header.Set(requestHeaderDate, "Thu, 05 Jan 2014 21:31:40 GMT")
r.Method = http.MethodGet
signature := s.getSigningString(&r)

assert.Equal(t, expectedSigningString, signature)
}

func TestOCIRequestSigner_ComputeSignature(t *testing.T) {
s := ociRequestSigner{
KeyProvider: testKeyProvider{},
Expand Down
35 changes: 33 additions & 2 deletions common/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ func TestHttpMarshalerAll(t *testing.T) {
var content map[string]string
body, _ := ioutil.ReadAll(request.Body)
json.Unmarshal(body, &content)
when := s.When.Format(time.RFC3339)
when := s.When.Format(time.RFC3339Nano)
assert.True(t, request.URL.Path == "//101")
assert.True(t, request.URL.Query().Get("name") == s.Name)
assert.True(t, request.URL.Query().Get("income") == strconv.FormatFloat(float64(s.Income), 'f', 6, 32))
Expand Down Expand Up @@ -291,7 +291,7 @@ func TestHttpMarshallerSimpleStructPointers(t *testing.T) {
assert.Equal(t, "", request.Header.Get(requestHeaderOpcRetryToken))
assert.True(t, strings.Contains(request.URL.Path, "111"))
assert.True(t, strings.Contains(string(all), "thekey"))
assert.Contains(t, string(all), now.Format(time.RFC3339))
assert.Contains(t, string(all), now.Format(time.RFC3339Nano))
}

func TestHttpMarshallerSimpleStructPointersFilled(t *testing.T) {
Expand Down Expand Up @@ -1010,6 +1010,37 @@ func TestOmitFieldsInJson_SimpleStructWithTime(t *testing.T) {
assert.Equal(t, theTime, mapRet.(map[string]interface{})["theTime"])
}

func TestToStringValue_TimeFormat(t *testing.T) {
testingData := []struct {
TheTime *SDKTime `mandatory:"true" json:"theTime"`
Input string
Expected string
}{
{
Input: "2018-10-15T19:43:05.080Z",
Expected: "2018-10-15T19:43:05.08Z",
},
{
Input: "2018-10-15T19:43:05Z",
Expected: "2018-10-15T19:43:05Z",
},
}

for _, item := range testingData {
time, err := time.Parse(time.RFC3339, item.Input)
assert.NoError(t, err)
item.TheTime = &SDKTime{time}

reflectValue := reflect.ValueOf(item)
reflectType := reflectValue.Type()

str, err := toStringValue(reflectValue.Field(0), reflectType.Field(0))
assert.NoError(t, err)

assert.Equal(t, item.Expected, str)
}
}

func TestSDKDate_Unmarshal(t *testing.T) {
type structWithTime struct {
Name string `json:"name"`
Expand Down
2 changes: 1 addition & 1 deletion common/version.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions containerengine/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (m Cluster) String() string {
// ClusterLifecycleStateEnum Enum with underlying type: string
type ClusterLifecycleStateEnum string

// Set of constants representing the allowable values for ClusterLifecycleState
// Set of constants representing the allowable values for ClusterLifecycleStateEnum
const (
ClusterLifecycleStateCreating ClusterLifecycleStateEnum = "CREATING"
ClusterLifecycleStateActive ClusterLifecycleStateEnum = "ACTIVE"
Expand All @@ -75,7 +75,7 @@ var mappingClusterLifecycleState = map[string]ClusterLifecycleStateEnum{
"UPDATING": ClusterLifecycleStateUpdating,
}

// GetClusterLifecycleStateEnumValues Enumerates the set of values for ClusterLifecycleState
// GetClusterLifecycleStateEnumValues Enumerates the set of values for ClusterLifecycleStateEnum
func GetClusterLifecycleStateEnumValues() []ClusterLifecycleStateEnum {
values := make([]ClusterLifecycleStateEnum, 0)
for _, v := range mappingClusterLifecycleState {
Expand Down
4 changes: 2 additions & 2 deletions containerengine/cluster_summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (m ClusterSummary) String() string {
// ClusterSummaryLifecycleStateEnum Enum with underlying type: string
type ClusterSummaryLifecycleStateEnum string

// Set of constants representing the allowable values for ClusterSummaryLifecycleState
// Set of constants representing the allowable values for ClusterSummaryLifecycleStateEnum
const (
ClusterSummaryLifecycleStateCreating ClusterSummaryLifecycleStateEnum = "CREATING"
ClusterSummaryLifecycleStateActive ClusterSummaryLifecycleStateEnum = "ACTIVE"
Expand All @@ -75,7 +75,7 @@ var mappingClusterSummaryLifecycleState = map[string]ClusterSummaryLifecycleStat
"UPDATING": ClusterSummaryLifecycleStateUpdating,
}

// GetClusterSummaryLifecycleStateEnumValues Enumerates the set of values for ClusterSummaryLifecycleState
// GetClusterSummaryLifecycleStateEnumValues Enumerates the set of values for ClusterSummaryLifecycleStateEnum
func GetClusterSummaryLifecycleStateEnumValues() []ClusterSummaryLifecycleStateEnum {
values := make([]ClusterSummaryLifecycleStateEnum, 0)
for _, v := range mappingClusterSummaryLifecycleState {
Expand Down
12 changes: 6 additions & 6 deletions containerengine/list_clusters_request_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (response ListClustersResponse) HTTPResponse() *http.Response {
// ListClustersLifecycleStateEnum Enum with underlying type: string
type ListClustersLifecycleStateEnum string

// Set of constants representing the allowable values for ListClustersLifecycleState
// Set of constants representing the allowable values for ListClustersLifecycleStateEnum
const (
ListClustersLifecycleStateCreating ListClustersLifecycleStateEnum = "CREATING"
ListClustersLifecycleStateActive ListClustersLifecycleStateEnum = "ACTIVE"
Expand All @@ -105,7 +105,7 @@ var mappingListClustersLifecycleState = map[string]ListClustersLifecycleStateEnu
"UPDATING": ListClustersLifecycleStateUpdating,
}

// GetListClustersLifecycleStateEnumValues Enumerates the set of values for ListClustersLifecycleState
// GetListClustersLifecycleStateEnumValues Enumerates the set of values for ListClustersLifecycleStateEnum
func GetListClustersLifecycleStateEnumValues() []ListClustersLifecycleStateEnum {
values := make([]ListClustersLifecycleStateEnum, 0)
for _, v := range mappingListClustersLifecycleState {
Expand All @@ -117,7 +117,7 @@ func GetListClustersLifecycleStateEnumValues() []ListClustersLifecycleStateEnum
// ListClustersSortOrderEnum Enum with underlying type: string
type ListClustersSortOrderEnum string

// Set of constants representing the allowable values for ListClustersSortOrder
// Set of constants representing the allowable values for ListClustersSortOrderEnum
const (
ListClustersSortOrderAsc ListClustersSortOrderEnum = "ASC"
ListClustersSortOrderDesc ListClustersSortOrderEnum = "DESC"
Expand All @@ -128,7 +128,7 @@ var mappingListClustersSortOrder = map[string]ListClustersSortOrderEnum{
"DESC": ListClustersSortOrderDesc,
}

// GetListClustersSortOrderEnumValues Enumerates the set of values for ListClustersSortOrder
// GetListClustersSortOrderEnumValues Enumerates the set of values for ListClustersSortOrderEnum
func GetListClustersSortOrderEnumValues() []ListClustersSortOrderEnum {
values := make([]ListClustersSortOrderEnum, 0)
for _, v := range mappingListClustersSortOrder {
Expand All @@ -140,7 +140,7 @@ func GetListClustersSortOrderEnumValues() []ListClustersSortOrderEnum {
// ListClustersSortByEnum Enum with underlying type: string
type ListClustersSortByEnum string

// Set of constants representing the allowable values for ListClustersSortBy
// Set of constants representing the allowable values for ListClustersSortByEnum
const (
ListClustersSortById ListClustersSortByEnum = "ID"
ListClustersSortByName ListClustersSortByEnum = "NAME"
Expand All @@ -153,7 +153,7 @@ var mappingListClustersSortBy = map[string]ListClustersSortByEnum{
"TIME_CREATED": ListClustersSortByTimeCreated,
}

// GetListClustersSortByEnumValues Enumerates the set of values for ListClustersSortBy
// GetListClustersSortByEnumValues Enumerates the set of values for ListClustersSortByEnum
func GetListClustersSortByEnumValues() []ListClustersSortByEnum {
values := make([]ListClustersSortByEnum, 0)
for _, v := range mappingListClustersSortBy {
Expand Down
8 changes: 4 additions & 4 deletions containerengine/list_node_pools_request_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (response ListNodePoolsResponse) HTTPResponse() *http.Response {
// ListNodePoolsSortOrderEnum Enum with underlying type: string
type ListNodePoolsSortOrderEnum string

// Set of constants representing the allowable values for ListNodePoolsSortOrder
// Set of constants representing the allowable values for ListNodePoolsSortOrderEnum
const (
ListNodePoolsSortOrderAsc ListNodePoolsSortOrderEnum = "ASC"
ListNodePoolsSortOrderDesc ListNodePoolsSortOrderEnum = "DESC"
Expand All @@ -97,7 +97,7 @@ var mappingListNodePoolsSortOrder = map[string]ListNodePoolsSortOrderEnum{
"DESC": ListNodePoolsSortOrderDesc,
}

// GetListNodePoolsSortOrderEnumValues Enumerates the set of values for ListNodePoolsSortOrder
// GetListNodePoolsSortOrderEnumValues Enumerates the set of values for ListNodePoolsSortOrderEnum
func GetListNodePoolsSortOrderEnumValues() []ListNodePoolsSortOrderEnum {
values := make([]ListNodePoolsSortOrderEnum, 0)
for _, v := range mappingListNodePoolsSortOrder {
Expand All @@ -109,7 +109,7 @@ func GetListNodePoolsSortOrderEnumValues() []ListNodePoolsSortOrderEnum {
// ListNodePoolsSortByEnum Enum with underlying type: string
type ListNodePoolsSortByEnum string

// Set of constants representing the allowable values for ListNodePoolsSortBy
// Set of constants representing the allowable values for ListNodePoolsSortByEnum
const (
ListNodePoolsSortById ListNodePoolsSortByEnum = "ID"
ListNodePoolsSortByName ListNodePoolsSortByEnum = "NAME"
Expand All @@ -122,7 +122,7 @@ var mappingListNodePoolsSortBy = map[string]ListNodePoolsSortByEnum{
"TIME_CREATED": ListNodePoolsSortByTimeCreated,
}

// GetListNodePoolsSortByEnumValues Enumerates the set of values for ListNodePoolsSortBy
// GetListNodePoolsSortByEnumValues Enumerates the set of values for ListNodePoolsSortByEnum
func GetListNodePoolsSortByEnumValues() []ListNodePoolsSortByEnum {
values := make([]ListNodePoolsSortByEnum, 0)
for _, v := range mappingListNodePoolsSortBy {
Expand Down
Loading

0 comments on commit 893b72e

Please sign in to comment.