Skip to content

Commit

Permalink
feature: added basic doc generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas De Meyer committed Sep 26, 2022
1 parent d7c5b72 commit 323e3a4
Show file tree
Hide file tree
Showing 18 changed files with 430 additions and 138 deletions.
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.DEFAULT_GOAL := build
.DEFAULT_GOAL := generate build

fmt:
go fmt ./...
Expand All @@ -9,5 +9,8 @@ test:
build:
go build ./...

generate:
gomarkdoc -u -o README.md ./commercelayer/ && cd examples/full && terraform-docs .
generate: dependencies
go generate

dependencies:
go get -u github.com/hashicorp/terraform-plugin-docs/cmd/tfplugindocs
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ terraform {
required_providers {
commercelayer = {
version = ">= 0.0.1"
source = "incentro-dc/commercelayer"
source = "incentro/commercelayer"
}
}
}
Expand Down
1 change: 0 additions & 1 deletion commercelayer/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ func Provider() *schema.Provider {
"commercelayer_merchant": resourceMerchant(),
"commercelayer_price_list": resourcePriceList(),
"commercelayer_customer_group": resourceCustomerGroup(),
"commercelayer_price_list": resourcePriceList(),
},
ConfigureContextFunc: providerConfigureFunc,
}
Expand Down
58 changes: 58 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
---
page_title: "commercelayer provider"
subcategory: ""
description: |-
The commercelayer provider provides resources to interact with the commercelayer API

---

# commercelayer provider

## Commercial support
TODO

## Installation
Terraform automatically downloads providers from the terraform registry. Add the following to your terraform project

```hcl
terraform {
required_providers {
commercelayer = {
version = ">= 0.0.1"
source = "incentro-dc/commercelayer"
}
}
}
```

