Documentation ¶
Overview ¶
Package native contains the c bindings into the Pact Reference types.
Index ¶
- Constants
- Variables
- func GetTLSConfig() *tls.Config
- func Init(logLevel string)
- func RegisterPactPluginServer(s grpc.ServiceRegistrar, srv PactPluginServer)
- func Version() string
- type Body
- func (*Body) Descriptor() ([]byte, []int)deprecated
- func (x *Body) GetContent() *wrapperspb.BytesValue
- func (x *Body) GetContentType() string
- func (x *Body) GetContentTypeHint() Body_ContentTypeHint
- func (*Body) ProtoMessage()
- func (x *Body) ProtoReflect() protoreflect.Message
- func (x *Body) Reset()
- func (x *Body) String() string
- type Body_ContentTypeHint
- func (Body_ContentTypeHint) Descriptor() protoreflect.EnumDescriptor
- func (x Body_ContentTypeHint) Enum() *Body_ContentTypeHint
- func (Body_ContentTypeHint) EnumDescriptor() ([]byte, []int)deprecated
- func (x Body_ContentTypeHint) Number() protoreflect.EnumNumber
- func (x Body_ContentTypeHint) String() string
- func (Body_ContentTypeHint) Type() protoreflect.EnumType
- type CUlong
- type Catalogue
- type CatalogueEntry
- func (*CatalogueEntry) Descriptor() ([]byte, []int)deprecated
- func (x *CatalogueEntry) GetKey() string
- func (x *CatalogueEntry) GetType() CatalogueEntry_EntryType
- func (x *CatalogueEntry) GetValues() map[string]string
- func (*CatalogueEntry) ProtoMessage()
- func (x *CatalogueEntry) ProtoReflect() protoreflect.Message
- func (x *CatalogueEntry) Reset()
- func (x *CatalogueEntry) String() string
- type CatalogueEntry_EntryType
- func (CatalogueEntry_EntryType) Descriptor() protoreflect.EnumDescriptor
- func (x CatalogueEntry_EntryType) Enum() *CatalogueEntry_EntryType
- func (CatalogueEntry_EntryType) EnumDescriptor() ([]byte, []int)deprecated
- func (x CatalogueEntry_EntryType) Number() protoreflect.EnumNumber
- func (x CatalogueEntry_EntryType) String() string
- func (CatalogueEntry_EntryType) Type() protoreflect.EnumType
- type CompareContentsRequest
- func (*CompareContentsRequest) Descriptor() ([]byte, []int)deprecated
- func (x *CompareContentsRequest) GetActual() *Body
- func (x *CompareContentsRequest) GetAllowUnexpectedKeys() bool
- func (x *CompareContentsRequest) GetExpected() *Body
- func (x *CompareContentsRequest) GetPluginConfiguration() *PluginConfiguration
- func (x *CompareContentsRequest) GetRules() map[string]*MatchingRules
- func (*CompareContentsRequest) ProtoMessage()
- func (x *CompareContentsRequest) ProtoReflect() protoreflect.Message
- func (x *CompareContentsRequest) Reset()
- func (x *CompareContentsRequest) String() string
- type CompareContentsResponse
- func (*CompareContentsResponse) Descriptor() ([]byte, []int)deprecated
- func (x *CompareContentsResponse) GetError() string
- func (x *CompareContentsResponse) GetResults() map[string]*ContentMismatches
- func (x *CompareContentsResponse) GetTypeMismatch() *ContentTypeMismatch
- func (*CompareContentsResponse) ProtoMessage()
- func (x *CompareContentsResponse) ProtoReflect() protoreflect.Message
- func (x *CompareContentsResponse) Reset()
- func (x *CompareContentsResponse) String() string
- type ConfigureInteractionRequest
- func (*ConfigureInteractionRequest) Descriptor() ([]byte, []int)deprecated
- func (x *ConfigureInteractionRequest) GetContentType() string
- func (x *ConfigureInteractionRequest) GetContentsConfig() *structpb.Struct
- func (*ConfigureInteractionRequest) ProtoMessage()
- func (x *ConfigureInteractionRequest) ProtoReflect() protoreflect.Message
- func (x *ConfigureInteractionRequest) Reset()
- func (x *ConfigureInteractionRequest) String() string
- type ConfigureInteractionResponse
- func (*ConfigureInteractionResponse) Descriptor() ([]byte, []int)deprecated
- func (x *ConfigureInteractionResponse) GetError() string
- func (x *ConfigureInteractionResponse) GetInteraction() []*InteractionResponse
- func (x *ConfigureInteractionResponse) GetPluginConfiguration() *PluginConfiguration
- func (*ConfigureInteractionResponse) ProtoMessage()
- func (x *ConfigureInteractionResponse) ProtoReflect() protoreflect.Message
- func (x *ConfigureInteractionResponse) Reset()
- func (x *ConfigureInteractionResponse) String() string
- type ContentMismatch
- func (*ContentMismatch) Descriptor() ([]byte, []int)deprecated
- func (x *ContentMismatch) GetActual() *wrapperspb.BytesValue
- func (x *ContentMismatch) GetDiff() string
- func (x *ContentMismatch) GetExpected() *wrapperspb.BytesValue
- func (x *ContentMismatch) GetMismatch() string
- func (x *ContentMismatch) GetPath() string
- func (*ContentMismatch) ProtoMessage()
- func (x *ContentMismatch) ProtoReflect() protoreflect.Message
- func (x *ContentMismatch) Reset()
- func (x *ContentMismatch) String() string
- type ContentMismatches
- func (*ContentMismatches) Descriptor() ([]byte, []int)deprecated
- func (x *ContentMismatches) GetMismatches() []*ContentMismatch
- func (*ContentMismatches) ProtoMessage()
- func (x *ContentMismatches) ProtoReflect() protoreflect.Message
- func (x *ContentMismatches) Reset()
- func (x *ContentMismatches) String() string
- type ContentTypeMismatch
- func (*ContentTypeMismatch) Descriptor() ([]byte, []int)deprecated
- func (x *ContentTypeMismatch) GetActual() string
- func (x *ContentTypeMismatch) GetExpected() string
- func (*ContentTypeMismatch) ProtoMessage()
- func (x *ContentTypeMismatch) ProtoReflect() protoreflect.Message
- func (x *ContentTypeMismatch) Reset()
- func (x *ContentTypeMismatch) String() string
- type GenerateContentRequest
- func (*GenerateContentRequest) Descriptor() ([]byte, []int)deprecated
- func (x *GenerateContentRequest) GetContents() *Body
- func (x *GenerateContentRequest) GetGenerators() map[string]*Generator
- func (x *GenerateContentRequest) GetPluginConfiguration() *PluginConfiguration
- func (*GenerateContentRequest) ProtoMessage()
- func (x *GenerateContentRequest) ProtoReflect() protoreflect.Message
- func (x *GenerateContentRequest) Reset()
- func (x *GenerateContentRequest) String() string
- type GenerateContentResponse
- func (*GenerateContentResponse) Descriptor() ([]byte, []int)deprecated
- func (x *GenerateContentResponse) GetContents() *Body
- func (*GenerateContentResponse) ProtoMessage()
- func (x *GenerateContentResponse) ProtoReflect() protoreflect.Message
- func (x *GenerateContentResponse) Reset()
- func (x *GenerateContentResponse) String() string
- type Generator
- type InitPluginRequest
- func (*InitPluginRequest) Descriptor() ([]byte, []int)deprecated
- func (x *InitPluginRequest) GetImplementation() string
- func (x *InitPluginRequest) GetVersion() string
- func (*InitPluginRequest) ProtoMessage()
- func (x *InitPluginRequest) ProtoReflect() protoreflect.Message
- func (x *InitPluginRequest) Reset()
- func (x *InitPluginRequest) String() string
- type InitPluginResponse
- func (*InitPluginResponse) Descriptor() ([]byte, []int)deprecated
- func (x *InitPluginResponse) GetCatalogue() []*CatalogueEntry
- func (*InitPluginResponse) ProtoMessage()
- func (x *InitPluginResponse) ProtoReflect() protoreflect.Message
- func (x *InitPluginResponse) Reset()
- func (x *InitPluginResponse) String() string
- type Interaction
- func (i *Interaction) Given(state string) *Interaction
- func (i *Interaction) GivenWithParameter(state string, params map[string]interface{}) *Interaction
- func (i *Interaction) UponReceiving(description string) *Interaction
- func (i *Interaction) WithBinaryRequestBody(body []byte) *Interaction
- func (i *Interaction) WithBinaryResponseBody(body []byte) *Interaction
- func (i *Interaction) WithJSONRequestBody(body interface{}) *Interaction
- func (i *Interaction) WithJSONResponseBody(body interface{}) *Interaction
- func (i *Interaction) WithPluginInteractionContents(part interactionPart, contentType string, contents string) error
- func (i *Interaction) WithQuery(valueOrMatcher map[string][]interface{}) *Interaction
- func (i *Interaction) WithRequest(method string, pathOrMatcher interface{}) *Interaction
- func (i *Interaction) WithRequestBody(contentType string, body []byte) *Interaction
- func (i *Interaction) WithRequestHeaders(valueOrMatcher map[string][]interface{}) *Interaction
- func (i *Interaction) WithRequestMultipartFile(contentType string, filename string, mimePartName string) *Interaction
- func (i *Interaction) WithResponseBody(contentType string, body []byte) *Interaction
- func (i *Interaction) WithResponseHeaders(valueOrMatcher map[string][]interface{}) *Interaction
- func (i *Interaction) WithResponseMultipartFile(contentType string, filename string, mimePartName string) *Interaction
- func (i *Interaction) WithStatus(status int) *Interaction
- type InteractionResponse
- func (*InteractionResponse) Descriptor() ([]byte, []int)deprecated
- func (x *InteractionResponse) GetContents() *Body
- func (x *InteractionResponse) GetGenerators() map[string]*Generator
- func (x *InteractionResponse) GetInteractionMarkup() string
- func (x *InteractionResponse) GetInteractionMarkupType() InteractionResponse_MarkupType
- func (x *InteractionResponse) GetMessageMetadata() *structpb.Struct
- func (x *InteractionResponse) GetPartName() string
- func (x *InteractionResponse) GetPluginConfiguration() *PluginConfiguration
- func (x *InteractionResponse) GetRules() map[string]*MatchingRules
- func (*InteractionResponse) ProtoMessage()
- func (x *InteractionResponse) ProtoReflect() protoreflect.Message
- func (x *InteractionResponse) Reset()
- func (x *InteractionResponse) String() string
- type InteractionResponse_MarkupType
- func (InteractionResponse_MarkupType) Descriptor() protoreflect.EnumDescriptor
- func (x InteractionResponse_MarkupType) Enum() *InteractionResponse_MarkupType
- func (InteractionResponse_MarkupType) EnumDescriptor() ([]byte, []int)deprecated
- func (x InteractionResponse_MarkupType) Number() protoreflect.EnumNumber
- func (x InteractionResponse_MarkupType) String() string
- func (InteractionResponse_MarkupType) Type() protoreflect.EnumType
- type MatchingRule
- func (*MatchingRule) Descriptor() ([]byte, []int)deprecated
- func (x *MatchingRule) GetType() string
- func (x *MatchingRule) GetValues() *structpb.Struct
- func (*MatchingRule) ProtoMessage()
- func (x *MatchingRule) ProtoReflect() protoreflect.Message
- func (x *MatchingRule) Reset()
- func (x *MatchingRule) String() string
- type MatchingRules
- type Message
- func (m *Message) ExpectsToReceive(description string) *Message
- func (m *Message) GetMessageRequestContents() ([]byte, error)
- func (m *Message) GetMessageResponseContents() ([][]byte, error)
- func (m *Message) Given(state string) *Message
- func (m *Message) GivenWithParameter(state string, params map[string]interface{}) *Message
- func (m *Message) WithContents(part interactionPart, contentType string, body []byte) *Message
- func (m *Message) WithMetadata(valueOrMatcher map[string]string) *Message
- func (m *Message) WithPluginInteractionContents(part interactionPart, contentType string, contents string) error
- func (m *Message) WithRequestBinaryContentType(contentType string, body []byte) *Message
- func (m *Message) WithRequestBinaryContents(body []byte) *Message
- func (m *Message) WithRequestJSONContents(body interface{}) *Message
- func (m *Message) WithResponseBinaryContents(body []byte) *Message
- func (m *Message) WithResponseJSONContents(body interface{}) *Message
- type MessagePact
- type MessageServer
- func (m *MessageServer) CleanupMockServer(port int) bool
- func (m *MessageServer) CleanupPlugins()
- func (m *MessageServer) MockServerMatched(port int) bool
- func (m *MessageServer) MockServerMismatchedRequests(port int) []MismatchedRequest
- func (m *MessageServer) NewAsyncMessageInteraction(description string) *Message
- func (m *MessageServer) NewMessage() *Message
- func (m *MessageServer) NewSyncMessageInteraction(description string) *Message
- func (m *MessageServer) StartTransport(transport string, address string, port int, config map[string][]interface{}) (int, error)
- func (m *MessageServer) UsingPlugin(pluginName string, pluginVersion string) error
- func (m *MessageServer) WithMetadata(namespace, k, v string) *MessageServer
- func (m *MessageServer) WithSpecificationVersion(version specificationVersion)
- func (m *MessageServer) WritePactFile(dir string, overwrite bool) error
- func (m *MessageServer) WritePactFileForServer(port int, dir string, overwrite bool) error
- type MismatchDetail
- type MismatchedRequest
- type MockServer
- func (m *MockServer) CleanupMockServer(port int) bool
- func (m *MockServer) CleanupPlugins()
- func (m *MockServer) CreateMockServer(pact string, address string, tls bool) (int, error)
- func (m *MockServer) MockServerMismatchedRequests(port int) []MismatchedRequest
- func (m *MockServer) NewInteraction(description string) *Interaction
- func (m *MockServer) Start(address string, tls bool) (int, error)
- func (m *MockServer) StartTransport(transport string, address string, port int, config map[string][]interface{}) (int, error)
- func (m *MockServer) UsingPlugin(pluginName string, pluginVersion string) error
- func (m *MockServer) Verify(port int, dir string) (bool, []MismatchedRequest)
- func (m *MockServer) Version() string
- func (m *MockServer) WithMetadata(namespace, k, v string) *MockServer
- func (m *MockServer) WithSpecificationVersion(version specificationVersion)
- func (m *MockServer) WritePactFile(port int, dir string) error
- type Pact
- type PactPluginClient
- type PactPluginServer
- type PluginConfiguration
- func (*PluginConfiguration) Descriptor() ([]byte, []int)deprecated
- func (x *PluginConfiguration) GetInteractionConfiguration() *structpb.Struct
- func (x *PluginConfiguration) GetPactConfiguration() *structpb.Struct
- func (*PluginConfiguration) ProtoMessage()
- func (x *PluginConfiguration) ProtoReflect() protoreflect.Message
- func (x *PluginConfiguration) Reset()
- func (x *PluginConfiguration) String() string
- type Request
- type UnimplementedPactPluginServer
- func (UnimplementedPactPluginServer) CompareContents(context.Context, *CompareContentsRequest) (*CompareContentsResponse, error)
- func (UnimplementedPactPluginServer) ConfigureInteraction(context.Context, *ConfigureInteractionRequest) (*ConfigureInteractionResponse, error)
- func (UnimplementedPactPluginServer) GenerateContent(context.Context, *GenerateContentRequest) (*GenerateContentResponse, error)
- func (UnimplementedPactPluginServer) InitPlugin(context.Context, *InitPluginRequest) (*InitPluginResponse, error)
- func (UnimplementedPactPluginServer) UpdateCatalogue(context.Context, *Catalogue) (*emptypb.Empty, error)
- type UnsafePactPluginServer
- type Verifier
- func (v *Verifier) AddCustomHeader(name string, value string)
- func (v *Verifier) AddDirectorySource(directory string)
- func (v *Verifier) AddFileSource(file string)
- func (v *Verifier) AddTransport(protocol string, port uint16, path string, scheme string)
- func (v *Verifier) AddURLSource(url string, username string, password string, token string)
- func (v *Verifier) BrokerSourceWithSelectors(url string, username string, password string, token string, enablePending bool, ...)
- func (v *Verifier) Execute() error
- func (v *Verifier) SetColoredOutput(isColoredOutput bool)
- func (v *Verifier) SetConsumerFilters(consumers []string)
- func (v *Verifier) SetFilterInfo(description string, state string, noState bool)
- func (v *Verifier) SetNoPactsIsError(isError bool)
- func (v *Verifier) SetProviderInfo(name string, scheme string, host string, port uint16, path string)
- func (v *Verifier) SetProviderState(url string, teardown bool, body bool)
- func (v *Verifier) SetPublishOptions(providerVersion string, buildUrl string, providerTags []string, ...)
- func (v *Verifier) SetVerificationOptions(disableSSLVerification bool, requestTimeout int64)
- func (v *Verifier) Shutdown()
- func (v *Verifier) Verify(args []string) error
- func (v *Verifier) Version() string
Constants ¶
const ( MESSAGE_TYPE_ASYNC messageType = iota MESSAGE_TYPE_SYNC )
const ( INTERACTION_PART_REQUEST interactionPart = iota INTERACTION_PART_RESPONSE )
const ( RESULT_OK interactionPart = iota RESULT_FAILED )
const ( SPECIFICATION_VERSION_UNKNOWN specificationVersion = iota SPECIFICATION_VERSION_V1 SPECIFICATION_VERSION_V1_1 SPECIFICATION_VERSION_V2 SPECIFICATION_VERSION_V3 SPECIFICATION_VERSION_V4 )
const ( LOG_LEVEL_OFF logLevel = iota LOG_LEVEL_ERROR LOG_LEVEL_WARN LOG_LEVEL_INFO LOG_LEVEL_DEBUG LOG_LEVEL_TRACE )
Variables ¶
var ( // ErrHandleNotFound indicates the underlying handle was not found, and a logic error in the framework ErrHandleNotFound = fmt.Errorf("unable to find the native interface handle (this indicates a defect in the framework)") // ErrMockServerPanic indicates a panic ocurred when invoking the remote Mock Server. ErrMockServerPanic = fmt.Errorf("a general panic occured when starting/invoking mock service (this indicates a defect in the framework)") // ErrUnableToWritePactFile indicates an error when writing the pact file to disk. ErrUnableToWritePactFile = fmt.Errorf("unable to write to file") // ErrMockServerNotfound indicates the Mock Server could not be found. ErrMockServerNotfound = fmt.Errorf("unable to find mock server with the given port") // ErrInvalidMockServerConfig indicates an issue configuring the mock server ErrInvalidMockServerConfig = fmt.Errorf("configuration for the mock server was invalid and an unknown error occurred (this is most likely a defect in the framework)") // ErrInvalidPact indicates the pact file provided to the mock server was not a valid pact file ErrInvalidPact = fmt.Errorf("pact given to mock server is invalid") // ErrMockServerUnableToStart means the mock server could not be started in the rust library ErrMockServerUnableToStart = fmt.Errorf("unable to start the mock server") // ErrInvalidAddress means the address provided to the mock server was invalid and could not be understood ErrInvalidAddress = fmt.Errorf("invalid address provided to the mock server") // ErrMockServerTLSConfiguration indicates a TLS mock server could not be started // and is likely a framework level problem ErrMockServerTLSConfiguration = fmt.Errorf("a tls mock server could not be started (this is likely a defect in the framework)") // ErrNoInteractions indicates no Interactions have been registered to a mock server, and cannot be started/stopped until at least one is added ErrNoInteractions = fmt.Errorf("no interactions have been registered for the mock server") // ErrPluginFailed indicates the plugin could not be started ErrPluginFailed = fmt.Errorf("the plugin could not be started") )
Errors
var ( ErrCantSetLogger = fmt.Errorf("can't set logger (applying the logger failed, perhaps because one is applied already).") ErrNoLogger = fmt.Errorf("no logger has been initialized (call `logger_init` before any other log function).") ErrSpecifierNotUtf8 = fmt.Errorf("The sink specifier was not UTF-8 encoded.") ErrUnknownSinkType = fmt.Errorf(`the sink type specified is not a known type (known types: "buffer", "stdout", "stderr", or "file /some/path").`) ErrMissingFilePath = fmt.Errorf("no file path was specified in a file-type sink specification.") ErrCantOpenSinkToFile = fmt.Errorf("opening a sink to the specified file path failed (check permissions).") ErrCantConstructSink = fmt.Errorf("can't construct the log sink") )
Log Errors
var ( ErrPluginGenericPanic = fmt.Errorf("A general panic was caught.") ErrPluginMockServerStarted = fmt.Errorf("The mock server has already been started.") ErrPluginInteractionHandleInvalid = fmt.Errorf("The interaction handle is invalid. ") ErrPluginInvalidContentType = fmt.Errorf("The content type is not valid.") ErrPluginInvalidJson = fmt.Errorf("The contents JSON is not valid JSON.") ErrPluginSpecificError = fmt.Errorf("The plugin returned an error.") )
Plugin Errors
var ( CatalogueEntry_EntryType_name = map[int32]string{ 0: "CONTENT_MATCHER", 1: "CONTENT_GENERATOR", 2: "MOCK_SERVER", 3: "MATCHER", 4: "INTERACTION", } CatalogueEntry_EntryType_value = map[string]int32{ "CONTENT_MATCHER": 0, "CONTENT_GENERATOR": 1, "MOCK_SERVER": 2, "MATCHER": 3, "INTERACTION": 4, } )
Enum value maps for CatalogueEntry_EntryType.
var ( Body_ContentTypeHint_name = map[int32]string{ 0: "DEFAULT", 1: "TEXT", 2: "BINARY", } Body_ContentTypeHint_value = map[string]int32{ "DEFAULT": 0, "TEXT": 1, "BINARY": 2, } )
Enum value maps for Body_ContentTypeHint.
var ( InteractionResponse_MarkupType_name = map[int32]string{ 0: "COMMON_MARK", 1: "HTML", } InteractionResponse_MarkupType_value = map[string]int32{ "COMMON_MARK": 0, "HTML": 1, } )
Enum value maps for InteractionResponse_MarkupType.
var ( // ErrVerifierPanic indicates a panic ocurred when invoking the verifier. ErrVerifierPanic = fmt.Errorf("a general panic occured when starting/invoking verifier (this indicates a defect in the framework)") // ErrInvalidVerifierConfig indicates an issue configuring the verifier ErrInvalidVerifierConfig = fmt.Errorf("configuration for the verifier was invalid and an unknown error occurred (this is most likely a defect in the framework)") //ErrVerifierFailed is the standard error if a verification failed (e.g. beacause the pact verification was not successful) ErrVerifierFailed = fmt.Errorf("the verifier failed to successfully verify the pacts, this indicates an issue with the provider API") //ErrVerifierFailedToRun indicates the verification process was unable to run ErrVerifierFailedToRun = fmt.Errorf("the verifier failed to execute (this is most likely a defect in the framework)") )
var File_plugin_proto protoreflect.FileDescriptor
var PactPlugin_ServiceDesc = grpc.ServiceDesc{ ServiceName: "io.pact.plugin.PactPlugin", HandlerType: (*PactPluginServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "InitPlugin", Handler: _PactPlugin_InitPlugin_Handler, }, { MethodName: "UpdateCatalogue", Handler: _PactPlugin_UpdateCatalogue_Handler, }, { MethodName: "CompareContents", Handler: _PactPlugin_CompareContents_Handler, }, { MethodName: "ConfigureInteraction", Handler: _PactPlugin_ConfigureInteraction_Handler, }, { MethodName: "GenerateContent", Handler: _PactPlugin_GenerateContent_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "pact_plugin.proto", }
PactPlugin_ServiceDesc is the grpc.ServiceDesc for PactPlugin service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func GetTLSConfig ¶
GetTLSConfig returns a tls.Config compatible with the TLS mock server
func RegisterPactPluginServer ¶
func RegisterPactPluginServer(s grpc.ServiceRegistrar, srv PactPluginServer)
Types ¶
type Body ¶
type Body struct { // The content type of the body in MIME format (i.e. application/json) ContentType string `protobuf:"bytes,1,opt,name=contentType,proto3" json:"contentType,omitempty"` // Bytes of the actual content Content *wrapperspb.BytesValue `protobuf:"bytes,2,opt,name=content,proto3" json:"content,omitempty"` // Content type override to apply (if required). If omitted, the default rules of the Pact implementation // will be used ContentTypeHint Body_ContentTypeHint `protobuf:"varint,3,opt,name=contentTypeHint,proto3,enum=io.pact.plugin.Body_ContentTypeHint" json:"contentTypeHint,omitempty"` // contains filtered or unexported fields }
Message representing a request, response or message body
func (*Body) Descriptor
deprecated
func (*Body) GetContent ¶
func (x *Body) GetContent() *wrapperspb.BytesValue
func (*Body) GetContentType ¶
func (*Body) GetContentTypeHint ¶
func (x *Body) GetContentTypeHint() Body_ContentTypeHint
func (*Body) ProtoMessage ¶
func (*Body) ProtoMessage()
func (*Body) ProtoReflect ¶
func (x *Body) ProtoReflect() protoreflect.Message
type Body_ContentTypeHint ¶
type Body_ContentTypeHint int32
Enum of content type override. This is a hint on how the content type should be treated.
const ( // Determine the form of the content using the default rules of the Pact implementation Body_DEFAULT Body_ContentTypeHint = 0 // Contents must always be treated as a text form Body_TEXT Body_ContentTypeHint = 1 // Contents must always be treated as a binary form Body_BINARY Body_ContentTypeHint = 2 )
func (Body_ContentTypeHint) Descriptor ¶
func (Body_ContentTypeHint) Descriptor() protoreflect.EnumDescriptor
func (Body_ContentTypeHint) Enum ¶
func (x Body_ContentTypeHint) Enum() *Body_ContentTypeHint
func (Body_ContentTypeHint) EnumDescriptor
deprecated
func (Body_ContentTypeHint) EnumDescriptor() ([]byte, []int)
Deprecated: Use Body_ContentTypeHint.Descriptor instead.
func (Body_ContentTypeHint) Number ¶
func (x Body_ContentTypeHint) Number() protoreflect.EnumNumber
func (Body_ContentTypeHint) String ¶
func (x Body_ContentTypeHint) String() string
func (Body_ContentTypeHint) Type ¶
func (Body_ContentTypeHint) Type() protoreflect.EnumType
type Catalogue ¶
type Catalogue struct { // List of entries from the core catalogue Catalogue []*CatalogueEntry `protobuf:"bytes,1,rep,name=catalogue,proto3" json:"catalogue,omitempty"` // contains filtered or unexported fields }
Catalogue of Core Pact + Plugin features
func (*Catalogue) Descriptor
deprecated
func (*Catalogue) GetCatalogue ¶
func (x *Catalogue) GetCatalogue() []*CatalogueEntry
func (*Catalogue) ProtoMessage ¶
func (*Catalogue) ProtoMessage()
func (*Catalogue) ProtoReflect ¶
func (x *Catalogue) ProtoReflect() protoreflect.Message
type CatalogueEntry ¶
type CatalogueEntry struct { // Entry type Type CatalogueEntry_EntryType `protobuf:"varint,1,opt,name=type,proto3,enum=io.pact.plugin.CatalogueEntry_EntryType" json:"type,omitempty"` // Entry key Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` // Associated data required for the entry. For CONTENT_MATCHER and CONTENT_GENERATOR types, a "content-types" // value (separated by semi-colons) is required for all the content types the plugin supports. Values map[string]string `` /* 153-byte string literal not displayed */ // contains filtered or unexported fields }
Entry to be added to the core catalogue. Each entry describes one of the features the plugin provides. Entries will be stored in the catalogue under the key "plugin/$name/$type/$key".
func (*CatalogueEntry) Descriptor
deprecated
func (*CatalogueEntry) Descriptor() ([]byte, []int)
Deprecated: Use CatalogueEntry.ProtoReflect.Descriptor instead.
func (*CatalogueEntry) GetKey ¶
func (x *CatalogueEntry) GetKey() string
func (*CatalogueEntry) GetType ¶
func (x *CatalogueEntry) GetType() CatalogueEntry_EntryType
func (*CatalogueEntry) GetValues ¶
func (x *CatalogueEntry) GetValues() map[string]string
func (*CatalogueEntry) ProtoMessage ¶
func (*CatalogueEntry) ProtoMessage()
func (*CatalogueEntry) ProtoReflect ¶
func (x *CatalogueEntry) ProtoReflect() protoreflect.Message
func (*CatalogueEntry) Reset ¶
func (x *CatalogueEntry) Reset()
func (*CatalogueEntry) String ¶
func (x *CatalogueEntry) String() string
type CatalogueEntry_EntryType ¶
type CatalogueEntry_EntryType int32
const ( // Matcher for contents of messages, requests or response bodies CatalogueEntry_CONTENT_MATCHER CatalogueEntry_EntryType = 0 // Generator for contents of messages, requests or response bodies CatalogueEntry_CONTENT_GENERATOR CatalogueEntry_EntryType = 1 // Mock server for a network protocol CatalogueEntry_MOCK_SERVER CatalogueEntry_EntryType = 2 // Matching rule for content field/values CatalogueEntry_MATCHER CatalogueEntry_EntryType = 3 // Type of interaction CatalogueEntry_INTERACTION CatalogueEntry_EntryType = 4 )
func (CatalogueEntry_EntryType) Descriptor ¶
func (CatalogueEntry_EntryType) Descriptor() protoreflect.EnumDescriptor
func (CatalogueEntry_EntryType) Enum ¶
func (x CatalogueEntry_EntryType) Enum() *CatalogueEntry_EntryType
func (CatalogueEntry_EntryType) EnumDescriptor
deprecated
func (CatalogueEntry_EntryType) EnumDescriptor() ([]byte, []int)
Deprecated: Use CatalogueEntry_EntryType.Descriptor instead.
func (CatalogueEntry_EntryType) Number ¶
func (x CatalogueEntry_EntryType) Number() protoreflect.EnumNumber
func (CatalogueEntry_EntryType) String ¶
func (x CatalogueEntry_EntryType) String() string
func (CatalogueEntry_EntryType) Type ¶
func (CatalogueEntry_EntryType) Type() protoreflect.EnumType
type CompareContentsRequest ¶
type CompareContentsRequest struct { // Expected body from the Pact interaction Expected *Body `protobuf:"bytes,1,opt,name=expected,proto3" json:"expected,omitempty"` // Actual received body Actual *Body `protobuf:"bytes,2,opt,name=actual,proto3" json:"actual,omitempty"` // If unexpected keys or attributes should be allowed. Setting this to false results in additional keys or fields // will cause a mismatch AllowUnexpectedKeys bool `protobuf:"varint,3,opt,name=allow_unexpected_keys,json=allowUnexpectedKeys,proto3" json:"allow_unexpected_keys,omitempty"` // Map of expressions to matching rules. The expressions follow the documented Pact matching rule expressions Rules map[string]*MatchingRules `` /* 151-byte string literal not displayed */ // Additional data added to the Pact/Interaction by the plugin PluginConfiguration *PluginConfiguration `protobuf:"bytes,5,opt,name=pluginConfiguration,proto3" json:"pluginConfiguration,omitempty"` // contains filtered or unexported fields }
Request to preform a comparison on an actual body given the expected one
func (*CompareContentsRequest) Descriptor
deprecated
func (*CompareContentsRequest) Descriptor() ([]byte, []int)
Deprecated: Use CompareContentsRequest.ProtoReflect.Descriptor instead.
func (*CompareContentsRequest) GetActual ¶
func (x *CompareContentsRequest) GetActual() *Body
func (*CompareContentsRequest) GetAllowUnexpectedKeys ¶
func (x *CompareContentsRequest) GetAllowUnexpectedKeys() bool
func (*CompareContentsRequest) GetExpected ¶
func (x *CompareContentsRequest) GetExpected() *Body
func (*CompareContentsRequest) GetPluginConfiguration ¶
func (x *CompareContentsRequest) GetPluginConfiguration() *PluginConfiguration
func (*CompareContentsRequest) GetRules ¶
func (x *CompareContentsRequest) GetRules() map[string]*MatchingRules
func (*CompareContentsRequest) ProtoMessage ¶
func (*CompareContentsRequest) ProtoMessage()
func (*CompareContentsRequest) ProtoReflect ¶
func (x *CompareContentsRequest) ProtoReflect() protoreflect.Message
func (*CompareContentsRequest) Reset ¶
func (x *CompareContentsRequest) Reset()
func (*CompareContentsRequest) String ¶
func (x *CompareContentsRequest) String() string
type CompareContentsResponse ¶
type CompareContentsResponse struct { // Error message if an error occurred. If this field is set, the remaining fields will be ignored and the // verification marked as failed Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` // There was a mismatch with the types of content. If this is set, the results may not be set. TypeMismatch *ContentTypeMismatch `protobuf:"bytes,2,opt,name=typeMismatch,proto3" json:"typeMismatch,omitempty"` // Results of the match, keyed by matching rule expression Results map[string]*ContentMismatches `` /* 155-byte string literal not displayed */ // contains filtered or unexported fields }
Response to the CompareContentsRequest with the results of the comparison
func (*CompareContentsResponse) Descriptor
deprecated
func (*CompareContentsResponse) Descriptor() ([]byte, []int)
Deprecated: Use CompareContentsResponse.ProtoReflect.Descriptor instead.
func (*CompareContentsResponse) GetError ¶
func (x *CompareContentsResponse) GetError() string
func (*CompareContentsResponse) GetResults ¶
func (x *CompareContentsResponse) GetResults() map[string]*ContentMismatches
func (*CompareContentsResponse) GetTypeMismatch ¶
func (x *CompareContentsResponse) GetTypeMismatch() *ContentTypeMismatch
func (*CompareContentsResponse) ProtoMessage ¶
func (*CompareContentsResponse) ProtoMessage()
func (*CompareContentsResponse) ProtoReflect ¶
func (x *CompareContentsResponse) ProtoReflect() protoreflect.Message
func (*CompareContentsResponse) Reset ¶
func (x *CompareContentsResponse) Reset()
func (*CompareContentsResponse) String ¶
func (x *CompareContentsResponse) String() string
type ConfigureInteractionRequest ¶
type ConfigureInteractionRequest struct { // Content type of the interaction (MIME format) ContentType string `protobuf:"bytes,1,opt,name=contentType,proto3" json:"contentType,omitempty"` // This is data specified by the user in the consumer test ContentsConfig *structpb.Struct `protobuf:"bytes,2,opt,name=contentsConfig,proto3" json:"contentsConfig,omitempty"` // contains filtered or unexported fields }
Request to configure/setup an interaction so that it can be verified later
func (*ConfigureInteractionRequest) Descriptor
deprecated
func (*ConfigureInteractionRequest) Descriptor() ([]byte, []int)
Deprecated: Use ConfigureInteractionRequest.ProtoReflect.Descriptor instead.
func (*ConfigureInteractionRequest) GetContentType ¶
func (x *ConfigureInteractionRequest) GetContentType() string
func (*ConfigureInteractionRequest) GetContentsConfig ¶
func (x *ConfigureInteractionRequest) GetContentsConfig() *structpb.Struct
func (*ConfigureInteractionRequest) ProtoMessage ¶
func (*ConfigureInteractionRequest) ProtoMessage()
func (*ConfigureInteractionRequest) ProtoReflect ¶
func (x *ConfigureInteractionRequest) ProtoReflect() protoreflect.Message
func (*ConfigureInteractionRequest) Reset ¶
func (x *ConfigureInteractionRequest) Reset()
func (*ConfigureInteractionRequest) String ¶
func (x *ConfigureInteractionRequest) String() string
type ConfigureInteractionResponse ¶
type ConfigureInteractionResponse struct { // If an error occurred. In this case, the other fields will be ignored/not set Error string `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"` // The actual response if no error occurred. Interaction []*InteractionResponse `protobuf:"bytes,2,rep,name=interaction,proto3" json:"interaction,omitempty"` // Plugin specific data to be persisted in the pact file PluginConfiguration *PluginConfiguration `protobuf:"bytes,3,opt,name=pluginConfiguration,proto3" json:"pluginConfiguration,omitempty"` // contains filtered or unexported fields }
Response to the configure/setup an interaction request
func (*ConfigureInteractionResponse) Descriptor
deprecated
func (*ConfigureInteractionResponse) Descriptor() ([]byte, []int)
Deprecated: Use ConfigureInteractionResponse.ProtoReflect.Descriptor instead.
func (*ConfigureInteractionResponse) GetError ¶
func (x *ConfigureInteractionResponse) GetError() string
func (*ConfigureInteractionResponse) GetInteraction ¶
func (x *ConfigureInteractionResponse) GetInteraction() []*InteractionResponse
func (*ConfigureInteractionResponse) GetPluginConfiguration ¶
func (x *ConfigureInteractionResponse) GetPluginConfiguration() *PluginConfiguration
func (*ConfigureInteractionResponse) ProtoMessage ¶
func (*ConfigureInteractionResponse) ProtoMessage()
func (*ConfigureInteractionResponse) ProtoReflect ¶
func (x *ConfigureInteractionResponse) ProtoReflect() protoreflect.Message
func (*ConfigureInteractionResponse) Reset ¶
func (x *ConfigureInteractionResponse) Reset()
func (*ConfigureInteractionResponse) String ¶
func (x *ConfigureInteractionResponse) String() string
type ContentMismatch ¶
type ContentMismatch struct { // Expected data bytes Expected *wrapperspb.BytesValue `protobuf:"bytes,1,opt,name=expected,proto3" json:"expected,omitempty"` // Actual data bytes Actual *wrapperspb.BytesValue `protobuf:"bytes,2,opt,name=actual,proto3" json:"actual,omitempty"` // Description of the mismatch Mismatch string `protobuf:"bytes,3,opt,name=mismatch,proto3" json:"mismatch,omitempty"` // Path to the item that was matched. This is the value as per the documented Pact matching rule expressions. Path string `protobuf:"bytes,4,opt,name=path,proto3" json:"path,omitempty"` // Optional diff of the contents Diff string `protobuf:"bytes,5,opt,name=diff,proto3" json:"diff,omitempty"` // contains filtered or unexported fields }
A mismatch for an particular item of content
func (*ContentMismatch) Descriptor
deprecated
func (*ContentMismatch) Descriptor() ([]byte, []int)
Deprecated: Use ContentMismatch.ProtoReflect.Descriptor instead.
func (*ContentMismatch) GetActual ¶
func (x *ContentMismatch) GetActual() *wrapperspb.BytesValue
func (*ContentMismatch) GetDiff ¶
func (x *ContentMismatch) GetDiff() string
func (*ContentMismatch) GetExpected ¶
func (x *ContentMismatch) GetExpected() *wrapperspb.BytesValue
func (*ContentMismatch) GetMismatch ¶
func (x *ContentMismatch) GetMismatch() string
func (*ContentMismatch) GetPath ¶
func (x *ContentMismatch) GetPath() string
func (*ContentMismatch) ProtoMessage ¶
func (*ContentMismatch) ProtoMessage()
func (*ContentMismatch) ProtoReflect ¶
func (x *ContentMismatch) ProtoReflect() protoreflect.Message
func (*ContentMismatch) Reset ¶
func (x *ContentMismatch) Reset()
func (*ContentMismatch) String ¶
func (x *ContentMismatch) String() string
type ContentMismatches ¶
type ContentMismatches struct { Mismatches []*ContentMismatch `protobuf:"bytes,1,rep,name=mismatches,proto3" json:"mismatches,omitempty"` // contains filtered or unexported fields }
List of content mismatches
func (*ContentMismatches) Descriptor
deprecated
func (*ContentMismatches) Descriptor() ([]byte, []int)
Deprecated: Use ContentMismatches.ProtoReflect.Descriptor instead.
func (*ContentMismatches) GetMismatches ¶
func (x *ContentMismatches) GetMismatches() []*ContentMismatch
func (*ContentMismatches) ProtoMessage ¶
func (*ContentMismatches) ProtoMessage()
func (*ContentMismatches) ProtoReflect ¶
func (x *ContentMismatches) ProtoReflect() protoreflect.Message
func (*ContentMismatches) Reset ¶
func (x *ContentMismatches) Reset()
func (*ContentMismatches) String ¶
func (x *ContentMismatches) String() string
type ContentTypeMismatch ¶
type ContentTypeMismatch struct { // Expected content type (MIME format) Expected string `protobuf:"bytes,1,opt,name=expected,proto3" json:"expected,omitempty"` // Actual content type received (MIME format) Actual string `protobuf:"bytes,2,opt,name=actual,proto3" json:"actual,omitempty"` // contains filtered or unexported fields }
Indicates that there was a mismatch with the content type
func (*ContentTypeMismatch) Descriptor
deprecated
func (*ContentTypeMismatch) Descriptor() ([]byte, []int)
Deprecated: Use ContentTypeMismatch.ProtoReflect.Descriptor instead.
func (*ContentTypeMismatch) GetActual ¶
func (x *ContentTypeMismatch) GetActual() string
func (*ContentTypeMismatch) GetExpected ¶
func (x *ContentTypeMismatch) GetExpected() string
func (*ContentTypeMismatch) ProtoMessage ¶
func (*ContentTypeMismatch) ProtoMessage()
func (*ContentTypeMismatch) ProtoReflect ¶
func (x *ContentTypeMismatch) ProtoReflect() protoreflect.Message
func (*ContentTypeMismatch) Reset ¶
func (x *ContentTypeMismatch) Reset()
func (*ContentTypeMismatch) String ¶
func (x *ContentTypeMismatch) String() string
type GenerateContentRequest ¶
type GenerateContentRequest struct { // Original contents Contents *Body `protobuf:"bytes,1,opt,name=contents,proto3" json:"contents,omitempty"` // Generators to apply Generators map[string]*Generator `` /* 161-byte string literal not displayed */ // Additional data added to the Pact/Interaction by the plugin PluginConfiguration *PluginConfiguration `protobuf:"bytes,3,opt,name=pluginConfiguration,proto3" json:"pluginConfiguration,omitempty"` // contains filtered or unexported fields }
Request to generate the contents using any defined generators
func (*GenerateContentRequest) Descriptor
deprecated
func (*GenerateContentRequest) Descriptor() ([]byte, []int)
Deprecated: Use GenerateContentRequest.ProtoReflect.Descriptor instead.
func (*GenerateContentRequest) GetContents ¶
func (x *GenerateContentRequest) GetContents() *Body
func (*GenerateContentRequest) GetGenerators ¶
func (x *GenerateContentRequest) GetGenerators() map[string]*Generator
func (*GenerateContentRequest) GetPluginConfiguration ¶
func (x *GenerateContentRequest) GetPluginConfiguration() *PluginConfiguration
func (*GenerateContentRequest) ProtoMessage ¶
func (*GenerateContentRequest) ProtoMessage()
func (*GenerateContentRequest) ProtoReflect ¶
func (x *GenerateContentRequest) ProtoReflect() protoreflect.Message
func (*GenerateContentRequest) Reset ¶
func (x *GenerateContentRequest) Reset()
func (*GenerateContentRequest) String ¶
func (x *GenerateContentRequest) String() string
type GenerateContentResponse ¶
type GenerateContentResponse struct { Contents *Body `protobuf:"bytes,1,opt,name=contents,proto3" json:"contents,omitempty"` // contains filtered or unexported fields }
Generated body/message response
func (*GenerateContentResponse) Descriptor
deprecated
func (*GenerateContentResponse) Descriptor() ([]byte, []int)
Deprecated: Use GenerateContentResponse.ProtoReflect.Descriptor instead.
func (*GenerateContentResponse) GetContents ¶
func (x *GenerateContentResponse) GetContents() *Body
func (*GenerateContentResponse) ProtoMessage ¶
func (*GenerateContentResponse) ProtoMessage()
func (*GenerateContentResponse) ProtoReflect ¶
func (x *GenerateContentResponse) ProtoReflect() protoreflect.Message
func (*GenerateContentResponse) Reset ¶
func (x *GenerateContentResponse) Reset()
func (*GenerateContentResponse) String ¶
func (x *GenerateContentResponse) String() string
type Generator ¶
type Generator struct { // Type of generator Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` // Associated data for the generator Values *structpb.Struct `protobuf:"bytes,2,opt,name=values,proto3" json:"values,omitempty"` // contains filtered or unexported fields }
Example generator
func (*Generator) Descriptor
deprecated
func (*Generator) ProtoMessage ¶
func (*Generator) ProtoMessage()
func (*Generator) ProtoReflect ¶
func (x *Generator) ProtoReflect() protoreflect.Message
type InitPluginRequest ¶
type InitPluginRequest struct { // Implementation calling the plugin Implementation string `protobuf:"bytes,1,opt,name=implementation,proto3" json:"implementation,omitempty"` // Version of the implementation Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version,omitempty"` // contains filtered or unexported fields }
Request to verify the plugin has loaded OK
func (*InitPluginRequest) Descriptor
deprecated
func (*InitPluginRequest) Descriptor() ([]byte, []int)
Deprecated: Use InitPluginRequest.ProtoReflect.Descriptor instead.
func (*InitPluginRequest) GetImplementation ¶
func (x *InitPluginRequest) GetImplementation() string
func (*InitPluginRequest) GetVersion ¶
func (x *InitPluginRequest) GetVersion() string
func (*InitPluginRequest) ProtoMessage ¶
func (*InitPluginRequest) ProtoMessage()
func (*InitPluginRequest) ProtoReflect ¶
func (x *InitPluginRequest) ProtoReflect() protoreflect.Message
func (*InitPluginRequest) Reset ¶
func (x *InitPluginRequest) Reset()
func (*InitPluginRequest) String ¶
func (x *InitPluginRequest) String() string
type InitPluginResponse ¶
type InitPluginResponse struct { // List of entries the plugin supports Catalogue []*CatalogueEntry `protobuf:"bytes,1,rep,name=catalogue,proto3" json:"catalogue,omitempty"` // contains filtered or unexported fields }
Response to init plugin, providing the catalogue entries the plugin provides
func (*InitPluginResponse) Descriptor
deprecated
func (*InitPluginResponse) Descriptor() ([]byte, []int)
Deprecated: Use InitPluginResponse.ProtoReflect.Descriptor instead.
func (*InitPluginResponse) GetCatalogue ¶
func (x *InitPluginResponse) GetCatalogue() []*CatalogueEntry
func (*InitPluginResponse) ProtoMessage ¶
func (*InitPluginResponse) ProtoMessage()
func (*InitPluginResponse) ProtoReflect ¶
func (x *InitPluginResponse) ProtoReflect() protoreflect.Message
func (*InitPluginResponse) Reset ¶
func (x *InitPluginResponse) Reset()
func (*InitPluginResponse) String ¶
func (x *InitPluginResponse) String() string
type Interaction ¶
type Interaction struct {
// contains filtered or unexported fields
}
Interaction is a Go representation of the InteractionHandle struct
func (*Interaction) Given ¶
func (i *Interaction) Given(state string) *Interaction
func (*Interaction) GivenWithParameter ¶
func (i *Interaction) GivenWithParameter(state string, params map[string]interface{}) *Interaction
func (*Interaction) UponReceiving ¶
func (i *Interaction) UponReceiving(description string) *Interaction
func (*Interaction) WithBinaryRequestBody ¶
func (i *Interaction) WithBinaryRequestBody(body []byte) *Interaction
func (*Interaction) WithBinaryResponseBody ¶
func (i *Interaction) WithBinaryResponseBody(body []byte) *Interaction
func (*Interaction) WithJSONRequestBody ¶
func (i *Interaction) WithJSONRequestBody(body interface{}) *Interaction
func (*Interaction) WithJSONResponseBody ¶
func (i *Interaction) WithJSONResponseBody(body interface{}) *Interaction
func (*Interaction) WithPluginInteractionContents ¶
func (i *Interaction) WithPluginInteractionContents(part interactionPart, contentType string, contents string) error
NewInteraction initialises a new interaction for the current contract
func (*Interaction) WithQuery ¶
func (i *Interaction) WithQuery(valueOrMatcher map[string][]interface{}) *Interaction
func (*Interaction) WithRequest ¶
func (i *Interaction) WithRequest(method string, pathOrMatcher interface{}) *Interaction
func (*Interaction) WithRequestBody ¶
func (i *Interaction) WithRequestBody(contentType string, body []byte) *Interaction
func (*Interaction) WithRequestHeaders ¶
func (i *Interaction) WithRequestHeaders(valueOrMatcher map[string][]interface{}) *Interaction
func (*Interaction) WithRequestMultipartFile ¶
func (i *Interaction) WithRequestMultipartFile(contentType string, filename string, mimePartName string) *Interaction
func (*Interaction) WithResponseBody ¶
func (i *Interaction) WithResponseBody(contentType string, body []byte) *Interaction
func (*Interaction) WithResponseHeaders ¶
func (i *Interaction) WithResponseHeaders(valueOrMatcher map[string][]interface{}) *Interaction
func (*Interaction) WithResponseMultipartFile ¶
func (i *Interaction) WithResponseMultipartFile(contentType string, filename string, mimePartName string) *Interaction
func (*Interaction) WithStatus ¶
func (i *Interaction) WithStatus(status int) *Interaction
Set the expected HTTTP response status
type InteractionResponse ¶
type InteractionResponse struct { // Contents for the interaction Contents *Body `protobuf:"bytes,1,opt,name=contents,proto3" json:"contents,omitempty"` // All matching rules to apply Rules map[string]*MatchingRules `` /* 151-byte string literal not displayed */ // Generators to apply Generators map[string]*Generator `` /* 161-byte string literal not displayed */ // For message interactions, any metadata to be applied MessageMetadata *structpb.Struct `protobuf:"bytes,4,opt,name=messageMetadata,proto3" json:"messageMetadata,omitempty"` // Plugin specific data to be persisted in the pact file PluginConfiguration *PluginConfiguration `protobuf:"bytes,5,opt,name=pluginConfiguration,proto3" json:"pluginConfiguration,omitempty"` // Markdown/HTML formatted text representation of the interaction InteractionMarkup string `protobuf:"bytes,6,opt,name=interactionMarkup,proto3" json:"interactionMarkup,omitempty"` InteractionMarkupType InteractionResponse_MarkupType `` /* 147-byte string literal not displayed */ // Description of what part this interaction belongs to (in the case of there being more than one, for instance, // request/response messages) PartName string `protobuf:"bytes,8,opt,name=partName,proto3" json:"partName,omitempty"` // contains filtered or unexported fields }
Response to the configure/setup an interaction request
func (*InteractionResponse) Descriptor
deprecated
func (*InteractionResponse) Descriptor() ([]byte, []int)
Deprecated: Use InteractionResponse.ProtoReflect.Descriptor instead.
func (*InteractionResponse) GetContents ¶
func (x *InteractionResponse) GetContents() *Body
func (*InteractionResponse) GetGenerators ¶
func (x *InteractionResponse) GetGenerators() map[string]*Generator
func (*InteractionResponse) GetInteractionMarkup ¶
func (x *InteractionResponse) GetInteractionMarkup() string
func (*InteractionResponse) GetInteractionMarkupType ¶
func (x *InteractionResponse) GetInteractionMarkupType() InteractionResponse_MarkupType
func (*InteractionResponse) GetMessageMetadata ¶
func (x *InteractionResponse) GetMessageMetadata() *structpb.Struct
func (*InteractionResponse) GetPartName ¶
func (x *InteractionResponse) GetPartName() string
func (*InteractionResponse) GetPluginConfiguration ¶
func (x *InteractionResponse) GetPluginConfiguration() *PluginConfiguration
func (*InteractionResponse) GetRules ¶
func (x *InteractionResponse) GetRules() map[string]*MatchingRules
func (*InteractionResponse) ProtoMessage ¶
func (*InteractionResponse) ProtoMessage()
func (*InteractionResponse) ProtoReflect ¶
func (x *InteractionResponse) ProtoReflect() protoreflect.Message
func (*InteractionResponse) Reset ¶
func (x *InteractionResponse) Reset()
func (*InteractionResponse) String ¶
func (x *InteractionResponse) String() string
type InteractionResponse_MarkupType ¶
type InteractionResponse_MarkupType int32
Type of markup used
const ( // CommonMark format InteractionResponse_COMMON_MARK InteractionResponse_MarkupType = 0 // HTML format InteractionResponse_HTML InteractionResponse_MarkupType = 1 )
func (InteractionResponse_MarkupType) Descriptor ¶
func (InteractionResponse_MarkupType) Descriptor() protoreflect.EnumDescriptor
func (InteractionResponse_MarkupType) Enum ¶
func (x InteractionResponse_MarkupType) Enum() *InteractionResponse_MarkupType
func (InteractionResponse_MarkupType) EnumDescriptor
deprecated
func (InteractionResponse_MarkupType) EnumDescriptor() ([]byte, []int)
Deprecated: Use InteractionResponse_MarkupType.Descriptor instead.
func (InteractionResponse_MarkupType) Number ¶
func (x InteractionResponse_MarkupType) Number() protoreflect.EnumNumber
func (InteractionResponse_MarkupType) String ¶
func (x InteractionResponse_MarkupType) String() string
func (InteractionResponse_MarkupType) Type ¶
func (InteractionResponse_MarkupType) Type() protoreflect.EnumType
type MatchingRule ¶
type MatchingRule struct { // Type of the matching rule Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` // Associated data for the matching rule Values *structpb.Struct `protobuf:"bytes,2,opt,name=values,proto3" json:"values,omitempty"` // contains filtered or unexported fields }
Represents a matching rule
func (*MatchingRule) Descriptor
deprecated
func (*MatchingRule) Descriptor() ([]byte, []int)
Deprecated: Use MatchingRule.ProtoReflect.Descriptor instead.
func (*MatchingRule) GetType ¶
func (x *MatchingRule) GetType() string
func (*MatchingRule) GetValues ¶
func (x *MatchingRule) GetValues() *structpb.Struct
func (*MatchingRule) ProtoMessage ¶
func (*MatchingRule) ProtoMessage()
func (*MatchingRule) ProtoReflect ¶
func (x *MatchingRule) ProtoReflect() protoreflect.Message
func (*MatchingRule) Reset ¶
func (x *MatchingRule) Reset()
func (*MatchingRule) String ¶
func (x *MatchingRule) String() string
type MatchingRules ¶
type MatchingRules struct { Rule []*MatchingRule `protobuf:"bytes,1,rep,name=rule,proto3" json:"rule,omitempty"` // contains filtered or unexported fields }
List of matching rules
func (*MatchingRules) Descriptor
deprecated
func (*MatchingRules) Descriptor() ([]byte, []int)
Deprecated: Use MatchingRules.ProtoReflect.Descriptor instead.
func (*MatchingRules) GetRule ¶
func (x *MatchingRules) GetRule() []*MatchingRule
func (*MatchingRules) ProtoMessage ¶
func (*MatchingRules) ProtoMessage()
func (*MatchingRules) ProtoReflect ¶
func (x *MatchingRules) ProtoReflect() protoreflect.Message
func (*MatchingRules) Reset ¶
func (x *MatchingRules) Reset()
func (*MatchingRules) String ¶
func (x *MatchingRules) String() string
type Message ¶
type Message struct {
// contains filtered or unexported fields
}
func (*Message) ExpectsToReceive ¶
func (*Message) GetMessageRequestContents ¶
GetMessageContents retreives the binary contents of the request for a given message any matchers are stripped away if given if the contents is from a plugin, the byte[] representation of the parsed plugin data is returned, again, with any matchers etc. removed
func (*Message) GetMessageResponseContents ¶
GetMessageResponseContents retreives the binary contents of the response for a given message any matchers are stripped away if given if the contents is from a plugin, the byte[] representation of the parsed plugin data is returned, again, with any matchers etc. removed
func (*Message) GivenWithParameter ¶
func (*Message) WithContents ¶
Note that string values here must be NUL terminated.
func (*Message) WithMetadata ¶
func (*Message) WithPluginInteractionContents ¶
func (m *Message) WithPluginInteractionContents(part interactionPart, contentType string, contents string) error
NewInteraction initialises a new interaction for the current contract
func (*Message) WithRequestBinaryContentType ¶
func (*Message) WithRequestBinaryContents ¶
func (*Message) WithRequestJSONContents ¶
func (*Message) WithResponseBinaryContents ¶
func (*Message) WithResponseJSONContents ¶
type MessagePact ¶
type MessagePact struct {
// contains filtered or unexported fields
}
type MessageServer ¶
type MessageServer struct {
// contains filtered or unexported fields
}
MessageServer is the public interface for managing the message based interface
func NewMessageServer ¶
func NewMessageServer(consumer string, provider string) *MessageServer
NewMessage initialises a new message for the current contract
func (*MessageServer) CleanupMockServer ¶
func (m *MessageServer) CleanupMockServer(port int) bool
CleanupMockServer frees the memory from the previous mock server.
func (*MessageServer) CleanupPlugins ¶
func (m *MessageServer) CleanupPlugins()
NewInteraction initialises a new interaction for the current contract
func (*MessageServer) MockServerMatched ¶
func (m *MessageServer) MockServerMatched(port int) bool
MockServerMismatchedRequests returns a JSON object containing any mismatches from the last set of interactions.
func (*MessageServer) MockServerMismatchedRequests ¶
func (m *MessageServer) MockServerMismatchedRequests(port int) []MismatchedRequest
MockServerMismatchedRequests returns a JSON object containing any mismatches from the last set of interactions.
func (*MessageServer) NewAsyncMessageInteraction ¶
func (m *MessageServer) NewAsyncMessageInteraction(description string) *Message
NewAsyncMessageInteraction initialises a new asynchronous message interaction for the current contract
func (*MessageServer) NewMessage ¶
func (m *MessageServer) NewMessage() *Message
NewMessage initialises a new message for the current contract Deprecated: use NewAsyncMessageInteraction instead
func (*MessageServer) NewSyncMessageInteraction ¶
func (m *MessageServer) NewSyncMessageInteraction(description string) *Message
NewSyncMessageInteraction initialises a new synchronous message interaction for the current contract
func (*MessageServer) StartTransport ¶
func (m *MessageServer) StartTransport(transport string, address string, port int, config map[string][]interface{}) (int, error)
StartTransport starts up a mock server on the given address:port for the given transport https://docs.rs/pact_ffi/latest/pact_ffi/mock_server/fn.pactffi_create_mock_server_for_transport.html
func (*MessageServer) UsingPlugin ¶
func (m *MessageServer) UsingPlugin(pluginName string, pluginVersion string) error
NewInteraction initialises a new interaction for the current contract
func (*MessageServer) WithMetadata ¶
func (m *MessageServer) WithMetadata(namespace, k, v string) *MessageServer
Sets the additional metadata on the Pact file. Common uses are to add the client library details such as the name and version
func (*MessageServer) WithSpecificationVersion ¶
func (m *MessageServer) WithSpecificationVersion(version specificationVersion)
func (*MessageServer) WritePactFile ¶
func (m *MessageServer) WritePactFile(dir string, overwrite bool) error
WritePactFile writes the Pact to file.
func (*MessageServer) WritePactFileForServer ¶
func (m *MessageServer) WritePactFileForServer(port int, dir string, overwrite bool) error
WritePactFile writes the Pact to file.
type MismatchDetail ¶
MismatchDetail contains the specific assertions that failed during the verification
type MismatchedRequest ¶
type MismatchedRequest struct { Request Mismatches []MismatchDetail Type string }
MismatchedRequest contains details of any request mismatches during pact verification
type MockServer ¶
type MockServer struct {
// contains filtered or unexported fields
}
MockServer is the public interface for managing the HTTP mock server
func NewHTTPPact ¶
func NewHTTPPact(consumer string, provider string) *MockServer
NewHTTPPact creates a new HTTP mock server for a given consumer/provider
func (*MockServer) CleanupMockServer ¶
func (m *MockServer) CleanupMockServer(port int) bool
CleanupMockServer frees the memory from the previous mock server.
func (*MockServer) CleanupPlugins ¶
func (m *MockServer) CleanupPlugins()
NewInteraction initialises a new interaction for the current contract
func (*MockServer) CreateMockServer ¶
CreateMockServer creates a new Mock Server from a given Pact file. Returns the port number it started on or an error if failed
func (*MockServer) MockServerMismatchedRequests ¶
func (m *MockServer) MockServerMismatchedRequests(port int) []MismatchedRequest
MockServerMismatchedRequests returns a JSON object containing any mismatches from the last set of interactions.
func (*MockServer) NewInteraction ¶
func (m *MockServer) NewInteraction(description string) *Interaction
NewInteraction initialises a new interaction for the current contract
func (*MockServer) Start ¶
func (m *MockServer) Start(address string, tls bool) (int, error)
Start starts up the mock HTTP server on the given address:port and TLS config https://docs.rs/pact_mock_server_ffi/0.0.7/pact_mock_server_ffi/fn.create_mock_server_for_pact.html
func (*MockServer) StartTransport ¶
func (m *MockServer) StartTransport(transport string, address string, port int, config map[string][]interface{}) (int, error)
StartTransport starts up a mock server on the given address:port for the given transport https://docs.rs/pact_ffi/latest/pact_ffi/mock_server/fn.pactffi_create_mock_server_for_transport.html
func (*MockServer) UsingPlugin ¶
func (m *MockServer) UsingPlugin(pluginName string, pluginVersion string) error
NewInteraction initialises a new interaction for the current contract
func (*MockServer) Verify ¶
func (m *MockServer) Verify(port int, dir string) (bool, []MismatchedRequest)
Verify verifies that all interactions were successful. If not, returns a slice of Mismatch-es. Does not write the pact or cleanup server.
func (*MockServer) Version ¶
func (m *MockServer) Version() string
Version returns the current semver FFI interface version
func (*MockServer) WithMetadata ¶
func (m *MockServer) WithMetadata(namespace, k, v string) *MockServer
Sets the additional metadata on the Pact file. Common uses are to add the client library details such as the name and version
func (*MockServer) WithSpecificationVersion ¶
func (m *MockServer) WithSpecificationVersion(version specificationVersion)
func (*MockServer) WritePactFile ¶
func (m *MockServer) WritePactFile(port int, dir string) error
WritePactFile writes the Pact to file. TODO: expose overwrite
type Pact ¶
type Pact struct {
// contains filtered or unexported fields
}
Pact is a Go representation of the PactHandle struct
type PactPluginClient ¶
type PactPluginClient interface { // Check that the plugin loaded OK. Returns the catalogue entries describing what the plugin provides InitPlugin(ctx context.Context, in *InitPluginRequest, opts ...grpc.CallOption) (*InitPluginResponse, error) // Updated catalogue. This will be sent when the core catalogue has been updated (probably by a plugin loading). UpdateCatalogue(ctx context.Context, in *Catalogue, opts ...grpc.CallOption) (*emptypb.Empty, error) // Request to perform a comparison of some contents (matching request) CompareContents(ctx context.Context, in *CompareContentsRequest, opts ...grpc.CallOption) (*CompareContentsResponse, error) // Request to configure/setup the interaction for later verification. Data returned will be persisted in the pact file. ConfigureInteraction(ctx context.Context, in *ConfigureInteractionRequest, opts ...grpc.CallOption) (*ConfigureInteractionResponse, error) // Request to generate the content using any defined generators GenerateContent(ctx context.Context, in *GenerateContentRequest, opts ...grpc.CallOption) (*GenerateContentResponse, error) }
PactPluginClient is the client API for PactPlugin service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewPactPluginClient ¶
func NewPactPluginClient(cc grpc.ClientConnInterface) PactPluginClient
type PactPluginServer ¶
type PactPluginServer interface { // Check that the plugin loaded OK. Returns the catalogue entries describing what the plugin provides InitPlugin(context.Context, *InitPluginRequest) (*InitPluginResponse, error) // Updated catalogue. This will be sent when the core catalogue has been updated (probably by a plugin loading). UpdateCatalogue(context.Context, *Catalogue) (*emptypb.Empty, error) // Request to perform a comparison of some contents (matching request) CompareContents(context.Context, *CompareContentsRequest) (*CompareContentsResponse, error) // Request to configure/setup the interaction for later verification. Data returned will be persisted in the pact file. ConfigureInteraction(context.Context, *ConfigureInteractionRequest) (*ConfigureInteractionResponse, error) // Request to generate the content using any defined generators GenerateContent(context.Context, *GenerateContentRequest) (*GenerateContentResponse, error) // contains filtered or unexported methods }
PactPluginServer is the server API for PactPlugin service. All implementations must embed UnimplementedPactPluginServer for forward compatibility
type PluginConfiguration ¶
type PluginConfiguration struct { // Data to be persisted against the interaction InteractionConfiguration *structpb.Struct `protobuf:"bytes,1,opt,name=interactionConfiguration,proto3" json:"interactionConfiguration,omitempty"` // Data to be persisted in the Pact file metadata (Global data) PactConfiguration *structpb.Struct `protobuf:"bytes,2,opt,name=pactConfiguration,proto3" json:"pactConfiguration,omitempty"` // contains filtered or unexported fields }
Plugin configuration added to the pact file by the ConfigureInteraction step
func (*PluginConfiguration) Descriptor
deprecated
func (*PluginConfiguration) Descriptor() ([]byte, []int)
Deprecated: Use PluginConfiguration.ProtoReflect.Descriptor instead.
func (*PluginConfiguration) GetInteractionConfiguration ¶
func (x *PluginConfiguration) GetInteractionConfiguration() *structpb.Struct
func (*PluginConfiguration) GetPactConfiguration ¶
func (x *PluginConfiguration) GetPactConfiguration() *structpb.Struct
func (*PluginConfiguration) ProtoMessage ¶
func (*PluginConfiguration) ProtoMessage()
func (*PluginConfiguration) ProtoReflect ¶
func (x *PluginConfiguration) ProtoReflect() protoreflect.Message
func (*PluginConfiguration) Reset ¶
func (x *PluginConfiguration) Reset()
func (*PluginConfiguration) String ¶
func (x *PluginConfiguration) String() string
type Request ¶
type Request struct { Method string `json:"method"` Path string `json:"path"` Query string `json:"query,omitempty"` Headers map[string]string `json:"headers,omitempty"` Body interface{} `json:"body,omitempty"` }
Request is the sub-struct of Mismatch
type UnimplementedPactPluginServer ¶
type UnimplementedPactPluginServer struct { }
UnimplementedPactPluginServer must be embedded to have forward compatible implementations.
func (UnimplementedPactPluginServer) CompareContents ¶
func (UnimplementedPactPluginServer) CompareContents(context.Context, *CompareContentsRequest) (*CompareContentsResponse, error)
func (UnimplementedPactPluginServer) ConfigureInteraction ¶
func (UnimplementedPactPluginServer) ConfigureInteraction(context.Context, *ConfigureInteractionRequest) (*ConfigureInteractionResponse, error)
func (UnimplementedPactPluginServer) GenerateContent ¶
func (UnimplementedPactPluginServer) GenerateContent(context.Context, *GenerateContentRequest) (*GenerateContentResponse, error)
func (UnimplementedPactPluginServer) InitPlugin ¶
func (UnimplementedPactPluginServer) InitPlugin(context.Context, *InitPluginRequest) (*InitPluginResponse, error)
func (UnimplementedPactPluginServer) UpdateCatalogue ¶
type UnsafePactPluginServer ¶
type UnsafePactPluginServer interface {
// contains filtered or unexported methods
}
UnsafePactPluginServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to PactPluginServer will result in compilation errors.
type Verifier ¶
type Verifier struct {
// contains filtered or unexported fields
}