-
Notifications
You must be signed in to change notification settings - Fork 116
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support to create serverless projects and test packages using elastic-package with a new provider (--provider serverless). Currently, supported serverless projects in elastic-package are observability and security. For testing packages in serverless, geoIP fields in documents are skipped when comparing with the expected documents, since it could not be set a specific GeoIP database to make the tests stable.
- Loading branch information
Showing
17 changed files
with
1,275 additions
and
35 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
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,45 @@ | ||
// Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
// or more contributor license agreements. Licensed under the Elastic License; | ||
// you may not use this file except in compliance with the Elastic License. | ||
|
||
package kibana | ||
|
||
import ( | ||
"encoding/json" | ||
"errors" | ||
"fmt" | ||
"net/http" | ||
) | ||
|
||
// DefaultFleetServerURL returns the default Fleet server configured in Kibana | ||
func (c *Client) DefaultFleetServerURL() (string, error) { | ||
path := fmt.Sprintf("%s/fleet_server_hosts", FleetAPI) | ||
|
||
statusCode, respBody, err := c.get(path) | ||
if err != nil { | ||
return "", fmt.Errorf("could not reach fleet server hosts endpoint: %w", err) | ||
} | ||
|
||
if statusCode != http.StatusOK { | ||
return "", fmt.Errorf("could not get status data; API status code = %d; response body = %s", statusCode, respBody) | ||
} | ||
|
||
var hosts struct { | ||
Items []struct { | ||
IsDefault bool `json:"is_default"` | ||
HostURLs []string `json:"host_urls"` | ||
} `json:"items"` | ||
} | ||
err = json.Unmarshal(respBody, &hosts) | ||
if err != nil { | ||
return "", fmt.Errorf("failed to decode response: %w", err) | ||
} | ||
|
||
for _, server := range hosts.Items { | ||
if server.IsDefault && len(server.HostURLs) > 0 { | ||
return server.HostURLs[0], nil | ||
} | ||
} | ||
|
||
return "", errors.New("could not find the fleet server URL for this project") | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,12 @@ | ||
# Directory containing GeoIP databases for stacks managed by elastic-agent. | ||
# stack.geoip_dir: "/path/to/geoip_dir/" | ||
## Elastic Cloud | ||
# Host URL | ||
# stack.elastic_cloud.host: https://cloud.elastic.co | ||
|
||
## Serverless stack provider | ||
# Project type | ||
# stack.serverless.type: observability | ||
# Region where the Serverless project is going to be created | ||
# stack.serverless.region: aws-us-east-1 | ||
|
Oops, something went wrong.