scorecard

package
v1.11.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

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

Create a parent blueprint with a child blueprint and an aggregation property to count the parent kids:

` + "```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
  ]
}

` + "```"

Functions

func NewScorecardResource

func NewScorecardResource() resource.Resource

func RuleSchema

func RuleSchema() map[string]schema.Attribute

func ScorecardSchema

func ScorecardSchema() map[string]schema.Attribute

Types

type Query

type Query struct {
	Combinator types.String   `tfsdk:"combinator"`
	Conditions []types.String `tfsdk:"conditions"`
}

type Rule

type Rule struct {
	Identifier types.String `tfsdk:"identifier"`
	Title      types.String `tfsdk:"title"`
	Level      types.String `tfsdk:"level"`
	Query      *Query       `tfsdk:"query"`
}

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"`
	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 (*ScorecardResource) Create

func (*ScorecardResource) Delete

func (*ScorecardResource) ImportState

func (*ScorecardResource) Metadata

func (*ScorecardResource) Read

func (*ScorecardResource) Schema

func (*ScorecardResource) Update

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL