Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed error when universal profiling is activated #783

Merged
merged 3 commits into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changelog/783.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
```release-note:feature
resource/deployment: Added support for symbols and profiling endpoints.
```
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,10 @@ type IntegrationsServerTF struct {
}

type EndpointsTF struct {
Fleet *string `tfsdk:"fleet"`
APM *string `tfsdk:"apm"`
Fleet *string `tfsdk:"fleet"`
APM *string `tfsdk:"apm"`
Symbols *string `tfsdk:"symbols"`
Profiling *string `tfsdk:"profiling"`
}

func (srv IntegrationsServerTF) payload(ctx context.Context, payload models.IntegrationsServerPayload) (*models.IntegrationsServerPayload, diag.Diagnostics) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,10 @@ type IntegrationsServer struct {
}

type Endpoints struct {
Fleet *string `tfsdk:"fleet"`
APM *string `tfsdk:"apm"`
Fleet *string `tfsdk:"fleet"`
APM *string `tfsdk:"apm"`
Symbols *string `tfsdk:"symbols"`
Profiling *string `tfsdk:"profiling"`
}

func ReadIntegrationsServers(in []*models.IntegrationsServerResourceInfo) (*IntegrationsServer, error) {
Expand Down Expand Up @@ -121,6 +123,12 @@ func readEndpoints(in *models.IntegrationsServerResourceInfo) *Endpoints {
case "fleet":
endpoints.Fleet = url.URL
hasValidEndpoints = true
case "symbols":
endpoints.Symbols = url.URL
hasValidEndpoints = true
case "profiling":
endpoints.Profiling = url.URL
hasValidEndpoints = true
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,14 @@ func Test_readIntegrationsServer(t *testing.T) {
Service: ec.String("fleet"),
URL: ec.String("https://fleet_endpoint.cloud.elastic.co"),
},
{
Service: ec.String("symbols"),
URL: ec.String("https://symbols_endpoint.cloud.elastic.co"),
},
{
Service: ec.String("profiling"),
URL: ec.String("https://profiling_endpoint.cloud.elastic.co"),
},
},
},
PlanInfo: &models.IntegrationsServerPlansInfo{Current: &models.IntegrationsServerPlanInfo{
Expand Down Expand Up @@ -115,8 +123,10 @@ func Test_readIntegrationsServer(t *testing.T) {
HttpEndpoint: ec.String("http://integrations_serverresource.cloud.elastic.co:9200"),
HttpsEndpoint: ec.String("https://integrations_serverresource.cloud.elastic.co:9243"),
Endpoints: &Endpoints{
Fleet: ec.String("https://fleet_endpoint.cloud.elastic.co"),
APM: ec.String("https://apm_endpoint.cloud.elastic.co"),
Fleet: ec.String("https://fleet_endpoint.cloud.elastic.co"),
APM: ec.String("https://apm_endpoint.cloud.elastic.co"),
Symbols: ec.String("https://symbols_endpoint.cloud.elastic.co"),
Profiling: ec.String("https://profiling_endpoint.cloud.elastic.co"),
},
InstanceConfigurationId: ec.String("aws.integrations_server.r4"),
InstanceConfigurationVersion: ec.Int(5),
Expand Down Expand Up @@ -153,6 +163,14 @@ func Test_readIntegrationsServer(t *testing.T) {
Service: ec.String("fleet"),
URL: ec.String("https://fleet_endpoint.cloud.elastic.co"),
},
{
Service: ec.String("symbols"),
URL: ec.String("https://symbols_endpoint.cloud.elastic.co"),
},
{
Service: ec.String("profiling"),
URL: ec.String("https://profiling_endpoint.cloud.elastic.co"),
},
},
},
PlanInfo: &models.IntegrationsServerPlansInfo{Current: &models.IntegrationsServerPlanInfo{
Expand Down Expand Up @@ -207,6 +225,14 @@ func Test_readIntegrationsServer(t *testing.T) {
Service: ec.String("fleet"),
URL: ec.String("https://fleet_endpoint.cloud.elastic.co"),
},
{
Service: ec.String("symbols"),
URL: ec.String("https://symbols_endpoint.cloud.elastic.co"),
},
{
Service: ec.String("profiling"),
URL: ec.String("https://profiling_endpoint.cloud.elastic.co"),
},
},
},
PlanInfo: &models.IntegrationsServerPlansInfo{Current: &models.IntegrationsServerPlanInfo{
Expand Down Expand Up @@ -247,8 +273,10 @@ func Test_readIntegrationsServer(t *testing.T) {
HttpEndpoint: ec.String("http://integrations_serverresource.cloud.elastic.co:9200"),
HttpsEndpoint: ec.String("https://integrations_serverresource.cloud.elastic.co:9243"),
Endpoints: &Endpoints{
Fleet: ec.String("https://fleet_endpoint.cloud.elastic.co"),
APM: ec.String("https://apm_endpoint.cloud.elastic.co"),
Fleet: ec.String("https://fleet_endpoint.cloud.elastic.co"),
APM: ec.String("https://apm_endpoint.cloud.elastic.co"),
Symbols: ec.String("https://symbols_endpoint.cloud.elastic.co"),
Profiling: ec.String("https://profiling_endpoint.cloud.elastic.co"),
},
InstanceConfigurationId: ec.String("aws.integrations_server.r4"),
Size: ec.String("1g"),
Expand Down Expand Up @@ -289,6 +317,14 @@ func Test_readIntegrationsServer(t *testing.T) {
Service: ec.String("fleet"),
URL: ec.String("https://fleet_endpoint.cloud.elastic.co"),
},
{
Service: ec.String("symbols"),
URL: ec.String("https://symbols_endpoint.cloud.elastic.co"),
},
{
Service: ec.String("profiling"),
URL: ec.String("https://profiling_endpoint.cloud.elastic.co"),
},
},
},
PlanInfo: &models.IntegrationsServerPlansInfo{Current: &models.IntegrationsServerPlanInfo{
Expand Down Expand Up @@ -330,8 +366,10 @@ func Test_readIntegrationsServer(t *testing.T) {
HttpEndpoint: ec.String("http://integrations_serverresource.cloud.elastic.co:9200"),
HttpsEndpoint: ec.String("https://integrations_serverresource.cloud.elastic.co:9243"),
Endpoints: &Endpoints{
Fleet: ec.String("https://fleet_endpoint.cloud.elastic.co"),
APM: ec.String("https://apm_endpoint.cloud.elastic.co"),
Fleet: ec.String("https://fleet_endpoint.cloud.elastic.co"),
APM: ec.String("https://apm_endpoint.cloud.elastic.co"),
Symbols: ec.String("https://symbols_endpoint.cloud.elastic.co"),
Profiling: ec.String("https://profiling_endpoint.cloud.elastic.co"),
},
InstanceConfigurationId: ec.String("aws.integrations_server.r4"),
Size: ec.String("1g"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ func IntegrationsServerSchema() schema.Attribute {
Computed: true,
Description: "URLs for the accessing the Fleet and APM API's within this Integrations Server resource.",
AttributeTypes: map[string]attr.Type{
"apm": types.StringType,
"fleet": types.StringType,
"apm": types.StringType,
"fleet": types.StringType,
"symbols": types.StringType,
"profiling": types.StringType,
},
PlanModifiers: []planmodifier.Object{
objectplanmodifier.UseStateForUnknown(),
Expand Down
Loading