Documentation ¶
Index ¶
- Constants
- Variables
- func APIVersion() string
- func APIVersionSOAP() string
- func GetRemoteResource(orgId, channelId string) string
- func GetTokenUpdater(tok *oauth2.Token) common.OAuthOption
- type BoolString
- type BulkOperationMode
- type BulkOperationParams
- type BulkOperationResult
- type CalloutOptions
- type Connector
- func (c *Connector) BulkDelete(ctx context.Context, params BulkOperationParams) (*BulkOperationResult, error)
- func (c *Connector) BulkQuery(ctx context.Context, query string) (*GetJobInfoResult, error)
- func (c *Connector) BulkWrite(ctx context.Context, config BulkOperationParams) (*BulkOperationResult, error)
- func (c *Connector) Close() error
- func (c *Connector) CreateEventChannel(ctx context.Context, channel *EventChannel) (*EventChannel, error)
- func (c *Connector) CreateEventChannelMember(ctx context.Context, member *EventChannelMember) (*EventChannelMember, error)
- func (c *Connector) CreateEventRelayConfig(ctx context.Context, cfg *EventRelayConfig) (*EventRelayConfig, error)
- func (c *Connector) CreateMetadata(ctx context.Context, metadata *xmldom.Node, tok *oauth2.Token) (string, error)
- func (c *Connector) CreateNamedCredential(ctx context.Context, creds *NamedCredential) (*NamedCredential, error)
- func (c *Connector) GetBulkQueryInfo(ctx context.Context, jobId string) (*GetJobInfoResult, error)
- func (c *Connector) GetBulkQueryResults(ctx context.Context, jobId string) (*http.Response, error)
- func (c *Connector) GetJobInfo(ctx context.Context, jobId string) (*GetJobInfoResult, error)
- func (c *Connector) GetJobResults(ctx context.Context, jobId string) (*JobResults, error)
- func (c *Connector) GetOrganizationId(ctx context.Context) (string, error)
- func (c *Connector) GetSuccessfulJobResults(ctx context.Context, jobId string) (*http.Response, error)
- func (c *Connector) HTTPClient() *common.HTTPClient
- func (c *Connector) JSONHTTPClient() *common.JSONHTTPClient
- func (c *Connector) ListObjectMetadata(ctx context.Context, objectNames []string) (*common.ListObjectMetadataResult, error)
- func (c *Connector) Provider() providers.Provider
- func (c *Connector) Read(ctx context.Context, config common.ReadParams) (*common.ReadResult, error)
- func (c *Connector) RunEventRelay(ctx context.Context, cfg *EventRelayConfig) error
- func (c *Connector) String() string
- func (c *Connector) Write(ctx context.Context, config common.WriteParams) (*common.WriteResult, error)
- type Credential
- type EventChannel
- type EventChannelMember
- type EventChannelMemberMetadata
- type EventChannelMetadata
- type EventRelayConfig
- type EventRelayConfigMetadata
- type FailInfo
- type GetJobInfoResult
- type JobResults
- type NamedCredential
- type NamedCredentialMetadata
- type NamedCredentialParameter
- type NamedCredentialParameterType
- type Option
- type SFAPIResponseBody
- type ToolingApiBaseParams
Constants ¶
const ( Insert BulkOperationMode = "insert" Upsert BulkOperationMode = "upsert" Update BulkOperationMode = "update" Delete BulkOperationMode = "delete" JobStateAborted = "Aborted" JobStateFailed = "Failed" JobStateComplete = "JobComplete" JobStateInProgress = "InProgress" JobStateUploadComplete = "UploadComplete" )
const ( True string = "true" False string = "false" )
Variables ¶
var ( ErrKeyNotFound = errors.New("key not found") ErrUnknownNodeType = errors.New("unknown node type when parsing JSON") ErrInvalidType = errors.New("invalid type") ErrInvalidJobState = errors.New("invalid job state") ErrUnsupportedMode = errors.New("unsupported mode") ErrReadToByteFailed = errors.New("failed to read data to bytes") ErrUnsupportedOperation = errors.New("unsupported operation") )
var ( ErrNotArray = errors.New("records is not an array") ErrNotObject = errors.New("record isn't an object") ErrNoFields = errors.New("no fields specified") ErrNotString = errors.New("nextRecordsUrl isn't a string") ErrNotBool = errors.New("done isn't a boolean") ErrNotNumeric = errors.New("totalSize isn't numeric") ErrMissingWorkspace = errors.New("missing Salesforce workspace name") ErrMissingClient = errors.New("JSON http client not set") ErrCannotReadMetadata = errors.New("cannot read object metadata, it is possible you don't have the correct permissions set") // nolint:lll )
Functions ¶
func APIVersion ¶
func APIVersion() string
func APIVersionSOAP ¶
func APIVersionSOAP() string
func GetRemoteResource ¶
func GetTokenUpdater ¶
func GetTokenUpdater(tok *oauth2.Token) common.OAuthOption
Types ¶
type BoolString ¶
type BoolString string
type BulkOperationMode ¶
type BulkOperationMode string
type BulkOperationParams ¶
type BulkOperationParams struct { // The name of the object we are writing, e.g. "Account" ObjectName string // required // The name of a field on the object which is an External ID. Provided in the case of upserts, not inserts ExternalIdField string // required // The path to the CSV file we are writing CSVData io.Reader // required // Salesforce operation mode Mode BulkOperationMode }
BulkOperationParams defines how we are writing data to a SaaS API.
type BulkOperationResult ¶
type BulkOperationResult struct { // State is the state of the bulk job process State string `json:"state"` // JobId is the ID of the bulk job process JobId string `json:"jobId"` }
BulkOperation is what's returned from writing data via the BulkOperation call.
type CalloutOptions ¶
type Connector ¶
type Connector struct { Domain string BaseURL string Client *common.JSONHTTPClient }
Connector is a Salesforce connector.
func NewConnector ¶
NewConnector returns a new Salesforce connector.
func (*Connector) BulkDelete ¶
func (c *Connector) BulkDelete(ctx context.Context, params BulkOperationParams) (*BulkOperationResult, error)
func (*Connector) BulkWrite ¶
func (c *Connector) BulkWrite( ctx context.Context, config BulkOperationParams, ) (*BulkOperationResult, error)
func (*Connector) CreateEventChannel ¶
func (c *Connector) CreateEventChannel(ctx context.Context, channel *EventChannel) (*EventChannel, error)
func (*Connector) CreateEventChannelMember ¶
func (c *Connector) CreateEventChannelMember( ctx context.Context, member *EventChannelMember, ) (*EventChannelMember, error)
func (*Connector) CreateEventRelayConfig ¶
func (c *Connector) CreateEventRelayConfig( ctx context.Context, cfg *EventRelayConfig, ) (*EventRelayConfig, error)
func (*Connector) CreateMetadata ¶
func (*Connector) CreateNamedCredential ¶
func (c *Connector) CreateNamedCredential(ctx context.Context, creds *NamedCredential) (*NamedCredential, error)
func (*Connector) GetBulkQueryInfo ¶
func (*Connector) GetBulkQueryResults ¶
func (*Connector) GetJobInfo ¶
func (*Connector) GetJobResults ¶
func (*Connector) GetOrganizationId ¶
func (*Connector) GetSuccessfulJobResults ¶
func (*Connector) HTTPClient ¶
func (c *Connector) HTTPClient() *common.HTTPClient
func (*Connector) JSONHTTPClient ¶
func (c *Connector) JSONHTTPClient() *common.JSONHTTPClient
JSONHTTPClient returns the underlying JSON HTTP client.
func (*Connector) ListObjectMetadata ¶
func (c *Connector) ListObjectMetadata( ctx context.Context, objectNames []string, ) (*common.ListObjectMetadataResult, error)
ListObjectMetadata returns object metadata for each object name provided.
func (*Connector) Read ¶
func (c *Connector) Read(ctx context.Context, config common.ReadParams) (*common.ReadResult, error)
Read reads data from Salesforce. By default it will read all rows (backfill). However, if Since is set, it will read only rows that have been updated since the specified time.
func (*Connector) RunEventRelay ¶
func (c *Connector) RunEventRelay(ctx context.Context, cfg *EventRelayConfig) error
func (*Connector) String ¶
String returns a string representation of the connector, which is useful for logging / debugging.
func (*Connector) Write ¶
func (c *Connector) Write(ctx context.Context, config common.WriteParams) (*common.WriteResult, error)
Write will write data to Salesforce.
type Credential ¶
type Credential interface {
DestinationResourceName() string
}
type EventChannel ¶
type EventChannel struct { Id string `json:"Id,omitempty"` FullName string `json:"FullName"` Metadata *EventChannelMetadata `json:"Metadata"` }
nolint:tagliatelle
type EventChannelMember ¶
type EventChannelMember struct { Id string `json:"Id,omitempty"` FullName string `json:"FullName"` Metadata *EventChannelMemberMetadata `json:"Metadata"` }
nolint:tagliatelle
type EventChannelMetadata ¶
type EventRelayConfig ¶
type EventRelayConfig struct { Id string `json:"Id,omitempty"` FullName string `json:"FullName,omitempty"` Metadata *EventRelayConfigMetadata `json:"Metadata,omitempty"` DeveloperName string `json:"DeveloperName,omitempty"` DestinationResourceName string `json:"DestinationResourceName,omitempty"` EventChannel string `json:"EventChannel,omitempty"` }
nolint:tagliatelle
type GetJobInfoResult ¶
type GetJobInfoResult struct { Id string `json:"id"` Object string `json:"object"` CreatedById string `json:"createdById"` ExternalIdFieldName string `json:"externalIdFieldName,omitempty"` State string `json:"state"` Operation string `json:"operation"` ColumnDelimiter string `json:"columnDelimiter"` LineEnding string `json:"lineEnding"` NumberRecordsFailed float64 `json:"numberRecordsFailed"` NumberRecordsProcessed float64 `json:"numberRecordsProcessed"` ErrorMessage string `json:"errorMessage"` ApexProcessingTime float64 `json:"apexProcessingTime,omitempty"` ApiActiveProcessingTime float64 `json:"apiActiveProcessingTime,omitempty"` ApiVersion float64 `json:"apiVersion,omitempty"` ConcurrencyMode string `json:"concurrencyMode,omitempty"` ContentType string `json:"contentType,omitempty"` CreatedDate string `json:"createdDate,omitempty"` JobType string `json:"jobType,omitempty"` Retries float64 `json:"retries,omitempty"` SystemModstamp string `json:"systemModstamp,omitempty"` TotalProcessingTime float64 `json:"totalProcessingTime,omitempty"` IsPkChunkingSupported bool `json:"isPkChunkingSupported,omitempty"` }
type JobResults ¶
type JobResults struct { JobId string `json:"jobId"` State string `json:"state"` FailureDetails *FailInfo `json:"failureDetails,omitempty"` JobInfo *GetJobInfoResult `json:"jobInfo,omitempty"` Message string `json:"message,omitempty"` }
type NamedCredential ¶
type NamedCredential struct { FullName string `json:"FullName"` Metadata *NamedCredentialMetadata `json:"Metadata"` // below exist in response, but not in request Id string `json:"Id,omitempty"` }
nolint:tagliatelle
func (*NamedCredential) DestinationResourceName ¶
func (n *NamedCredential) DestinationResourceName() string
type NamedCredentialMetadata ¶
type NamedCredentialMetadata struct { AllowMergeFieldsInBody bool `json:"allowMergeFieldsInBody,omitempty"` AllowMergeFieldsInHeader bool `json:"allowMergeFieldsInHeader,omitempty"` GenerateAuthorizationHeader bool `json:"generateAuthorizationHeader,omitempty"` FullName string `json:"fullName,omitempty" validate:"required"` Label string `json:"label,omitempty"` NamedCredentialParameters []*NamedCredentialParameter `json:"namedCredentialParameters,omitempty"` NamedCredentialType string `json:"namedCredentialType,omitempty"` // Below are deprecated fields, but still in use in SF AuthProvider string `json:"authProvider,omitempty"` AuthTokenEndpointUrl string `json:"authTokenEndpointUrl,omitempty"` // nolint: revive AwsAccessKey string `json:"awsAccessKey,omitempty"` AwsAccessSecret string `json:"awsAccessSecret,omitempty"` AwsRegion string `json:"awsRegion,omitempty"` AwsService string `json:"awsService,omitempty"` Certificate string `json:"certificate,omitempty"` Endpoint string `json:"endpoint,omitempty"` JwtAudience string `json:"jwtAudience,omitempty"` JwtFormulaSubject string `json:"jwtFormulaSubject,omitempty"` JwtIssuer string `json:"jwtIssuer,omitempty"` JwtSigningCertificate string `json:"jwtSigningCertificate,omitempty"` JwtTextSubject string `json:"jwtTextSubject,omitempty"` JwtValidityPeriodSeconds int `json:"jwtValidityPeriodSeconds,omitempty"` OauthRefreshToken string `json:"oauthRefreshToken,omitempty"` OauthScope string `json:"oauthScope,omitempty"` OauthToken string `json:"oauthToken,omitempty"` Password string `json:"password,omitempty"` PrincipalType string `json:"principalType,omitempty"` Protocol string `json:"protocol,omitempty"` Username string `json:"username,omitempty"` }
nolint: lll
type NamedCredentialParameter ¶
type NamedCredentialParameter struct { Certificate string `json:"certificate"` Description string `json:"description"` ExternalCredential string `json:"externalCredential"` OutboundNetworkConnection string `json:"outboundNetworkConnection"` ParameterName string `json:"parameterName"` ParameterType string `json:"parameterType"` ParameterValue string `json:"parameterValue"` SequenceNumber int `json:"sequenceNumber"` }
type NamedCredentialParameterType ¶
type NamedCredentialParameterType string
const ( AllowedManagedPackageNamespaces NamedCredentialParameterType = "AllowedManagedPackageNamespaces" ClientCertificate NamedCredentialParameterType = "ClientCertificate" HttpHeader NamedCredentialParameterType = "HttpHeader" OutboundNetworkConnection NamedCredentialParameterType = "OutboundNetworkConnection" Url NamedCredentialParameterType = "Url" )
nolint: revive
type Option ¶
type Option func(params *sfParams)
Option is a function which mutates the salesforce connector configuration.
func WithAuthenticatedClient ¶
func WithAuthenticatedClient(client common.AuthenticatedHTTPClient) Option
WithAuthenticatedClient sets the http client to use for the connector. Its usage is optional.
func WithClient ¶
func WithClient(ctx context.Context, client *http.Client, config *oauth2.Config, token *oauth2.Token, opts ...common.OAuthOption, ) Option
WithClient sets the http client to use for the connector. Saves some boilerplate.
func WithWorkspace ¶
WithWorkspace sets the salesforce workspace to use for the connector. It's required.
type SFAPIResponseBody ¶
type ToolingApiBaseParams ¶
type ToolingApiBaseParams struct { DeveloperName string `json:"DeveloperName,omitempty"` Language string `json:"Language,omitempty"` ManageableState string `json:"ManageableState,omitempty"` MasterLabel string `json:"MasterLabel,omitempty"` NamespacePrefix string `json:"NamespacePrefix,omitempty"` }
nolint: tagliatelle