Skip to content

Commit

Permalink
provider/catalog_repository: Added the CRUD for the Catalog Repository
Browse files Browse the repository at this point in the history
  • Loading branch information
xescugc committed Mar 18, 2024
1 parent ae73316 commit 1554d46
Show file tree
Hide file tree
Showing 8 changed files with 474 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ tf-generate: ## Will regenerate the new provider spec and models
@tfplugingen-openapi generate --config generator_config.yml --output out_code_spec.json openapi.yaml
@tfplugingen-framework generate resources --input ./out_code_spec.json --output .

.PHONY: new-resource
new-resource: ## Generates boilplate code for new resource R
@tfplugingen-framework scaffold resource --name $(R) --output-dir ./provider

.PHONY: install
install: ## Install the provider
@go install .
Expand Down
33 changes: 33 additions & 0 deletions docs/resources/catalog_repository.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
# generated by https://github.com/hashicorp/terraform-plugin-docs
page_title: "cycloid_catalog_repository Resource - terraform-provider-cycloid"
subcategory: ""
description: |-
---

# cycloid_catalog_repository (Resource)





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

### Required

- `branch` (String)
- `name` (String)
- `url` (String)

### Optional

- `canonical` (String)
- `credential_canonical` (String)
- `organization_canonical` (String) A canonical of an organization.
- `owner` (String) User canonical that owns this service catalog source. If omitted then the person
creating this service catalog source will be assigned as owner. When a user is the
owner of a service catalog source they has all the permissions on it.


19 changes: 19 additions & 0 deletions generator_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,22 @@ resources:
ignores:
- data
- credential_canonical
catalog_repository:
create:
path: /organizations/{organization_canonical}/service_catalog_sources
method: POST
read:
path: /organizations/{organization_canonical}/service_catalog_sources/{service_catalog_source_canonical}
method: GET
update:
path: /organizations/{organization_canonical}/service_catalog_sources/{service_catalog_source_canonical}
method: PUT
delete:
path: /organizations/{organization_canonical}/service_catalog_sources/{service_catalog_source_canonical}
method: DELETE
schema:
ignores:
- data
- service_catalog_source_canonical
- page_index
- page_size
141 changes: 141 additions & 0 deletions out_code_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,147 @@
}
},
"resources": [
{
"name": "catalog_repository",
"schema": {
"attributes": [
{
"name": "branch",
"string": {
"computed_optional_required": "required"
}
},
{
"name": "canonical",
"string": {
"computed_optional_required": "computed_optional",
"validators": [
{
"custom": {
"imports": [
{
"path": "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
}
],
"schema_definition": "stringvalidator.LengthBetween(3, 100)"
}
},
{
"custom": {
"imports": [
{
"path": "regexp"
},
{
"path": "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
}
],
"schema_definition": "stringvalidator.RegexMatches(regexp.MustCompile(\"^[a-z0-9]+[a-z0-9\\\\-_]+[a-z0-9]+$\"), \"\")"
}
}
]
}
},
{
"name": "credential_canonical",
"string": {
"computed_optional_required": "computed_optional",
"validators": [
{
"custom": {
"imports": [
{
"path": "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
}
],
"schema_definition": "stringvalidator.LengthBetween(3, 100)"
}
},
{
"custom": {
"imports": [
{
"path": "regexp"
},
{
"path": "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
}
],
"schema_definition": "stringvalidator.RegexMatches(regexp.MustCompile(\"^[a-z0-9]+[a-z0-9\\\\-_]+[a-z0-9]+$\"), \"\")"
}
}
]
}
},
{
"name": "name",
"string": {
"computed_optional_required": "required"
}
},
{
"name": "owner",
"string": {
"computed_optional_required": "computed_optional",
"description": "User canonical that owns this service catalog source. If omitted then the person\ncreating this service catalog source will be assigned as owner. When a user is the\nowner of a service catalog source they has all the permissions on it.\n"
}
},
{
"name": "url",
"string": {
"computed_optional_required": "required",
"validators": [
{
"custom": {
"imports": [
{
"path": "regexp"
},
{
"path": "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
}
],
"schema_definition": "stringvalidator.RegexMatches(regexp.MustCompile(\"^((/|~)[^/]*)+.(\\\\.git)|(([\\\\w\\\\]+@[\\\\w\\\\.]+))(:(//)?)([\\\\w\\\\.@\\\\:/\\\\-~]+)(/)?\"), \"\")"
}
}
]
}
},
{
"name": "organization_canonical",
"string": {
"computed_optional_required": "computed_optional",
"description": "A canonical of an organization.",
"validators": [
{
"custom": {
"imports": [
{
"path": "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
}
],
"schema_definition": "stringvalidator.LengthBetween(3, 100)"
}
},
{
"custom": {
"imports": [
{
"path": "regexp"
},
{
"path": "github.com/hashicorp/terraform-plugin-framework-validators/stringvalidator"
}
],
"schema_definition": "stringvalidator.RegexMatches(regexp.MustCompile(\"^[a-z0-9]+[a-z0-9\\\\-_]+[a-z0-9]+$\"), \"\")"
}
}
]
}
}
]
}
},
{
"name": "credential",
"schema": {
Expand Down
Loading

0 comments on commit 1554d46

Please sign in to comment.