Skip to content

Commit

Permalink
Open/raw API calls (#57)
Browse files Browse the repository at this point in the history
* working int and ext open api calls

* slimmed down code

* external call error handling, tweaking

* more tweaking

* call status and tests refactoring

* disconnect clears mgmtClient

* update changelog
  • Loading branch information
DumpySquare authored Aug 6, 2020
1 parent 6426c44 commit 1250e49
Show file tree
Hide file tree
Showing 26 changed files with 1,030 additions and 130 deletions.
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,28 @@ All notable changes to the "vscode-f5-fast" extension will be documented in this

Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how to structure this file.

---

## [2.1.0] - (8-5-2020)

### Added
- Make HTTP/S Requests function provides the necessary flexbility to make any API call to ANYthing (mostly...)
- Highlight text, right-click, select: `Make HTTPS Request`
- support raw URL, json and yaml structures
- Added the ability to make any api call to connected f5 (will utilized other known device details like: host/port/user/password/token/headers)
- Also accepts enough parameters to craft an external API for any destination
- Includes connection status pop up and error handling like other api calls in the extension
- Documented usage and examples:
- * [Crafting raw API calls](./README_docs/rawApiCalls.md)


### Modified
- Added nodejs nock for api tests
- Started refactoring device mgmt functions for automated testing
- Device Add/Remove
- allowing entry/command functions to take parameters that would normally be collected from the user by some sort of input, like a click or input/select box


---

## [2.0.1] - (7-28-2020)
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,15 @@ Any comments, questions or feature requests, please open a github repository iss

* [CHANGELOG](CHANGELOG.md)
* [Research](./README_docs/research.md)
* [Writing ATC declarations in YAML!!!](./README_docs/jsonSchemaInYaml.md)
* [Crafting raw API calls](./README_docs/rawApiCalls.md)
* [ATC ILX rpm package management](./README_docs/rpmMgmt.md)
* [FAST information and How-To's](./README_docs/fast.md)
* [Additional Tools](./README_docs/tools.md)


Future extension features and enhancements have been moved to the repo issues(enhancements) for better tracking
* [repo issues and enhancements](https://github.com/DumpySquare/vscode-f5-fast/issues)

---

Expand Down
9 changes: 9 additions & 0 deletions README_docs/fast.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# FAST Templates information

[BACK TO MAIN README](../README.md)

---

Details about FAST templates, authoring and uploading

## Commands
Binary file added README_docs/images/as3SchemaInYaml.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
32 changes: 32 additions & 0 deletions README_docs/jsonSchemaInYaml.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@



# Research

[BACK TO MAIN README](../README.md)

---
## Validating YAML with JSON Schemas

### WRITE ATC DECLARATIONS IN YAML!!!



Install the RedHat YAML extension
https://marketplace.visualstudio.com/items?itemName=redhat.vscode-yaml


In the vscode settings for that extension:
```
"yaml.schemas": {
"https://raw.githubusercontent.com/F5Networks/f5-appsvcs-extension/master/schema/latest/as3-schema.json": ["*.as3.yml"],
"https://raw.githubusercontent.com/F5Networks/f5-declarative-onboarding/master/src/schema/latest/base.schema.json": ["*.do.yml"],
"https://raw.githubusercontent.com/F5Networks/f5-telemetry-streaming/master/src/schema/latest/base_schema.json": ["*.ts.*"],
}
```

create a yaml file for as3 like: `as3Dec1.as3.yml `



![example1](./images/as3SchemaInYaml.PNG)
122 changes: 122 additions & 0 deletions README_docs/rawApiCalls.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@


# Make HTTP/S Request documentation and examples

[BACK TO MAIN README](../README.md)

---

This function provides the necessary flexbility to make any API call to ANYthing

Highlight text, right-click, select: `Make HTTPS Request`

## Calls without "http" in url
This assumes the request is intented for the currently connected device, of which host details are already known.

K13225405: Common iControl REST API command examples
- https://support.f5.com/csp/article/K13225405

### simple url as string
```
/mgmt/tm/sys/clock
```

### simple url in yaml format
```
url: /mgmt/tm/sys/clock
```

### simple url in json format
```
{
"url": "/mgmt/tm/sys/clock"
}
```

### list vlans
```
/mgmt/tm/net/vlan/
```



### url post in yaml
```
url: /mgmt/shared/authn/login
method: POST
body:
username: user1
password: dobgispet
```

### url post in yaml
```
url: /mgmt/tm/sys/config
method: POST
body:
command: save
```

### list sys options
```
/mgmt/tm/sys/
```

### list sys ucs
```
/mgmt/tm/sys/ucs/
```

### url post in json
```
{
"url": "/mgmt/shared/authn/login",
"method": "POST",
"body": {
"username": "todai",
"password": "dobgispet"
}
}
```

---

## Calls for outside f5

The command will detect if the url has "http", if found, it considers it a fully qualified request destined for something outside of a device defined within the extension

Default HTTP method = GET

data, or body, must also include 'POST' HTTP method

### Simple get
```
https://api.chucknorris.io/jokes/random
```

### simple get in yaml
```
url: https://api.chucknorris.io/jokes/random
```

### simple get in yaml - shows broken response
```
url: https://broken.extra.io/whah
```

### simple POST in yaml
```
url: https://postman-echo.com/post
method: POST
data: 'hi'
```

### simple POST in json
```
{
"url": "https://postman-echo.com/post",
"method": "POST",
"data": "hi"
}
```

31 changes: 31 additions & 0 deletions README_docs/rpmMgmt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@



# ATC ILX RPM MANAGEMENT

[BACK TO MAIN README](../README.md)

---

The extension can install and un-install ILX rpms on the connected device

## Commands

* `F5: Install/Update RPM`: Installs selected ATC and version
- Updating an existing rpm to a newer version "should" work but hasn't been thoroughly tested
- Provides a list of ATC tools to install (FAST, AS3, DO, TS)
- When ATC service has been selected, a list of available version is presented
- When a version is selected, the extension will check the local cache
- if already downloaded, upload and install
- if NOT already downloaded, then download from repo, upload to device, install
- Also exposed as a right-click option in the explorer view
- This allows the selection of local ILX RPMs that may be part of a repo

* `F5: Un-Install RPM`: Un-Installs selected rpm
- Querys the device for currently installed rpm packages
- On select, issues task to delete rpm install


>**Note: the install/un-install task completes rather quickly but it can take another 20-60 seconds for restnoded/restjavad to complete the restart**

15 changes: 15 additions & 0 deletions README_docs/tools.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Tools

[BACK TO MAIN README](../README.md)

---

Additional tools included to make life easier...

## Commands


- base64 encode/decode
- json <-> yaml converter

- raw HTTP rest function?
40 changes: 36 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 1250e49

Please sign in to comment.