delltdapi

package module
v0.0.0-...-3d7da20 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

README

DellTDAPI

This Library supports fetching Dell Tech Direct API Warranty Information

Considerations

Proxy can be set via proxyUrl in client.go as needed

Usage

//main.go
package main

import (
	"fmt"
	"github.com/vnikolin/delltdapi"
)

func main() {
	
	client, err := delltdapi.NewDellTDClient("dell-url-fqdn", "client-id", "client-secret", "client-token")
	//Example below (client-token expires every 3600 and is an optional parameter):
	//client, err := delltdapi.NewDellTDClient("apigtwb2c.us.dell.com", "123456", "654321", "")
	
	dellReturn, err := client.FetchWarrantyInfo("hostname", "asset-tag")

	if err != nil {
		fmt.Println(err)
	} else {
		fmt.Println(dellReturn)
	}
}

Documentation

Index

Constants

View Source
const (
	StatusUnauthorized        = "Unauthorized"
	StatusInternalServerError = "Server Error"
	StatusBadRequest          = "Bad Request"
	StatusConflict            = "Conflict Already Exists"
	StatusNotFound            = "Not Found"
	StatusForbidden           = "Forbidden"
)

Declaring the Constant Values

Variables

This section is empty.

Functions

This section is empty.

Types

type AssetInfo

type AssetInfo []struct {
	HostName   string
	ServiceTag string `json:"serviceTag"`
	//ProductId    string `json:"productId"`
	Entitlements []struct {
		EndDate          string `json:"endDate"`
		ServiceLevelCode string `json:"serviceLevelCode"`
	} `json:"entitlements"`
}

type DellTDClient

type DellTDClient struct {
	DellFQDN     string
	ClientId     string
	ClientSecret string
	APIToken     string

	Client *http.Client
}

DellTDClient ... Contstructor required Variables

func NewDellTDClient

func NewDellTDClient(target string, username string, password string, apiToken string) (*DellTDClient, error)

NewDellTDClient ... Initializes the Constructor with the above variables

func (*DellTDClient) FetchWarrantyInfo

func (c *DellTDClient) FetchWarrantyInfo(hostName string, assetTag string) (AssetInfo, error)

FetchDellTD

func (*DellTDClient) QueryData

func (c *DellTDClient) QueryData(call string, link string, data []byte) ([]byte, http.Header, int, error)

queryData ... will make REST verbs based on the url

type TokenInfo

type TokenInfo struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
	ExpiresIn   int    `json:"expires_in"`
	Scope       string `json:"oob"`
}

TokenInfo from API

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL