Version: v0.0.1 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2019 License: Apache-2.0 Imports: 9 Imported by: 0



Package servercreate makes the tool cloud agnostic with respect to creation of server. The decision will be made here to route the request to respective package based on input.



This section is empty.


This section is empty.


This section is empty.


type ServerCreateInput

type ServerCreateInput struct {
	// Name that has to be assigend to the instance which will be created.
	InstanceName string `json:"instancename"`

	// The number of instance that has to be created.
	Count int64 `json:"count"`

	// Id of the base image that has to be used for creating the vm's.
	ImageId string `json:"imageid"`

	// Id of the subnetwork in which the instance/vm has to be created.
	SubnetId string `json:"subnetid"`

	// Name of the ssh keypair that has to used for creation of vm's, and this key will be used to log into the servers.
	KeyName string `json:"keyname"`

	// Flavor defines the hardware configurations of the vm that has to be created [ex: t2.micro(aws),n1-standard-2(gcp) etc.]
	Flavor string `json:"flavor"`

	// The raw codes that has to be executed immediately after server boots up goes here.
	UserData string `json:"userdata"`

	// This defines whether a public IP has to be assigned to VM or not
	AssignPubIp bool `json:"assignpubip"`

	// All cloud info goes here
	Cloud cmn.Cloud

ServerCreateInput actually implements CreateServer and holds the data in creating server.

func New

func New() *ServerCreateInput

New returns the new ServerCreateInput instance with empty values

func (ServerCreateInput) CreateServer

func (serv ServerCreateInput) CreateServer() (ServerCreateResponse, error)

CreateServer will create the server with the requirement passed to him appropriate user and his cloud profile details which was passed while calling it.

type ServerCreateResponse

type ServerCreateResponse struct {
	// Contains filtered/unfiltered response of AWS.
	AwsResponse []server.ServerResponse `json:"AwsResponse,omitempty"`

	// Contains filtered/unfiltered response of Azure.
	AzureResponse string `json:"AzureResponse,omitempty"`

	// Default response if no inputs or matching the values required.
	DefaultResponse interface{} `json:"DefaultResponse,omitempty"`

ServerCreateResponse will return the filtered/unfiltered responses of variuos clouds.

func CreateServerMock

func CreateServerMock() (ServerCreateResponse, error)

CreateServerMock will help the user to know what all parameter CreateServer takes as part of ServerCreateInput

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL