minio/pkg/madmin
Krishnan Parthasarathi c192e5c9b2 Implement heal-upload admin API (#3914)
This API is meant for administrative tools like mc-admin to heal an
ongoing multipart upload on a Minio server.  N B This set of admin
APIs apply only for Minio servers.

`github.com/minio/minio/pkg/madmin` provides a go SDK for this (and
other admin) operations.  Specifically,

  func HealUpload(bucket, object, uploadID string, dryRun bool) error

Sample admin API request:
POST
/?heal&bucket=mybucket&object=myobject&upload-id=myuploadID&dry-run
- Header(s): ["x-minio-operation"] = "upload"

Notes:
- bucket, object and upload-id are mandatory query parameters
- if dry-run is set, API returns success if all parameters passed are
  valid.
2017-03-17 09:25:49 -07:00
..
examples Implement heal-upload admin API (#3914) 2017-03-17 09:25:49 -07:00
api-error-response.go admin: Add service Set Credentials API (#3580) 2017-01-17 14:25:59 -08:00
api.go cleanup: All conditionals simplified under pkg. (#3875) 2017-03-09 10:13:30 -08:00
API.md Implement heal-upload admin API (#3914) 2017-03-17 09:25:49 -07:00
api_test.go admin: Add missing madmin examples and API docs. (#3483) 2016-12-20 18:49:48 -08:00
config-commands.go admin: Set Config returns errSet and errMsg (#3822) 2017-03-03 02:53:48 -08:00
constants.go admin: Add missing madmin examples and API docs. (#3483) 2016-12-20 18:49:48 -08:00
generic-commands.go madmin: Do not require SSL to set credentials (#3879) 2017-03-09 14:08:33 -08:00
heal-commands.go Implement heal-upload admin API (#3914) 2017-03-17 09:25:49 -07:00
info-commands.go admin: Add ServerInfo API() (#3743) 2017-02-15 10:45:45 -08:00
lock-commands.go madmin: Fix a typo in Locks duration query name (#3673) 2017-02-01 11:46:49 -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
README.md admin: Add service Set Credentials API (#3580) 2017-01-17 14:25:59 -08:00
service-commands.go admin: Move SetCredentials from Service to Generic (#3805) 2017-02-25 11:06:08 -08:00
utils.go admin: Add service Set Credentials API (#3580) 2017-01-17 14:25:59 -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, ReadQuorum:0, WriteQuorum:0}}

API Reference

API Reference : Service Operations

Full Examples

Full Examples : Service Operations

Contribute

Contributors Guide