Partially golang implement of openstack keystone client.

Keystone client

Introduction

The openapi folder is generated from keystone.yaml(i.e. the OAS) using openapi-generator-cli.

Another OAS token.json is not used for now because the openapi-generator-cli v5.3.0 does not support object combinations(oneOf, anyOf and allOf), in which case brings too much complexity.

The options parameter in some APIs is not supported.

Build

docker run --rm -v $(pwd)/keystone.yaml:/tmp/keystone.yaml -v $(pwd):/tmp/keystone openapitools/openapi-generator-cli generate -i /tmp/keystone.yaml -g go -o /tmp/keystone/openapi
rm -f ./openapi/go.mod ./openapi/go.sum

Note

For openapi-generator-cli does not support oneOf schema, define OneOfstringprojectResponse in model_project_get.go

type OneOfstringprojectResponse interface{}

Usage

// Build client
config := openapi.NewConfiguration()
client, err := keystone.NewClient(config)
if err != nil {
    panic(err)
}

// Authenticate
domain := "default"
scope := model.NewDomainScope(&domain, nil)
user := "drone"
cred := model.NewPasswordCredential(nil, &user, "password", &domain, nil)
response, err := client.Auth.Authenticate(scope, cred)

if err != nil {
    fmt.Printf("%v\n", response)
    fmt.Printf("%v\n", err)
    panic(err)
}
fmt.Println(client.Token)

// API Call
resp, r, err := client.DomainApi.ListDomain(context.TODO()).Execute()

How to change the server configuration?

Default

The client uses the first server (index=0) defined in OAS by default.

Change server index

By specifying the server index, client will use corresponding server configuration defined in OAS.

// Build the client
serverIndex := 1
config := openapi.NewConfiguration()
client, err := keystone.NewClientWithServerIndex(config, serverIndex)

// Authentication is omitted.

// API Call
ctx := context.WithValue(context.TODO(), openapi.ContextServerIndex, serverIndex)
resp, r, err := client.DomainApi.ListDomain(ctx).Execute()

Change manually in code

Just edit the config object.

config := openapi.NewConfiguration()
config.Servers = openapi.ServerConfigurations{{
    URL:         "localhost:8000",
    Description: "local test",
    Variables:   nil,
}}
client, err := keystone.NewClient(config)
Similar Resources

Go language interface to Swift / Openstack Object Storage / Rackspace cloud files (golang)

Swift This package provides an easy to use library for interfacing with Swift / Openstack Object Storage / Rackspace cloud files from the Go Language

Nov 9, 2022

K8s-cinder-csi-plugin - K8s Pod Use Openstack Cinder Volume

k8s-cinder-csi-plugin K8s Pod Use Openstack Cinder Volume openstack volume list

Jul 18, 2022

Forklift: an API application developed with go that enables virtual server migration from vcenter virtualization environment to openstack environment

Forklift: an API application developed with go that enables virtual server migration from vcenter virtualization environment to openstack environment

What is the Forklift? Forklift is an API application developed with go that enables virtual server migration from vcenter virtualization environment t

Jan 14, 2022

Openstack Invalid HTTPS Cert Scanner

Openstack Invalid HTTPS Cert Scanner Scans all OpenStack API endpoints in a given catalog and warns about legacy HTTPS certificates that do not list t

Jan 18, 2022

others implement usefuls stuff in their free time. I implement an eventstore framework

Eventstore eventstore is a library where I try out new stuff related to an eventstore as a single point of truth. At the moment I'm writing this it's

Nov 10, 2022

redis client implement by golang, inspired by jedis.

godis redis client implement by golang, refers to jedis. this library implements most of redis command, include normal redis command, cluster command,

Dec 6, 2022

This repository contains a set of tools to help you implement IndieAuth, both server and client, in Go.

This repository contains a set of tools to help you implement IndieAuth, both server and client, in Go.

Nov 26, 2022

A bytecode-based virtual machine to implement scripting/filtering support in your golang project.

eval-filter Implementation Scripting Facilities Types Built-In Functions Conditionals Loops Functions Case/Switch Use Cases Security Denial of service

Dec 30, 2022

Use Golang to implement PHP's common built-in functions.

PHP2Go Use Golang to implement PHP's common built-in functions. About 140+ functions have been implemented. Install go get github.com/syyongx/php2go R

Dec 28, 2022

