Documentation
¶
Index ¶
- Constants
- Variables
- func BuildGithubLink(fpath string, fpos jsonpointerpos.JSONPointerPosition, commit, specdir string) (string, error)
- func PathItemOperation(pathItem spec.PathItem, op OperationKind) *spec.Operation
- func SetLogger(l Logger)
- func SpecListFromReadmeMD(b []byte) ([]string, error)
- type APIMethods
- type APIVersions
- type DedupMatcher
- type DedupMatcherIn
- type DedupOp
- type DedupPicker
- type DedupPickerIn
- type DedupRecord
- type DeduplicateRecords
- type Deduplicator
- type FlattenOpIndex
- type Index
- type Logger
- type MatchSegment
- type Matcher
- type Matchers
- type NullLogger
- type OpLocator
- type OperationInfo
- type OperationKind
- type OperationRefs
- type PathPattern
- type PathPatternStr
- type PathSegment
- type ResourceProviders
- type ResourceTypes
- type TagInfo
Constants ¶
const ( OperationKindGet OperationKind = "GET" OperationKindPut = "PUT" OperationKindPost = "POST" OperationKindDelete = "DELETE" OperationKindOptions = "OPTIONS" OperationKindHead = "HEAD" OperationKindPatch = "PATCH" )
const ResourceRP = "Microsoft.Resources"
const Wildcard = "*"
Variables ¶
var PossibleOperationKinds = []OperationKind{ OperationKindGet, OperationKindPut, OperationKindPost, OperationKindDelete, OperationKindOptions, OperationKindHead, OperationKindPatch, }
Functions ¶
func BuildGithubLink ¶
func BuildGithubLink(fpath string, fpos jsonpointerpos.JSONPointerPosition, commit, specdir string) (string, error)
func PathItemOperation ¶
func PathItemOperation(pathItem spec.PathItem, op OperationKind) *spec.Operation
func SpecListFromReadmeMD ¶
Types ¶
type APIMethods ¶
type APIMethods map[OperationKind]ResourceTypes
type APIVersions ¶
type APIVersions map[string]APIMethods
type DedupMatcher ¶
type DedupMatcherIn ¶
type DedupOp ¶
type DedupOp struct {
Picker *DedupPicker
Ignore bool
Any bool
}
type DedupPicker ¶
func (DedupPicker) Match ¶
func (picker DedupPicker) Match(ref jsonreference.Ref) bool
type DedupPickerIn ¶
type DedupRecord ¶
type DedupRecord struct {
Matcher DedupMatcherIn `json:"matcher"`
Picker *DedupPickerIn `json:"picker"`
Ignore *bool `json:"ignore"`
Any *bool `json:"any"`
}
type DeduplicateRecords ¶
type DeduplicateRecords map[string]DedupRecord
func (DeduplicateRecords) ToDeduplicator ¶
func (records DeduplicateRecords) ToDeduplicator() (Deduplicator, error)
type Deduplicator ¶
type Deduplicator map[DedupMatcher]DedupOp
type FlattenOpIndex ¶
type FlattenOpIndex map[OpLocator]OperationRefs
type Index ¶
type Index struct {
Commit string `json:"commit,omitempty"`
ResourceProviders `json:"resource_providers"`
}
func BuildIndex ¶
BuildIndex builds the index file for the given specification directory. Since there are duplicated specification files in the directory, that defines the same API (same API path, version, operation), users can Optionally specify a deduplication file. Otherwise, it will use a default dedup file instead. Optionally specify a list of services (e.g. `compute`) to build. Otherwise, it will generate for every service.
type MatchSegment ¶
type Matcher ¶
type Matcher struct {
PrefixSep bool
Separater string
Segments []MatchSegment
}
type NullLogger ¶
type NullLogger struct{}
func (*NullLogger) Debug ¶
func (n *NullLogger) Debug(msg string, args ...interface{})
func (*NullLogger) Error ¶
func (n *NullLogger) Error(msg string, args ...interface{})
func (*NullLogger) Info ¶
func (n *NullLogger) Info(msg string, args ...interface{})
func (*NullLogger) Warn ¶
func (n *NullLogger) Warn(msg string, args ...interface{})
type OpLocator ¶
type OpLocator struct {
// Upper cased RP name, e.g. MICROSOFT.COMPUTE. This might be "" for API path that has no explicit RP defined (e.g. /subscriptions/{subscriptionId})
// This can be "*" to indicate it maps any RP
RP string
// API version, e.g. 2020-10-01-preview
Version string
// Upper cased resource type, e.g. /VIRTUALNETWORKS/SUBNETS
// Each subtype can be "*" to indicate it maps any sub type.
RT string
// Upper cased potential action/collection type, e.g. LISTKEYS (action), SUBNETS
// This can be "*" to indicate it maps any RP
ACT string
// HTTP operation kind, e.g. GET
Method OperationKind
}
type OperationInfo ¶
type OperationInfo struct {
Actions map[string]OperationRefs `json:"actions,omitempty"`
OperationRefs OperationRefs `json:"operation_refs,omitempty"`
}
type OperationKind ¶
type OperationKind string
type OperationRefs ¶
type OperationRefs map[PathPatternStr]jsonreference.Ref
OperationRefs represents a set of operation defintion (in form of JSON reference) that are mapped by the same operation locator. Since for a given operation locator, there might maps to multiple operation definition, only differing by the contained path pattern, there fore the actual operation ref is keyed by the containing path pattern. The value is a JSON reference to the operation, e.g. <dir>/foo.json#/paths/~1subscriptions~1{subscriptionId}~1providers~1{resourceProviderNamespace}~1register/post
func (OperationRefs) MarshalJSON ¶
func (o OperationRefs) MarshalJSON() ([]byte, error)
func (*OperationRefs) UnmarshalJSON ¶
func (o *OperationRefs) UnmarshalJSON(b []byte) error
type PathPattern ¶
type PathPattern struct {
Segments []PathSegment
}
func ParsePathPatternFromString ¶
func ParsePathPatternFromString(path string) *PathPattern
func ParsePathPatternFromSwagger ¶
func ParsePathPatternFromSwagger(specFile string, swagger *spec.Swagger, path string, operation OperationKind) ([]PathPattern, error)
func (PathPattern) String ¶
func (p PathPattern) String() string
type PathPatternStr ¶
type PathPatternStr string
PathPatternStr represents an API path pattern, with all the fixed segment upper cased, and all the parameterized segment as a literal "{}", or "{*}" (for x-ms-skip-url-encoding).
type PathSegment ¶
type ResourceProviders ¶
type ResourceProviders map[string]APIVersions
type ResourceTypes ¶
type ResourceTypes map[string]*OperationInfo