dep

package
v1.9.0-beta Latest Latest
Warning

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

Go to latest
Published: Oct 17, 2021 License: MIT Imports: 10 Imported by: 5

Documentation

Index

Constants

View Source
const (
	XServerProtocolVersionHeader = "X-Server-Protocol-Version"
	XServerProtocolVersion       = "3"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Account

type Account struct {
	ServerName    string `json:"server_name"`
	ServerUUID    string `json:"server_uuid"`
	AdminID       string `json:"admin_id"`
	FacilitatorID string `json:"facilitator_id,omitempty"` //deprecated
	OrgName       string `json:"org_name"`
	OrgEmail      string `json:"org_email"`
	OrgPhone      string `json:"org_phone"`
	OrgAddress    string `json:"org_address"`
	OrgID         string `json:"org_id"`
	OrgIDHash     string `json:"org_id_hash"`
	URLs          []URL  `json:"urls"`
	OrgType       string `json:"org_type"`
	OrgVersion    string `json:"org_version"`
}

type ActivationLockRequest added in v1.8.0

type ActivationLockRequest struct {
	Device string `json:"device"`

	//  If the escrow key is not provided, the device will be locked to the person who created the MDM server in the portal.
	// https://developer.apple.com/documentation/devicemanagement/device_assignment/activation_lock_a_device/creating_and_using_bypass_codes
	// The EscrowKey is a hex-encoded PBKDF2 derivation of the bypass code. See activationlock.BypassCode.
	EscrowKey string `json:"escrow_key"`

	LostMessage string `json:"lost_message"`
}

type ActivationLockResponse added in v1.8.0

type ActivationLockResponse struct {
	SerialNumber string `json:"serial_number"`
	Status       string `json:"response_status"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(p OAuthParameters, opts ...Option) *Client

func (*Client) Account

func (c *Client) Account() (*Account, error)

func (*Client) ActivationLock added in v1.8.0

func (c *Client) ActivationLock(alr ActivationLockRequest) (*ActivationLockResponse, error)

func (*Client) AssignProfile

func (c *Client) AssignProfile(uuid string, serials ...string) (*ProfileResponse, error)

func (*Client) DefineProfile

func (c *Client) DefineProfile(request *Profile) (*ProfileResponse, error)

func (*Client) DeviceDetails

func (c *Client) DeviceDetails(serials ...string) (*DeviceDetailsResponse, error)

func (*Client) FetchDevices

func (c *Client) FetchDevices(opts ...DeviceRequestOption) (*DeviceResponse, error)

func (*Client) FetchProfile

func (c *Client) FetchProfile(uuid string) (*Profile, error)

func (*Client) RemoveProfile

func (c *Client) RemoveProfile(serials ...string) (map[string]string, error)

func (*Client) SyncDevices

func (c *Client) SyncDevices(cursor string, opts ...DeviceRequestOption) (*DeviceResponse, error)

type Device

type Device struct {
	SerialNumber       string    `json:"serial_number"`
	Model              string    `json:"model"`
	Description        string    `json:"description"`
	Color              string    `json:"color"`
	AssetTag           string    `json:"asset_tag,omitempty"`
	ProfileStatus      string    `json:"profile_status"`
	ProfileUUID        string    `json:"profile_uuid,omitempty"`
	ProfileAssignTime  time.Time `json:"profile_assign_time,omitempty"`
	ProfilePushTime    time.Time `json:"profile_push_time,omitempty"`
	DeviceAssignedDate time.Time `json:"device_assigned_date,omitempty"`
	DeviceAssignedBy   string    `json:"device_assigned_by,omitempty"`
	OS                 string    `json:"os,omitempty"`
	DeviceFamily       string    `json:"device_family,omitempty"`
	// sync fields
	OpType string    `json:"op_type,omitempty"`
	OpDate time.Time `json:"op_date,omitempty"`
	// details fields
	ResponseStatus string `json:"response_status,omitempty"`
}

type DeviceDetailsResponse

type DeviceDetailsResponse struct {
	Devices map[string]Device `json:"devices"`
}

type DeviceRequestOption

type DeviceRequestOption func(*deviceRequestOpts) error

DeviceRequestOption is an optional parameter for the DeviceService API. The option can be used to set Cursor or Limit options for the request.

func Cursor

func Cursor(cursor string) DeviceRequestOption

Cursor is an optional argument that can be added to FetchDevices

func Limit

func Limit(limit int) DeviceRequestOption

Limit is an optional argument that can be passed to FetchDevices and SyncDevices

type DeviceResponse

type DeviceResponse struct {
	Devices      []Device  `json:"devices"`
	Cursor       string    `json:"cursor"`
	FetchedUntil time.Time `json:"fetched_until"`
	MoreToFollow bool      `json:"more_to_follow"`
}

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

type LimitDict

type LimitDict struct {
	Default int `json:"default"`
	Maximum int `json:"maximum"`
}

type OAuthParameters

type OAuthParameters struct {
	ConsumerKey    string `json:"consumer_key"`
	ConsumerSecret string `json:"consumer_secret"`
	AccessToken    string `json:"access_token"`
	AccessSecret   string `json:"access_secret"`
}

type Option

type Option func(*Client)

func WithHTTPClient

func WithHTTPClient(client HTTPClient) Option

func WithServerURL

func WithServerURL(baseURL *url.URL) Option

type Profile

type Profile struct {
	ProfileName           string   `json:"profile_name"`
	ProfileUUID           string   `json:"profile_uuid,omitempty"`
	URL                   string   `json:"url"`
	AllowPairing          bool     `json:"allow_pairing,omitempty"`
	IsSupervised          bool     `json:"is_supervised,omitempty"`
	IsMultiUser           bool     `json:"is_multi_user,omitempty"`
	IsMandatory           bool     `json:"is_mandatory,omitempty"`
	AwaitDeviceConfigured bool     `json:"await_device_configured,omitempty"`
	IsMDMRemovable        bool     `json:"is_mdm_removable"`
	SupportPhoneNumber    string   `json:"support_phone_number,omitempty"`
	AutoAdvanceSetup      bool     `json:"auto_advance_setup,omitempty"`
	SupportEmailAddress   string   `json:"support_email_address,omitempty"`
	OrgMagic              string   `json:"org_magic"`
	AnchorCerts           []string `json:"anchor_certs,omitempty"`
	SupervisingHostCerts  []string `json:"supervising_host_certs,omitempty"`
	SkipSetupItems        []string `json:"skip_setup_items,omitempty"`
	Department            string   `json:"department,omitempty"`
	Devices               []string `json:"devices"`
	Language              string   `json:"language,omitempty"`
	Region                string   `json:"region,omitempty"`
	ConfigurationWebURL   string   `json:"configuration_web_url,omitempty"`
}

type ProfileResponse

type ProfileResponse struct {
	ProfileUUID string            `json:"profile_uuid"`
	Devices     map[string]string `json:"devices"`
}

type URL

type URL struct {
	URI        string    `json:"uri"`
	HTTPMethod []string  `json:"http_method"`
	Limit      LimitDict `json:"limit"`
}

Jump to

Keyboard shortcuts

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