Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // ErrInvalidConfig indicates HTTP connector configuration is invalid. ErrInvalidConfig = xerror.InvalidInput(xerror.DataSource) // ErrInvalidCredentials indicates HTTP connector credentials are invalid. ErrInvalidCredentials = xerror.InvalidInput(xerror.DataSource) )
Functions ¶
func ValidateCredentials ¶
func ValidateCredentials(creds Credentials) error
ValidateCredentials keeps the service and runtime authentication boundary consistent.
Types ¶
type Config ¶
type Config struct {
BaseURL string `json:"base_url" validate:"required,url"`
HealthPath string `json:"health_path,omitempty"`
TimeoutSeconds int `json:"timeout_seconds,omitempty" validate:"omitempty,min=1,max=300"`
OpenAPIURL string `json:"openapi_url,omitempty" validate:"omitempty,url"`
OpenAPIFetchTimeoutSeconds int `json:"openapi_fetch_timeout_seconds,omitempty" validate:"omitempty,min=1,max=60"`
AllowPrivateHosts bool `json:"allow_private_hosts,omitempty"`
}
Config holds configuration for HTTP data source connectivity checks and schema introspection.
type Connector ¶
type Connector struct {
// contains filtered or unexported fields
}
Connector validates HTTP connectivity by sending a request to a configured endpoint.
func (*Connector) Execute ¶
func (c *Connector) Execute( ctx context.Context, queryData json.RawMessage, params map[string]types.TypedParam, limits ...types.ExecutionLimits, ) (*result.ExecutionResult, error)
Execute executes an HTTP request described by queryData with the provided parameters.
queryData must be a JSON object with at minimum "method" and "path" fields. params are injected into the query_params, headers, or body structure as specified in queryData.
func (*Connector) IntrospectSchema ¶
func (c *Connector) IntrospectSchema(ctx context.Context) (*HTTPSchema, error)
IntrospectSchema retrieves and parses the OpenAPI schema from the configured OpenAPIURL.
type Credentials ¶
type Credentials struct {
// OAuthDestination is an internal runtime binding emitted only by credentialssvc.
OAuthDestination string `json:"oauth_destination,omitempty"`
BearerToken string `json:"bearer_token,omitempty"`
Username string `json:"username,omitempty"`
Password string `json:"password,omitempty"`
APIKey string `json:"api_key,omitempty"`
APIKeyHeader string `json:"api_key_header,omitempty"`
SecretHeaders map[string]string `json:"secret_headers,omitempty"`
}
Credentials holds authentication settings for HTTP endpoints.
type HTTPSchema ¶
type HTTPSchema struct {
Operations []Operation `json:"operations"`
}
HTTPSchema represents the extracted schema from an OpenAPI specification.
type HTTPSchemaIntrospector ¶
type HTTPSchemaIntrospector interface {
IntrospectSchema(ctx context.Context) (*HTTPSchema, error)
}
HTTPSchemaIntrospector defines the interface for HTTP connector schema introspection.
type OpenAPIFormat ¶
type OpenAPIFormat string
OpenAPIFormat represents the format of an OpenAPI specification file.
const ( OpenAPIFormatJSON OpenAPIFormat = "json" OpenAPIFormatYAML OpenAPIFormat = "yaml" )
type Operation ¶
type Operation struct {
OperationID string `json:"operation_id"` // Unique identifier (e.g., "listUsers")
Path string `json:"path"` // API path (e.g., "/users")
Method string `json:"method"` // HTTP method (GET, POST, PUT, DELETE, PATCH)
Description string `json:"description"` // Human-readable description
Parameters json.RawMessage `json:"parameters,omitempty"` // Parameter schema (JSON)
RequestBody json.RawMessage `json:"request_body,omitempty"` // Request body schema (JSON)
Responses json.RawMessage `json:"responses,omitempty"` // Response schemas (JSON)
Draft json.RawMessage `json:"draft,omitempty"`
Diagnostics []string `json:"diagnostics,omitempty"`
}
Operation represents a single HTTP operation (endpoint) from an OpenAPI spec.