coverage

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2024 License: MPL-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetIndex

func GetIndex() (*azidx.Index, error)

func GetIndexFromLocalDir

func GetIndexFromLocalDir(swaggerRepo string) (*azidx.Index, error)

func MockResourceIDFromType

func MockResourceIDFromType(azapiResourceType string) (string, string)

func SchemaNamePathFromRef

func SchemaNamePathFromRef(swaggerPath string, ref openapiSpec.Ref) (schemaName string, schemaPath string)

Types

type ArmResource

type ArmResource struct {
	ApiPath string
	Type    string
}

type CoverageReport

type CoverageReport struct {
	Coverages map[ArmResource]*Model
}

func (*CoverageReport) AddCoverageFromState

func (c *CoverageReport) AddCoverageFromState(resourceId, resourceType string, jsonBody map[string]interface{}, swaggerPath string) error

type Model

type Model struct {
	Bool                    *map[string]bool   `json:"Bool,omitempty"` // key is the Enum value, value is coverage status
	BoolCoveredCount        int                `json:"BoolCoveredCount,omitempty"`
	CoveredCount            int                `json:"CoveredCount,omitempty"`
	Discriminator           *string            `json:"Discriminator,omitempty"`
	Enum                    *map[string]bool   `json:"Enum,omitempty"` // key is the Enum value, value is coverage status
	EnumCoveredCount        int                `json:"EnumCoveredCount,omitempty"`
	EnumTotalCount          int                `json:"EnumTotalCount,omitempty"`
	Format                  *string            `json:"Format,omitempty"`
	HasAdditionalProperties bool               `json:"HasAdditionalProperties,omitempty"`
	Identifier              string             `json:"Identifier,omitempty"` // e.g., #.properties.accessPolicies[].permissions.certificates
	IsAnyCovered            bool               `json:"IsAnyCovered"`
	IsFullyCovered          bool               `json:"IsFullyCovered,omitempty"`
	IsReadOnly              bool               `json:"IsReadOnly,omitempty"`
	IsRequired              bool               `json:"IsRequired,omitempty"`
	IsSecret                bool               `json:"IsSecret,omitempty"` // related to x-ms-secret
	Item                    *Model             `json:"Item,omitempty"`
	ModelName               string             `json:"ModelName,omitempty"`
	Properties              *map[string]*Model `json:"Properties,omitempty"`
	SourceFile              string             `json:"SourceFile,omitempty"`
	TotalCount              int                `json:"TotalCount,omitempty"`
	Type                    *string            `json:"Type,omitempty"`
	Variants                *map[string]*Model `json:"Variants,omitempty"`    // variant model name is used as key, this may only contains
	VariantType             *string            `json:"VariantType,omitempty"` // the x-ms-discriminator-value of the variant model if exists, otherwise model name
}

func Expand

func Expand(modelName, swaggerPath string) (*Model, error)

func (*Model) CountCoverage

func (m *Model) CountCoverage() (int, int)

func (*Model) CredScan

func (m *Model) CredScan(root interface{}, secrets map[string]string)

CredScan scans the input payload (root) and extract the secret field and value in the secrets map.

func (*Model) MarkCovered

func (m *Model) MarkCovered(root interface{})

func (*Model) SplitCovered

func (m *Model) SplitCovered(covered, uncovered *[]string)

type SwaggerModel

type SwaggerModel struct {
	ApiPath     string
	ModelName   string
	SwaggerPath string
}

func GetModelInfoFromIndex

func GetModelInfoFromIndex(resourceId, apiVersion string) (*SwaggerModel, error)

func GetModelInfoFromIndexRef

func GetModelInfoFromIndexRef(ref openapispec.Ref, swaggerRepo string) (*SwaggerModel, error)

func GetModelInfoFromIndexWithType

func GetModelInfoFromIndexWithType(azapiResourceType string) (*SwaggerModel, error)

func GetModelInfoFromLocalDir

func GetModelInfoFromLocalDir(resourceId, apiVersion, swaggerPath string) (*SwaggerModel, error)

func GetModelInfoFromLocalIndex

func GetModelInfoFromLocalIndex(resourceId, apiVersion, swaggerRepo string) (*SwaggerModel, error)

GetModelInfoFromLocalIndex tries to build index from local swagger repo and get model info from it

func GetModelInfoFromLocalSpecFile

func GetModelInfoFromLocalSpecFile(resourceId, apiVersion, swaggerPath string) (*SwaggerModel, error)

Jump to

Keyboard shortcuts

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