jamfpro

package
v0.0.10 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2023 License: MIT Imports: 6 Imported by: 553

Documentation

Overview

http_logging.go

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountDataSubsetGroup

type AccountDataSubsetGroup struct {
	ID         int                         `json:"id,omitempty" xml:"id,omitempty"`
	Name       string                      `json:"name" xml:"name"`
	Site       AccountDataSubsetSite       `json:"site,omitempty" xml:"site,omitempty"`
	Privileges AccountDataSubsetPrivileges `json:"privileges,omitempty" xml:"privileges,omitempty"`
}

type AccountDataSubsetLdapServer

type AccountDataSubsetLdapServer struct {
	ID   int    `json:"id,omitempty" xml:"id,omitempty"`
	Name string `json:"name" xml:"name"`
}

type AccountDataSubsetPrivileges

type AccountDataSubsetPrivileges struct {
	JSSObjects    []string `json:"jss_objects,omitempty" xml:"jss_objects>privilege"`
	JSSSettings   []string `json:"jss_settings,omitempty" xml:"jss_settings>privilege"`
	JSSActions    []string `json:"jss_actions,omitempty" xml:"jss_actions>privilege"`
	Recon         []string `json:"recon,omitempty" xml:"recon>privilege"`
	CasperAdmin   []string `json:"casper_admin,omitempty" xml:"casper_admin>privilege"`
	CasperRemote  []string `json:"casper_remote,omitempty" xml:"casper_remote>privilege"`
	CasperImaging []string `json:"casper_imaging,omitempty" xml:"casper_imaging>privilege"`
}

type AccountDataSubsetSite

type AccountDataSubsetSite struct {
	ID   int    `json:"id,omitempty" xml:"id,omitempty"`
	Name string `json:"name" xml:"name"`
}

type AccountDataSubsetUser

type AccountDataSubsetUser struct {
	ID   int    `json:"id,omitempty" xml:"id,omitempty"`
	Name string `json:"name,omitempty" xml:"name,omitempty"`
}

type AccountDetail

type AccountDetail struct {
	ID                  int                         `json:"id,omitempty" xml:"id,omitempty"`
	Name                string                      `json:"name" xml:"name"`
	DirectoryUser       bool                        `json:"directory_user,omitempty" xml:"directory_user,omitempty"`
	FullName            string                      `json:"full_name,omitempty" xml:"full_name,omitempty"`
	Email               string                      `json:"email,omitempty" xml:"email,omitempty"`
	EmailAddress        string                      `json:"email_address,omitempty" xml:"email_address,omitempty"`
	Enabled             string                      `json:"enabled,omitempty" xml:"enabled,omitempty"`
	LdapServer          AccountDataSubsetLdapServer `json:"ldap_server,omitempty" xml:"ldap_server,omitempty"`
	ForcePasswordChange bool                        `json:"force_password_change,omitempty" xml:"force_password_change,omitempty"`
	AccessLevel         string                      `json:"access_level,omitempty" xml:"access_level,omitempty"`
	Password            string                      `json:"password" xml:"password"`
	PrivilegeSet        string                      `json:"privilege_set,omitempty" xml:"privilege_set,omitempty"`
	Site                AccountDataSubsetSite       `json:"site,omitempty" xml:"site,omitempty"`
	Privileges          AccountDataSubsetPrivileges `json:"privileges,omitempty" xml:"privileges,omitempty"`
}

type AccountUser

type AccountUser struct {
	ID   int    `json:"id,omitempty" xml:"id,omitempty"`
	Name string `json:"name" xml:"name"`
}

type AllowedFileExtensionDetail added in v0.0.9

type AllowedFileExtensionDetail struct {
	XMLName   xml.Name `xml:"allowed_file_extension"`
	ID        int      `xml:"id"`
	Extension string   `xml:"extension"`
}

type BuildingDetail added in v0.0.8

type BuildingDetail struct {
	ID             int    `json:"id,omitempty" xml:"id"`
	Name           string `json:"name,omitempty" xml:"name"`
	StreetAddress1 string `json:"streetAddress1,omitempty" xml:"streetAddress1,omitempty"`
	StreetAddress2 string `json:"streetAddress2,omitempty" xml:"streetAddress2,omitempty"`
	City           string `json:"city,omitempty" xml:"city,omitempty"`
	StateProvince  string `json:"stateProvince,omitempty" xml:"stateProvince,omitempty"`
	ZipPostalCode  string `json:"zipPostalCode,omitempty" xml:"zipPostalCode,omitempty"`
	Country        string `json:"country,omitempty" xml:"country,omitempty"`
	Href           string `json:"href,omitempty" xml:"href,omitempty"`
}

type Client

