Skip to content

Commit 5bf1e50

Browse files
authored
Merge pull request #10 from srikanthkm/master
Changes to include IBM Core SDK, documentation
2 parents a694cb3 + ce3e159 commit 5bf1e50

37 files changed

+2649
-586
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ repos:
1111
# You are encouraged to use static refs such as tags, instead of branch name
1212
#
1313
# Running "pre-commit autoupdate" would automatically updates rev to latest tag
14-
rev: 0.13.1+ibm.36.dss
14+
rev: 0.13.1+ibm.39.dss
1515
hooks:
1616
- id: detect-secrets # pragma: whitelist secret
1717
# Add options for detect-secrets-hook binary. You can run `detect-secrets-hook --help` to list out all possible options.

.secrets.baseline

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"files": "^.secrets.baseline$|go.sum|examples/SampleApp/go.sum|vendor",
44
"lines": null
55
},
6-
"generated_at": "2021-05-27T19:00:52Z",
6+
"generated_at": "2021-07-01T06:28:41Z",
77
"plugins_used": [
88
{
99
"name": "AWSKeyDetector"
@@ -70,31 +70,23 @@
7070
"hashed_secret": "d4c3d66fd0c38547a3c7a4c6bdc29c36911bc030",
7171
"is_secret": false,
7272
"is_verified": false,
73-
"line_number": 63,
74-
"type": "Secret Keyword",
75-
"verified_result": null
76-
},
77-
{
78-
"hashed_secret": "a94906aadfc6ddd1659ef976cf1b5ecae197b9a3",
79-
"is_secret": false,
80-
"is_verified": false,
81-
"line_number": 131,
73+
"line_number": 74,
8274
"type": "Secret Keyword",
8375
"verified_result": null
8476
}
8577
],
86-
"lib/internal/utils/Metering.go": [
78+
"lib/internal/utils/UrlBuilder.go": [
8779
{
88-
"hashed_secret": "d4c3d66fd0c38547a3c7a4c6bdc29c36911bc030",
80+
"hashed_secret": "f75b33f87ffeacb3a4f793a09693e672e07449ff",
8981
"is_secret": false,
9082
"is_verified": false,
91-
"line_number": 86,
83+
"line_number": 80,
9284
"type": "Secret Keyword",
9385
"verified_result": null
9486
}
9587
]
9688
},
97-
"version": "0.13.1+ibm.36.dss",
89+
"version": "0.13.1+ibm.39.dss",
9890
"word_list": {
9991
"file": null,
10092
"hash": null

CODE_OF_CONDUCT.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# Contributor Covenant Code of Conduct
2+
3+
## Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making
6+
participation in our project and our community a harassment-free experience for everyone, regardless of age, body size,
7+
disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education,
8+
socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation.
9+
10+
## Our Standards
11+
12+
Examples of behavior that contributes to creating a positive environment include:
13+
14+
* Using welcoming and inclusive language
15+
* Being respectful of differing viewpoints and experiences
16+
* Gracefully accepting constructive criticism
17+
* Focusing on what is best for the community
18+
* Showing empathy towards other community members
19+
20+
Examples of unacceptable behavior by participants include:
21+
22+
* The use of sexualized language or imagery and unwelcome sexual attention or advances
23+
* Trolling, insulting/derogatory comments, and personal or political attacks
24+
* Public or private harassment
25+
* Publishing others' private information, such as a physical or electronic address, without explicit permission
26+
* Other conduct which could reasonably be considered inappropriate in a professional setting
27+
28+
## Our Responsibilities
29+
30+
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take
31+
appropriate and fair corrective action in response to any instances of unacceptable behavior.
32+
33+
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits,
34+
issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any
35+
contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
36+
37+
## Scope
38+
39+
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the
40+
project or its community. Examples of representing a project or community include using an official project e-mail
41+
address, posting via an official social media account, or acting as an appointed representative at an online or offline
42+
event. Representation of a project may be further defined and clarified by project maintainers.
43+
44+
## Enforcement
45+
46+
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at
47+
[email protected]. All complaints will be reviewed and investigated and will result in a response that is deemed
48+
necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to
49+
the reporter of an incident. Further details of specific enforcement policies may be posted separately.
50+
51+
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent
52+
repercussions as determined by other members of the project's leadership.
53+
54+
## Attribution
55+
56+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available
57+
at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
58+
59+
[homepage]: https://www.contributor-covenant.org
60+
61+
For answers to common questions about this code of conduct, see
62+
https://www.contributor-covenant.org/faq

CONTRIBUTING.MD

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Contributing
2+
3+
Review the following guidelines for submitting questions, issues, or changes to this repository.
4+
5+
## Questions
6+
7+
If you have questions about using the IBM Cloud App Configuration SDKs, you can ask questions in
8+
[Stack Overflow](https://stackoverflow.com/questions/tagged/ibm-appconfiguration). Be sure to include
9+
the `ibm-appconfiguration` tags.
10+
11+
## Coding Style
12+
13+
The SDK follows the Go coding conventions documented [here](https://golang.org/doc/effective_go.html).
14+
15+
### Running Linter
16+
Linter is a tool that analyzes source code to flag programming errors, bugs, stylistic errors, and suspicious constructs.
17+
Golint is a useful Go linting tool that prints out coding style mistakes.
18+
19+
Perform the following steps to run "golint" on this SDK :-
20+
- Ensure that local GOPATH and GOBIN are fully setup by using the go env command.
21+
- Install the package by using the command
22+
```
23+
go get -u golang.org/x/lint/golint
24+
```
25+
- Verify the installation by running 'ls $GOBIN | grep golint' command.
26+
- To run "golint" on the SDK, run the following from the SDK root directory.
27+
```
28+
make lint
29+
```
30+
31+
## Issues
32+
33+
If you encounter an issue with Go SDK, you're welcome to submit
34+
a [bug report](https://github.com/IBM/appconfiguration-go-sdk/issues). Before that, please search for similar issues. It's possible somebody has encountered this issue already.
35+
36+
## Pull Requests
37+
38+
If you want to contribute to the repository, follow these steps:
39+
40+
1. Fork the repository
41+
2. Develop and test your code changes:
42+
- To build/test: `make test`
43+
3. Please add one or more tests to validate your changes.
44+
4. Make sure everything builds/tests cleanly
45+
5. Check your code for lint issues:
46+
```
47+
make lint
48+
```
49+
6. Commit your changes
50+
7. Push to your fork and submit a pull request to the `master` branch
51+
52+
## Running the tests
53+
54+
The tests within the SDK consists of unit tests.
55+
56+
To run the test, run the following from the root folder:
57+
58+
```
59+
make test
60+
```
61+
62+
# Developer's Certificate of Origin 1.1
63+
64+
By making a contribution to this project, I certify that:
65+
66+
(a) The contribution was created in whole or in part by me and I
67+
have the right to submit it under the open source license
68+
indicated in the file; or
69+
70+
(b) The contribution is based upon previous work that, to the best
71+
of my knowledge, is covered under an appropriate open source
72+
license and I have the right under that license to submit that
73+
work with modifications, whether created in whole or in part
74+
by me, under the same open source license (unless I am
75+
permitted to submit under a different license), as indicated
76+
in the file; or
77+
78+
(c) The contribution was provided directly to me by some other
79+
person who certified (a), (b) or (c) and I have not modified
80+
it.
81+
82+
(d) I understand and agree that this project and the contribution
83+
are public and that a record of the contribution (including all
84+
personal information I submit with it, including my sign-off) is
85+
maintained indefinitely and may be redistributed consistent with
86+
this project or the open source license(s) involved.
87+

Makefile

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
lint:
2+
golint lib && golint lib/internal/models && golint lib/internal/utils && golint lib/internal/messages && golint lib/internal/constants && golint examples
3+
4+
testLib:
5+
cd lib/ && go test -coverprofile=coverage.out
6+
7+
testLibModels:
8+
cd lib/internal/models && go test -coverprofile=coverage.out
9+
10+
testLibUtils:
11+
cd lib/internal/utils && go test -coverprofile=coverage.out
12+
13+
test:
14+
make testLib
15+
make testLibModels
16+
make testLibUtils
17+
go test --coverprofile=coverage.out ./... && go tool cover -func=coverage.out

README.md

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ properties for distributed applications centrally.
2525

2626
## Installation
2727

28-
The current version of this SDK: 0.1.0
28+
The current version of this SDK: 0.1.1
2929

3030
There are a few different ways to download and install the IBM App Configuration Go SDK project for use by your Go
3131
application:
@@ -93,17 +93,13 @@ appConfiguration.SetContext("airlines-webapp", "dev", AppConfiguration.ContextOp
9393
- LiveConfigUpdateEnabled: Set this value to `false` if the new configuration values shouldn't be fetched from the
9494
server. Make sure to provide a proper JSON file in the path. By default, this value is enabled.
9595

96-
### Permissions required by SDK
97-
Add write permission for `non-root` users to `appconfiguration.json` file which is used as cache in AppConfiguration SDK.
98-
AppConfiguration cache location will be the application root folder.
99-
10096
## Get single feature
10197

10298
```go
10399
feature, err := appConfiguration.GetFeature("online-check-in")
104100
if err == nil {
105101
fmt.Println("Feature Name", feature.GetFeatureName())
106-
fmt.Println("Feature Id", feature.GetFeatureId())
102+
fmt.Println("Feature Id", feature.GetFeatureID())
107103
fmt.Println("Feature Type", feature.GetFeatureDataType())
108104

109105
if (feature.IsEnabled()) {
@@ -121,7 +117,7 @@ features := appConfiguration.GetFeatures()
121117
feature := features["online-check-in"]
122118

123119
fmt.Println("Feature Name", feature.GetFeatureName())
124-
fmt.Println("Feature Id", feature.GetFeatureId())
120+
fmt.Println("Feature Id", feature.GetFeatureID())
125121
fmt.Println("Feature Type", feature.GetFeatureDataType())
126122
fmt.Println("Feature is enabled", feature.IsEnabled())
127123
```
@@ -147,7 +143,7 @@ featureVal := feature.GetCurrentValue(entityId, entityAttributes)
147143
property, err := appConfiguration.GetProperty("check-in-charges")
148144
if err == nil {
149145
fmt.Println("Property Name", property.GetPropertyName())
150-
fmt.Println("Property Id", property.GetPropertyId())
146+
fmt.Println("Property Id", property.GetPropertyID())
151147
fmt.Println("Property Type", property.GetPropertyDataType())
152148
}
153149
```
@@ -159,7 +155,7 @@ properties := appConfiguration.GetProperties()
159155
property := properties["check-in-charges"]
160156

161157
fmt.Println("Property Name", property.GetPropertyName())
162-
fmt.Println("Property Id", property.GetPropertyId())
158+
fmt.Println("Property Id", property.GetPropertyID())
163159
fmt.Println("Property Type", property.GetPropertyDataType())
164160
```
165161

examples/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ module examples
33
go 1.16
44

55
require (
6-
github.com/IBM/appconfiguration-go-sdk v0.1.0
6+
github.com/IBM/appconfiguration-go-sdk v0.1.1
77
github.com/gorilla/mux v1.7.2
8-
)
8+
)

examples/go.sum

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuF
2121
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
2222
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
2323
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
24-
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
24+
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=

examples/main.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ func main() {
1919
appConfiguration := AppConfiguration.GetInstance()
2020
appConfiguration.Init(AppConfiguration.REGION_US_SOUTH, "<guid>", "<apikey>")
2121
appConfiguration.SetContext("<collectionId>", "<environmentId>")
22-
entityId := "user123"
22+
entityID := "user123"
2323
entityAttributes := make(map[string]interface{})
2424
entityAttributes["city"] = "Bangalore"
2525
entityAttributes["radius"] = 60
@@ -28,19 +28,19 @@ func main() {
2828
feature, err := appConfiguration.GetFeature("<featureId>")
2929
if err == nil {
3030
fmt.Println("Feature Name:", feature.GetFeatureName())
31-
fmt.Println("Feature Id:", feature.GetFeatureId())
31+
fmt.Println("Feature Id:", feature.GetFeatureID())
3232
fmt.Println("Feature Data type:", feature.GetFeatureDataType())
3333
fmt.Println("Is Feature enabled?", feature.IsEnabled())
34-
fmt.Println("Feature evaluated value is:", feature.GetCurrentValue(entityId, entityAttributes))
34+
fmt.Println("Feature evaluated value is:", feature.GetCurrentValue(entityID, entityAttributes))
3535
}
3636

3737
fmt.Println("\n\nPROPERTY OPERATIONS\n")
3838
property, err := appConfiguration.GetProperty("<propertyId>")
3939
if err == nil {
4040
fmt.Println("Property Name:", property.GetPropertyName())
41-
fmt.Println("Property Id:", property.GetPropertyId())
41+
fmt.Println("Property Id:", property.GetPropertyID())
4242
fmt.Println("Property Data type:", property.GetPropertyDataType())
43-
fmt.Println("Property evaluated value is:", property.GetCurrentValue(entityId, entityAttributes))
43+
fmt.Println("Property evaluated value is:", property.GetCurrentValue(entityID, entityAttributes))
4444
}
4545
//whenever the configurations get changed/updated on the app configuration service instance the function inside this listener is triggered.
4646
//So, to keep track of live changes to configurations use this listener.

go.mod

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,16 @@ module github.com/IBM/appconfiguration-go-sdk
33
go 1.16
44

55
require (
6-
github.com/go-resty/resty/v2 v2.4.0
6+
github.com/IBM/go-sdk-core/v5 v5.5.1
7+
github.com/google/uuid v1.2.0 // indirect
78
github.com/gorilla/websocket v1.4.2
9+
github.com/mitchellh/mapstructure v1.4.1 // indirect
810
github.com/robfig/cron v1.2.0
911
github.com/sirupsen/logrus v1.7.0
12+
github.com/stretchr/testify v1.6.1
13+
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4 // indirect
14+
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22 // indirect
15+
golang.org/x/text v0.3.6 // indirect
16+
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 // indirect
17+
gopkg.in/yaml.v2 v2.4.0 // indirect
1018
)

0 commit comments

Comments
 (0)