selling-partner-api-models/clients/sellingpartner-api-aa-java
dependabot[bot] 2ea42bba1e
Bump guava in /clients/sellingpartner-api-aa-java
Bumps [guava](https://github.com/google/guava) from 30.1-jre to 32.0.0-jre.
- [Release notes](https://github.com/google/guava/releases)
- [Commits](https://github.com/google/guava/commits)

---
updated-dependencies:
- dependency-name: com.google.guava:guava
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-06-14 22:43:03 +00:00
..
resources/swagger-codegen/templates Add a constructor for AWSSigV4Signer so that a request can be signed in a NAWS environment using only the IAM role and region , Add custom credential provider support ,Add fix to Junit test case and tests when building ,remove enable trust all mode code path 2023-02-24 13:50:03 -05:00
src/com/amazon/SellingPartnerAPIAA Add a constructor for AWSSigV4Signer so that a request can be signed in a NAWS environment using only the IAM role and region , Add custom credential provider support ,Add fix to Junit test case and tests when building ,remove enable trust all mode code path 2023-02-24 13:50:03 -05:00
tst/com/amazon/SellingPartnerAPIAA Add a constructor for AWSSigV4Signer so that a request can be signed in a NAWS environment using only the IAM role and region , Add custom credential provider support ,Add fix to Junit test case and tests when building ,remove enable trust all mode code path 2023-02-24 13:50:03 -05:00
.gitignore Added the clients directory 2020-08-05 17:53:39 -07:00
README.md RateLimiter Update 2021-08-11 11:16:42 -07:00
pom.xml Bump guava in /clients/sellingpartner-api-aa-java 2023-06-14 22:43:03 +00:00

README.md

Selling Partner API Authentication/Authorization Library

This library provides helper classes for use when signing HTTP requests for Amazon Selling Partner APIs. It is intended for use with the Selling Partner API Client Libraries generated by swagger codegen using the OkHttp library. It can also be integrated into custom projects.

LWAAuthorizationSigner

Obtains and signs a request with an access token from LWA (Login with Amazon) for the specified endpoint using the provided LWA credentials.

Example

com.squareup.okhttp.Request request = new Request.Builder()
    .url(...)
    ...
    .build();

// Seller APIs

LWAAuthorizationCredentials lwaAuthorizationCredentials = LWAAuthorizationCredentials.builder()
    .clientId("...")
    .clientSecret("...")
    .refreshToken("...")
    .endpoint("...")
    .build();

/* Sellerless APIs
The Selling Partner API scopes can be retrieved from the ScopeConstants class and passed as argument(s) to either the withScope(String scope) or withScopes(String... scopes) method during lwaAuthorizationCredentials object instantiation. */

import static com.amazon.SellingPartnerAPIAA.ScopeConstants.SCOPE_NOTIFICATIONS_API;

LWAAuthorizationCredentials lwaAuthorizationCredentials = LWAAuthorizationCredentials.builder()
    .clientId("...")
    .clientSecret("...")
    .withScopes("...")
    .endpoint("...")
    .build();

com.squareup.okhttp.Request signedRequest = new LWAAuthorizationSigner(lwaAuthorizationCredentials)
    .sign(request);

AWSSigV4Signer

Signs a request with AWS Signature Version 4 using the provided AWS developer account credentials.

Example

com.squareup.okhttp.Request request = new Request.Builder()
    .url(...)
    ...
    .build();

AWSAuthenticationCredentials awsAuthenticationCredentials = AWSAuthenticationCredentials.builder()
                .accessKeyId("...")
                .secretKey("...")
                .region("...")
                .build();

com.squareup.okhttp.Request signedRequest = new AWSSigV4Signer(awsAuthenticationCredentials)
    .sign(request);

/*Signs request using IAM role credentials.

AWSAuthenticationCredentialsProvider awsAuthenticationCredentialsProvider = AWSAuthenticationCredentialsProvider.builder()
               .roleArn("...")
               .roleSessionName("...")
               .build();
               
com.squareup.okhttp.Request signedRequest = new 
     AWSSigV4Signer(awsAuthenticationCredentialsProvider.getCredentials())
    .sign(request);

LWAAccessTokenCache

Interface to implement cache for access token that is returned in LWAClient and reuse the access token until time to live.

RateLimitConfiguration

Interface to set and get rateLimit configurations that are used with RateLimiter. RateLimiter is used on client side to restrict the rate at which requests are made. RateLimiter Configuration takes Permit, rate which requests are made and TimeOut

Example


com.squareup.okhttp.Request request = new Request.Builder()
    .url(...)
    ...
    .build();
    
 RateLimitConfiguration rateLimitOption = RateLimitConfigurationOnRequests.builder()
                .rateLimitPermit(...)
                .waitTimeOutInMilliSeconds(...)
                .build();

Resources

This package features Mustache templates designed for use with swagger codegen. When you build Selling Partner API Swagger models with these templates, they help generate a rich SDK with functionality to invoke Selling Partner APIs built in. The templates are located in resources/swagger-codegen.

Building

This library can be built using Maven by running this command in the package root:

mvn clean package

Dependencies are declared in the pom.xml file.

License

Swagger Codegen templates are subject to the Swagger Codegen License.

All other work licensed as follows:

Copyright 2019 Amazon.com, Inc

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this library except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.