Пример #1
0
 def get_config(self, project, **kwargs):
     return [
         {
             "name": "queue_url",
             "label": "Queue URL",
             "type": "url",
             "placeholder": "https://sqs-us-east-1.amazonaws.com/12345678/myqueue",
         },
         {
             "name": "region",
             "label": "Region",
             "type": "select",
             "choices": tuple((z, z) for z in get_regions()),
         },
         get_secret_field_config(
             name="access_key", label="Access Key", secret=self.get_option("access_key", project)
         ),
         get_secret_field_config(
             name="secret_key", label="Secret Key", secret=self.get_option("secret_key", project)
         ),
         {
             "name": "message_group_id",
             "label": "Message Group ID",
             "type": "text",
             "required": False,
             "placeholder": "Required for FIFO queues, exclude for standard queues",
         },
     ]
Пример #2
0
 def get_config(self, project, **kwargs):
     return [
         {
             'name': 'queue_url',
             'label': 'Queue URL',
             'type': 'url',
             'placeholder': 'https://sqs-us-east-1.amazonaws.com/12345678/myqueue',
         },
         {
             'name': 'region',
             'label': 'Region',
             'type': 'select',
             'choices': tuple((z, z) for z in get_regions()),
         },
         get_secret_field_config(
             name='access_key',
             label='Access Key',
             secret=self.get_option('access_key', project),
         ),
         get_secret_field_config(
             name='secret_key',
             label='Secret Key',
             secret=self.get_option('secret_key', project),
         ),
     ]
Пример #3
0
 def get_config(self, project, **kwargs):
     return [
         {
             'name': 'queue_url',
             'label': 'Queue URL',
             'type': 'url',
             'placeholder': 'https://sqs-us-east-1.amazonaws.com/12345678/myqueue',
         },
         {
             'name': 'region',
             'label': 'Region',
             'type': 'select',
             'choices': tuple((z, z) for z in get_regions()),
         },
         get_secret_field_config(
             name='access_key',
             label='Access Key',
             secret=self.get_option('access_key', project),
         ),
         get_secret_field_config(
             name='secret_key',
             label='Secret Key',
             secret=self.get_option('secret_key', project),
         ),
     ]
Пример #4
0
    def get_config(self, **kwargs):
        userkey = self.get_option("userkey", kwargs["project"])
        apikey = self.get_option("apikey", kwargs["project"])

        userkey_field = get_secret_field_config(
            userkey, "Your user key. See https://pushover.net/", include_prefix=True
        )
        userkey_field.update({"name": "userkey", "label": "User Key"})

        apikey_field = get_secret_field_config(
            apikey, "Application API token. See https://pushover.net/apps/", include_prefix=True
        )

        apikey_field.update({"name": "apikey", "label": "API Key"})

        return [
            userkey_field,
            apikey_field,
            {
                "name": "priority",
                "label": "Message Priority",
                "type": "choice",
                "required": True,
                "choices": [
                    ("-2", "Lowest"),
                    ("-1", "Low"),
                    ("0", "Normal"),
                    ("1", "High"),
                    ("2", "Emergency"),
                ],
                "default": "0",
            },
            {
                "name": "retry",
                "label": "Retry",
                "type": "number",
                "required": False,
                "placeholder": "e.g. 30",
                "help": 'How often (in seconds) you will receive the same notification. Minimum of 30 seconds. Only required for "Emergency" level priority.',
            },
            {
                "name": "expire",
                "label": "Expire",
                "type": "number",
                "required": False,
                "placeholder": "e.g. 9000",
                "help": 'How many seconds your notification will continue to be retried for. Maximum of 10800 seconds. Only required for "Emergency" level priority.',
            },
        ]
Пример #5
0
 def get_config(self, project, **kwargs):
     return [{
         'name': 'instance',
         'label': 'Instance URL',
         'type': 'url',
         'required': True,
         'help': 'The URL to your HEC Splunk instance.',
         'placeholder': 'e.g. https://my-splunk.example.com:8088',
     }, {
         'name': 'index',
         'label': 'Index',
         'type': 'string',
         'required': True,
         'default': 'main',
     }, {
         'name': 'source',
         'label': 'Source',
         'type': 'string',
         'required': True,
         'default': 'sentry',
     },
             get_secret_field_config(
                 name='token',
                 label='Token',
                 secret=self.get_option('token', project),
             )]
Пример #6
0
 def get_configure_plugin_fields(self, request, project, **kwargs):
     token = self.get_option('token', project)
     helptext = ('Enter your API Token (found on '
                 '<a href="https://www.pivotaltracker.com/profile"'
                 '>pivotaltracker.com/profile</a>).')
     secret_field = get_secret_field_config(token,
                                            helptext,
                                            include_prefix=True)
     secret_field.update({
         'name':
         'token',
         'label':
         'API Token',
         'placeholder':
         'e.g. a9877d72b6d13b23410a7109b35e88bc'
     })
     return [
         secret_field, {
             'name': 'project',
             'label': 'Project ID',
             'default': self.get_option('project', project),
             'type': 'text',
             'placeholder': 'e.g. 639281',
             'help': 'Enter your project\'s numerical ID.'
         }
     ]
Пример #7
0
 def get_configure_plugin_fields(self, request, project, **kwargs):
     token = self.get_option('token', project)
     helptext = (
         'Enter your API Token (found on '
         '<a href="https://www.pivotaltracker.com/profile"'
         '>pivotaltracker.com/profile</a>).'
     )
     secret_field = get_secret_field_config(token, helptext, include_prefix=True)
     secret_field.update(
         {
             'name': 'token',
             'label': 'API Token',
             'placeholder': 'e.g. a9877d72b6d13b23410a7109b35e88bc'
         }
     )
     return [
         secret_field, {
             'name': 'project',
             'label': 'Project ID',
             'default': self.get_option('project', project),
             'type': 'text',
             'placeholder': 'e.g. 639281',
             'help': 'Enter your project\'s numerical ID.'
         }
     ]
Пример #8
0
 def get_configure_plugin_fields(self, request, project, **kwargs):
     token = self.get_option("token", project)
     helptext = "Enter your API Token (found on " "your account Settings, under API Tokens)."
     secret_field = get_secret_field_config(token,
                                            helptext,
                                            include_prefix=True)
     secret_field.update({
         "name":
         "token",
         "label":
         "API Token",
         "placeholder":
         "e.g. 12345678-1234-1234-1234-1234567890AB",
     })
     return [
         secret_field,
         {
             "name": "project",
             "label": "Project ID",
             "default": self.get_option("project", project),
             "type": "text",
             "placeholder": "e.g. 639281",
             "help": "Enter your project's numerical ID.",
         },
     ]
Пример #9
0
 def get_config(self, project, **kwargs):
     return [
         {
             "name": "instance",
             "label": "Instance URL",
             "type": "url",
             "required": True,
             "help":
             "The HTTP Event Collector endpoint for your Splunk instance.",
             "placeholder": "e.g. https://input-foo.cloud.splunk.com:8088",
         },
         {
             "name": "index",
             "label": "Index",
             "type": "string",
             "required": True,
             "default": "main",
         },
         {
             "name": "source",
             "label": "Source",
             "type": "string",
             "required": True,
             "default": "sentry",
         },
         get_secret_field_config(name="token",
                                 label="Token",
                                 secret=self.get_option("token", project)),
     ]
Пример #10
0
    def get_configure_plugin_fields(self, request: Request, project, **kwargs):
        token = self.get_option("token", project)
        helptext = "You may generate a Conduit API Token from your account settings in Phabricator."
        secret_field = get_secret_field_config(token, helptext, include_prefix=True)
        secret_field.update({"name": "token", "label": "Token", "required": False})

        return [
            {
                "name": "host",
                "label": "Host",
                "type": "text",
                "placeholder": "e.g. http://secure.phabricator.org",
                "required": True,
            },
            secret_field,
            {
                "name": "username",
                "label": "Username",
                "type": "text",
                "help": "For token-based authentication you do not need to fill in username.",
                "required": False,
            },
            {
                "name": "certificate",
                "label": "Certificate",
                "type": "textarea",
                "help": "For token-based authentication you do not need to fill in certificate.",
                "required": False,
            },
        ]
Пример #11
0
 def get_configure_plugin_fields(self, request, project, **kwargs):
     token = self.get_option("token", project)
     helptext = ("Enter your API Token (found on "
                 '<a href="https://www.pivotaltracker.com/profile"'
                 ">pivotaltracker.com/profile</a>).")
     secret_field = get_secret_field_config(token,
                                            helptext,
                                            include_prefix=True)
     secret_field.update({
         "name":
         "token",
         "label":
         "API Token",
         "placeholder":
         "e.g. a9877d72b6d13b23410a7109b35e88bc",
     })
     return [
         secret_field,
         {
             "name": "project",
             "label": "Project ID",
             "default": self.get_option("project", project),
             "type": "text",
             "placeholder": "e.g. 639281",
             "help": "Enter your project's numerical ID.",
         },
     ]
Пример #12
0
 def get_configure_plugin_fields(self, request, project, **kwargs):
     token = self.get_option('token', project)
     helptext = ('Enter your API Token (found on '
                 'your account Settings, under API Tokens).')
     secret_field = get_secret_field_config(token,
                                            helptext,
                                            include_prefix=True)
     secret_field.update({
         'name':
         'token',
         'label':
         'API Token',
         'placeholder':
         'e.g. 12345678-1234-1234-1234-1234567890AB'
     })
     return [
         secret_field, {
             'name': 'project',
             'label': 'Project ID',
             'default': self.get_option('project', project),
             'type': 'text',
             'placeholder': 'e.g. 639281',
             'help': 'Enter your project\'s numerical ID.'
         }
     ]
Пример #13
0
 def get_config(self, project, **kwargs):
     return [{
         'name': 'instance',
         'label': 'Instance URL',
         'type': 'url',
         'required': True,
         'help': 'The HTTP Event Collector endpoint for your Splunk instance.',
         'placeholder': 'e.g. https://input-foo.cloud.splunk.com:8088',
     }, {
         'name': 'index',
         'label': 'Index',
         'type': 'string',
         'required': True,
         'default': 'main',
     }, {
         'name': 'source',
         'label': 'Source',
         'type': 'string',
         'required': True,
         'default': 'sentry',
     }, get_secret_field_config(
         name='token',
         label='Token',
         secret=self.get_option('token', project),
     )]