Packages of the releases are available at [the GitHub Repo](https://github.com/incentro-dc/terraform-provider-commercelayer/releases).
See the [terraform documentation](https://www.terraform.io/docs/configuration/providers.html#third-party-plugins)
for more information about installing third-party providers.

## Using the provider
The provider attempts to read the required values from environment variables:
- `COMMERCELAYER_CLIENT_ID`
- `COMMERCELAYER_CLIENT_SECRET`
- `COMMERCELAYER_API_ENDPOINT`
- `COMMERCELAYER_AUTH_ENDPOINT`

Alternatively, you can set it up directly in the terraform file:

```hcl
provider "commercelayer" {
client_id = "<client_id>"
client_secret = "<client_secret>"
api_endpoint = "<api_endpoint>"
auth_endpoint = "<auth_endpoint>"
}
```

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

### Optional

- `api_endpoint` (String) The Commercelayer api endpoint
- `auth_endpoint` (String) The Commercelayer auth endpoint
- `client_id` (String, Sensitive) The client id of a Commercelayer store
- `client_secret` (String, Sensitive) The client secret of a Commercelayer store
54 changes: 54 additions & 0 deletions docs/resources/address.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "commercelayer_address Resource - terraform-provider-commercelayer"
subcategory: ""
description: |-
Get notified when specific events occur on a Commercelayer store. For more information, see Addresss Overview.
---

# commercelayer_address (Resource)

Get notified when specific events occur on a Commercelayer store. For more information, see Addresss Overview.



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

### Required

- `attributes` (Block List, Min: 1, Max: 1) Resource attributes (see [below for nested schema](#nestedblock--attributes))

### Read-Only

- `id` (String) The address unique identifier

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

Required:

- `city` (String) Address city
- `country_code` (String) The international 2-letter country code as defined by the ISO 3166-1 standard
- `line_1` (String) Address line 1, i.e. Street address, PO Box
- `phone` (String) Phone number (including extension).
- `state_code` (String) State, province or region code

Optional:

- `billing_info` (String) Customer's billing information (i.e. VAT number, codice fiscale)
- `business` (Boolean) Indicates if it's a business or a personal address
- `company` (String) Address company name
- `email` (String) Email address
- `first_name` (String) Address first name
- `last_name` (String) Address last name
- `lat` (Number) The address geocoded latitude. This is automatically generated when creating a shipping/billing address for an order and a valid geocoder is attached to the order's market.
- `line_2` (String) Address line 2, i.e. Apartment, Suite, Building
- `lng` (Number) The address geocoded longitude. This is automatically generated when creating a shipping/billing address for an order and a valid geocoder is attached to the order's market.
- `metadata` (Map of String) Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format
- `notes` (String) A free notes attached to the address. When used as a shipping address, this can be useful to let the customers add specific delivery instructions.
- `reference` (String) A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.
- `reference_origin` (String) Any identifier of the third party system that defines the reference code
- `zip_code` (String) ZIP or postal code


45 changes: 45 additions & 0 deletions docs/resources/customer_group.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "commercelayer_customer_group Resource - terraform-provider-commercelayer"
subcategory: ""
description: |-
A customer group is a resource that can be used to organize customers into groups.
When you associate a customer group to a market, that market becomes private and can be accessed
only by the customers belonging to the group. You can use customer groups to manage B2B customers,
B2C loyalty programs, private sales, and more.
---

# commercelayer_customer_group (Resource)

A customer group is a resource that can be used to organize customers into groups.
When you associate a customer group to a market, that market becomes private and can be accessed
only by the customers belonging to the group. You can use customer groups to manage B2B customers,
B2C loyalty programs, private sales, and more.



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

### Required

- `attributes` (Block List, Min: 1) Resource attributes (see [below for nested schema](#nestedblock--attributes))

### Read-Only

- `id` (String) The CustomerGroup unique identifier

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

Required:

- `name` (String) The customer group's internal name

Optional:

- `metadata` (Map of String) Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format
- `reference` (String) A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.
- `reference_origin` (String) Any identifier of the third party system that defines the reference code


48 changes: 48 additions & 0 deletions docs/resources/merchant.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "commercelayer_merchant Resource - terraform-provider-commercelayer"
subcategory: ""
description: |-
A merchant is the fiscal representative that is selling in a specific market. Tax calculators use the merchant's address (and the shipping address) to determine the tax rate for an order.
---

# commercelayer_merchant (Resource)

A merchant is the fiscal representative that is selling in a specific market. Tax calculators use the merchant's address (and the shipping address) to determine the tax rate for an order.



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

### Required

- `attributes` (Block List, Min: 1, Max: 1) Resource attributes (see [below for nested schema](#nestedblock--attributes))
- `relationships` (Block List, Min: 1, Max: 1) Resource relationships (see [below for nested schema](#nestedblock--relationships))

### Read-Only

- `id` (String) The merchant unique identifier

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

Required:

- `name` (String) The merchant's internal name

Optional:

- `metadata` (Map of String) Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format
- `reference` (String) A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.
- `reference_origin` (String) Any identifier of the third party system that defines the reference code


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

Required:

- `address` (String) The related address


49 changes: 49 additions & 0 deletions docs/resources/price_list.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "commercelayer_price_list Resource - terraform-provider-commercelayer"
subcategory: ""
description: |-
Price lists are collections of SKU prices,
defined by currency and market. When a list of SKUs is fetched,
only SKUs with a price defined in the market's price list and at least
a stock item in one of the market stock locations will be returned.
A user can create price lists to manage international business or B2B/B2C models.
---

# commercelayer_price_list (Resource)

Price lists are collections of SKU prices,
defined by currency and market. When a list of SKUs is fetched,
only SKUs with a price defined in the market's price list and at least
a stock item in one of the market stock locations will be returned.
A user can create price lists to manage international business or B2B/B2C models.



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

### Required

- `attributes` (Block List, Min: 1) Resource attributes (see [below for nested schema](#nestedblock--attributes))

### Read-Only

- `id` (String) The PriceList unique identifier

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

Required:

- `currency_code` (String) The international 3-letter currency code as defined by the ISO 4217 standard.
- `name` (String) The price list's internal name

Optional:

- `metadata` (Map of String) Set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the resource in a structured format
- `reference` (String) A string that you can use to add any external identifier to the resource. This can be useful for integrating the resource to an external system, like an ERP, a marketing tool, a CRM, or whatever.
- `reference_origin` (String) Any identifier of the third party system that defines the reference code
- `tax_included` (Boolean) Indicates if the associated prices include taxes.


50 changes: 0 additions & 50 deletions examples/full/.terraform-docs.yml

This file was deleted.

Loading

0 comments on commit 323e3a4

Please sign in to comment.