type Client struct {
	HTTP *http_client.Client
}

func NewClient

func NewClient(baseURL string, config http_client.Config) *Client

NewClient creates a new Jamf Pro client

func (*Client) CreateAccountByID

func (c *Client) CreateAccountByID(accountDetail *AccountDetail) (*ResponseAccount, error)

CreateAccountByID creates an Account using its ID

func (*Client) CreateAllowedFileExtension added in v0.0.9

func (c *Client) CreateAllowedFileExtension(extension *AllowedFileExtensionDetail) (*AllowedFileExtensionDetail, error)

CreateAllowedFileExtension creates a new allowed file extension

func (*Client) CreateBuilding added in v0.0.9

func (c *Client) CreateBuilding(buildingDetail *BuildingDetail) (*ResponseBuilding, error)

CreateBuilding creates a new building using its ID.

func (*Client) CreateDepartment added in v0.0.10

func (c *Client) CreateDepartment(department *Department) (*Department, error)

CreateDepartment creates a new department

func (*Client) DeleteAccountByID

func (c *Client) DeleteAccountByID(id int) (*http.Response, error)

DeleteAccountByID deletes an Account using its ID and returns a response.

func (*Client) DeleteAllowedFileExtensionByID added in v0.0.9

func (c *Client) DeleteAllowedFileExtensionByID(id int) error

DeleteAllowedFileExtensionByID deletes an existing allowed file extension by ID

func (*Client) DeleteAllowedFileExtensionByName added in v0.0.9

func (c *Client) DeleteAllowedFileExtensionByName(extensionName string) error

DeleteAllowedFileExtensionByNameByID deletes an existing allowed file extension by resolving its name to an ID

func (*Client) DeleteDepartmentByID added in v0.0.10

func (c *Client) DeleteDepartmentByID(id int) error

DeleteDepartmentByID deletes an existing department by its ID

func (*Client) DeleteDepartmentByName added in v0.0.10

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

DeleteDepartmentByName deletes an existing department by its name

func (*Client) GetAccountByID

func (c *Client) GetAccountByID(id int) (*ResponseAccount, error)

GetAccountByID retrieves the Account by its ID

func (*Client) GetAccountByName

func (c *Client) GetAccountByName(name string) (*ResponseAccount, error)

GetAccountByName retrieves the Account by its name

func (*Client) GetAllowedFileExtensionByID added in v0.0.9

func (c *Client) GetAllowedFileExtensionByID(id int) (*AllowedFileExtensionDetail, error)

GetAllowedFileExtensionByID retrieves the allowed file extension by its ID

func (*Client) GetAllowedFileExtensionByName added in v0.0.9

func (c *Client) GetAllowedFileExtensionByName(extensionName string) (*AllowedFileExtensionDetail, error)

GetAllowedFileExtensionByName retrieves the allowed file extension by its name

func (*Client) GetAllowedFileExtensions added in v0.0.9

func (c *Client) GetAllowedFileExtensions() (*ResponseAllowedFileExtensionsList, error)

GetAllowedFileExtensions retrieves all allowed file extensions

func (*Client) GetBuildingByID added in v0.0.8

func (c *Client) GetBuildingByID(id int) (*ResponseBuilding, error)

GetBuildingByID retrieves the Building by its ID

func (*Client) GetBuildings added in v0.0.9

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

GetBuildings retrieves all buildings.

func (*Client) GetBuildingsByName added in v0.0.8

func (c *Client) GetBuildingsByName(name string) (*ResponseBuilding, error)

GetBuildingsByName retrieves the Building by its Name

func (*Client) GetDepartmentByID added in v0.0.10

func (c *Client) GetDepartmentByID(id string) (*Department, error)

GetDepartmentByID retrieves the department by its ID

func (*Client) GetDepartmentByName added in v0.0.10

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

GetDepartmentByName retrieves the department by its name

func (*Client) GetDepartmentIdByName added in v0.0.10

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

GetDepartmentIdByName retrieves the department ID by its name

func (*Client) GetDepartments added in v0.0.10

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

GetDepartments retrieves all departments

func (*Client) GetGroupByID added in v0.0.8

func (c *Client) GetGroupByID(id int) (*ResponseAccountGroup, error)

GetGroupByID gets an account group using its ID and returns a response.

func (*Client) GetJamfProVersion added in v0.0.10

func (c *Client) GetJamfProVersion() (*ResponseJamfProVersion, error)

func (*Client) GetSSOFailoverSettings

func (c *Client) GetSSOFailoverSettings() (*SSOFailoverResponse, error)

GetSSOFailoverSettings fetches SSO failover settings from Jamf Pro

func (*Client) UpdateAccountByID

