Skip to content

Commit 893b72e

Browse files
authored
Releasing v2.7.0 (#135)
releasing go sdk v2.7.0
1 parent efb53d1 commit 893b72e

File tree

315 files changed

+6770
-737
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

315 files changed

+6770
-737
lines changed

CHANGELOG.md

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,21 @@ All notable changes to this project will be documented in this file.
44

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

7+
## 2.7.0 - 2018-10-18
8+
### Added
9+
- Support for cost tracking tags in the Identity service
10+
- Support for generating and downloading wallets in the Database service
11+
- Support for creating a standalone backup from an on-premises database in the Database service
12+
- Support for db version and additional connection strings in the Autonomous Transaction Processing and Autonomous Data Warehouse resources of the Database service
13+
- Support for copying volume backups across regions in the Block Storage service
14+
- Support for deleting compartments in the Identity service
15+
- Support for reboot migration for virtual machines in the Compute service
16+
- Support for Instance Pools and Instance Configurations in the Compute service
17+
18+
### Fixed
19+
- The signing algorithm does not lower case the header fields [Github issue 132](https://github.com/oracle/oci-go-sdk/issues/132)
20+
- Raw configuration provider does not check for empty strings [Github issue 134](https://github.com/oracle/oci-go-sdk/issues/134)
21+
722
## 2.6.0 - 2018-10-04
823
### Added
924
- Support for trusted partner images through application listings and subscriptions in the Compute service
@@ -30,14 +45,14 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
3045
- Support for resizing an offline volume in the Block Storage service
3146
- Nil interface when polymorphic json response object is null
3247

33-
## 2.2.0 - 2018-07-26
48+
## 2.2.0 - 2018-08-09
3449
### Added
3550
- Support for fault domains in the Compute service
3651
- 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)
3752

3853
## 2.1.0 - 2018-07-26
3954
### Added
40-
- Support for the OCI Search service
55+
- Support for the Search service
4156
- Support for specifying a backup policy when creating a boot volume in the Block Storage service
4257

4358
### Fixed
@@ -207,7 +222,7 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
207222
208223
## 1.3.0 - 2018-04-19
209224
### Added
210-
- 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)
225+
- 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)
211226
- Support for tagging DbSystem and Database resources in the Database Service
212227
- Support for filtering by DbSystemId in ListDbVersions operation in Database Service
213228

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ type ConfigurationProvider interface {
5454
```
5555

5656
### Making a request
57-
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.
57+
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.
5858

5959
- *Creating a client*: All packages provide a function to create clients, using the naming convention `New<ServiceName>ClientWithConfigurationProvider`,
6060
such as `NewVirtualNetworkClientWithConfigurationProvider` or `NewIdentityClientWithConfigurationProvider`. To create a new client,

common/common.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package common
55
import (
66
"fmt"
77
"strings"
8+
"regexp"
89
)
910

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

4647
// canStringBeRegion test if the string can be a region, if it can, returns the string as is, otherwise it
4748
// returns an error
49+
var blankRegex = regexp.MustCompile("\\s")
4850
func canStringBeRegion(stringRegion string) (region string, err error) {
49-
if strings.Contains(stringRegion, " ") || stringRegion == "" {
51+
if blankRegex.MatchString(stringRegion) || stringRegion == "" {
5052
return "", fmt.Errorf("region can not be empty or have spaces")
5153
}
5254
return stringRegion, nil

common/configuration.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,14 +80,23 @@ func (p rawConfigurationProvider) KeyID() (keyID string, err error) {
8080
}
8181

8282
func (p rawConfigurationProvider) TenancyOCID() (string, error) {
83+
if p.tenancy == "" {
84+
return "", fmt.Errorf("tenancy OCID can not be empty")
85+
}
8386
return p.tenancy, nil
8487
}
8588

8689
func (p rawConfigurationProvider) UserOCID() (string, error) {
90+
if p.user == "" {
91+
return "", fmt.Errorf("user OCID can not be empty")
92+
}
8793
return p.user, nil
8894
}
8995

9096
func (p rawConfigurationProvider) KeyFingerprint() (string, error) {
97+
if p.fingerprint == "" {
98+
return "", fmt.Errorf("fingerprint can not be empty")
99+
}
91100
return p.fingerprint, nil
92101
}
93102

common/configuration_test.go

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,33 @@ func TestRawConfigurationProvider(t *testing.T) {
112112

113113
}
114114

115+
func TestBadRawConfigurationProvider(t *testing.T) {
116+
var (
117+
testTenancy = ""
118+
testUser = ""
119+
testRegion = ""
120+
testFingerprint = ""
121+
)
122+
123+
c := NewRawConfigurationProvider(testTenancy, testUser, testRegion, testFingerprint, "", nil)
124+
125+
_, err := c.UserOCID()
126+
assert.Error(t, err)
127+
128+
_, err = c.KeyFingerprint()
129+
assert.Error(t, err)
130+
131+
_, err = c.Region()
132+
assert.Error(t, err)
133+
134+
_, err = c.PrivateRSAKey()
135+
assert.Error(t, err)
136+
137+
_, err = c.KeyID()
138+
assert.Error(t, err)
139+
140+
}
141+
115142
func TestRawConfigurationProvider_BadRegion(t *testing.T) {
116143
var (
117144
testTenancy = "ocid1.tenancy.oc1..aaaaaaaaxf3fuazos"
@@ -824,7 +851,12 @@ func TestIsRegionValid(t *testing.T) {
824851
{"single trailing string", "aasb ", true},
825852
{"trailing string", "aasb ", true},
826853
{"single trailing and leading", " aasb ", true},
854+
{"tab", "aasb ", true},
855+
{"carriage return", "\raasb", true},
856+
{"new line", "aasb\n", true},
857+
{"feed", "aa\fsb", true},
827858
{"trailing and leading", " aasb ", true},
859+
828860
}
829861

830862
for _, tIO := range testIO {

common/helpers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,15 @@ var sdkDateType = reflect.TypeOf(SDKDate{})
121121
var sdkDateTypePtr = reflect.TypeOf(&SDKDate{})
122122

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

128128
func tryParsingTimeWithValidFormatsForHeaders(data []byte, headerName string) (t time.Time, err error) {
129129
header := strings.ToLower(headerName)
130130
switch header {
131131
case "lastmodified", "date":
132-
t, err = tryParsing(data, time.RFC3339, time.RFC1123, rfc1123OptionalLeadingDigitsInDay, time.RFC850, time.ANSIC)
132+
t, err = tryParsing(data, time.RFC3339Nano, time.RFC3339, time.RFC1123, rfc1123OptionalLeadingDigitsInDay, time.RFC850, time.ANSIC)
133133
return
134134
default: //By default we parse with RFC3339
135135
t, err = time.Parse(sdkTimeFormat, string(data))

common/http_signer.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ func (signer ociRequestSigner) getSigningString(request *http.Request) string {
110110
signingParts := make([]string, len(signingHeaders))
111111
for i, part := range signingHeaders {
112112
var value string
113+
part = strings.ToLower(part)
113114
switch part {
114115
case "(request-target)":
115116
value = getRequestTarget(request)

common/http_signer_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,28 @@ func TestOCIRequestSigner_SigningString(t *testing.T) {
122122
assert.Equal(t, expectedSigningString, signature)
123123
}
124124

125+
func TestOCIRequestSigner_SigningString_Uppercase(t *testing.T) {
126+
s := ociRequestSigner{
127+
KeyProvider: testKeyProvider{},
128+
GenericHeaders: []string{"Date", "(Request-target)", "host"},
129+
ShouldHashBody: defaultBodyHashPredicate,
130+
BodyHeaders: defaultBodyHeaders}
131+
132+
url, _ := url.Parse(testURL)
133+
r := http.Request{
134+
Proto: "HTTP/1.1",
135+
ProtoMajor: 1,
136+
ProtoMinor: 1,
137+
Header: make(http.Header),
138+
URL: url,
139+
}
140+
r.Header.Set(requestHeaderDate, "Thu, 05 Jan 2014 21:31:40 GMT")
141+
r.Method = http.MethodGet
142+
signature := s.getSigningString(&r)
143+
144+
assert.Equal(t, expectedSigningString, signature)
145+
}
146+
125147
func TestOCIRequestSigner_ComputeSignature(t *testing.T) {
126148
s := ociRequestSigner{
127149
KeyProvider: testKeyProvider{},

common/http_test.go

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ func TestHttpMarshalerAll(t *testing.T) {
218218
var content map[string]string
219219
body, _ := ioutil.ReadAll(request.Body)
220220
json.Unmarshal(body, &content)
221-
when := s.When.Format(time.RFC3339)
221+
when := s.When.Format(time.RFC3339Nano)
222222
assert.True(t, request.URL.Path == "//101")
223223
assert.True(t, request.URL.Query().Get("name") == s.Name)
224224
assert.True(t, request.URL.Query().Get("income") == strconv.FormatFloat(float64(s.Income), 'f', 6, 32))
@@ -291,7 +291,7 @@ func TestHttpMarshallerSimpleStructPointers(t *testing.T) {
291291
assert.Equal(t, "", request.Header.Get(requestHeaderOpcRetryToken))
292292
assert.True(t, strings.Contains(request.URL.Path, "111"))
293293
assert.True(t, strings.Contains(string(all), "thekey"))
294-
assert.Contains(t, string(all), now.Format(time.RFC3339))
294+
assert.Contains(t, string(all), now.Format(time.RFC3339Nano))
295295
}
296296

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

1013+
func TestToStringValue_TimeFormat(t *testing.T) {
1014+
testingData := []struct {
1015+
TheTime *SDKTime `mandatory:"true" json:"theTime"`
1016+
Input string
1017+
Expected string
1018+
}{
1019+
{
1020+
Input: "2018-10-15T19:43:05.080Z",
1021+
Expected: "2018-10-15T19:43:05.08Z",
1022+
},
1023+
{
1024+
Input: "2018-10-15T19:43:05Z",
1025+
Expected: "2018-10-15T19:43:05Z",
1026+
},
1027+
}
1028+
1029+
for _, item := range testingData {
1030+
time, err := time.Parse(time.RFC3339, item.Input)
1031+
assert.NoError(t, err)
1032+
item.TheTime = &SDKTime{time}
1033+
1034+
reflectValue := reflect.ValueOf(item)
1035+
reflectType := reflectValue.Type()
1036+
1037+
str, err := toStringValue(reflectValue.Field(0), reflectType.Field(0))
1038+
assert.NoError(t, err)
1039+
1040+
assert.Equal(t, item.Expected, str)
1041+
}
1042+
}
1043+
10131044
func TestSDKDate_Unmarshal(t *testing.T) {
10141045
type structWithTime struct {
10151046
Name string `json:"name"`

common/version.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

containerengine/cluster.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func (m Cluster) String() string {
5656
// ClusterLifecycleStateEnum Enum with underlying type: string
5757
type ClusterLifecycleStateEnum string
5858

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

78-
// GetClusterLifecycleStateEnumValues Enumerates the set of values for ClusterLifecycleState
78+
// GetClusterLifecycleStateEnumValues Enumerates the set of values for ClusterLifecycleStateEnum
7979
func GetClusterLifecycleStateEnumValues() []ClusterLifecycleStateEnum {
8080
values := make([]ClusterLifecycleStateEnum, 0)
8181
for _, v := range mappingClusterLifecycleState {

containerengine/cluster_summary.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func (m ClusterSummary) String() string {
5656
// ClusterSummaryLifecycleStateEnum Enum with underlying type: string
5757
type ClusterSummaryLifecycleStateEnum string
5858

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

78-
// GetClusterSummaryLifecycleStateEnumValues Enumerates the set of values for ClusterSummaryLifecycleState
78+
// GetClusterSummaryLifecycleStateEnumValues Enumerates the set of values for ClusterSummaryLifecycleStateEnum
7979
func GetClusterSummaryLifecycleStateEnumValues() []ClusterSummaryLifecycleStateEnum {
8080
values := make([]ClusterSummaryLifecycleStateEnum, 0)
8181
for _, v := range mappingClusterSummaryLifecycleState {

containerengine/list_clusters_request_response.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func (response ListClustersResponse) HTTPResponse() *http.Response {
8686
// ListClustersLifecycleStateEnum Enum with underlying type: string
8787
type ListClustersLifecycleStateEnum string
8888

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

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

120-
// Set of constants representing the allowable values for ListClustersSortOrder
120+
// Set of constants representing the allowable values for ListClustersSortOrderEnum
121121
const (
122122
ListClustersSortOrderAsc ListClustersSortOrderEnum = "ASC"
123123
ListClustersSortOrderDesc ListClustersSortOrderEnum = "DESC"
@@ -128,7 +128,7 @@ var mappingListClustersSortOrder = map[string]ListClustersSortOrderEnum{
128128
"DESC": ListClustersSortOrderDesc,
129129
}
130130

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

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

156-
// GetListClustersSortByEnumValues Enumerates the set of values for ListClustersSortBy
156+
// GetListClustersSortByEnumValues Enumerates the set of values for ListClustersSortByEnum
157157
func GetListClustersSortByEnumValues() []ListClustersSortByEnum {
158158
values := make([]ListClustersSortByEnum, 0)
159159
for _, v := range mappingListClustersSortBy {

containerengine/list_node_pools_request_response.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ func (response ListNodePoolsResponse) HTTPResponse() *http.Response {
8686
// ListNodePoolsSortOrderEnum Enum with underlying type: string
8787
type ListNodePoolsSortOrderEnum string
8888

89-
// Set of constants representing the allowable values for ListNodePoolsSortOrder
89+
// Set of constants representing the allowable values for ListNodePoolsSortOrderEnum
9090
const (
9191
ListNodePoolsSortOrderAsc ListNodePoolsSortOrderEnum = "ASC"
9292
ListNodePoolsSortOrderDesc ListNodePoolsSortOrderEnum = "DESC"
@@ -97,7 +97,7 @@ var mappingListNodePoolsSortOrder = map[string]ListNodePoolsSortOrderEnum{
9797
"DESC": ListNodePoolsSortOrderDesc,
9898
}
9999

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

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

125-
// GetListNodePoolsSortByEnumValues Enumerates the set of values for ListNodePoolsSortBy
125+
// GetListNodePoolsSortByEnumValues Enumerates the set of values for ListNodePoolsSortByEnum
126126
func GetListNodePoolsSortByEnumValues() []ListNodePoolsSortByEnum {
127127
values := make([]ListNodePoolsSortByEnum, 0)
128128
for _, v := range mappingListNodePoolsSortBy {

0 commit comments

Comments
 (0)