Skip to content

Commit

Permalink
Merge pull request #78 from mulesoft-consulting/dev
Browse files Browse the repository at this point in the history
Documentation: Anypoint MQ components
  • Loading branch information
soufi authored Feb 10, 2023
2 parents a2f629e + 4b18837 commit bd7e07b
Show file tree
Hide file tree
Showing 29 changed files with 929 additions and 10 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,23 @@ This project was initiated by Mulesoft's consultants and architects from the pro

This provider uses the anypoint platform APIs to perform actions for each one of the implemented resources.

![alt text](resources/imgs/provider-arch.png)
![alt text](drive/imgs/provider-arch.png)

We use the **anypoint client library** as an abstraction layer to perform actions on the platform.

For better maintainability and in order to speed up the development process, the **anypoint client library** is a library generated from OAS3 specifications written by the community.

The following image describes the delivery cycle:

![alt text](resources/imgs/provider-deliver.png)
![alt text](drive/imgs/provider-deliver.png)

The cycle is composed of 3 steps:

1. Pick one resource and understand how it works using tools like Postman, anypoint's documentation and your favorite browser's inspector.
2. Create the OAS3 specification. The specification should at least contain GET, POST and DELETE operations.
The specification should be contributed [here](https://github.com/mulesoft-consulting/anypoint-automation-client-generator). Using the OAS spec, a go module will be generated and pushed [here](https://github.com/mulesoft-consulting/anypoint-client-go).

![alt text](resources/imgs/provider-cycle.png)
![alt text](drive/imgs/provider-cycle.png)
3. Implement the resource and related data sources in the provider using the generated library.

## How to use
Expand Down
2 changes: 1 addition & 1 deletion anypoint/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema"
)

const COMPOSITE_ID_SEPARATOR = "_"
const COMPOSITE_ID_SEPARATOR = "/"