func (c *Client) UpdateAccountByID(id int, accountDetail *AccountDetail) (*ResponseAccount, error)

UpdateAccountByID updates an Account using its ID

func (*Client) UpdateAccountByName

func (c *Client) UpdateAccountByName(name string, accountDetail *AccountDetail) (*ResponseAccount, error)

UpdateAccountByName updates an Account using its name.

func (*Client) UpdateDepartmentByID added in v0.0.10

func (c *Client) UpdateDepartmentByID(department *Department) (*Department, error)

UpdateDepartmentByID updates an existing department

func (*Client) UpdateDepartmentByName added in v0.0.10

func (c *Client) UpdateDepartmentByName(department *Department) (*Department, error)

UpdateDepartmentByName updates an existing department by its name

func (*Client) UpdateFailoverUrl

func (c *Client) UpdateFailoverUrl() (*SSOFailoverResponse, error)

UpdateFailoverUrl regenerates the failover URL by changing the failover key to a new one and returns the new failover settings.

type Department added in v0.0.10

type Department struct {
	XMLName xml.Name `xml:"department"`
	Id      string   `xml:"id"`
	Name    string   `xml:"name"`
	Href    string   `xml:"href,omitempty"`
}

type GroupDetail added in v0.0.8

type GroupDetail struct {
	ID           int                         `json:"id,omitempty" xml:"id"`
	Name         string                      `json:"name" xml:"name"`
	AccessLevel  string                      `json:"access_level" xml:"access_level"`
	PrivilegeSet string                      `json:"privilege_set" xml:"privilege_set"`
	Site         AccountDataSubsetSite       `json:"site" xml:"site"`
	Privileges   AccountDataSubsetPrivileges `json:"privileges" xml:"privileges"`
	Members      []AccountDataSubsetUser     `json:"members" xml:"members>user"`
}

type Groups

type Groups struct {
	Group []ResponseAccountGroup `json:"group,omitempty" xml:"group,omitempty"`
}

type Logger

type Logger interface {
	Trace(msg string, keysAndValues ...interface{}) // For very detailed logs
	Debug(msg string, keysAndValues ...interface{}) // For development and troubleshooting
	Info(msg string, keysAndValues ...interface{})  // Informational messages
	Warn(msg string, keysAndValues ...interface{})  // For potentially problematic situations
	Error(msg string, keysAndValues ...interface{}) // For errors that might still allow the app to continue running
	Fatal(msg string, keysAndValues ...interface{}) // For errors that might prevent the app from continuing
}

Logger is an interface for logging within the SDK.

func NewDefaultLogger

func NewDefaultLogger() Logger

NewDefaultLogger returns a new instance of the default logger.

type Privilege

type Privilege struct {
	Privilege string `json:"privilege,omitempty" xml:"privilege,omitempty"`
}

type ResponseAccount

type ResponseAccount struct {
	Account AccountDetail `json:"account"`
}

type ResponseAccountGroup

type ResponseAccountGroup struct {
	Groups []GroupDetail `json:"group"`
}

type ResponseAccountsList

type ResponseAccountsList struct {
	Users  Users  `json:"users,omitempty" xml:"users,omitempty"`
	Groups Groups `json:"groups,omitempty" xml:"groups,omitempty"`
}

type ResponseAllowedFileExtensionsList added in v0.0.9

type ResponseAllowedFileExtensionsList struct {
	XMLName               xml.Name                     `xml:"allowed_file_extensions"`
	Size                  int                          `xml:"size"`
	AllowedFileExtensions []AllowedFileExtensionDetail `xml:"allowed_file_extension"`
}

Response structure for the list of allowed file extensions

type ResponseBuilding added in v0.0.8

type ResponseBuilding BuildingDetail

ResponseBuilding is now directly the BuildingDetail

type ResponseBuildings added in v0.0.9

type ResponseBuildings struct {
	Size      int              `xml:"size"`
	Buildings []BuildingDetail `xml:"building"`
}

For multiple buildings, the structure remains the same.

type ResponseDepartments added in v0.0.10

type ResponseDepartments struct {
	XMLName    xml.Name     `xml:"departments"`
	TotalCount int          `xml:"size"`
	Results    []Department `xml:"department"`
}

Response structure for the list of departments

type ResponseJamfProVersion added in v0.0.10

type ResponseJamfProVersion struct {
	Version *string `json:"Version,omitempty"`
}

type SSOFailoverResponse

type SSOFailoverResponse struct {
	FailoverURL    string `json:"failoverUrl"`
	GenerationTime int64  `json:"generationTime"`
}

type Users

type Users struct {
	User []AccountUser `json:"user,omitempty" xml:"user,omitempty"`
}

Jump to

Keyboard shortcuts

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