// Acquire takes a console pod and the number of nodes to acquire.
// Returns:
// statusCode - the http response code
// ncisAcquired - the list of nodes acquired
// err - any error
Acquire takes a console pod and the number of nodes to acquire.
Returns:
statusCode - the http response code
ncisAcquired - the list of nodes acquired
err - any error
// Acquire takes a console pod and the number of nodes to acquire . // Returns : // statusCode - the http response code // ncisAcquired - the list of nodes acquired // err - any error
func (o *ConsoleApiOp) Acquire(cosole_pod_id string, numMtn, numRvr int) (statusCode int, ncisAcquired []NodeConsoleInfo, err error) {
	if cosole_pod_id == "" {
		return 0, nil, errors.New("cosole_pod_id is required but was empty")
	}
	uri := "http://cray-console-data/v1/consolepod/%s/acquire"
	uri = fmt.Sprintf(uri, cosole_pod_id)
	client := &http.Client{Timeout: 15 * time.Second}
	o.ReqData.NumMtn = numMtn
	o.ReqData.NumRvr = numRvr
	jsonReq, err := json.Marshal(o.ReqData)
	if err != nil {
		return 0, nil, err
	}
	httpReq, err := http.NewRequest(http.MethodPost, uri, bytes.NewBuffer(jsonReq))
	if err != nil {
		return 0, nil, err
	}
	httpReq.Header.Set("Content-Type", "application/json")
	httpResp, err := client.Do(httpReq)
	if err != nil {
		return 0, nil, err
	}
	statusCode = httpResp.StatusCode
	ncisAcquired = []NodeConsoleInfo{}
	json.NewDecoder(httpResp.Body).Decode(&ncisAcquired)
	defer httpResp.Body.Close()
	return statusCode, ncisAcquired, nil
}
func ( o * ConsoleApiOp ) Acquire ( cosole_pod_id string , numMtn , numRvr int ) ( statusCode int , ncisAcquired [ ] NodeConsoleInfo , err error ) { if cosole_pod_id == " " { return 0 , nil , errors . New ( " " ) } uri := " " uri = fmt . Sprintf ( uri , cosole_pod_id ) client := & http . Client { Timeout : 15 * time . Second } o . ReqData . NumMtn = numMtn o . ReqData . NumRvr = numRvr jsonReq , err := json . Marshal ( o . ReqData ) if err != nil { return 0 , nil , err } httpReq , err := http . NewRequest ( http . MethodPost , uri , bytes . NewBuffer ( jsonReq ) ) if err != nil { return 0 , nil , err } httpReq . Header . Set ( " " , " " ) httpResp , err := client . Do ( httpReq ) if err != nil { return 0 , nil , err } statusCode = httpResp . StatusCode ncisAcquired = [ ] NodeConsoleInfo { } json . NewDecoder ( httpResp . Body ) . Decode ( & ncisAcquired ) defer httpResp . Body . Close ( ) return statusCode , ncisAcquired , nil }
Acquire takes a console pod and the number of nodes to acquire.
Acquire takes a console pod and the number of nodes to acquire .
//log.Println("InventoryApiOp.Put() called") // Send the request //log.Printf("statusCode=%d", statusCode) // Return everything to the caller for evaluation.