Пример #14
0
    def get_configure_plugin_fields(self, request, project, **kwargs):
        token = self.get_option('token', project)
        helptext = (
            'You may generate a Conduit API Token from your account settings in Phabricator.'
        )
        secret_field = get_secret_field_config(token, helptext, include_prefix=True)
        secret_field.update({
            'name': 'token',
            'label': 'Token',
            'required': False,
        })

        return [{
            'name': 'host',
            'label': 'Host',
            'type': 'text',
            'placeholder': 'e.g. http://secure.phabricator.org',
            'required': True,
        }, secret_field, {
            'name': 'username',
            'label': 'Username',
            'type': 'text',
            'help': 'For token-based authentication you do not need to fill in username.',
            'required': False,
        }, {
            'name': 'certificate',
            'label': 'Certificate',
            'type': 'textarea',
            'help': 'For token-based authentication you do not need to fill in certificate.',
            'required': False,
        }]
Пример #15
0
 def get_config(self, **kwargs):
     service_key = self.get_option("service_key", kwargs["project"])
     secret_field = get_secret_field_config(
         service_key,
         "PagerDuty's Sentry service Integration Key",
         include_prefix=True)
     secret_field.update({"name": "service_key", "label": "Service Key"})
     return [
         secret_field,
         {
             "name":
             "routes",
             "label":
             "Tag routing",
             "type":
             "textarea",
             "placeholder":
             "environment,production,KEY1\ndevice,Other,KEY2",
             "required":
             False,
             "help":
             ("Route each event to a different PagerDuty service key based "
              "on the event's tags. Each line should contain a tag, "
              "value, and service key separated by commas. The first "
              "line that matches a tag's key and value will send to that "
              "integration key instead of the main service key above."),
         },
     ]
Пример #16
0
 def get_config(self, **kwargs):
     service_key = self.get_option('service_key', kwargs['project'])
     secret_field = get_secret_field_config(
         service_key,
         'PagerDuty\'s Sentry service Integration Key',
         include_prefix=True)
     secret_field.update({'name': 'service_key', 'label': 'Service Key'})
     return [
         secret_field,
         {
             'name':
             'routes',
             'label':
             'Tag routing',
             'type':
             'textarea',
             'placeholder':
             'environment,production,KEY1\ndevice,Other,KEY2',
             'required':
             False,
             'help':
             ('Route each event to a different PagerDuty service key based '
              'on the event\'s tags. Each line should contain a tag, '
              'value, and service key separated by commas. The first '
              'line that matches a tag\'s key and value will send to that '
              'integration key instead of the main service key above.')
         },
     ]
Пример #17
0
 def get_config(self, **kwargs):
     service_key = self.get_option('service_key', kwargs['project'])
     secret_field = get_secret_field_config(
         service_key,
         'PagerDuty\'s Sentry service Integration Key',
         include_prefix=True)
     secret_field.update({'name': 'service_key', 'label': 'Service Key'})
     return [secret_field]
Пример #18
0
    def get_config(self, **kwargs):
        userkey = self.get_option('userkey', kwargs['project'])
        apikey = self.get_option('apikey', kwargs['project'])

        userkey_field = get_secret_field_config(
            userkey, 'Your user key. See https://pushover.net/', include_prefix=True
        )
        userkey_field.update({'name': 'userkey', 'label': 'User Key'})

        apikey_field = get_secret_field_config(
            apikey, 'Application API token. See https://pushover.net/apps/', include_prefix=True
        )

        apikey_field.update({'name': 'apikey', 'label': 'API Key'})

        return [
            userkey_field, apikey_field, {
                'name': 'priority',
                'label': 'Message Priority',
                'type': 'choice',
                'required': True,
                'choices': [
                    ('-2', 'Lowest'),
                    ('-1', 'Low'),
                    ('0', 'Normal'),
                    ('1', 'High'),
                    ('2', 'Emergency'),
                ],
                'default': '0',
            }, {
                'name': 'retry',
                'label': 'Retry',
                'type': 'number',
                'required': False,
                'placeholder': 'e.g. 30',
                'help': 'How often (in seconds) you will receive the same notification. Minimum of 30 seconds. Only required for "Emergency" level priority.'
            }, {
                'name': 'expire',
                'label': 'Expire',
                'type': 'number',
                'required': False,
                'placeholder': 'e.g. 9000',
                'help': 'How many seconds your notification will continue to be retried for. Maximum of 10800 seconds. Only required for "Emergency" level priority.'
            },
        ]
Пример #19
0
 def get_config(self, project, **kwargs):
     return [
         get_secret_field_config(
             name='write_key',
             label='Write Key',
             secret=self.get_option('write_key', project),
             help_text='Your Segment write key',
         ),
     ]
