package serviceadapter import ( "time" ) // Upstream defines an upstream target. type Upstream struct { URL string `json:"url" yaml:"url"` TimeoutSeconds int32 `json:"timeoutSeconds" yaml:"timeoutSeconds"` } // Auth defines authentication requirements. type Auth struct { Required bool `json:"required" yaml:"required"` Capability string `json:"capability,omitempty" yaml:"capability,omitempty"` } // Method defines an HTTP method endpoint. type Method struct { Verb string `json:"verb" yaml:"verb"` UpstreamPath string `json:"upstreamPath" yaml:"upstreamPath"` RequestSchema string `json:"requestSchema,omitempty" yaml:"requestSchema,omitempty"` ResponseSchema string `json:"responseSchema,omitempty" yaml:"responseSchema,omitempty"` Auth *Auth `json:"auth,omitempty" yaml:"auth,omitempty"` } // Resource defines a resource with multiple methods. type Resource struct { Name string `json:"name" yaml:"name"` Methods []Method `json:"methods" yaml:"methods"` Auth *Auth `json:"auth,omitempty" yaml:"auth,omitempty"` } // Spec is the ServiceAdapter spec. type Spec struct { ServiceName string `json:"serviceName" yaml:"serviceName"` Upstream Upstream `json:"upstream" yaml:"upstream"` Auth Auth `json:"auth" yaml:"auth"` Retryable bool `json:"retryable,omitempty" yaml:"retryable,omitempty"` Resources []Resource `json:"resources" yaml:"resources"` } // Status is the ServiceAdapter status. type Status struct { Ready bool `json:"ready,omitempty"` Error string `json:"error,omitempty"` LastSyncTime *time.Time `json:"lastSyncTime,omitempty"` } // ServiceAdapter is a gateway service adapter. type ServiceAdapter struct { Name string // namespace/name Namespace string ServiceName string Spec Spec Status Status CreatedAt time.Time }