func IsString(v interface{}) bool {
return reflect.TypeOf(v) == reflect.TypeOf("")
Expand Down
66 changes: 66 additions & 0 deletions docs/data-sources/ame.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "anypoint_ame Data Source - terraform-provider-anypoint"
subcategory: ""
description: |-
Reads all `Anypoint MQs` in your environment's region.
---

# anypoint_ame (Data Source)

Reads all `Anypoint MQs` in your environment's region.

## Example Usage

```terraform
data "anypoint_ame" "ame_list" {
org_id = var.root_org
env_id = var.env_id
region_id = "us-east-1"
params {
offset = 2
limit = 10
}
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `env_id` (String) The environment id where the Anypoint MQ Exchange is defined.
- `org_id` (String) The organization id where the Anypoint MQ Exchange is defined.
- `region_id` (String) The region id where the Anypoint MQ Exchange is defined. Refer to Anypoint Platform official documentation for the list of available regions

### Optional

- `params` (Block Set, Max: 1) The search parameters. Should only provide one occurrence of the block. (see [below for nested schema](#nestedblock--params))

### Read-Only

- `exchanges` (List of Object) List of exchanges defined in the given region (see [below for nested schema](#nestedatt--exchanges))
- `id` (String) The ID of this resource.

<a id="nestedblock--params"></a>
### Nested Schema for `params`

Optional:

- `destination_ids` (List of String) Includes only results with the given Ids.
- `limit` (Number) Limit the number of elements in the response.
- `offset` (Number) Skip over a number of elements by specifying an offset value for the query.
- `starts_with` (String) Searchs the field from the left using the passed string.


<a id="nestedatt--exchanges"></a>
### Nested Schema for `exchanges`

Read-Only:

- `encrypted` (Boolean)
- `exchange_id` (String)
- `type` (String)


72 changes: 72 additions & 0 deletions docs/data-sources/amq.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "anypoint_amq Data Source - terraform-provider-anypoint"
subcategory: ""
description: |-
Reads all `Anypoint MQs` in your environment's region.
---

# anypoint_amq (Data Source)

Reads all `Anypoint MQs` in your environment's region.

## Example Usage

```terraform
data "anypoint_amq" "amq_list" {
org_id = var.root_org
env_id = var.env_id
region_id = "us-east-1"
params {
offset = 2
limit = 10
}
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `env_id` (String) The environment id where the Anypoint MQ is defined.
- `org_id` (String) The organization id where the Anypoint MQ is defined.
- `region_id` (String) The region id where the Anypoint MQ is defined. Refer to Anypoint Platform official documentation for the list of available regions

### Optional

- `params` (Block Set, Max: 1) The search parameters. Should only provide one occurrence of the block. (see [below for nested schema](#nestedblock--params))

### Read-Only

- `id` (String) The ID of this resource.
- `queues` (List of Object) List of queues defined in the given region (see [below for nested schema](#nestedatt--queues))

<a id="nestedblock--params"></a>
### Nested Schema for `params`

Optional:

- `destination_ids` (List of String) Includes only results with the given Ids.
- `limit` (Number) Limit the number of elements in the response.
- `offset` (Number) Skip over a number of elements by specifying an offset value for the query.
- `starts_with` (String) Searchs the field from the left using the passed string.


<a id="nestedatt--queues"></a>
### Nested Schema for `queues`

Read-Only:

- `dead_letter_queue_id` (String)
- `default_delivery_delay` (Number)
- `default_lock_ttl` (Number)
- `default_ttl` (Number)
- `encrypted` (Boolean)
- `fifo` (Boolean)
- `max_deliveries` (Number)
- `queue_id` (String)
- `type` (String)


58 changes: 58 additions & 0 deletions docs/data-sources/connected_app.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "anypoint_connected_app Data Source - terraform-provider-anypoint"
subcategory: ""
description: |-
Reads all `connected apps` in your organization.
---

# anypoint_connected_app (Data Source)

Reads all `connected apps` in your organization.

## Example Usage

```terraform
data "anypoint_connected_app" "my_read_conn_app" {
id = "7d72415f862044199be3b739848e6adb" # existing Connected App client id
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `id` (String) The unique id of this connected app generated by the anypoint platform.

### Read-Only

- `audience` (String) Who can use this application
- `cert_expiry` (String)
- `client_uri` (String) Users can visit this URL to learn more about your app. Required for "on behalf of user"
connected apps
- `enabled` (Boolean) True if the connected app is enabled
- `grant_types` (List of String) List of grant types. For "on its own behalf" connected apps the only allowed value is "client_credentials".
The allowed values for "on behalf of user" connected apps are: "authorization_code", "refresh_token",
"password", and "urn:ietf:params:oauth:grant-type:jwt-bearer".
- `name` (String) The name of the connected app.
- `organization_id` (String) The organization id where the connected app's owner is defined.
- `policy_uri` (String)
- `public_keys` (List of String) Application public key (PEM format). Used to validate JWT authorization grants.
Required when grant type jwt-bearer is selected.
- `redirect_uris` (List of String) Configure which URIs users may be directed to after authorization
- `scope` (List of Object) The scopes this connected app has authorization to work on (see [below for nested schema](#nestedatt--scope))
- `secret` (String, Sensitive) The secret of the connected app.
- `tos_uri` (String)
- `user_id` (String) The id of the user who owns the connected app

<a id="nestedatt--scope"></a>
### Nested Schema for `scope`

Read-Only:

- `env_id` (String)
- `org_id` (String)
- `scope` (String)


1 change: 0 additions & 1 deletion docs/data-sources/env.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ data "anypoint_env" "env" {
- `client_id` (String)
- `is_production` (Boolean) True if the environment is a production environment
- `name` (String) The name of the environment
- `organization_id` (String) The organization id where the environment is defined.
- `type` (String) The type of the environment: sandbox or production


57 changes: 57 additions & 0 deletions docs/resources/ame.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "anypoint_ame Resource - terraform-provider-anypoint"
subcategory: ""
description: |-
Creates an `Anypoint MQ Exchange` in your `region`.
---

# anypoint_ame (Resource)

Creates an `Anypoint MQ Exchange` in your `region`.

## Example Usage

```terraform
resource "anypoint_ame" "ame" {
org_id = var.root_org
env_id = var.env_id
region_id = "us-east-1"
exchange_id = "myExchangeId"
encrypted = true
}
```

<!-- schema generated by tfplugindocs -->
## Schema

### Required

- `env_id` (String) The environment id where the Anypoint MQ Exchange is defined.
- `exchange_id` (String) The unique id of this Anypoint MQ Exchange.
- `org_id` (String) The organization id where the Anypoint MQ Exchange is defined.
- `region_id` (String) The region id where the Anypoint MQ Exchange is defined. Refer to Anypoint Platform official documentation for the list of available regions

### Optional

- `encrypted` (Boolean) Whether to encrypt the Exchange or not.
- `last_updated` (String) The last time this resource has been updated locally.

### Read-Only

- `id` (String) The unique id of this Anypoint MQ Exchange generated by the provider composed of {orgId}_{envId}_{regionId}_{queueId}.
- `type` (String) The type of the Anypoint MQ Exchange.

## Import

Import is supported using the following syntax:

```shell
# In order for the import to work, you should provide a ID composed of the following:
# {ORG_ID}/{ENV_ID}/{REGION_ID}/{EXCHANGE_ID}

terraform import \
-var-file params.tfvars.json \ #variables file
anypoint_ame.ame \ #resource name
aa1f55d6-213d-4f60-845c-201282484cd1/7074fcdd-9b23-4ab6-97r8-5db5f4adf17d/us-east-1/myAwesomeExchange #resource ID
```
Loading

0 comments on commit bd7e07b

Please sign in to comment.