Пример #20
0
 def get_config(self, project, **kwargs):
     return [
         get_secret_field_config(
             name='write_key',
             label='Write Key',
             secret=self.get_option('write_key', project),
             help_text='Your Segment write key',
         ),
     ]
Пример #21
0
 def get_config(self, project, **kwargs):
     return [
         {
             "name":
             "queue_url",
             "label":
             "Queue URL",
             "type":
             "url",
             "placeholder":
             "https://sqs-us-east-1.amazonaws.com/12345678/myqueue",
         },
         {
             "name": "region",
             "label": "Region",
             "type": "select",
             "choices": tuple((z, z) for z in get_regions()),
         },
         {
             "name": "access_key",
             "label": "Access Key",
             "type": "text",
             "placeholder": "Access Key",
         },
         get_secret_field_config(name="secret_key",
                                 label="Secret Key",
                                 secret=self.get_option(
                                     "secret_key", project)),
         {
             "name":
             "message_group_id",
             "label":
             "Message Group ID",
             "type":
             "text",
             "required":
             False,
             "placeholder":
             "Required for FIFO queues, exclude for standard queues",
         },
         {
             "name":
             "s3_bucket",
             "label":
             "S3 Bucket",
             "type":
             "text",
             "required":
             False,
             "placeholder":
             "s3-bucket",
             "help":
             ("Specify a bucket to store events in S3. The SQS message will contain a reference"
              " to the payload location in S3. If no S3 bucket is provided, events over the SQS"
              " limit of 256KB will not be forwarded."),
         },
     ]
Пример #22
0
 def get_config(self, project, **kwargs):
     return [
         get_secret_field_config(
             name="write_key",
             label="Write Key",
             secret=self.get_option("write_key", project),
             help_text="Your Segment write key",
         )
     ]
Пример #23
0
    def get_config(self, **kwargs):
        userkey = self.get_option('userkey', kwargs['project'])
        apikey = self.get_option('apikey', kwargs['project'])
        userkey_field = get_secret_field_config(
            userkey,
            'Your user key. See https://pushover.net/',
            include_prefix=True)
        userkey_field.update({'name': 'userkey', 'label': 'User Key'})

        apikey_field = get_secret_field_config(
            apikey,
            'Application API token. See https://pushover.net/apps/',
            include_prefix=True)

        apikey_field.update({'name': 'apikey', 'label': 'API Key'})
        return [
            userkey_field, apikey_field, {
                'name':
                'priority',
                'label':
                'Message Priority',
                'type':
                'choice',
                'required':
                True,
                'choices': [
                    ('-2', 'Lowest'),
                    ('-1', 'Low'),
                    ('0', 'Normal'),
                    ('1', 'High'),
                    ('2', 'Emergency'),
                ],
                'default':
                '0',
            }
        ]
Пример #24
0
 def get_config(self, **kwargs):
     return [
         get_secret_field_config(
             name='api_key',
             label='API Key',
             secret=self.get_option('api_key', kwargs['project']),
             help_text='VictorOps\'s Sentry API Key',
             include_prefix=True,
         ), {
             'name': 'routing_key',
             'label': 'Routing Key',
             'type': 'string',
             'default': 'everyone',
             'required': False,
         }
     ]
Пример #25
0
 def get_config(self, **kwargs):
     return [
         get_secret_field_config(
             name="api_key",
             label="API Key",
             secret=self.get_option("api_key", kwargs["project"]),
             help_text="VictorOps's Sentry API Key",
             include_prefix=True,
         ),
         {
             "name": "routing_key",
             "label": "Routing Key",
             "type": "string",
             "default": "everyone",
             "required": False,
         },
     ]
Пример #26
0
    def get_config(self, *args, **kwargs):
        """
        Called by the web process when user wants to configure the plugin.
        """
        project = kwargs['project']
        pw = self.get_option('password', project)
        secret_field = get_secret_field_config(pw, '')
        secret_field.update({'name': 'password', 'label': 'Password'})

        return [{
            'name': 'zendesk_url',
            'label': 'Zendesk URL',
            'default': self.get_option('zendesk_url', project),
            'type': 'text',
            'placeholder': 'e.g. "https://mycompany.zendesk.com"',
            'help': 'It must be visible to the Sentry server'
        }, {
            'name': 'username',
            'label': 'Username',
            'default': self.get_option('username', project),
            'type': 'text',
            'help': 'Ensure the Zendesk user has admin permissions on the '
                    'project'
        }, secret_field, {
            'name': 'auto_create_problems',
            'label': 'Automatically create Zendesk problems',
            'default': self.get_option('auto_create_problems', project) or False,  # noqa
            'type': 'bool',
            'required': False,
            'help': 'Automatically create a Zendesk ticket of type problem '
                    'for EVERY new issue'
        }, {
            'name': 'auto_create_incidents',
            'label': 'Automatically create Zendesk incidents',
            'default': self.get_option('auto_create_incidents', project) or False,  # noqa
            'type': 'bool',
            'required': False,
            'help': 'Automatically create a Zendesk ticket of type incident ' \
                    'for EVERY event after the first one, linking it to the ' \
                    'previously created problem.'
        }]
