-
Notifications
You must be signed in to change notification settings - Fork 87
/
environment.go
95 lines (77 loc) · 3.5 KB
/
environment.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
/*
Copyright 2023 The Radius Authors.
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 datamodel
import (
v1 "github.com/radius-project/radius/pkg/armrpc/api/v1"
rpv1 "github.com/radius-project/radius/pkg/rp/v1"
)
const EnvironmentResourceType = "Applications.Core/environments"
// Environment represents Application environment resource.
type Environment struct {
v1.BaseResource
// Properties is the properties of the resource.
Properties EnvironmentProperties `json:"properties"`
}
// ResourceTypeName returns the resource type of the Environment instance.
func (e *Environment) ResourceTypeName() string {
return EnvironmentResourceType
}
// EnvironmentProperties represents the properties of Environment.
type EnvironmentProperties struct {
Compute rpv1.EnvironmentCompute `json:"compute,omitempty"`
Recipes map[string]map[string]EnvironmentRecipeProperties `json:"recipes,omitempty"`
Providers Providers `json:"providers,omitempty"`
RecipeConfig RecipeConfigProperties `json:"recipeConfig,omitempty"`
Extensions []Extension `json:"extensions,omitempty"`
Simulated bool `json:"simulated,omitempty"`
}
// EnvironmentRecipeProperties represents the properties of environment's recipe.
type EnvironmentRecipeProperties struct {
TemplateKind string `json:"templateKind"`
TemplatePath string `json:"templatePath"`
TemplateVersion string `json:"templateVersion,omitempty"`
Parameters map[string]any `json:"parameters,omitempty"`
PlainHTTP bool `json:"plainHttp,omitempty"`
}
// Recipe represents input properties for recipe getMetadata api.
type Recipe struct {
// Type of the portable resource this recipe can be consumed by. For example: 'Applications.Datastores/mongoDatabases'
ResourceType string `json:"resourceType,omitempty"`
// Name of the recipe registered to the environment.
Name string `json:"recipeName,omitempty"`
}
// ResourceTypeName returns the resource type of the Recipe instance.
func (e *Recipe) ResourceTypeName() string {
return "Applications.Core/environments"
}
// ResourceTypeName returns the resource type of the EnvironmentRecipeProperties instance.
func (e *EnvironmentRecipeProperties) ResourceTypeName() string {
return "Applications.Core/environments"
}
// Providers represents configs for providers for the environment, eg azure,aws
type Providers struct {
// Azure provider information
Azure ProvidersAzure `json:"azure,omitempty"`
// AWS provider information
AWS ProvidersAWS `json:"aws,omitempty"`
}
// ProvidersAzure represents the azure provider configs
type ProvidersAzure struct {
// Scope is the target level for deploying the azure resources
Scope string `json:"scope,omitempty"`
}
// ProvidersAWS represents the aws provider configs
type ProvidersAWS struct {
// Scope is the target level for deploying the aws resources
Scope string `json:"scope,omitempty"`
}