 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Index ¶
- Variables
- func DefaultCliLevels() []cli.Level
- func LevelSchema() map[string]schema.Attribute
- func NewScorecardResource() resource.Resource
- func RuleSchema() map[string]schema.Attribute
- func ScorecardSchema() map[string]schema.Attribute
- type Level
- type Query
- type Rule
- type ScorecardModel
- type ScorecardResource
- func (r *ScorecardResource) Configure(ctx context.Context, req resource.ConfigureRequest, ...)
- func (r *ScorecardResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse)
- func (r *ScorecardResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse)
- func (r *ScorecardResource) ImportState(ctx context.Context, req resource.ImportStateRequest, ...)
- func (r *ScorecardResource) Metadata(ctx context.Context, req resource.MetadataRequest, ...)
- func (r *ScorecardResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse)
- func (r *ScorecardResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse)
- func (r *ScorecardResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse)
 
Constants ¶
This section is empty.
Variables ¶
      View Source
      
  
var ResourceMarkdownDescription = `
# Scorecard
This resource allows you to manage a scorecard.
See the [Port documentation](https://docs.getport.io/promote-scorecards/) for more information about scorecards.
## Example Usage
This will create a blueprint with a Scorecard measuring the readiness of a microservice.
` + "```hcl" + `
resource "port_blueprint" "microservice" {
  title      = "microservice"
  icon       = "Terraform"
  identifier = "microservice"
  properties = {
    string_props = {
      "author" = {
        title = "Author"
      }
      "url" = {
        title = "URL"
      }
    }
    boolean_props = {
      "required" = {
        type = "boolean"
      }
    }
    number_props = {
      "sum" = {
        type = "number"
      }
    }
  }
}
resource "port_scorecard" "readiness" {
  identifier = "Readiness"
  title      = "Readiness"
  blueprint  = port_blueprint.microservice.identifier
  rules      = [
    {
      identifier = "hasOwner"
      title      = "Has Owner"
      level      = "Gold"
      query      = {
        combinator = "and"
        conditions = [
          jsonencode({
            property = "$team"
            operator = "isNotEmpty"
          }),
          jsonencode({
            property = "author"
            operator : "="
            value : "myValue"
          })
        ]
      }
    },
    {
      identifier = "hasUrl"
      title      = "Has URL"
      level      = "Silver"
      query      = {
        combinator = "and"
        conditions = [
          jsonencode({
            property = "url"
            operator = "isNotEmpty"
          })
        ]
      }
    },
    {
      identifier = "checkSumIfRequired"
      title      = "Check Sum If Required"
      level      = "Bronze"
      query      = {
        combinator = "or"
        conditions = [
          jsonencode({
            property = "required"
            operator : "="
            value : false
          }),
          jsonencode({
            property = "sum"
            operator : ">"
            value : 2
          })
        ]
      }
    }
  ]
  depends_on = [
    port_blueprint.microservice
  ]
}
` + "```" + `
## Example Usage with Levels and Filter
This will override the default levels (Basic, Bronze, Silver, Gold) with the provided levels: Not Ready, Partially Ready, Ready.
` + "```hcl" + `
resource "port_blueprint" "microservice" {
  title      = "microservice"
  icon       = "Terraform"
  identifier = "microservice"
  properties = {
    string_props = {
      "author" = {
        title = "Author"
      }
      "url" = {
        title = "URL"
      }
    }
    boolean_props = {
      "required" = {
        type = "boolean"
      }
    }
    number_props = {
      "sum" = {
        type = "number"
      }
    }
  }
}
resource "port_scorecard" "readiness" {
  identifier = "Readiness"
  title      = "Readiness"
  blueprint  = port_blueprint.microservice.identifier
  filter = {
    combinator = "and"
    conditions = [
      jsonencode({
        property = "sum"
        operator = ">"
        value = 0
      })
    ]
  }
  levels = [
    {
      color = "red"
      title = "No Ready"
    },
    {
      color = "yellow"
      title = "Partially Ready"
    },
    {
      color = "green"
      title = "Ready"
    }
  ]
  rules = [
    {
      identifier = "hasOwner"
      title      = "Has Owner"
      level      = "Ready"
      query = {
        combinator = "and"
        conditions = [
          jsonencode({
            property = "$team"
            operator = "isNotEmpty"
          }),
          jsonencode({
            property = "author"
            operator : "="
            value : "myValue"
          })
        ]
      }
    },
    {
      identifier = "hasUrl"
      title      = "Has URL"
      level      = "Partially Ready"
      query = {
        combinator = "and"
        conditions = [
          jsonencode({
            property = "url"
            operator = "isNotEmpty"
          })
        ]
      }
    },
    {
      identifier = "checkSumIfRequired"
      title      = "Check Sum If Required"
      level      = "Partially Ready"
      query = {
        combinator = "or"
        conditions = [
          jsonencode({
            property = "required"
            operator : "="
            value : false
          }),
          jsonencode({
            property = "sum"
            operator : ">"
            value : 2
          })
        ]
      }
    }
  ]
  depends_on = [
    port_blueprint.microservice
  ]
}
` + "```"
    Functions ¶
func DefaultCliLevels ¶ added in v2.0.12
func LevelSchema ¶ added in v2.0.12
func NewScorecardResource ¶
func RuleSchema ¶
func ScorecardSchema ¶
Types ¶
type ScorecardModel ¶
type ScorecardModel struct {
	ID         types.String `tfsdk:"id"`
	Identifier types.String `tfsdk:"identifier"`
	Blueprint  types.String `tfsdk:"blueprint"`
	Title      types.String `tfsdk:"title"`
	Filter     *Query       `tfsdk:"filter"`
	Levels     []Level      `tfsdk:"levels"`
	Rules      []Rule       `tfsdk:"rules"`
	CreatedAt  types.String `tfsdk:"created_at"`
	CreatedBy  types.String `tfsdk:"created_by"`
	UpdatedAt  types.String `tfsdk:"updated_at"`
	UpdatedBy  types.String `tfsdk:"updated_by"`
}
    type ScorecardResource ¶
type ScorecardResource struct {
	// contains filtered or unexported fields
}
    func (*ScorecardResource) Configure ¶
func (r *ScorecardResource) Configure(ctx context.Context, req resource.ConfigureRequest, resp *resource.ConfigureResponse)
func (*ScorecardResource) Create ¶
func (r *ScorecardResource) Create(ctx context.Context, req resource.CreateRequest, resp *resource.CreateResponse)
func (*ScorecardResource) Delete ¶
func (r *ScorecardResource) Delete(ctx context.Context, req resource.DeleteRequest, resp *resource.DeleteResponse)
func (*ScorecardResource) ImportState ¶
func (r *ScorecardResource) ImportState(ctx context.Context, req resource.ImportStateRequest, resp *resource.ImportStateResponse)
func (*ScorecardResource) Metadata ¶
func (r *ScorecardResource) Metadata(ctx context.Context, req resource.MetadataRequest, resp *resource.MetadataResponse)
func (*ScorecardResource) Read ¶
func (r *ScorecardResource) Read(ctx context.Context, req resource.ReadRequest, resp *resource.ReadResponse)
func (*ScorecardResource) Schema ¶
func (r *ScorecardResource) Schema(ctx context.Context, req resource.SchemaRequest, resp *resource.SchemaResponse)
func (*ScorecardResource) Update ¶
func (r *ScorecardResource) Update(ctx context.Context, req resource.UpdateRequest, resp *resource.UpdateResponse)
 Click to show internal directories. 
   Click to hide internal directories.