Documentation
¶
Index ¶
- Variables
- func EntitySchema() map[string]schema.Attribute
- func NewSearchDataSource() datasource.DataSource
- func Schema() map[string]schema.Attribute
- type ArrayPropsModel
- type EntityModel
- type EntityPropertiesModel
- type RelationModel
- type ScorecardModel
- type ScorecardRulesModel
- type SearchDataModel
- type SearchDataSource
- func (d *SearchDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, ...)
- func (d *SearchDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, ...)
- func (d *SearchDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse)
- func (d *SearchDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, ...)
Constants ¶
This section is empty.
Variables ¶
View Source
var SearchDataSourceMarkdownDescription = `
# Search Data Source
The search data source allows you to search for entities in Port.
See the [Port documentation](https://docs.getport.io/search-and-query/) for more information about the search capabilities in Port.
## Example Usage
### Search for all entities in a specific blueprint:
` + "```hcl" + `
data "port_search" "all_service" {
query = jsonencode({
"combinator" : "and", "rules" : [
{ "operator" : "=", "property" : "$blueprint", "value" : "Service" },
]
})
}
` + "\n```" + `
### Search for entity with specific identifier in a specific blueprint to create another resource based on the values of the entity:
` + "```hcl" + `
data "port_search" "ads_service" {
query = jsonencode({
"combinator" : "and", "rules" : [
{ "operator" : "=", "property" : "$blueprint", "value" : "Service" },
{ "operator" : "=", "property" : "$identifier", "value" : "Ads" },
]
})
}
` + "\n```" + `
### Scorecards automation example
In this example we are creating a jira task for each service that its Ownership Scorecard hasn't reached Gold level :
` + "```hcl" + `
data "port_search" "all_services" {
query = jsonencode({
"combinator" : "and", "rules" : [
{ "operator" : "=", "property" : "$blueprint", "value" : "microservice" },
]
})
}
locals {
// Count the number of services that are not owned by a team with a Gold level
microservice_ownership_without_gold_level = length([
for entity in data.port_search.all_services.entities : entity.scorecards["ownership"].level
if entity.scorecards["ownership"].level != "Gold"
])
}
// create jira issue per service that is not owned by a team with a Gold level
resource "jira_issue" "microservice_ownership_without_gold_level" {
count = local.microservice_ownership_without_gold_level
issue_type = "Task"
project_key = "PORT"
summary = "Service ${data.port_search.backend_services.entities[count.index].title} hasn't reached Gold level in Ownership Scorecard"
description = "[Service](https://app.getport.io/${port_blueprint.microservice.identifier}Entity/${data.port_search.backend_services.entities[count.index].identifier}) is not owned by a team with a Gold level, please assign a team with a Gold level to the service"
}
` + "\n```" + ``
Functions ¶
func EntitySchema ¶
func NewSearchDataSource ¶
func NewSearchDataSource() datasource.DataSource
Types ¶
type ArrayPropsModel ¶
type EntityModel ¶
type EntityModel struct {
Identifier types.String `tfsdk:"identifier"`
Blueprint types.String `tfsdk:"blueprint"`
Title types.String `tfsdk:"title"`
Icon types.String `tfsdk:"icon"`
RunID types.String `tfsdk:"run_id"`
CreatedAt types.String `tfsdk:"created_at"`
CreatedBy types.String `tfsdk:"created_by"`
UpdatedAt types.String `tfsdk:"updated_at"`
UpdatedBy types.String `tfsdk:"updated_by"`
Properties *EntityPropertiesModel `tfsdk:"properties"`
Teams []types.String `tfsdk:"teams"`
Scorecards *map[string]ScorecardModel `tfsdk:"scorecards"`
Relations *RelationModel `tfsdk:"relations"`
}
type EntityPropertiesModel ¶
type EntityPropertiesModel struct {
StringProps map[string]types.String `tfsdk:"string_props"`
NumberProps map[string]types.Float64 `tfsdk:"number_props"`
BooleanProps map[string]types.Bool `tfsdk:"boolean_props"`
ObjectProps map[string]types.String `tfsdk:"object_props"`
ArrayProps *ArrayPropsModel `tfsdk:"array_props"`
}
type RelationModel ¶
type ScorecardModel ¶
type ScorecardModel struct {
Rules []ScorecardRulesModel `tfsdk:"rules"`
Level types.String `tfsdk:"level"`
}
type ScorecardRulesModel ¶
type SearchDataModel ¶
type SearchDataModel struct {
ID types.String `tfsdk:"id"`
Query types.String `tfsdk:"query"`
ExcludeCalculatedProperties types.Bool `tfsdk:"exclude_calculated_properties"`
Include []types.String `tfsdk:"include"`
Exclude []types.String `tfsdk:"exclude"`
AttachTitleToRelation types.Bool `tfsdk:"attach_title_to_relation"`
MatchingBlueprints []types.String `tfsdk:"matching_blueprints"`
Entities []EntityModel `tfsdk:"entities"`
}
func (*SearchDataModel) GenerateID ¶
func (m *SearchDataModel) GenerateID() string
type SearchDataSource ¶
type SearchDataSource struct {
// contains filtered or unexported fields
}
func (*SearchDataSource) Configure ¶
func (d *SearchDataSource) Configure(ctx context.Context, req datasource.ConfigureRequest, resp *datasource.ConfigureResponse)
func (*SearchDataSource) Metadata ¶
func (d *SearchDataSource) Metadata(ctx context.Context, req datasource.MetadataRequest, resp *datasource.MetadataResponse)
func (*SearchDataSource) Read ¶
func (d *SearchDataSource) Read(ctx context.Context, req datasource.ReadRequest, resp *datasource.ReadResponse)
func (*SearchDataSource) Schema ¶
func (d *SearchDataSource) Schema(ctx context.Context, req datasource.SchemaRequest, resp *datasource.SchemaResponse)
Click to show internal directories.
Click to hide internal directories.