jamf

package module
v0.0.0-...-fb40135 Latest Latest
Warning

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

Go to latest
Published: Nov 27, 2020 License: MIT Imports: 8 Imported by: 1

README

Jamf API in Go

Install

import "github.com/sioncojp/go-jamf-api"

Usage

sample code: examples

Get auth token in curl

$ curl -u username:password -X POST "https://xxxxx.jamfcloud.com/uapi/auth/tokens"
$ token=xxxxx
$ curl -X GET -H "Content-Type: application/json" -H "Authorization: Bearer $token" "https://xxxxx.jamfcloud.com/uapi/v1/departments"

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Building

type Building struct {
	Id             *string `json:"id,omitempty"` // The response type to be returned is a string
	Name           *string `json:"name,omitempty"`
	StreetAddress1 *string `json:"streetAddress1,omitempty"`
	StreetAddress2 *string `json:"streetAddress2,omitempty"`
	City           *string `json:"city,omitempty"`
	StateProvince  *string `json:"stateProvince,omitempty"`
	ZipPostalCode  *string `json:"zipPostalCode,omitempty"`
	Country        *string `json:"country,omitempty"`
	Href           *string `json:"href,omitempty"`
}

func (*Building) GetCity

func (d *Building) GetCity() string

func (*Building) GetCountry

func (d *Building) GetCountry() string

func (*Building) GetId

func (d *Building) GetId() string

func (*Building) GetName

func (d *Building) GetName() string

func (*Building) GetStateProvince

func (d *Building) GetStateProvince() string

func (*Building) GetStreetAddress1

func (d *Building) GetStreetAddress1() string

func (*Building) GetStreetAddress2

func (d *Building) GetStreetAddress2() string

func (*Building) GetZipPostalCode

func (d *Building) GetZipPostalCode() string

func (*Building) SetCity

func (d *Building) SetCity(v string)

func (*Building) SetCountry

func (d *Building) SetCountry(v string)

func (*Building) SetId

func (d *Building) SetId(v string)

Buildings

func (*Building) SetName

func (d *Building) SetName(v string)

func (*Building) SetStateProvince

func (d *Building) SetStateProvince(v string)

func (*Building) SetStreetAddress1

func (d *Building) SetStreetAddress1(v string)

func (*Building) SetStreetAddress2

func (d *Building) SetStreetAddress2(v string)

func (*Building) SetZipPostalCode

func (d *Building) SetZipPostalCode(v string)

type Category

type Category struct {
	Id       *string `json:"id,omitempty"` // The response type to be returned is a string
	Name     *string `json:"name,omitempty"`
	Priority *int    `json:"priority,omitempty"`
	Href     *string `json:"href,omitempty"`
}

func (*Category) GetId

func (d *Category) GetId() string

func (*Category) GetName

func (d *Category) GetName() string

func (*Category) GetPriority

func (d *Category) GetPriority() int

func (*Category) SetId

func (d *Category) SetId(v string)

Categories

func (*Category) SetName

func (d *Category) SetName(v string)

func (*Category) SetPriority

func (d *Category) SetPriority(v int)

type Client

type Client struct {

	// The Http Client that is used to make requests
	HttpClient       *http.Client
	HttpRetryTimeout time.Duration

	// Option to specify extra headers like User-Agent
	ExtraHeader map[string]string
	// contains filtered or unexported fields
}

Client ... stores an object to talk with Jamf API

func NewClient

func NewClient(username, password, url string) (*Client, error)

NewClient ... returns a new jamf.Client which can be used to access the API

func (*Client) CreateBuilding

func (c *Client) CreateBuilding(name, sa1, sa2, city, sp, zpc, country *string) (*Building, error)

func (*Client) CreateCategory

func (c *Client) CreateCategory(name *string, priority *int) (*Category, error)

func (*Client) CreateDepartment

func (c *Client) CreateDepartment(name *string) (*Department, error)

func (*Client) DeleteBuilding

func (c *Client) DeleteBuilding(name string) error

func (*Client) DeleteCategory

func (c *Client) DeleteCategory(name string) error

func (*Client) DeleteDepartment

func (c *Client) DeleteDepartment(name string) error

func (*Client) GetBuilding

func (c *Client) GetBuilding(id string) (data *Building, err error)

func (*Client) GetBuildingByName

func (c *Client) GetBuildingByName(name string) (data *Building, err error)

func (*Client) GetBuildingIdByName

func (c *Client) GetBuildingIdByName(name string) (string, error)

func (*Client) GetBuildings

func (c *Client) GetBuildings() (data *ResponseBuildings, err error)

func (*Client) GetCategories

func (c *Client) GetCategories() (data *ResponseCategories, err error)

func (*Client) GetCategory

func (c *Client) GetCategory(id string) (data *Category, err error)

func (*Client) GetCategoryByName

func (c *Client) GetCategoryByName(name string) (data *Category, err error)

func (*Client) GetCategoryIdByName

func (c *Client) GetCategoryIdByName(name string) (string, error)

func (*Client) GetDepartment

func (c *Client) GetDepartment(id string) (data *Department, err error)

func (*Client) GetDepartmentByName

func (c *Client) GetDepartmentByName(name string) (data *Department, err error)

func (*Client) GetDepartmentIdByName

func (c *Client) GetDepartmentIdByName(name string) (string, error)

func (*Client) GetDepartments

func (c *Client) GetDepartments() (data *ResponseDepartments, err error)

func (*Client) UpdateBuilding

func (c *Client) UpdateBuilding(d *Building) (*Building, error)

func (*Client) UpdateCategory

func (c *Client) UpdateCategory(d *Category) (*Category, error)

func (*Client) UpdateDepartment

func (c *Client) UpdateDepartment(d *Department) (*Department, error)

type Department

type Department struct {
	Id   *string `json:"id,omitempty"` // The response type to be returned is a string
	Name *string `json:"name,omitempty"`
	Href *string `json:"href,omitempty"`
}

func (*Department) GetId

func (d *Department) GetId() string

func (*Department) GetName

func (d *Department) GetName() string

func (*Department) SetId

func (d *Department) SetId(v string)

Departments

func (*Department) SetName

func (d *Department) SetName(v string)

type ResponseAuthToken

type ResponseAuthToken struct {
	Token   *string `json:"token,omitempty"`
	Expires *int    `json:"expires,omitempty"`
}

type ResponseBuildings

type ResponseBuildings struct {
	TotalCount *int       `json:"totalCount,omitempty"`
	Results    []Building `json:"results,omitempty"`
}

type ResponseCategories

type ResponseCategories struct {
	TotalCount *int       `json:"totalCount,omitempty"`
	Results    []Category `json:"results,omitempty"`
}

type ResponseDepartments

type ResponseDepartments struct {
	TotalCount *int         `json:"totalCount,omitempty"`
	Results    []Department `json:"results,omitempty"`
}

Directories

Path Synopsis
In curl: curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token" "$jssurl/uapi/v1/departments" -d "{\"name\": \"hoge\"}"
In curl: curl -X POST -H "Content-Type: application/json" -H "Authorization: Bearer $token" "$jssurl/uapi/v1/departments" -d "{\"name\": \"hoge\"}"

Jump to

Keyboard shortcuts

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