Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add necessary docs #9

Merged
merged 7 commits into from
Jan 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This should match the owning team set up in https://github.com/orgs/opensearch-project/teams
* @opensearch-project/dashboards-reports
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/BUG_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: 🐛 Bug report
about: Create a report to help us improve
title: '[BUG]'
labels: 'bug, untriaged'
assignees: ''
---
### What is the bug?
_A clear and concise description of the bug._

### How can one reproduce the bug?
_Steps to reproduce the behavior._

### What is the expected behavior?
_A clear and concise description of what you expected to happen._

### What is your host/environment?
_Operating system, version._

### Do you have any screenshots?
_If applicable, add screenshots to help explain your problem._

### Do you have any additional context?
_Add any other context about the problem._
18 changes: 18 additions & 0 deletions .github/ISSUE_TEMPLATE/FEATURE_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
name: 🎆 Feature request
about: Request a feature in this project
title: '[FEATURE]'
labels: 'enhancement, untriaged'
assignees: ''
---
### Is your feature request related to a problem?
_A clear and concise description of what the problem is, e.g. I'm always frustrated when [...]._

### What solution would you like?
_A clear and concise description of what you want to happen._

### What alternatives have you considered?
_A clear and concise description of any alternative solutions or features you've considered._

### Do you have any additional context?
_Add any other context or screenshots about the feature request here._
40 changes: 40 additions & 0 deletions .github/ISSUE_TEMPLATE/PROPOSAL_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
---
name: 💭 Proposal
about: Suggest an idea for a specific feature you wish to propose to the community for comment
title: '[PROPOSAL]'
labels: proposal
assignees: ''
---
## What/Why
### What are you proposing?
_In a few sentences, describe the feature and its core capabilities._

### What users have asked for this feature?
_Highlight any research, proposals, requests or anecdotes that signal this is the right thing to build. Include links to GitHub Issues, Forums, Stack Overflow, Twitter, Etc_

### What problems are you trying to solve?
_Summarize the core use cases and user problems and needs you are trying to solve. Describe the most important user needs, pain points and jobs as expressed by the user asks above. Template: When \<a situation arises> , a \<type of user> wants to \<do something>, so they can \<expected outcome>. (Example: When **searching by postal code**, **a buyer** wants to **be required to enter a valid code** so they **don’t waste time searching for a clearly invalid postal code.**)_

### What is the developer experience going to be?
_Does this have a REST API? If so, please describe the API and any impact it may have to existing APIs. In a brief summary (not a spec), highlight what new REST APIs or changes to REST APIs are planned. as well as any other API, CLI or Configuration changes that are planned as part of this feature._

#### Are there any security considerations?
_Describe if the feature has any security considerations or impact. What is the security model of the new APIs? Features should be integrated into the OpenSearch security suite and so if they are not, we should highlight the reasons here._

#### Are there any breaking changes to the API
_If this feature will require breaking changes to any APIs, ouline what those are and why they are needed. What is the path to minimizing impact? (example, add new API and deprecate the old one)_

### What is the user experience going to be?
_Describe the feature requirements and or user stories. You may include low-fidelity sketches, wireframes, APIs stubs, or other examples of how a user would use the feature via CLI, OpenSearch Dashboards, REST API, etc. Using a bulleted list or simple diagrams to outline features is okay. If this is net new functionality, call this out as well._

#### Are there breaking changes to the User Experience?
_Will this change the existing user experience? Will this be a breaking change from a user flow or user experience perspective?_

### Why should it be built? Any reason not to?
_Describe the value that this feature will bring to the OpenSearch community, as well as what impact it has if it isn't built, or new risks if it is. Highlight opportunities for additional research._

### What will it take to execute?
_Describe what it will take to build this feature. Are there any assumptions you may be making that could limit scope or add limitations? Are there performance, cost, or technical constraints that may impact the user experience? Does this feature depend on other feature work? What additional risks are there?_

### Any remaining open questions?
_What are known enhancements to this feature? Any enhancements that may be out of scope but that we will want to track long term? List any other open questions that may need to be answered before proceeding with an implementation._
7 changes: 7 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
contact_links:
- name: OpenSearch Community Support
url: https://discuss.opendistrocommunity.dev/
about: Please ask and answer questions here.
- name: AWS/Amazon Security
url: https://aws.amazon.com/security/vulnerability-reporting/
about: Please report security vulnerabilities here.
19 changes: 19 additions & 0 deletions .github/workflows/add-untriaged.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Apply 'untriaged' label during issue lifecycle

