minio/pkg/madmin
Aditya Manthramurthy a337ea4d11 Move admin APIs to new path and add redesigned heal APIs (#5351)
- Changes related to moving admin APIs
   - admin APIs now have an endpoint under /minio/admin
   - admin APIs are now versioned - a new API to server the version is
     added at "GET /minio/admin/version" and all API operations have the
     path prefix /minio/admin/v1/<operation>
   - new service stop API added
   - credentials change API is moved to /minio/admin/v1/config/credential
   - credentials change API and configuration get/set API now require TLS
     so that credentials are protected
   - all API requests now receive JSON
   - heal APIs are disabled as they will be changed substantially

- Heal API changes
   Heal API is now provided at a single endpoint with the ability for a
   client to start a heal sequence on all the data in the server, a
   single bucket, or under a prefix within a bucket.

   When a heal sequence is started, the server returns a unique token
   that needs to be used for subsequent 'status' requests to fetch heal
   results.

   On each status request from the client, the server returns heal result
   records that it has accumulated since the previous status request. The
   server accumulates upto 1000 records and pauses healing further
   objects until the client requests for status. If the client does not
   request any further records for a long time, the server aborts the
   heal sequence automatically.

   A heal result record is returned for each entity healed on the server,
   such as system metadata, object metadata, buckets and objects, and has
   information about the before and after states on each disk.

   A client may request to force restart a heal sequence - this causes
   the running heal sequence to be aborted at the next safe spot and
   starts a new heal sequence.
2018-01-22 14:54:55 -08:00
..
examples Remove upload healing related dead code (#5404) 2018-01-15 18:20:39 -08:00
api_test.go admin: Add missing madmin examples and API docs. (#3483) 2016-12-20 18:49:48 -08:00
api-error-response.go Move admin APIs to new path and add redesigned heal APIs (#5351) 2018-01-22 14:54:55 -08:00
api.go Move admin APIs to new path and add redesigned heal APIs (#5351) 2018-01-22 14:54:55 -08:00
API.md Move admin APIs to new path and add redesigned heal APIs (#5351) 2018-01-22 14:54:55 -08:00
config-commands.go Move admin APIs to new path and add redesigned heal APIs (#5351) 2018-01-22 14:54:55 -08:00
constants.go Move admin APIs to new path and add redesigned heal APIs (#5351) 2018-01-22 14:54:55 -08:00
generic-commands.go Move admin APIs to new path and add redesigned heal APIs (#5351) 2018-01-22 14:54:55 -08:00
heal-commands.go Move admin APIs to new path and add redesigned heal APIs (#5351) 2018-01-22 14:54:55 -08:00
info-commands.go Move admin APIs to new path and add redesigned heal APIs (#5351) 2018-01-22 14:54:55 -08:00
lock-commands_test.go Implement list, clear locks REST API w/ pkg/madmin support (#3491) 2017-01-03 23:39:22 -08:00
lock-commands.go Move admin APIs to new path and add redesigned heal APIs (#5351) 2018-01-22 14:54:55 -08:00
README.md Update madmin package to return storage class parity (#5387) 2018-01-12 07:52:52 +05:30
service-commands.go Move admin APIs to new path and add redesigned heal APIs (#5351) 2018-01-22 14:54:55 -08:00
utils.go Move admin APIs to new path and add redesigned heal APIs (#5351) 2018-01-22 14:54:55 -08:00
version-commands.go Move admin APIs to new path and add redesigned heal APIs (#5351) 2018-01-22 14:54:55 -08:00

Minio Admin Library. Slack

The Minio Admin Golang Client SDK provides APIs to manage Minio services.

This quickstart guide will show you how to install the Minio Admin client SDK, connect to Minio admin service, and provide a walkthrough of a simple file uploader.

This document assumes that you have a working Golang setup.

Download from Github


go get -u github.com/minio/minio/pkg/madmin

Initialize Minio Admin Client

You need four items to connect to Minio admin services.

Parameter Description
endpoint URL to object storage service.
accessKeyID Access key is the user ID that uniquely identifies your account.
secretAccessKey Secret key is the password to your account.
secure Set this value to 'true' to enable secure (HTTPS) access.

package main

import (
	"github.com/minio/minio/pkg/madmin"
	"log"
)

func main() {
	endpoint := "your-minio.example.com:9000"
	accessKeyID := "YOUR-ACCESSKEYID"
	secretAccessKey := "YOUR-SECRETKEY"
	useSSL := true

	// Initialize minio admin client object.
        madmClnt, err := madmin.New(endpoint, accessKeyID, secretAccessKey, useSSL)
	if err != nil {
		log.Fatalln(err)
	}

	log.Println("%v", madmClnt) // Minio admin client is now setup


Quick Start Example - Service Status.

This example program connects to minio server, gets the current disk status.

We will use the Minio server running at https://your-minio.example.com:9000 in this example. Feel free to use this service for testing and development. Access credentials shown in this example are open to the public.

ServiceStatus.go

package main

import (
	"log"

	"github.com/minio/minio/pkg/madmin"
)

func main() {
	endpoint := "your-minio.example.com:9000"
	accessKeyID := "YOUR-ACCESSKEYID"
	secretAccessKey := "YOUR-SECRETKEY"
	useSSL := true

	// Initialize minio admin client.
	mdmClnt, err := madmin.New(endpoint, accessKeyID, secretAccessKey, useSSL)
	if err != nil {
		log.Fatalln(err)
	}

	st, err := madmClnt.ServiceStatus()
	if err != nil {
		log.Fatalln(err)
	}
	log.Printf("%#v\n", st)

}

Run ServiceStatus


go run service-status.go
2016/12/20 16:46:01 madmin.ServiceStatusMetadata{Total:177038229504, Free:120365559808, Backend:struct { Type madmin.BackendType; OnlineDisks int; OfflineDisks int; ReadQuorum int; WriteQuorum int }{Type:1, OnlineDisks:0, OfflineDisks:0, StandardSCParity:0, RRSCParity:0}}

API Reference

API Reference : Service Operations

Full Examples

Full Examples : Service Operations

Contribute

Contributors Guide