---
schema_version: "1"
id: 028a8b7128ceccc13aa4f66e5a4acd8805c29a13172256da900c94b81648b7b3
title: CloudHub Connector 1.0
collection: mulesoft
version: current
locale: ja-jp
portal_url: https://docs.salesforce.com/mulesoft/current/ja-jp/cloudhub-connector/1.0/index.md
canonical_url: https://docs.mulesoft.com/jp/cloudhub-connector/1.0/
source_site: docs.mulesoft.com
content_type: documentation
content_hash: f5d43e95ce24edb26c3e35beb66f3819604a922ed1bf0dc32fd84f26dece07ee
description: MuleSoft Documentation Site
release: "1.0"
latest: false
---
# CloudHub Connector 1.0

CloudHub 用 Anypoint Connector (CloudHub Connector) を使用すると、Mule アプリケーションから CloudHub API に接続できます。

互換性と修正された問題については、​[「CloudHub Connector リリースノート」](https://docs.mulesoft.com/jp/release-notes/connector/cloudhub-connector-release-notes-mule-4)​を参照してください。

## [](#cloudhub-設定の作成)CloudHub 設定の作成

基本の CloudHub 設定には次のプロパティが含まれます。

- Username (ユーザー名)  
    Anypoint Platform アカウントのユーザー
- Password (パスワード)  
    指定されたユーザーのパスワード
- Environment (環境)  
    使用する CloudHub 環境。Anypoint Platform でデフォルトとして定義された環境になります。

最小限の CloudHub 設定

```xml
<cloudhub:config name="CloudHub_Config" >
  <cloudhub:connection username="${ch.username}" password="${ch.password}" />
</cloudhub:config>
```

## [](#pom-ファイル情報)POM ファイル情報

Anypoint Studio 外でアプリケーションを作成する場合は、POM ファイルを次のように更新します。

```xml
<dependency>
  <groupId>com.mulesoft.connectors</groupId>
  <artifactId>mule-cloudhub-connector</artifactId>
  <version>x.x.x</version>
  <classifier>mule-plugin</classifier>
</dependency>
```

`x.x.x`​ を使用しているコネクタに対応するバージョンに置き換えます。

最新の ​`pom.xml`​ ファイル情報を取得する手順は、次のとおりです。

1. [Anypoint Exchange](https://www.mulesoft.com/exchange/)​ に移動します。
2. Exchange で、​**\[Login (ログイン)\]**​ をクリックし、Anypoint Platform のユーザー名とパスワードを指定します。
3. Exchange で、「​`hdfs`​」を検索します。
4. **\[Dependency Snippets (連動関係スニペット)\]**​ をクリックします。

## [](#使用可能な環境の表示)使用可能な環境の表示

ユーザー名とパスワードが適切に設定されると、使用可能な環境を取得して、容易に設定することができます。

![使用可能な環境](/mulesoft/current/ja-jp/cloudhub-connector/1.0/_images/cloudhub-environment-value-provider.gif)

CloudHub Connector は、​`/account`​ API エンドポイントから使用可能な環境を取得できず、空のドロップダウンリストが表示されることがあります。​**\[OAuth Client Credentials (OAuth クライアントログイン情報)\]**​ 接続種別を使用している場合​**、\[Environment (環境)\]**​ 項目は省略可能であるため、ドロップダウンリストが空でも問題は発生しません。

## [](#cloudhub-環境の使用)CloudHub 環境の使用

アプリケーションのデプロイメント環境を指定するには、​[`environment.id`](#environment.id-sysprop)​ システムプロパティを使用します。

デプロイ環境の使用

```xml
<cloudhub:config name="CloudHub_Config" >
  <cloudhub:connection
  username="${ch.username}"
  password="${ch.password}"
  environment="${environment.id}"/>
</cloudhub:config>
```

## [](#creating-notifications)通知の作成

ユーザーが通知を作成するには、指定された環境に対する Runtime Manager の ​`Read application`​ 権限が必要です。

ユーザーへの権限の割り当てについては、​[「ユーザーへの権限とロールの付与」](https://docs.mulesoft.com/jp/access-management/users#granting-permissions-and-roles-to-users)​を参照してください。

通知を作成するには、Create Notification 操作を使用します。 この操作には、通知メッセージと関連ドメインが必要です。 [`domain`](#domain-sysprop)​ システムプロパティを使用して、ドメインを指定できます。

以下を設定することもできます。

- **Custom properties (カスタムプロパティ)**
    
    作成した通知に追加の情報を提供するオープンオブジェクト
- **Priority (優先度)**
    
    通知の優先度を指定します。
    
    - ERROR
    - INFO
    - WARN
- トランザクション ID
    
    作成した通知に関連付けられたトランザクション ID

```xml
<flow name="cloudhub-connector-flows" >
  <cloudhub:create-notification domain="some-application-name" config-ref="CloudHub_Config"
  transactionId="#[uuid()]" priority="WARN">
   <cloudhub:message >
     <![CDATA[#["Problem occurred trying to process customer data"]]]>
   </cloudhub:message>
   <cloudhub:custom-properties >
     <![CDATA[#[output application/java
---
{
 "customer-id" : "ASD-123",
 "date" : now()
}]]]></cloudhub:custom-properties>
  </cloudhub:create-notification>
 </flow>
```

![通知の作成](/mulesoft/current/ja-jp/cloudhub-connector/1.0/_images/cloudhub-create-notification.png)

Figure 1. Studio での設定

## [](#listing-notifications)List Notifications

通知をコンシュームするには、List Notifications 操作を使用します。

この操作で必要なことは、通知の取得元のドメインを指定することのみです。 [`domain`](#domain-sysprop)​ システムプロパティを使用して、ドメインを指定できます。

以下を設定することもできます。

- Limit (制限)
    
    取得する通知数を指定します (デフォルトは ​`-1`​ です。この値は使用可能な通知すべてを示します)。
- Status (状況)
    
    通知を絞り込み、未読、既読、またはすべてを取得します (デフォルトは ​`unread`​ です。この値は、未読としてマークされた通知のみを取得します)。
- Search (検索)
    
    指定したテキストを含む通知のみを取得します。

```xml
<cloudhub:list-notifications config-ref="CloudHub_Config" domain="some-application-name"/>
```

![Listing Notifications](/mulesoft/current/ja-jp/cloudhub-connector/1.0/_images/cloudhub-list-notifications.png)

Figure 2. Studio での設定

この操作では、次の構造を持つ通知のリストが返されます。

```yaml
  Notification:
    type: object
    properties:
      id: string
      domain: string
      priority?: string
      read: boolean
      readOn?: datetime
      createdAt: datetime
      href: string
      properties: object
```

## [](#marking-notification)通知を既読としてマーク

Mark Notification 操作を使用して、通知を既読としてマークします。

コンシュームされた通知は既読としてマークされるため、次に通知が読み取られるときに未読の通知のみが取得されます。

Mark Notification 操作には通知 ID のみが必要です。これは、​[通知オブジェクト](#notification-object)​の ​`id`​ プロパティから取得できます。

通知を既読としてマークする例

```xml
<cloudhub:list-notifications config-ref="CloudHub_Config" domain="some-application-name"/>
<foreach>
  <cloudhub:mark-notification markAs="READ" config-ref="CloudHub_Config" notificationId="#[payload.id]"/>
</foreach>
```

## [](#listing-applications)List Applications

コネクタを使用すると、特定の環境で使用可能なすべてのアプリケーションを取得できます。設定は必要ありません。

```xml
<cloudhub:list-applications config-ref="CloudHub_Config"/>
```

情報の取得方法をカスタマイズし、アプリケーションに関するより少ない情報またはより多くの情報を取得できます。

## [](#retrieving-app-info)アプリケーションの取得

コネクタでアプリケーションのデプロイに関する情報を取得します。 必要な唯一の設定は、ドメインとアプリケーション名を指定することです。 [`domain`](#domain-sysprop)​ システムプロパティを使用して、ドメインを指定できます。

```xml
<cloudhub:get-application domain="some-application-name" config-ref="CloudHub_Config"/>
```

この操作は、アプリケーションのデプロイメントに関するすべての情報を返します。

## [](#役に立つ-cloudhub-システムプロパティ)役に立つ CloudHub システムプロパティ

<table class="tableblock frame-all grid-all fit-content spread">
<colgroup>
<col>
<col>
<col>
</colgroup>
<thead>
<tr>
<th class="tableblock halign-left valign-top">名前</th>
<th class="tableblock halign-left valign-top">情報</th>
<th class="tableblock halign-left valign-top">使用方法</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a id="domain-sysprop"></a> Domain (ドメイン)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">CloudHub 内でアプリケーションがデプロイされているドメインの名前。</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">${domain}</p></td>
</tr>
<tr>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a id="environment.id-sysprop"></a> Environment (環境)</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">アプリケーションがデプロイされている環境の ID。</p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock">${environment.id}</p></td>
</tr>
</tbody>
</table>

## [](#関連情報)関連情報

- [Anypoint Connector の概要](https://docs.mulesoft.com/connectors/introduction/introduction-to-anypoint-connectors)
- [Exchange を使用したコネクタ、テンプレート、およびサンプルの検出](https://docs.mulesoft.com/connectors/introduction/intro-use-exchange)
- [CloudHub Connector リファレンス](https://docs.mulesoft.com/jp/cloudhub-connector/1.0/cloudhub-connector-ref)
- [Anypoint Exchange の CloudHub Connector](https://www.mulesoft.com/exchange/com.mulesoft.connectors/mule-cloudhub-connector/)
- [MuleSoft ヘルプセンター](https://help.mulesoft.com)