クライアント ライブラリの設定

このページでは、任意の言語で API に接続できるように Memorystore for Redis API のクライアント ライブラリをインストールする方法について説明します。

クライアント ライブラリのインストール

C++

このクライアント ライブラリの要件とインストールの依存関係の詳細については、C++ 開発環境の設定をご覧ください。

C#

Visual Studio で Google.Cloud.Redis.V1 パッケージをインストールします。

Go

go get cloud.google.com/go/redis/apiv1

Java

Maven を使用している場合は、pom.xml ファイルに以下を追加します。

<dependency>
    <groupId>com.google.cloud</groupId>
    <artifactId>google-cloud-redis</artifactId>
    <version>0.62.0-alpha</version>
</dependency>

Gradle を使用している場合は、依存関係に以下の内容を追加します。

compile 'com.google.cloud:google-cloud-redis:0.62.0-alpha'

SBT を使用している場合は、依存関係に以下を追加します。

libraryDependencies += "com.google.cloud" % "google-cloud-redis" % "0.62.0-alpha"

VS Code、IntelliJ または Eclipse を使用している場合は、次の IDE プラグインでプロジェクトにクライアント ライブラリを追加できます。

プラグインでは、サービス アカウントのキー管理などの追加機能も提供されます。詳細は各プラグインのドキュメントをご覧ください。

Node.js

npm install --save @google-cloud/redis

PHP

composer require google/cloud-redis

Python

Python 開発環境の設定の詳細については、Python 開発環境設定ガイドをご覧ください。
pip install --upgrade google-cloud-redis

Ruby

gem install google-cloud-redis

認証の設定

  1. Install the Google Cloud CLI, then initialize it by running the following command:

    gcloud init
  2. If you're using a local shell, then create local authentication credentials for your user account:

    gcloud auth application-default login

    You don't need to do this if you're using Cloud Shell.

    If an authentication error is returned, and you are using an external identity provider (IdP), confirm that you have signed in to the gcloud CLI with your federated identity.

    ログイン画面が表示されます。ログインすると、ADC で使用されるローカル認証情報ファイルに認証情報が保存されます。

参考情報