Skip to content

Commit

Permalink
Create initial set of tables (#1)
Browse files Browse the repository at this point in the history
Co-authored-by: Ved misra <47312748+misraved@users.noreply.github.com>
Co-authored-by: misraved <ved@turbot.com>
  • Loading branch information
3 people committed Jun 22, 2023
1 parent 3c60c8a commit caeb73a
Show file tree
Hide file tree
Showing 65 changed files with 6,109 additions and 1 deletion.
26 changes: 26 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**Steampipe version (`steampipe -v`)**
Example: v0.3.0

**Plugin version (`steampipe plugin list`)**
Example: v0.5.0

**To reproduce**
Steps to reproduce the behavior (please include relevant code and/or commands).

**Expected behavior**
A clear and concise description of what you expected to happen.

**Additional context**
Add any other context about the problem here.
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Questions
url: https://steampipe.io/community/join
about: GitHub issues in this repository are only intended for bug reports and feature requests. Other issues will be closed. Please ask and answer questions through the Steampipe Slack community.
- name: Steampipe CLI Bug Reports and Feature Requests
url: https://github.com/turbot/steampipe/issues/new/choose
about: Steampipe CLI has its own codebase. Bug reports and feature requests for those pieces of functionality should be directed to that repository.
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/feature-request---new-table.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Feature request - New table
about: Suggest a new table for this project
title: Add table servicenow_<service>_<resource>
labels: enhancement, new table
assignees: ""
---

**References**
Add any related links that will help us understand the resource, including vendor documentation, related GitHub issues, and Go SDK documentation.
20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: enhancement
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
8 changes: 8 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Example query results
<details>
<summary>Results</summary>

```
Add example SQL query results here (please include the input queries as well)
```
</details>
14 changes: 14 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: golangci-lint
on:
push:
tags:
- v*
branches:
- main
pull_request:

jobs:
golangci_lint_workflow:
uses: turbot/steampipe-workflows/.github/workflows/golangci-lint.yml@main
with:
timeout: 20m
11 changes: 11 additions & 0 deletions .github/workflows/registry-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Build and Deploy OCI Image

on:
push:
tags:
- 'v*'

jobs:
registry_publish_workflow:
uses: turbot/steampipe-workflows/.github/workflows/registry-publish.yml@main
secrets: inherit
17 changes: 17 additions & 0 deletions .github/workflows/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Stale Issues and PRs
on:
schedule:
- cron: "30 23 * * *"
workflow_dispatch:
inputs:
dryRun:
description: Set to true for a dry run
required: false
default: "false"
type: string

jobs:
stale_workflow:
uses: turbot/steampipe-workflows/.github/workflows/stale.yml@main
with:
dryRun: ${{ github.event.inputs.dryRun }}
9 changes: 9 additions & 0 deletions .github/workflows/sync-labels.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Sync Labels
on:
schedule:
- cron: "30 22 * * 1"
workflow_dispatch:

jobs:
sync_labels_workflow:
uses: turbot/steampipe-workflows/.github/workflows/sync-labels.yml@main
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Editor cache and lock files
*.swp
*.swo

# Binaries for programs and plugins
*.exe
*.exe~
Expand Down
35 changes: 35 additions & 0 deletions .goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# This is an example goreleaser.yaml file with some sane defaults.
# Make sure to check the documentation at http://goreleaser.com
before:
hooks:
- go mod tidy
builds:
- env:
- CGO_ENABLED=0
- GO111MODULE=on
- GOPRIVATE=github.com/turbot
goos:
- linux
- darwin

goarch:
- amd64
- arm64

id: "steampipe"
binary: "{{ .ProjectName }}.plugin"

archives:
- format: gz
name_template: "{{ .ProjectName }}_{{ .Os }}_{{ .Arch }}"
files:
- none*
checksum:
name_template: "{{ .ProjectName }}_{{ .Version }}_SHA256SUMS"
algorithm: sha256
changelog:
sort: asc
filters:
exclude:
- "^docs:"
- "^test:"
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@

install:
go build -o ~/.steampipe/plugins/hub.steampipe.io/plugins/turbot/servicenow@latest/steampipe-plugin-servicenow.plugin *.go
127 changes: 126 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,126 @@
# steampipe-plugin-servicenow
![image](https://hub.steampipe.io/images/plugins/turbot/servicenow-social-graphic.png)

# ServiceNow Plugin for Steampipe

Use SQL to query sys_user, cmdb_ci, incident and more from ServiceNow.

- **[Get started →](https://hub.steampipe.io/plugins/turbot/servicenow)**
- Documentation: [Table definitions & examples](https://hub.steampipe.io/plugins/turbot/servicenow/tables)
- Community: [Slack Channel](https://steampipe.io/community/join)
- Get involved: [Issues](https://github.com/turbot/steampipe-plugin-servicenow/issues)

## Quick start

### Install

Download and install the latest Steampipe plugin:

```bash
steampipe plugin install servicenow
```

Configure your [credentials](https://hub.steampipe.io/plugins/turbot/servicenow#credentials) and [config file](https://hub.steampipe.io/plugins/turbot/servicenow#configuration).

Configure your account details in `~/.steampipe/config/servicenow.spc`:

```hcl
connection "servicenow" {
plugin = "servicenow"
# Your ServiceNow instance URL
instance_url = "https://<your_servicenow_instance>.service-now.com"
# Authentication information
username = "john.hill"
password = "j0t3-$j@H3"
}
```

Or through environment variables:

```sh
export SERVICENOW_INSTANCE_URL=https://<your_servicenow_instance>.service-now.com
export SERVICENOW_USERNAME=john.hill
export SERVICENOW_PASSWORD=j0t3-$j@H3
```

Run steampipe:

```shell
steampipe query
```

List new incidents on your ServiceNow instance:

```sql
select
number,
short_description,
category,
priority
from
servicenow_incident
where
state = 1;
```

```
+------------+---------------------------------------+----------+----------+
| number | short_description | category | priority |
+------------+---------------------------------------+----------+----------+
| INC0000039 | Trouble getting to Oregon mail server | network | 5 |
| INC0000046 | Can't access SFA software | software | 3 |
| INC0009001 | Unable to post content on a Wiki page | inquiry | 3 |
| INC0000057 | Performance problems with wifi | inquiry | 5 |
| INC0009005 | Email server is down. | software | 1 |
| INC0007002 | Need access to the common drive. | inquiry | 4 |
+------------+---------------------------------------+----------+----------+
```

## Developing

Prerequisites:

- [Steampipe](https://steampipe.io/downloads)
- [Golang](https://golang.org/doc/install)

Clone:

```sh
git clone https://github.com/turbot/steampipe-plugin-servicenow.git
cd steampipe-plugin-servicenow
```

Build, which automatically installs the new version to your `~/.steampipe/plugins` directory:

```
make
```

Configure the plugin:

```
cp config/* ~/.steampipe/config
vi ~/.steampipe/config/servicenow.spc
```

Try it!

```
steampipe query
> .inspect servicenow
```

Further reading:

- [Writing plugins](https://steampipe.io/docs/develop/writing-plugins)
- [Writing your first table](https://steampipe.io/docs/develop/writing-your-first-table)

## Contributing

Please see the [contribution guidelines](https://github.com/turbot/steampipe/blob/main/CONTRIBUTING.md) and our [code of conduct](https://github.com/turbot/steampipe/blob/main/CODE_OF_CONDUCT.md). All contributions are subject to the [Apache 2.0 open source license](https://github.com/turbot/steampipe-plugin-servicenow/blob/main/LICENSE).

`help wanted` issues:

- [Steampipe](https://github.com/turbot/steampipe/labels/help%20wanted)
- [ServiceNow Plugin](https://github.com/turbot/steampipe-plugin-servicenow/labels/help%20wanted)
23 changes: 23 additions & 0 deletions config/servicenow.spc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
connection "servicenow" {
plugin = "servicenow"

# `instance_url` (required) - Your ServiceNow instance URL.
# instance_url = "https://<your_servicenow_instance>.service-now.com"

# `username` (required) - Your ServiceNow username.
# username = "john.hill"
# `password` (required) - Your ServiceNow password.
# password = "j0t3-$j@H3"

# Optionally, to use OAuth2 authentication mode, you'll need to have the `client_id` and `client_secret` of
# a registered application in ServiceNow. You can register an application by going to
# `All > System oAuth > Application Registry` and creating a new OAuth API endpoint for external clients.

# `client_id` (optional) - ServiceNow login application client ID.
# client_id = "9148ce34f5252110392c96f819dbd422"
# `client_secret` (optional) - ServiceNow login application client secret.
# client_secret = "Ly#2auTd"

# `objects` (optional) - Additional ServiceNow tables you want to query.
# objects = ["cmdb_model", "cmn_location"]
}
Loading

0 comments on commit caeb73a

Please sign in to comment.