Пример #27
0
    def get_configure_plugin_fields(self, request, project, **kwargs):
        gitlab_token = self.get_option("gitlab_token", project)
        secret_field = get_secret_field_config(
            gitlab_token, "Enter your GitLab API token.", include_prefix=True
        )
        secret_field.update(
            {
                "name": "gitlab_token",
                "label": "Access Token",
                "placeholder": "e.g. g5DWFtLzaztgYFrqhVfE",
            }
        )

        return [
            {
                "name": "gitlab_url",
                "label": "GitLab URL",
                "type": "url",
                "default": "https://gitlab.com",
                "placeholder": "e.g. https://gitlab.example.com",
                "required": True,
                "help": "Enter the URL for your GitLab server.",
            },
            secret_field,
            {
                "name": "gitlab_repo",
                "label": "Repository Name",
                "type": "text",
                "placeholder": "e.g. getsentry/sentry",
                "required": True,
                "help": "Enter your repository name, including the owner.",
            },
            {
                "name": "gitlab_labels",
                "label": "Issue Labels",
                "type": "text",
                "placeholder": "e.g. high, bug",
                "required": False,
                "help": "Enter the labels you want to auto assign to new issues.",
            },
        ]
Пример #28
0
    def get_configure_plugin_fields(self, request, project, **kwargs):
        gitlab_token = self.get_option('gitlab_token', project)
        secret_field = get_secret_field_config(gitlab_token,
                                               'Enter your GitLab API token.',
                                               include_prefix=True)
        secret_field.update({
            'name': 'gitlab_token',
            'label': 'Access Token',
            'placeholder': 'e.g. g5DWFtLzaztgYFrqhVfE'
        })

        return [{
            'name': 'gitlab_url',
            'label': 'GitLab URL',
            'type': 'url',
            'default': 'https://gitlab.com',
            'placeholder': 'e.g. https://gitlab.example.com',
            'required': True,
            'help': 'Enter the URL for your GitLab server.'
        }, secret_field, {
            'name': 'gitlab_repo',
            'label': 'Repository Name',
            'type': 'text',
            'placeholder': 'e.g. getsentry/sentry',
            'required': True,
            'help': 'Enter your repository name, including the owner.'
        }, {
            'name':
            'gitlab_labels',
            'label':
            'Issue Labels',
            'type':
            'text',
            'placeholder':
            'e.g. high, bug',
            'required':
            False,
            'help':
            'Enter the labels you want to auto assign to new issues.',
        }]
Пример #29
0
    def get_configure_plugin_fields(self, request, project, **kwargs):
        gitlab_token = self.get_option('gitlab_token', project)
        secret_field = get_secret_field_config(
            gitlab_token, 'Enter your GitLab API token.', include_prefix=True
        )
        secret_field.update(
            {
                'name': 'gitlab_token',
                'label': 'Access Token',
                'placeholder': 'e.g. g5DWFtLzaztgYFrqhVfE'
            }
        )

        return [
            {
                'name': 'gitlab_url',
                'label': 'GitLab URL',
                'type': 'url',
                'default': 'https://gitlab.com',
                'placeholder': 'e.g. https://gitlab.example.com',
                'required': True,
                'help': 'Enter the URL for your GitLab server.'
            }, secret_field, {
                'name': 'gitlab_repo',
                'label': 'Repository Name',
                'type': 'text',
                'placeholder': 'e.g. getsentry/sentry',
                'required': True,
                'help': 'Enter your repository name, including the owner.'
            }, {
                'name': 'gitlab_labels',
                'label': 'Issue Labels',
                'type': 'text',
                'placeholder': 'e.g. high, bug',
                'required': False,
                'help': 'Enter the labels you want to auto assign to new issues.',
            }
        ]
Пример #30
0
 def get_config(self, **kwargs):
     service_key = self.get_option('service_key', kwargs['project'])
     secret_field = get_secret_field_config(
         service_key, 'PagerDuty\'s Sentry service Integration Key', include_prefix=True
     )
     secret_field.update({'name': 'service_key', 'label': 'Service Key'})
     return [
         secret_field,
         {
             'name': 'routes',
             'label': 'Tag routing',
             'type': 'textarea',
             'placeholder': 'environment,production,KEY1\ndevice,Other,KEY2',
             'required': False,
             'help': (
                 'Route each event to a different PagerDuty service key based '
                 'on the event\'s tags. Each line should contain a tag, '
                 'value, and service key separated by commas. The first '
                 'line that matches a tag\'s key and value will send to that '
                 'integration key instead of the main service key above.'
             )
         },
     ]
Пример #31
0
 def get_configure_plugin_fields(self, request, project, **kwargs):
     token = self.get_option('token', project)
     helptext = (
         'Enter your API Token (found on '
         'your account Settings, under API Tokens).'
     )
     secret_field = get_secret_field_config(token, helptext, include_prefix=True)
     secret_field.update(
         {
             'name': 'token',
             'label': 'API Token',
             'placeholder': 'e.g. 12345678-1234-1234-1234-1234567890AB'
         }
     )
     return [
         secret_field, {
             'name': 'project',
             'label': 'Project ID',
             'default': self.get_option('project', project),
             'type': 'text',
             'placeholder': 'e.g. 639281',
             'help': 'Enter your project\'s numerical ID.'
         }
     ]