on:
issues:
types: [opened, reopened, transferred]

jobs:
apply-label:
runs-on: ubuntu-latest
steps:
- uses: actions/github-script@v6
with:
script: |
github.rest.issues.addLabels({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
labels: ['untriaged']
})
4 changes: 4 additions & 0 deletions .github/workflows/reporting-cli-test-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@ jobs:
run: |
npm pack

- name: Rename artifact
run: |
mv opensearch-project-reporting-cli-${{ env.CLI_VERSION }}.tgz opensearch-reporting-cli-${{ env.CLI_VERSION }}.tgz

- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
Expand Down
11 changes: 11 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
node_modules/
.env
opensearch-report*
docs
test
.github
.gitignore
.npmignore
CODE_OF_CONDUCT.md
CONTRIBUTING.md
yarn.lock
13 changes: 13 additions & 0 deletions MAINTAINERS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
- [Overview](#overview)
- [Current Maintainers](#current-maintainers)

## Overview

This document contains a list of maintainers in this repo. See [opensearch-project/.github/RESPONSIBILITIES.md](https://github.com/opensearch-project/.github/blob/main/RESPONSIBILITIES.md#maintainer-responsibilities) that explains what the role of maintainer means, what maintainers do in this and other repos, and how they should be doing it. If you're interested in contributing, and becoming a maintainer, see [CONTRIBUTING](CONTRIBUTING.md).

## Current Maintainers

| Maintainer | GitHub ID | Affiliation |
| ---------------------- | ------------------------------------------------- | ----------- |
| Joshua Li | [joshuali925](https://github.com/joshuali925) | Amazon |
| Rupal Mahajan | [rupal-bq](https://github.com/rupal-bq) | Amazon |
31 changes: 30 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,35 @@
<img src="https://opensearch.org/assets/img/opensearch-logo-themed.svg" height="64px">

- [OpenSearch Reporting CLI](#opensearch-reporting-cli)
- [Setup](#setup)
- [Examples](#examples)
- [Contributing](#contributing)
- [Code of Conduct](#code-of-conduct)
- [Security](#security)
- [License](#license)
- [Copyright](#copyright)

# OpenSearch Reporting CLI

TODO
OpenSearch Reporting CLI is a quick out-of-box options to be able to download reports without using Dashboards.

## Setup

To download and install the Reporting CLI from npm, run the following command.

```bash
npm i @opensearch-project/reporting-cli
```

You can also download the `opensearch-reporting-cli` tool from the [OpenSearch.org](https://opensearch.org/downloads.html) and run the following command.

```bash
npm install -g opensearch-reporting-cli-1.0.0.tgz
```

## Examples

Please see the [USER_GUIDE](USER_GUIDE.md) for examples.

## Contributing

Expand Down
125 changes: 125 additions & 0 deletions USER_GUIDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
# OpenSearch Reporting CLI

Reporting CLI is a quick out-of-box options to be able to download reports without using Dashboards.

## Features

- Reporting CLI supports following authentication types for OpenSearch Dashboards connection.
- Basic authentication
- Cognito authentication
- SAML authentication
- No auth
- Reporting CLI supports downloading reports in below file formats.
- PDF
- PNG
- CSV
- Reporting CLI can be used to send email with report as an attachment.

## Command-line Options

Reporting CLI supports following configurable options.

Option | Default Value | Valid Options | Environment Variable | Description
-- | --- | --- | --- | --- |
-u, --url | - | - | OPENSEARCH_URL | url for the report
-f, --format | pdf | pdf, png, csv | - | file format for the report
-w, --width | 1680 | - | - | window width in pixels for the report
-l, --height | 600 | - | - | minimum window height in pixels for the report
-n, --filename | opensearch-report-timestamp | - | OPENSEARCH_FILENAME | file name of the report
-a, --auth | none | basic, saml, cognito | - | authentication type for the report
-t, --tenant | private | - | - | tenants in opensearch dashboards
-c, --credentials | - | - | OPENSEARCH_USERNAME and OPENSEARCH_PASSWORD | login credentials in the format of username:password for connecting to url
-s, --from | - | - | OPENSEARCH_FROM | email address of the sender
-r, --to | - | - | OPENSEARCH_TO | email address of the recipient
-e, --transport | - | ses, smtp | OPENSEARCH_TRANSPORT | transport for sending the email
--smtphost | - | - | OPENSEARCH_SMTP_HOST | the hostname of the smtp server
--smtpport | - | - | OPENSEARCH_SMTP_PORT | the port for connection
--smtpusername | - | - | OPENSEARCH_SMTP_USERNAME | smtp username
--smtppassword | - | - | OPENSEARCH_SMTP_PASSWORD | smtp password
--smtpsecure | - | - | OPENSEARCH_SMTP_SECURE | if true the connection will use TLS when connecting to server.
--subject | This is an email containing your dashboard report | - | OPENSEARCH_SUBJECT | subject for the email
| - | - | - | CHROMIUM_PATH | path to chromium directory

You can also find this information using help command.
```
opensearch-reporting-cli --help
```

## Environment Variable File

Reporting CLI also reads environment variables from .env file in the current directory.

- Each line should have format NAME=VALUE
- Lines starting with # are considered as comments.
- There is no special handling of quotation marks.

NOTE: Values from the command line argument has higher priority than environment variables. For example, if you add filename as *test* in *.env* file and also add `--filename report` command option, the downloded report's name will be *report*.

## Example

Sample command for downloading a dashboard report with basic authentication in png format
```
opensearch-reporting-cli --url https://localhost:5601/app/dashboards#/view/7adfa750-4c81-11e8-b3d7-01146121b73d --format png --auth basic --credentials admin:admin
```
Report will be downloaded in the current directory.

### Sending an Email with report attachment using Amazon SES

Prerequisites:
- The sender's email address must be verified on [Amazon SES](https://aws.amazon.com/ses/).
- [AWS CLI](https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-welcome.html) is required to interact with Amazon SES.
- [Configure](https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html#cli-configure-quickstart-config) basic settings used by AWS CLI.
- SES transport requires ses:SendRawEmail role.
```
{
"Statement": [
{
"Effect": "Allow",
"Action": "ses:SendRawEmail",
"Resource": "*"
}
]
}
```

Sample command to send email with report as an attachment:
```
opensearch-reporting-cli --url https://localhost:5601/app/dashboards#/view/7adfa750-4c81-11e8-b3d7-01146121b73d --transport ses --from <sender_email_id> --to <recipient_email_id>
```
This example uses default values for all other options.

You can also set *OPENSEARCH_FROM*, *OPENSEARCH_TO*, *OPENSEARCH_TRANSPORT* as environment variables and use following command.
```
opensearch-reporting-cli --url https://localhost:5601/app/dashboards#/view/7adfa750-4c81-11e8-b3d7-01146121b73d
```

### Sending an Email with report attachment using SMTP

For sending email using SMTP transport, the options **OPENSEARCH_SMTP_HOST**, **OPENSEARCH_SMTP_PORT**, **OPENSEARCH_SMTP_USERNAME**, **OPENSEARCH_SMTP_PASSWORD**, **OPENSEARCH_SMTP_SECURE** need to be set in environment variables.

Once above options are set, you can send the email using below sample command.
```
opensearch-reporting-cli --url https://localhost:5601/app/dashboards#/view/7adfa750-4c81-11e8-b3d7-01146121b73d --transport smtp --from <sender_email_id> --to <recipient_email_id>
```

You can choose to set options using *.env* file or the command line argument values in any combination. Make sure to specify all required values to avoid getting errors.

## Limitations
- Supported platforms are Windows x86, Windows x64, Mac Intel, Mac ARM, Linux x86, Linux x64.

For any other platform, users can take advantage of *CHROMIUM_PATH* environment variable to use custom chromium.

- If a URL contains `!`, history expansion needs to be disable temporarily.

bash: `set +H`

zsh: `setopt nobanghist`


Alternate option would be adding URL value in envirnoment variable as URL="<url-with-!>"

- All command option currently accept only lower-case letters.

## Troubleshooting

- To resolve **MessageRejected: Email address is not verified**, [check](https://aws.amazon.com/premiumsupport/knowledge-center/ses-554-400-message-rejected-error/) this arcticle.
Loading