Пример #1
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."),
         },
     ]
Пример #2
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.",
         },
     ]
Пример #3
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.",
         },
     ]
Пример #4
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,
            },
        ]
Пример #5
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)),
     ]
Пример #6
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",
         )
     ]
Пример #7
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",
         },
     ]
Пример #8
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,
         },
     ]
Пример #9
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.",
            },
        ]
Пример #10
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",
            },
        ]