-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduced
dynatrace_cloud_development_environments
resource
- Loading branch information
1 parent
912a151
commit d0c07b5
Showing
10 changed files
with
230 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
dynatrace/api/builtin/appengineregistry/clouddevelopmentenvironments/schema.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
{ | ||
"allowedScopes": [ | ||
"environment" | ||
], | ||
"description": "In order to enable Cloud Development Environment (CDE) for application development, the respective domains need to be configured here.", | ||
"displayName": "Cloud Development Environments", | ||
"documentation": "", | ||
"dynatrace": "1", | ||
"enums": {}, | ||
"maxObjects": 1, | ||
"multiObject": false, | ||
"properties": { | ||
"cloudDevelopmentEnvironments": { | ||
"description": "The URL to allow app development from. E.g. `https://*.my-company.my-cde-provider.com`.", | ||
"displayName": "Cloud Development Environments", | ||
"documentation": "", | ||
"items": { | ||
"constraints": [ | ||
{ | ||
"customMessage": "Not a valid URL. Use \"https://[*.]host[:port]\"", | ||
"pattern": "^https://(\\x2a\\.)?[^\\s/?#.\\x2a:]+?(\\.[^\\s/?#.\\x2a:]+?)*(:[0-9]{1,5})?$", | ||
"type": "PATTERN" | ||
}, | ||
{ | ||
"customMessage": "Special characters [;'] are not supported", | ||
"pattern": "^[^;']+$", | ||
"type": "PATTERN" | ||
}, | ||
{ | ||
"maxLength": 500, | ||
"minLength": 1, | ||
"type": "LENGTH" | ||
}, | ||
{ | ||
"customMessage": "Not a valid URI", | ||
"pattern": "^(([^\\s:/?#]+?):){1}((//)?([^\\s/?#]+?)){1}([^\\s?#]*?)(\\?([^\\s#]*?))?(#([^\\s]*?))?$", | ||
"type": "PATTERN" | ||
}, | ||
{ | ||
"customMessage": "Not a valid http(s) URL", | ||
"pattern": "^https?://.*$", | ||
"type": "PATTERN" | ||
} | ||
], | ||
"description": "", | ||
"displayName": "", | ||
"documentation": "", | ||
"subType": "url", | ||
"type": "text" | ||
}, | ||
"maxObjects": 20, | ||
"minObjects": 0, | ||
"modificationPolicy": "DEFAULT", | ||
"nullable": false, | ||
"type": "set" | ||
} | ||
}, | ||
"schemaGroups": [ | ||
"group:dt-apps-development", | ||
"group:preferences" | ||
], | ||
"schemaId": "builtin:app-engine-registry.cloud-development-environments", | ||
"types": {}, | ||
"version": "1.1" | ||
} |
31 changes: 31 additions & 0 deletions
31
dynatrace/api/builtin/appengineregistry/clouddevelopmentenvironments/service.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/** | ||
* @license | ||
* Copyright 2020 Dynatrace LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package clouddevelopmentenvironments | ||
|
||
import ( | ||
clouddevelopmentenvironments "github.com/dynatrace-oss/terraform-provider-dynatrace/dynatrace/api/builtin/appengineregistry/clouddevelopmentenvironments/settings" | ||
"github.com/dynatrace-oss/terraform-provider-dynatrace/dynatrace/settings" | ||
"github.com/dynatrace-oss/terraform-provider-dynatrace/dynatrace/settings/services/settings20" | ||
) | ||
|
||
const SchemaVersion = "1.1" | ||
const SchemaID = "builtin:app-engine-registry.cloud-development-environments" | ||
|
||
func Service(credentials *settings.Credentials) settings.CRUDService[*clouddevelopmentenvironments.Settings] { | ||
return settings20.Service[*clouddevelopmentenvironments.Settings](credentials, SchemaID, SchemaVersion) | ||
} |
28 changes: 28 additions & 0 deletions
28
dynatrace/api/builtin/appengineregistry/clouddevelopmentenvironments/service_test.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* @license | ||
* Copyright 2020 Dynatrace LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package clouddevelopmentenvironments_test | ||
|
||
import ( | ||
"testing" | ||
|
||
"github.com/dynatrace-oss/terraform-provider-dynatrace/dynatrace/testing/api" | ||
) | ||
|
||
func TestAccCloudDevelopmentEnvironments(t *testing.T) { | ||
api.TestAcc(t) | ||
} |
54 changes: 54 additions & 0 deletions
54
dynatrace/api/builtin/appengineregistry/clouddevelopmentenvironments/settings/settings.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
/** | ||
* @license | ||
* Copyright 2020 Dynatrace LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package clouddevelopmentenvironments | ||
|
||
import ( | ||
"github.com/dynatrace-oss/terraform-provider-dynatrace/terraform/hcl" | ||
"github.com/hashicorp/terraform-plugin-sdk/v2/helper/schema" | ||
) | ||
|
||
type Settings struct { | ||
CloudDevelopmentEnvironments []string `json:"cloudDevelopmentEnvironments,omitempty"` // The URL to allow app development from. E.g. `https://*.my-company.my-cde-provider.com`. | ||
} | ||
|
||
func (me *Settings) Name() string { | ||
return "cloud_development_environments" | ||
} | ||
|
||
func (me *Settings) Schema() map[string]*schema.Schema { | ||
return map[string]*schema.Schema{ | ||
"cloud_development_environments": { | ||
Type: schema.TypeSet, | ||
Description: "The URL to allow app development from. E.g. `https://*.my-company.my-cde-provider.com`.", | ||
Optional: true, // minobjects == 0 | ||
Elem: &schema.Schema{Type: schema.TypeString}, | ||
}, | ||
} | ||
} | ||
|
||
func (me *Settings) MarshalHCL(properties hcl.Properties) error { | ||
return properties.EncodeAll(map[string]any{ | ||
"cloud_development_environments": me.CloudDevelopmentEnvironments, | ||
}) | ||
} | ||
|
||
func (me *Settings) UnmarshalHCL(decoder hcl.Decoder) error { | ||
return decoder.DecodeAll(map[string]any{ | ||
"cloud_development_environments": &me.CloudDevelopmentEnvironments, | ||
}) | ||
} |
3 changes: 3 additions & 0 deletions
3
...pi/builtin/appengineregistry/clouddevelopmentenvironments/testdata/terraform/example_a.tf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
resource "dynatrace_cloud_development_environments" "#name#" { | ||
cloud_development_environments = ["https://example1.my-company.my-cde-provider.com", "https://example2.my-company.my-cde-provider.com", "https://example3.my-company.my-cde-provider.com"] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
templates/resources/cloud_development_environments.md.tmpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
--- | ||
layout: "" | ||
page_title: "dynatrace_cloud_development_environments Resource - terraform-provider-dynatrace" | ||
subcategory: "Environment Settings" | ||
description: |- | ||
The resource `dynatrace_cloud_development_environments` covers configuration for cloud development environments | ||
--- | ||
|
||
# dynatrace_cloud_development_environments (Resource) | ||
|
||
-> This resource requires the API token scopes **Read settings** (`settings.read`) and **Write settings** (`settings.write`) | ||
|
||
## Dynatrace Documentation | ||
|
||
- AppEngine - https://docs.dynatrace.com/docs/platform/appengine | ||
|
||
- Settings API - https://www.dynatrace.com/support/help/dynatrace-api/environment-api/settings (schemaId: `builtin:app-engine-registry.cloud-development-environments`) | ||
|
||
## Export Example Usage | ||
|
||
- `terraform-provider-dynatrace -export dynatrace_cloud_development_environments` downloads existing cloud development environments configuration | ||
|
||
The full documentation of the export feature is available [here](https://dt-url.net/h203qmc). | ||
|
||
## Resource Example Usage | ||
|
||
{{ tffile "dynatrace/api/builtin/appengineregistry/clouddevelopmentenvironments/testdata/terraform/example_a.tf" }} | ||
|
||
{{ .SchemaMarkdown | trimspace }} |