A bytecode-based virtual machine to implement scripting/filtering support in your golang project.

eval-filter Implementation Scripting Facilities Types Built-In Functions Conditionals Loops Functions Case/Switch Use Cases Security Denial of service

Jan 8, 2023

chia-blockchain some function implement in golang

gochia chia-blockchain some function implement in golang Package bls-signatures implement blspy Usage? Now we can use it to generate plot memo and id,

May 27, 2022

Golang implement of MapReduce

 Golang implement of MapReduce

mapreduce implement in Golang, EE447 Final Project

May 17, 2021

EvilEye is a BeaconEye implement in Golang.

EvilEye is a BeaconEye implement in Golang.

EvilEye is a BeaconEye implement in Golang. Try & Run download EvilEye in releases ./EvilEye.exe Screenshot Build go install github.com/akkuma

Jan 6, 2023

golang implement gossip algorithm

golang implement gossip algorithm

golang implement gossip algorithm

Dec 1, 2022

A SigFlip implement in golang

gSigFlip A SigFlip implement in golang, SigFlip is a tool for patching authenticode signed PE files (exe, dll, sys ..etc) in a way that doesn't affect

Nov 15, 2022

Golang code-generators used to implement Kubernetes-style API types.

code-generator Golang code-generators used to implement Kubernetes-style API types. Purpose These code-generators can be used in the context of Custom

Dec 30, 2022

Build a TodoList with Go Design and implement a backend RESTful service in golang with CRUD

May we ask Igor to do a little project in leu of sample code? If there is a hire, the hours spent should be invoiced, so please keep track of that. Th

May 5, 2022

An unofficial package in Golang to help developers implement ZATCA (Fatoora) QR code easily.

Zatca SDK GO An unofficial package in Golang to help developers to implement ZATCA (Fatoora) QR code easily which required for e-invoicing ✅ The hash

Jan 1, 2023

Implement clean-architecture sample by golang

Implement clean-architecture sample by golang

Feb 17, 2022
Golang Cafe - Go job board with no recruiters and clear salary ranges

Golang Cafe Golang Cafe is the first Go job board with no recruiters & clear salary ranges. Clear salary range in each job description No third party

Jan 6, 2023
Nwg-drawer is a golang replacement to the nwggrid command (a part of nwg-launchers).
Nwg-drawer is a golang replacement to the nwggrid command (a part of nwg-launchers).

Nwg-drawer is a golang replacement to the nwggrid command (a part of nwg-launchers). It's being developed with sway in mind, but should also work with other wlroots-based Wayland compositors. X Window System is not supported.

Dec 23, 2022
go:embed and the golang-standards project layout

An example of using the golang-standards project layout and the go:embed directive.

May 17, 2022
Epitech BSQ in Golang
Epitech BSQ in Golang

EPITECH BSQ in Golang BSQ GO What is BSQ ? The goal of the project is to find the biggest square on a map while avoiding obstacles. The file map is pa

Mar 7, 2022
Simple scaffolding for board or turn based games in Golang

Go-boardgame Go-boardgame is a simple Go package that can be used as the scaffolding to write the game logic for any board or turn based game. Status

May 26, 2022
This repository contains my Golang practice

Golang Practice Repository This repository contains my practice code for Golang. Each exercise includes a README for running the application. NOTE: TH

Nov 28, 2021
Golang Demo - simple API to get top ranking repos from online csv file

README Generator Description A Demo Golang project, topics : Simple Http Server Get csv from endpoint Convert csv to struct sort slice of struct filte

Dec 3, 2021
A set of example golang code to start learning Go

Working with Go View online at: https://mkaz.blog/working-with-go/ Working with Go is a set of examples for Go (golang) to help an experienced program

Dec 23, 2022
An open-source project for managing OpenStack resources and OpenStack infrastructure in a Kubernetes cluster

kupenStack Kubernetes-Native OpenStack A Sandbox Project. Have you used OpenStack before? If so, then for you KupenStack is magic ✨ that lets you use

Nov 11, 2021
A CLI to replace your git commit command, so your git message can partially follow the Conventional Changelog ecosystem
A CLI to replace your git commit command, so your git message can partially follow the Conventional Changelog ecosystem

COMMIT CLI A CLI to replace your git commit command, so your git message can partially follow the Conventional Changelog ecosystem. And yes, it is bui

Feb 9, 2022