Пример #32
0
    def get_config(self, **kwargs):
        userkey = self.get_option('userkey', kwargs['project'])
        apikey = self.get_option('apikey', kwargs['project'])

        userkey_field = get_secret_field_config(
            userkey,
            'Your user key. See https://pushover.net/',
            include_prefix=True)
        userkey_field.update({'name': 'userkey', 'label': 'User Key'})

        apikey_field = get_secret_field_config(
            apikey,
            'Application API token. See https://pushover.net/apps/',
            include_prefix=True)

        apikey_field.update({'name': 'apikey', 'label': 'API Key'})

        return [
            userkey_field,
            apikey_field,
            {
                'name':
                'priority',
                'label':
                'Message Priority',
                'type':
                'choice',
                'required':
                True,
                'choices': [
                    ('-2', 'Lowest'),
                    ('-1', 'Low'),
                    ('0', 'Normal'),
                    ('1', 'High'),
                    ('2', 'Emergency'),
                ],
                'default':
                '0',
            },
            {
                'name':
                'retry',
                'label':
                'Retry',
                'type':
                'number',
                'required':
                False,
                'placeholder':
                'e.g. 30',
                'help':
                'How often (in seconds) you will receive the same notification. Minimum of 30 seconds. Only required for "Emergency" level priority.'
            },
            {
                'name':
                'expire',
                'label':
                'Expire',
                'type':
                'number',
                'required':
                False,
                'placeholder':
                'e.g. 9000',
                'help':
                'How many seconds your notification will continue to be retried for. Maximum of 10800 seconds. Only required for "Emergency" level priority.'
            },
        ]
Пример #33
0
    def get_configure_plugin_fields(self, request, project, **kwargs):
        instance = self.get_option("instance_url", project)
        username = self.get_option("username", project)
        pw = self.get_option("password", project)
        jira_project = self.get_option("default_project", project)

        default_priority = self.get_option("default_priority", project)

        default_issue_type = self.get_option("default_issue_type", project)

        project_choices = []
        priority_choices = []
        issue_type_choices = []
        if instance and username and pw:
            client = JiraClient(instance, username, pw)
            try:
                projects = client.get_projects_list()
            except ApiError:
                projects = None
            else:
                if projects:
                    project_choices = [
                        (p.get("key"),
                         "%s (%s)" % (p.get("name"), p.get("key")))
                        for p in projects
                    ]
                    jira_project = jira_project or projects[0]["key"]

            if jira_project:
                try:
                    priorities = client.get_priorities()
                except ApiError:
                    priorities = None
                else:
                    if priorities:
                        priority_choices = [(p.get("id"),
                                             "%s" % (p.get("name")))
                                            for p in priorities]

                        default_priority = default_priority or priorities[0][
                            "id"]

                try:
                    meta = client.get_create_meta_for_project(jira_project)
                except ApiError:
                    meta = None
                else:
                    if meta:
                        issue_type_choices = self.make_choices(
                            meta["issuetypes"])
                        if issue_type_choices:
                            default_issue_type = default_issue_type or issue_type_choices[
                                0][0]

        secret_field = get_secret_field_config(pw, "")
        secret_field.update({
            "name": "password",
            "label": "Password/API Token"
        })

        return [
            {
                "name": "instance_url",
                "label": "JIRA Instance URL",
                "default": instance,
                "type": "text",
                "placeholder": 'e.g. "https://jira.atlassian.com"',
                "help": "It must be visible to the Sentry server",
            },
            {
                "name":
                "username",
                "label":
                "Username/Email",
                "default":
                username,
                "type":
                "text",
                "help":
                "Ensure the JIRA user has admin permissions on the project",
            },
            secret_field,
            {
                "name": "default_project",
                "label": "Linked Project",
                "type": "select",
                "choices": project_choices,
                "default": jira_project,
                "required": False,
            },
            {
                "name":
                "ignored_fields",
                "label":
                "Ignored Fields",
                "type":
                "textarea",
                "required":
                False,
                "placeholder":
                'e.g. "components, security, customfield_10006"',
                "default":
                self.get_option("ignored_fields", project),
                "help":
                "Comma-separated list of properties that you don't want to show in the form",
            },
            {
                "name": "default_priority",
                "label": "Default Priority",
                "type": "select",
                "choices": priority_choices,
                "required": False,
                "default": default_priority,
            },
            {
                "name": "default_issue_type",
                "label": "Default Issue Type",
                "type": "select",
                "choices": issue_type_choices,
                "required": False,
                "default": default_issue_type,
            },
            {
                "name": "auto_create",
                "label": "Automatically create JIRA Tickets",
                "default": self.get_option("auto_create", project) or False,
                "type": "bool",
                "required": False,
                "help":
                "Automatically create a JIRA ticket for EVERY new issue",
            },
        ]
Пример #34
0
    def get_configure_plugin_fields(self, request, project, **kwargs):
        instance = self.get_option('instance_url', project)
        username = self.get_option('username', project)
        pw = self.get_option('password', project)
        jira_project = self.get_option('default_project', project)

        default_priority = self.get_option('default_priority', project)

        default_issue_type = self.get_option('default_issue_type', project)

        project_choices = []
        priority_choices = []
        issue_type_choices = []
        if instance and username and pw:
            client = JiraClient(instance, username, pw)
            try:
                projects = client.get_projects_list()
            except ApiError:
                projects = None
            else:
                if projects:
                    project_choices = [
                        (p.get('key'), '%s (%s)' % (p.get('name'), p.get('key'))) for p in projects
                    ]
                    jira_project = jira_project or projects[0]['key']

            if jira_project:
                try:
                    priorities = client.get_priorities()
                except ApiError:
                    priorities = None
                else:
                    if priorities:
                        priority_choices = [
                            (p.get('id'), '%s' % (p.get('name'))) for p in priorities
                        ]

                        default_priority = default_priority or priorities[0]['id']

                try:
                    meta = client.get_create_meta_for_project(jira_project)
                except ApiError:
                    meta = None
                else:
                    if meta:
                        issue_type_choices = self.make_choices(meta['issuetypes'])
                        if issue_type_choices:
                            default_issue_type = default_issue_type or issue_type_choices[0][0]

        secret_field = get_secret_field_config(pw, '')
        secret_field.update({'name': 'password', 'label': 'Password/API Token'})

        return [
            {
                'name': 'instance_url',
                'label': 'JIRA Instance URL',
                'default': instance,
                'type': 'text',
                'placeholder': 'e.g. "https://jira.atlassian.com"',
                'help': 'It must be visible to the Sentry server'
            }, {
                'name': 'username',
                'label': 'Username/Email',
                'default': username,
                'type': 'text',
                'help': 'Ensure the JIRA user has admin permissions on the project'
            }, secret_field, {
                'name': 'default_project',
                'label': 'Linked Project',
                'type': 'select',
                'choices': project_choices,
                'default': jira_project,
                'required': False
            }, {
                'name': 'ignored_fields',
                'label': 'Ignored Fields',
                'type': 'textarea',
                'required': False,
                'placeholder': 'e.g. "components, security, customfield_10006"',
                'default': self.get_option('ignored_fields', project),
                'help':
                'Comma-separated list of properties that you don\'t want to show in the form'
            }, {
                'name': 'default_priority',
                'label': 'Default Priority',
                'type': 'select',
                'choices': priority_choices,
                'required': False,
                'default': default_priority
            }, {
                'name': 'default_issue_type',
                'label': 'Default Issue Type',
                'type': 'select',
                'choices': issue_type_choices,
                'required': False,
                'default': default_issue_type
            }, {
                'name': 'auto_create',
                'label': 'Automatically create JIRA Tickets',
                'default': self.get_option('auto_create', project) or False,
                'type': 'bool',
                'required': False,
                'help': 'Automatically create a JIRA ticket for EVERY new issue'
            }
        ]
Пример #35
0
    def get_configure_plugin_fields(self, request, project, **kwargs):
        vsts_personal_access_token = self.get_option(
            'vsts_personal_access_token', project)

        secret_field = get_secret_field_config(
            vsts_personal_access_token,
            'Enter your API Personal Access token. Follow the instructions \
            at the following URL to create a token for yourself in VSTS: \
            https://www.visualstudio.com/en-us/docs/setup-admin/team-services/use-personal-access-tokens-to-authenticate'
        )
        secret_field.update({
            'name': 'vsts_personal_access_token',
            'label': 'Access Token',
            'placeholder': '52 character personal access token',
            'required': True,
        })

        return [{
            'name':
            'account',
            'label':
            'VSTS Account Name',
            'type':
            'text',
            'default':
            project.organization.name,
            'placeholder':
            'VSTS Account Name',
            'required':
            True,
            'help':
            'Enter the account name of your VSTS instance. This will be the \
                same name appearing in your VSTS url: i.e. [name].visualstudio.com'
        }, {
            'name':
            'projectname',
            'label':
            'Project name',
            'type':
            'text',
            'default':
            project.name,
            'placeholder':
            'VSTS project name',
            'required':
            True,
            'help':
            'Enter the Visual Studio Team Services project name that you wish \
                new work items to be added to when they are created from Sentry. This must \
                be a valid project name within the VSTS account specified above.'
        }, {
            'name':
            'username',
            'label':
            'User name',
            'type':
            'text',
            'placeholder':
            'Your VSTS username',
            'required':
            True,
            'help':
            'Enter the username you use to login to Visual Studio Team Services.'
        }, secret_field]
Пример #36
0
    def get_config(self, **kwargs):
        privatekey = self.get_option('privatekey', kwargs['project'])
        device = self.get_option('device', kwargs['project'])
        icon = self.get_option('icon', kwargs['project'])
        iconcolor = self.get_option('iconcolor', kwargs['project'])
        sound = self.get_option('sound', kwargs['project'])
        vibration = self.get_option('vibration', kwargs['project'])
        time2live = self.get_option('time2live', kwargs['project'])

        privatekey_field = get_secret_field_config(
            privatekey,
            'Your private key. See https://www.pushsafer.com',
            include_prefix=True)
        privatekey_field.update({
            'name': 'privatekey',
            'label': 'Private or Alias Key'
        })

        device_field = get_secret_field_config(
            device,
            'Your Device or Device Group ID. See https://www.pushsafer.com/pushapi',
            include_prefix=True)
        device_field.update({
            'name': 'device',
            'label': 'Device or Device Group ID'
        })

        icon_field = get_secret_field_config(
            icon,
            'Your Icon ID (1-176). See https://www.pushsafer.com/pushapi',
            include_prefix=True)
        icon_field.update({'name': 'icon', 'label': 'Icon'})

        iconcolor_field = get_secret_field_config(
            iconcolor,
            'Your Icon Color (Hexadecimal Colorcode, Example: #FF0000). See https://www.pushsafer.com/pushapi',
            include_prefix=True)
        iconcolor_field.update({'name': 'iconcolor', 'label': 'Icon Color'})

        sound_field = get_secret_field_config(
            sound,
            'Your Sound ID (0-50). See https://www.pushsafer.com/pushapi',
            include_prefix=True)
        sound_field.update({'name': 'sound', 'label': 'Sound'})

        vibration_field = get_secret_field_config(
            vibration,
            'Your Vibration (empty or 1-3). See https://www.pushsafer.com/pushapi',
            include_prefix=True)
        vibration_field.update({'name': 'vibration', 'label': 'Vibration'})

        time2live_field = get_secret_field_config(
            time2live,
            'Time to Live (0-43200: Time in minutes, after which message automatically gets purged). See https://www.pushsafer.com/pushapi',
            include_prefix=True)
        time2live_field.update({'name': 'time2live', 'label': 'Time to Live'})

        return [
            privatekey_field, device_field, icon_field, iconcolor_field,
            sound_field, vibration_field, time2live_field
        ]
Пример #37
0
    def get_configure_plugin_fields(self, request, project, **kwargs):
        instance = self.get_option('instance_url', project)
        username = self.get_option('username', project)
        pw = self.get_option('password', project)
        jira_project = self.get_option('default_project', project)
        default_priority = self.get_option('default_priority', project)
        default_issue_type = self.get_option('default_issue_type', project)

        project_choices = []
        priority_choices = []
        issue_type_choices = []
        if instance and username and pw:
            client = JIRAClient(instance, username, pw)
            try:
                projects_response = client.get_projects_list()
            except JIRAError:
                projects_response = None
            else:
                projects = projects_response.json
                if projects:
                    project_choices = [
                        (p.get('key'),
                         '%s (%s)' % (p.get('name'), p.get('key')))
                        for p in projects
                    ]
                    jira_project = jira_project or projects[0]['key']

            if jira_project:
                try:
                    priorities_response = client.get_priorities()
                except JIRAError:
                    priorities_response = None
                else:
                    priorities = priorities_response.json
                    if priorities:
                        priority_choices = [(p.get('id'),
                                             '%s' % (p.get('name')))
                                            for p in priorities]
                        default_priority = default_priority or priorities[0][
                            'id']

                try:
                    meta = client.get_create_meta_for_project(jira_project)
                except JIRAError:
                    meta = None
                else:
                    if meta:
                        issue_type_choices = self.make_choices(
                            meta['issuetypes'])
                        if issue_type_choices:
                            default_issue_type = default_issue_type or issue_type_choices[
                                0][0]

        secret_field = get_secret_field_config(pw, '')
        secret_field.update({'name': 'password', 'label': 'Password'})

        return [{
            'name': 'instance_url',
            'label': 'JIRA Instance URL',
            'default': instance,
            'type': 'text',
            'placeholder': 'e.g. "https://jira.atlassian.com"',
            'help': 'It must be visible to the Sentry server'
        }, {
            'name':
            'username',
            'label':
            'Username',
            'default':
            username,
            'type':
            'text',
            'help':
            'Ensure the JIRA user has admin permissions on the project'
        }, secret_field, {
            'name': 'default_project',
            'label': 'Linked Project',
            'type': 'select',
            'choices': project_choices,
            'default': jira_project,
            'required': False
        }, {
            'name':
            'ignored_fields',
            'label':
            'Ignored Fields',
            'type':
            'textarea',
            'required':
            False,
            'placeholder':
            'e.g. "components, security, customfield_10006"',
            'default':
            self.get_option('ignored_fields', project),
            'help':
            'Comma-separated list of properties that you don\'t want to show in the form'
        }, {
            'name': 'default_priority',
            'label': 'Default Priority',
            'type': 'select',
            'choices': priority_choices,
            'required': False,
            'default': default_priority
        }, {
            'name': 'default_issue_type',
            'label': 'Default Issue Type',
            'type': 'select',
            'choices': issue_type_choices,
            'required': False,
            'default': default_issue_type
        }, {
            'name':
            'auto_create',
            'label':
            'Automatically create JIRA Tickets',
            'default':
            self.get_option('auto_create', project) or False,
            'type':
            'bool',
            'required':
            False,
            'help':
            'Automatically create a JIRA ticket for EVERY new issue'
        }]