Skip to content

Conversation

@eginez
Copy link
Contributor

@eginez eginez commented Feb 14, 2018

This PR adds content to the front page of the godocs page. It covers applicable technical information including: Optional fields, Signer, Pagination, Logging, Polymorphic json, etc. It also includes a brief example on how to get started with SDK, otherwise it references the examples directory or the readme file

oci.go Outdated
The SDK uses pointers for primitive types in many input structs. To aid in the construction of such structs, the SDK provides
functions that returns a pointer for a given value. For example:
//Given the struct
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

other comments above you put a space after the // before the comment

oci.go Outdated
DisplayName *string `mandatory:"false" json:"displayName"`
DisplayNumber *int `mandatory:"false" json:"dnsNumber"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whats a DisplayNumber? Why isn't this dnsNumber?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, does create vcn really take a dnsNumber param? seems wrong

oci.go Outdated
DisplayNumber *int `mandatory:"false" json:"dnsNumber"`
}
//We can use the helper functions to build the struct
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment re // space

oci.go Outdated
Signing custom requests
The oci-go-sdk exposes a stand-alone signer that can be used to sign custom requests. For example:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you call it 'sdk' in other places, but oci-go-sdk here. should be consistent

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a way to link to the signer's entry in the api ref here as well?

oci.go Outdated
var request http.Request
request = ... // some custom request
//Mandatory headers to be used in the sign process
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same point re // space here and below comments

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

" sign process" -> " signing process"

// A predicate that specifies when to use the optional signing headers
optionalHeadersPredicate := func (r *http.Request) bool {
return r.Method == http.MethodPost
}
Copy link
Contributor

@jodoglevy jodoglevy Feb 22, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why make the user pass this? this is common to OCI signing logic and wouldn't change based on user's code:

   defaultGenericHeaders    = []string{"date", "(request-target)", "host"}

//Optional headers
optionalHeaders = []string{"content-length", "content-type", "x-content-sha256"}

// A predicate that specifies when to use the optional signing headers
optionalHeadersPredicate := func (r *http.Request) bool {
	return r.Method == http.MethodPost
}

oci.go Outdated
//Build the signer
signer := common.RequestSigner(provider, defaultGenericHeaders, optionalHeaders, optionalHeadersPredicate)
//Signs the request
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

based on other tenses in comments, this should be 'Sign the request'

//Signs the request
signer.Sign(&request)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i think the example should show making the request, once its signed, too?

oci.go Outdated
//Signs the request
signer.Sign(&request)
For more information on the signing algorithm refer to: https://tools.ietf.org/html/draft-cavage-http-signatures-08
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please link to https://docs.us-phoenix-1.oraclecloud.com/Content/API/Concepts/signingrequests.htm instead. it does link to this link you've provided for more info if user needs it, but the TC doc is much more grokable than the spec itself.

oci.go Outdated
Polymorphic json requests and responses
Some operations accept or return polymorphic json objects. The SDK models such objects as an interface. Further the SDK provides
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"The SDK models such objects as an interface" -> "The SDK models such objects as interfaces"

oci.go Outdated
fmt.Println("Group's name is:", response.Name)
Organization of the SDK
// The CreateIdentityProviderRequest. Takes a CreateIdentityProviderDetails interface as input
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

stray period

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or maybe not. nevermind

oci.go Outdated
// The CreateIdentityProviderRequest. Takes a CreateIdentityProviderDetails interface as input
rCreate := identity.CreateIdentityProviderRequest{}
// The CreateSaml2IdentityProviderDetails implement such interface.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i would be clear that it implements the CreateIdentityProviderDetails interface here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also, did we update the descriptions for interfaces like CreateIdentityProviderDetails to mention the possible structs (subclasses) they can take? So user doesn't have to go searching through whole API reference for something that matches the interface?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not yet I have a task for that. Some services already document that others do not

oci.go Outdated
Pagination
When calling a list operation, the operation will retrieve a page of results. To retrieve more data, call the list operation again
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

" call the list operation again passing" -> " call the list operation again, passing"

oci.go Outdated
When calling a list operation, the operation will retrieve a page of results. To retrieve more data, call the list operation again
passing in the value of the most recent response's OpcNextPage as the value of Page in the next list operation call.
When there is no more data the OpcNextPage field will be nil. For example: https://github.com/oracle/oci-go-sdk/blob/master/example/example_core_test.go#L86
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"An example of paginating using this logic can be found here: For example: https://github.com/oracle/oci-go-sdk/blob/master/example/example_core_test.go#L86"

oci.go Outdated
The SDK has a built-in logging mechanism used internally. The internal logging logic is used to record the raw http
requests, responses and potential errors when (un)marshalling request and responses.
To expose debugging logs set the environment variable "OCI_GO_SDK_DEBUG" to "1", or some other non emtpy string.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"To expose debugging logs " -> "To expose debugging logs,"

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

typo: emtpy

oci.go Outdated
Forward and Backwards Compatibility
Some response fields are enum-typed. In the future, individual services may return values not covered by existing enums
for that field. To address this possibility, every enum-type response field is a model as a type that supports any string.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

" is a model as a" -> " is modeled as a"

oci.go Outdated
To expose debugging logs set the environment variable "OCI_GO_SDK_DEBUG" to "1", or some other non emtpy string.
Forward and Backwards Compatibility
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section is just on Forwards Compat. Title should remove backwards compat part

Some response fields are enum-typed. In the future, individual services may return values not covered by existing enums
for that field. To address this possibility, every enum-type response field is a model as a type that supports any string.
Thus if a service returns a value that is not recognized by your version of the SDK, then the response field will be set to this value.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about new subclasses for polymorphic models? should mention that as well

Each package represents a service. These packages include methods to interact with the service, structs that model
input and output parameters and a client struct that acts as receiver for the above methods. All code in these packages
is machine generated.
Licensing information available at: https://github.com/oracle/oci-go-sdk/blob/master/LICENSE.txt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

'License information is available at ...'

also, https://github.com/oracle/oci-go-sdk/blob/master/LICENSE.txt doesn't have the right '2016, 2018' copyright text in it

- cmd: internal tools used by the `oci-go-sdk`
*/
package oci
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if we add retry functionality for GA, should add a section on it here as well

@shalka fyi

there are some functions in this package that are meant for user consumption, most of them are meant to be used by the service packages.
- cmd: internal tools used by the `oci-go-sdk`
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about Notifications and Questions or Feedback sections?

@eginez
Copy link
Contributor Author

eginez commented Feb 27, 2018

@jodoglevy We are going to merge this changes as they are, to update master with the lastest godocs, if we need modifications we can tackle them later.

@eginez eginez merged commit 0332408 into master Feb 27, 2018
@eginez eginez deleted the eginez/godocs branch February 28, 2018 00:31
alexng-canuck pushed a commit that referenced this pull request Aug 16, 2018
SCOPE: preview, master

Squashed commit of the following:

commit 7b91e5360be814c245f1ac27c4211abf0897fdc7
Author: Esteban G <esteban.ginez@oracle.com>
Date:   Tue Jun 12 09:25:58 2018 -0700

    DEX-3649: Hiding details on R1 url
eginez pushed a commit that referenced this pull request Feb 20, 2019
SCOPE: preview, master

Squashed commit of the following:

commit 7b91e5360be814c245f1ac27c4211abf0897fdc7
Author: Esteban G <esteban.ginez@oracle.com>
Date:   Tue Jun 12 09:25:58 2018 -0700

    DEX-3649: Hiding details on R1 url
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants