OpenStack Keystone auth plugin for HTTPie
Project description
OpenStack Keystone auth plugin for HTTPie.
Installation
$ pip install --upgrade httpie-keystone-auth
You should now see keystone under --auth-type / -A in $ http --help output.
Usage
Plugin uses openstacksdk library to parse the clouds.yaml file and get the token from Keystone.
A simple example of a clouds.yaml file is:
clouds:
mycloud:
auth:
auth_url: <url of keystone endpoint>
username: <username>
password: <password>
user_domain_name: <user domain name>
project_name: <name of the project to authorize to>
project_domain_name: <domain of the project>
othercloud:
auth:
. . .
Read more about the format of the file and where to place it in openstacksdk docs
Using env var
You can set OS_CLOUD env var to a name of one of the clouds in the clouds.yaml file, which will be then used by plugin:
export OS_CLOUD=mycloud
http -A keystone devstack.local/images/v2/images
Passing cloud name explicitly
Alternatively you can pass the name of the cloud from the clouds.yaml file to use as ‘username’ to HTTPie:
https -A keystone -a myothercloud images.othercloud.com/v2/images
Using service type instead of full service URL
This plugin also simplifies working with OpenStack APIs by allowing you to specify only the service type instead of full URL, e.g
https -A keystone compute/servers
Under the hood, the plugin will check if there’s any service in the OpenStack service catalog of your cloud that has the service type as specified in the first part (netloc) of your URL, and replace this with the endpoint URL for this service as defined in the catalog for the region and endpoint type (interface) as set in your clouds.yaml. It will use API version as defined in the clouds.yaml file and openstacksdk defaults.
Additionally, instead of service type that is actually registered in the service catalog of the cloud, you can also use any of:
official service type (like block-storage)
official service type alias (like volumev3)
OpenStack community project name (like cinder)
service name as registered in the catalog (can be whatever cloud operator decided to name it)
If a single endpoint matching such criteria is found, it will be used.
OpenStack API microversions
Several OpenStack services use API microversions to alter the API behavior. The actual header is pretty long and cumbersome to type, and it can vary for some older versions of some services.
Instead, you can specify a simple header v, and appropriate microversion header will be included, together with legacy ones if required, e.g.
https -A keystone compute/servers v:2.59 -v
GET /v2.1/servers HTTP/1.1
...
OpenStack-API-Version: compute 2.59 # modern API microversion header
X-OpenStack-Nova-API-Version: 2.59 # legacy API microversion header
...
Note that this only works when using a service type etc instead of full URL.
Limitations
If you are using cloud that needs custom CA bundle file to verify the TLS connection, you will still have to pass it explicitly to HTTPie even if it is already set in the clouds.yaml file.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file httpie-keystone-auth-0.3.1.tar.gz
.
File metadata
- Download URL: httpie-keystone-auth-0.3.1.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 668f50d7a31194f63b478f3e879ac32fd1802e066b098fab8151163fd3f375b8 |
|
MD5 | 5b3d50a0557e8ec29e834d4e03ebd1c9 |
|
BLAKE2b-256 | 5f9bc9325409053613a09a6bb017d8e0bf74351852538008e4fee1997461c662 |
File details
Details for the file httpie_keystone_auth-0.3.1-py3-none-any.whl
.
File metadata
- Download URL: httpie_keystone_auth-0.3.1-py3-none-any.whl
- Upload date:
- Size: 5.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.12
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 82bdf65c2a36ff25881c701c61be56496411066d3003cc25920dec8857261b76 |
|
MD5 | ef37ff4d81c69f7ec5f74fa9f3f9e3c2 |
|
BLAKE2b-256 | 8694390f92e7f1bdacff244f0ea94a63283c4f56492f32081296e11cc0a32d6e |