GithubHelp home page GithubHelp logo

go-routespreferred's Introduction

Google Maps Platform Routes Preferred API Client for Go

Test Release Generation codecov semantic-release

Go idiomatic client for Google Maps Platform Routes PreferredAPI.

NOTE: The libraries in this repository should be considered experimental at this time and breaking changes should be expected.

NOTE: The libraries in this repository are autogenerated from the interface definitions in the googleapis/googleapis repository using Bazel.

Installation

go get developers.google.com/maps/go/routespreferred

Requirements

Create a Project

You will need a Google Cloud Platform project. Follow these instructions to get your project set up.

Enable the Routes Preferred API

You will need to enable the Google Maps Platform Routes Preferred API.

Enable billing

You will need to enable billing to use the Google Maps Platform Routes API.

Local development environment

You will need to set up the local development environment.

Get started quickly by installing the Google Cloud SDK and running the following commands in command line: gcloud auth login and gcloud config set project [YOUR PROJECT ID].

Authentication

Routes Preferred supports authentication by OAuth token, self-signed JWT, and API Key. This library only supports OAuth and JWT from service account credentials. You can specify OAuth with option.WithScopes("https://www.googleapis.com/auth/maps-platform.routespreferred") or JWT with option.WithAudiences("https://routespreferred.googleapis.com/"), though these are both set by default.

To run outside of App Engine/Compute Engine environments, download service account credentials following these instructions and point to it with option.WithCredentialsFile(...) or the GOOGLE_APPLICATION_CREDENTIALS environment variable. See the compute routes sample for a complete example.

App Engine/Compute Engine instances are associated with a default service account, which this library will use by default to authenticate. However, since Routes Preferred isn't a Cloud API, the cloud-platform scope will not grant access to it. Follow these instructions to set the https://www.googleapis.com/auth/maps-platform.routespreferred scope for your instance. Note that the scope doesn't appear on the Cloud Console, so you should use the gcloud command line interface.

Transport

Google Maps Platform Routes Preferred API uses gRPC for the transport layer.

Versioning

This library follows Semantic Versioning.

Contributing

Contributions to this library are always welcome and highly encouraged.

See CONTRIBUTING for more information how to get started.

License

Apache 2.0 - See LICENSE for more information.

go-routespreferred's People

Contributors

dependabot[bot] avatar googlemaps-bot avatar greghutch avatar jpoehnelt avatar semantic-release-bot avatar subtlemon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

go-routespreferred's Issues

Update Authentication section in README.

The section is currently outdated, as authentication is no longer limited to API keys.

Current state of authentication support:

  1. OAuth with service account credentials:
    1. Set by option.WithCredentialsFile(...).
    2. Set by environment variable GOOGLE_APPLICATION_CREDENTIALS.
    3. Set by AppEngine/Compute Engine environment. Note that your AppEngine/Compute Engine service account is likely not authorized to grant the routes preferred scope, so you'll have to update its scopes accordingly (https://cloud.google.com/compute/docs/access/create-enable-service-accounts-for-instances#changeserviceaccountandscopes). Also note that since we are not a cloud API, our scope will not appear on the cloud console and should be granted via gcloud CLI instead.
  2. Self-signed JWT:
    • Set by option.WithAudiences("https://routespreferred.googleapis.com/"), same credentials as OAuth.
    • Note: This doesn't seem to work with credentials provided by the AppEngine/Compute Engine environment.
  3. API Keys:
    • Unsupported in GAPIC libraries.

Add ComputeRouteMatrix example.

Is your feature request related to a problem? Please describe.
Before ComputeRouteMatrix is generally available, there should be examples in the GAPIC libraries.

Describe the solution you'd like
Add a compute-route-matrix sample, much like compute-routes.

Describe alternatives you've considered
Use one sample to show both ComputeRoutes and ComputeRouteMatrix examples.

Use OAuth over API Keys in sample code

Is your feature request related to a problem? Please describe.
API Keys are explicitly not supported by the GAPIC libraries. While this can be worked around, the workaround is different for each language and generally pretty ugly. The GAPIC library samples should show OAuth usage instead of API Key usage.

Describe the solution you'd like
Change the sample code to use OAuth.

Describe alternatives you've considered
Continue to show API Key usage, or show both usages. - This will require work to figure out how to use API Keys in other GAPIC languages, and only serves to provide a more convenient but less secure authentication method.

Additional context
The Routes Preferred endpoint supports authentication via API Keys, OAuth, or Self-Signed JWTs. Both OAuth and Self-Signed JWTs are well-supported by GAPIC libraries.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.