Documentation ¶
Index ¶
- func NewDestinationsHTTPHandler(destinationManager DestinationManager, config HandlerConfig) *handler
- func StartDestinationFetcherSyncJob(ctx context.Context, cfg SyncJobConfig, destinationSyncer DestinationSyncer) error
- type BundleRepo
- type Client
- type DestinationManager
- type DestinationRepo
- type DestinationResponse
- type DestinationService
- func (d *DestinationService) FetchDestinationsSensitiveData(ctx context.Context, tenantID string, destinationNames []string) ([]byte, error)
- func (d *DestinationService) GetSubscribedTenantIDs(ctx context.Context) ([]string, error)
- func (d *DestinationService) IsTenantSubscribed(ctx context.Context, tenantID string) (bool, error)
- func (d *DestinationService) SyncTenantDestinations(ctx context.Context, tenantID string) error
- type DestinationServiceAPIConfig
- type DestinationSyncer
- type FormationAssignmentRepository
- type HandlerConfig
- type LabelRepo
- type SyncJobConfig
- type TenantRepo
- type UUIDService
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewDestinationsHTTPHandler ¶
func NewDestinationsHTTPHandler(destinationManager DestinationManager, config HandlerConfig) *handler
NewDestinationsHTTPHandler returns a new HTTP handler, responsible for handling HTTP requests
func StartDestinationFetcherSyncJob ¶
func StartDestinationFetcherSyncJob(ctx context.Context, cfg SyncJobConfig, destinationSyncer DestinationSyncer) error
StartDestinationFetcherSyncJob starts destination sync job and blocks
Types ¶
type BundleRepo ¶
type BundleRepo interface { ListByDestination(ctx context.Context, tenantID string, destination model.DestinationInput) ([]*model.Bundle, error) ListByApplicationAndCorrelationIDs(ctx context.Context, tenantID, appID, correlationIDs string) ([]*model.Bundle, error) }
BundleRepo bundles repository
type Client ¶
Client destination client
func NewClient ¶
func NewClient(instanceConfig config.InstanceConfig, apiConfig DestinationServiceAPIConfig, subdomain string) (*Client, error)
NewClient returns new destination client
func (*Client) FetchDestinationSensitiveData ¶
func (c *Client) FetchDestinationSensitiveData(ctx context.Context, destinationName string) ([]byte, error)
FetchDestinationSensitiveData returns sensitive data of a destination
func (*Client) FetchTenantDestinationsPage ¶
func (c *Client) FetchTenantDestinationsPage(ctx context.Context, tenantID, page string) (*DestinationResponse, error)
FetchTenantDestinationsPage returns a page of destinations
type DestinationManager ¶
type DestinationManager interface { IsTenantSubscribed(ctx context.Context, tenantID string) (bool, error) GetSubscribedTenantIDs(ctx context.Context) ([]string, error) SyncTenantDestinations(ctx context.Context, tenantID string) error FetchDestinationsSensitiveData(ctx context.Context, tenantID string, destinationNames []string) ([]byte, error) }
DestinationManager missing godoc
type DestinationRepo ¶
type DestinationRepo interface { Upsert(ctx context.Context, in model.DestinationInput, id, tenantID, bundleID, revision string) error DeleteOld(ctx context.Context, latestRevision, tenantID string) error GetDestinationByNameAndTenant(ctx context.Context, destinationName, tenantID string) (*model.Destination, error) }
DestinationRepo destinations repository
type DestinationResponse ¶
type DestinationResponse struct {
// contains filtered or unexported fields
}
DestinationResponse paged response from destination service
type DestinationService ¶
type DestinationService struct { Transactioner persistence.Transactioner UUIDSvc UUIDService DestinationRepo DestinationRepo BundleRepo BundleRepo LabelRepo LabelRepo DestinationsConfig config.DestinationsConfig APIConfig DestinationServiceAPIConfig TenantRepo TenantRepo FormationAssignmentRepo FormationAssignmentRepository // contains filtered or unexported fields }
DestinationService missing godoc
func NewDestinationService ¶
func NewDestinationService(transactioner persistence.Transactioner, uuidSvc UUIDService, destinationRepo DestinationRepo, bundleRepo BundleRepo, labelRepo LabelRepo, destinationsConfig config.DestinationsConfig, apiConfig DestinationServiceAPIConfig, tenantRepo TenantRepo, formationAssignmentRepo FormationAssignmentRepository, selfRegDistinguishLabel string) *DestinationService
NewDestinationService creates new destination service
func (*DestinationService) FetchDestinationsSensitiveData ¶
func (d *DestinationService) FetchDestinationsSensitiveData(ctx context.Context, tenantID string, destinationNames []string) ([]byte, error)
FetchDestinationsSensitiveData returns sensitive data of destinations for a given tenant
func (*DestinationService) GetSubscribedTenantIDs ¶
func (d *DestinationService) GetSubscribedTenantIDs(ctx context.Context) ([]string, error)
GetSubscribedTenantIDs returns subscribed tenants
func (*DestinationService) IsTenantSubscribed ¶
IsTenantSubscribed returns true is tenant is subscribed and false if it's not
func (*DestinationService) SyncTenantDestinations ¶
func (d *DestinationService) SyncTenantDestinations(ctx context.Context, tenantID string) error
SyncTenantDestinations syncs destinations for a given tenant
type DestinationServiceAPIConfig ¶
type DestinationServiceAPIConfig struct { GoroutineLimit int64 `envconfig:"APP_DESTINATIONS_SENSITIVE_GOROUTINE_LIMIT,default=10"` RetryInterval time.Duration `envconfig:"APP_DESTINATIONS_RETRY_INTERVAL,default=100ms"` RetryAttempts uint `envconfig:"APP_DESTINATIONS_RETRY_ATTEMPTS,default=3"` EndpointGetTenantDestinations string `envconfig:"APP_ENDPOINT_GET_TENANT_DESTINATIONS,default=/destination-configuration/v1/subaccountDestinations"` EndpointFindDestination string `envconfig:"APP_ENDPOINT_FIND_DESTINATION,default=/destination-configuration/v1/destinations"` Timeout time.Duration `envconfig:"APP_DESTINATIONS_TIMEOUT,default=5s"` PageSize int `envconfig:"APP_DESTINATIONS_PAGE_SIZE,default=100"` PagingPageParam string `envconfig:"APP_DESTINATIONS_PAGE_PARAM,default=$page"` PagingSizeParam string `envconfig:"APP_DESTINATIONS_PAGE_SIZE_PARAM,default=$pageSize"` PagingCountParam string `envconfig:"APP_DESTINATIONS_PAGE_COUNT_PARAM,default=$pageCount"` PagingCountHeader string `envconfig:"APP_DESTINATIONS_PAGE_COUNT_HEADER,default=Page-Count"` SkipSSLVerify bool `envconfig:"APP_DESTINATIONS_SKIP_SSL_VERIFY,default=false"` OAuthTokenPath string `envconfig:"APP_DESTINATION_OAUTH_TOKEN_PATH,default=/oauth/token"` ResponseCorrelationIDHeader string `envconfig:"APP_DESTINATIONS_RESPONSE_CORRELATION_ID_HEADER,default=x-vcap-request-id"` }
DestinationServiceAPIConfig destination service api configuration
type DestinationSyncer ¶
type DestinationSyncer interface { SyncTenantDestinations(ctx context.Context, tenantID string) error GetSubscribedTenantIDs(ctx context.Context) ([]string, error) }
DestinationSyncer missing godoc
type FormationAssignmentRepository ¶
type FormationAssignmentRepository interface {
GetGlobalByID(ctx context.Context, id string) (*model.FormationAssignment, error)
}
FormationAssignmentRepository represents the Formation Assignment repository layer
type HandlerConfig ¶
type HandlerConfig struct { SyncDestinationsEndpoint string `envconfig:"APP_DESTINATIONS_SYNC_ENDPOINT,default=/v1/syncDestinations"` DestinationsSensitiveEndpoint string `envconfig:"APP_DESTINATIONS_SENSITIVE_DATA_ENDPOINT,default=/v1/destinations"` DestinationsQueryParameter string `envconfig:"APP_DESTINATIONS_SENSITIVE_DATA_QUERY_PARAM,default=name"` }
HandlerConfig destination handler configuration
type LabelRepo ¶
type LabelRepo interface { GetSubdomainLabelForSubscribedRuntime(ctx context.Context, tenantID string) (*model.Label, error) GetByKey(ctx context.Context, tenant string, objectType model.LabelableObject, objectID, key string) (*model.Label, error) }
LabelRepo labels repository
type SyncJobConfig ¶
type SyncJobConfig struct { ElectionCfg cronjob.ElectionConfig JobSchedulePeriod time.Duration TenantSyncTimeout time.Duration ParallelTenants int }
SyncJobConfig configuration for destination sync job
type TenantRepo ¶
type TenantRepo interface { ExistsSubscribed(ctx context.Context, id, selfDistinguishLabel string) (bool, error) ListBySubscribedRuntimesAndApplicationTemplates(ctx context.Context, selfRegDistinguishLabel string) ([]*model.BusinessTenantMapping, error) }
TenantRepo tenants repository
type UUIDService ¶
type UUIDService interface {
Generate() string
}
UUIDService service generating UUIDs