Documentation ¶
Index ¶
- Constants
- func NewLogger(app, level string) *logrus.Entry
- type Config
- func (c Config) FullSyncAlways() bool
- func (c Config) GetCompleteFieldKey(key FieldKey) string
- func (c Config) GetConfigFile() string
- func (c Config) GetConfigString(key string) string
- func (c Config) GetDaemonPeriod() time.Duration
- func (c Config) GetFieldID(key FieldKey) string
- func (c Config) GetFieldMapper() FieldMapper
- func (c Config) GetLogger() logrus.Entry
- func (c Config) GetProject() jira.Project
- func (c Config) GetProjectKey() string
- func (c Config) GetRepo() (string, string)
- func (c Config) GetSinceParam() time.Time
- func (c Config) GetTimeout() time.Duration
- func (c Config) IsBasicAuth() bool
- func (c Config) IsDaemon() bool
- func (c Config) IsDryRun() bool
- func (c *Config) LoadJIRAConfig(client jira.Client) error
- func (c *Config) SaveConfig() error
- func (c Config) SetJIRAToken(token *oauth1.Token)
- type DefaultFieldMapper
- type FieldKey
- type FieldMapper
- type JsonFieldMapper
- type TestFieldMapper
Constants ¶
const DateFormat = "2006-01-02T15:04:05-0700"
dateFormat is the format used for the `since` configuration parameter
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Config ¶
type Config struct {
// contains filtered or unexported fields
}
Config is the root configuration object the application creates.
func NewConfig ¶
NewConfig creates a new, immutable configuration object. This object holds the Viper configuration and the logger, and is validated. The JIRA configuration is not yet initialized.
func (Config) FullSyncAlways ¶
FullSyncAlways returns whether the application should rewrite the config file to set "since" to now or if it should always do a full sync from the given sync. Full sync is required for GitHubProjectBoard -> Jira State syncing. This is because moving a GitHub issue on the project board does not change the last updated time of the issue itself - only that of the project card.
func (Config) GetCompleteFieldKey ¶
GetCompleteFieldKey returns customfield_XXXXX, where XXXXX is the custom field ID (see GetFieldID).
func (Config) GetConfigFile ¶
GetConfigFile returns the file that Viper loaded the configuration from.
func (Config) GetConfigString ¶
GetConfigString returns a string value from the Viper configuration.
func (Config) GetDaemonPeriod ¶
GetDaemonPeriod returns the period on which the tool runs if in daemon mode.
func (Config) GetFieldID ¶
GetFieldID returns the customfield ID of a JIRA custom field.
func (Config) GetFieldMapper ¶
func (c Config) GetFieldMapper() FieldMapper
func (Config) GetProject ¶
func (c Config) GetProject() jira.Project
GetProject returns the JIRA project the user has configured.
func (Config) GetProjectKey ¶
GetProjectKey returns the JIRA key of the configured project.
func (Config) GetRepo ¶
GetRepo returns the user/org name and the repo name of the configured GitHub repository.
func (Config) GetSinceParam ¶
GetSinceParam returns the `since` configuration parameter, parsed as a time.Time.
func (Config) GetTimeout ¶
GetTimeout returns the configured timeout on all API calls, parsed as a time.Duration.
func (Config) IsBasicAuth ¶
IsBasicAuth is true if we're using HTTP Basic Authentication, and false if we're using OAuth.
func (Config) IsDryRun ¶
IsDryRun returns whether the application is running in dry-run mode or not.
func (*Config) LoadJIRAConfig ¶
LoadJIRAConfig loads the JIRA configuration (project key, custom field IDs) from a remote JIRA server.
func (*Config) SaveConfig ¶
SaveConfig updates the `since` parameter to now, then saves the configuration file.
func (Config) SetJIRAToken ¶
SetJIRAToken adds the JIRA OAuth tokens in the Viper configuration, ensuring that they are saved for future runs.
type DefaultFieldMapper ¶
type DefaultFieldMapper struct {
Config *Config
}
func (DefaultFieldMapper) GetFieldIDs ¶
func (m DefaultFieldMapper) GetFieldIDs(client jira.Client) (map[FieldKey]string, error)
func (DefaultFieldMapper) GetFieldValue ¶
func (m DefaultFieldMapper) GetFieldValue(jIssue *jira.Issue, fieldKey FieldKey) (interface{}, error)
Default Field Mapper
func (DefaultFieldMapper) MapFields ¶
func (m DefaultFieldMapper) MapFields(issue *models.ExtendedGithubIssue) (jira.IssueFields, error)
type FieldKey ¶
type FieldKey int
fieldKey is an enum-like type to represent the customfield ID keys
type FieldMapper ¶
type FieldMapper interface { MapFields(issue *models.ExtendedGithubIssue) (jira.IssueFields, error) GetFieldValue(jIssue *jira.Issue, fieldKey FieldKey) (interface{}, error) // getFieldIDs requests the metadata of every issue field in the JIRA // project, and saves the IDs of the custom fields used by issue-sync. GetFieldIDs(client jira.Client) (map[FieldKey]string, error) }
type JsonFieldMapper ¶
type JsonFieldMapper struct {
Config *Config
}
func (JsonFieldMapper) GetFieldIDs ¶
func (m JsonFieldMapper) GetFieldIDs(client jira.Client) (map[FieldKey]string, error)
func (JsonFieldMapper) GetFieldValue ¶
func (m JsonFieldMapper) GetFieldValue(jIssue *jira.Issue, fieldKey FieldKey) (interface{}, error)
Json Field Mapper
func (JsonFieldMapper) MapFields ¶
func (m JsonFieldMapper) MapFields(issue *models.ExtendedGithubIssue) (jira.IssueFields, error)
type TestFieldMapper ¶
type TestFieldMapper struct { HandleMapFields func(issue *models.ExtendedGithubIssue) (jira.IssueFields, error) HandleGetFieldValue func(jIssue *jira.Issue, fieldKey FieldKey) (interface{}, error) HandleGetFieldIDs func(client jira.Client) (map[FieldKey]string, error) }
func (TestFieldMapper) GetFieldIDs ¶
func (m TestFieldMapper) GetFieldIDs(client jira.Client) (map[FieldKey]string, error)
func (TestFieldMapper) GetFieldValue ¶
func (m TestFieldMapper) GetFieldValue(jIssue *jira.Issue, fieldKey FieldKey) (interface{}, error)
func (TestFieldMapper) MapFields ¶
func (m TestFieldMapper) MapFields(issue *models.ExtendedGithubIssue) (jira.IssueFields, error)