Documentation
¶
Overview ¶
Package devicegroups provides typed access to Jamf Platform devicegroups API endpoints.
Index ¶
- Variables
- func PrivilegesFor(method string) (jamfplatform.MethodPrivileges, bool)
- type ApiErrorCauseRepresentation
- type ApiErrorRepresentation
- type Client
- func (c *Client) CreateDeviceGroup(ctx context.Context, request *DeviceGroupCreateRepresentationV1) (*HrefRepresentation, error)
- func (c *Client) DeleteDeviceGroup(ctx context.Context, id string) error
- func (c *Client) GetDeviceGroup(ctx context.Context, id string) (*DeviceGroupReadRepresentationV1, error)
- func (c *Client) ListDeviceGroupMembers(ctx context.Context, id string) ([]string, error)
- func (c *Client) ListDeviceGroups(ctx context.Context, sort []string, filter string) ([]DeviceGroupListReadRepresentationV1, error)
- func (c *Client) ListDeviceGroupsForDevice(ctx context.Context, deviceID string) ([]DeviceGroupMemberOfRepresentationV1, error)
- func (c *Client) ResolveDeviceGroupByName(ctx context.Context, name string) (*DeviceGroupListReadRepresentationV1, error)
- func (c *Client) ResolveDeviceGroupIDByName(ctx context.Context, name string) (string, error)
- func (c *Client) UpdateDeviceGroup(ctx context.Context, id string, request *DeviceGroupUpdateRepresentationV1) error
- func (c *Client) UpdateDeviceGroupMembers(ctx context.Context, id string, ...) error
- type DeviceGroupCreateRepresentationV1
- type DeviceGroupCriteriaRepresentationV1
- type DeviceGroupListReadRepresentationV1
- type DeviceGroupMemberOfRepresentationV1
- type DeviceGroupMemberPatchRepresentationV1
- type DeviceGroupReadRepresentationV1
- type DeviceGroupUpdateRepresentationV1
- type DeviceTypeV1
- type GroupTypeV1
- type HrefRepresentation
- type JoinTypeV1
- type ListDeviceGroupMemberOfResponseRepresentation
- type ListDeviceGroupMemberReadRepresentation
- type ListResponseRepresentation
- type PaginatedDeviceGroupResponseRepresentation
- type PaginatedResponseRepresentation
Constants ¶
This section is empty.
Variables ¶
var Privileges = map[string]jamfplatform.MethodPrivileges{ "CreateDeviceGroup": {Method: "CreateDeviceGroup", HTTPMethod: "POST", Path: "/v1/device-groups", Scopes: []jamfplatform.ScopeKind{jamfplatform.ScopeEnvironment}, ScopesSource: "spec", Scoped: []string{"device-groups:create"}, Legacy: nil, Source: "spec"}, "DeleteDeviceGroup": {Method: "DeleteDeviceGroup", HTTPMethod: "DELETE", Path: "/v1/device-groups/{id}", Scopes: []jamfplatform.ScopeKind{jamfplatform.ScopeEnvironment}, ScopesSource: "spec", Scoped: []string{"device-groups:delete"}, Legacy: nil, Source: "spec"}, "GetDeviceGroup": {Method: "GetDeviceGroup", HTTPMethod: "GET", Path: "/v1/device-groups/{id}", Scopes: []jamfplatform.ScopeKind{jamfplatform.ScopeEnvironment}, ScopesSource: "spec", Scoped: []string{"device-groups:read"}, Legacy: nil, Source: "spec"}, "ListDeviceGroupMembers": {Method: "ListDeviceGroupMembers", HTTPMethod: "GET", Path: "/v1/device-groups/{id}/members", Scopes: []jamfplatform.ScopeKind{jamfplatform.ScopeEnvironment}, ScopesSource: "spec", Scoped: []string{"device-groups:read"}, Legacy: nil, Source: "spec"}, "ListDeviceGroups": {Method: "ListDeviceGroups", HTTPMethod: "GET", Path: "/v1/device-groups", Scopes: []jamfplatform.ScopeKind{jamfplatform.ScopeEnvironment}, ScopesSource: "spec", Scoped: []string{"device-groups:read"}, Legacy: nil, Source: "spec"}, "ListDeviceGroupsForDevice": {Method: "ListDeviceGroupsForDevice", HTTPMethod: "GET", Path: "/v1/devices/{id}/device-groups", Scopes: []jamfplatform.ScopeKind{jamfplatform.ScopeEnvironment}, ScopesSource: "spec", Scoped: []string{"device-groups:read"}, Legacy: nil, Source: "spec"}, "UpdateDeviceGroup": {Method: "UpdateDeviceGroup", HTTPMethod: "PATCH", Path: "/v1/device-groups/{id}", Scopes: []jamfplatform.ScopeKind{jamfplatform.ScopeEnvironment}, ScopesSource: "spec", Scoped: []string{"device-groups:update"}, Legacy: nil, Source: "spec"}, "UpdateDeviceGroupMembers": {Method: "UpdateDeviceGroupMembers", HTTPMethod: "PATCH", Path: "/v1/device-groups/{id}/members", Scopes: []jamfplatform.ScopeKind{jamfplatform.ScopeEnvironment}, ScopesSource: "spec", Scoped: []string{"device-groups:update"}, Legacy: nil, Source: "spec"}, }
Privileges maps each devicegroups SDK method name to the Jamf API privileges it requires, sourced from the x-required-privileges vendor extensions in the Jamf OpenAPI specs. Identifiers are GA capability permissions in {capability}:{action} form and a multi-entry Scoped slice means all of them are required.
Source names where each entry's Scoped set came from: "spec" for the operation's own x-required-privileges, "gateway-policy" for one the published spec omits and this SDK supplies from the gateway's authorization policy, and "" when Scoped is empty. An empty Scoped slice means nothing declares a privilege for the endpoint, which is NOT the same as none being required — see jamfplatform.MethodPrivileges. Do not render it as "no permission needed".
Scopes lists the scope kinds each endpoint accepts. It is an alternatives set: a client carries one scope, so a consumer needs a credential matching one of the listed kinds. ScopesSource names where the set came from — "spec" for the spec root's own x-scope-types, "config-override" for one this SDK supplies because the published spec understates what the gateway serves or declares no extension at all. A spec-sourced set is what the spec declares, which for the Platform APIs is currently stricter than the gateway — see jamfplatform.MethodPrivileges.
Synthetic Resolve<X>ByName / Apply<X> methods are not present; document the privileges of the operations they call instead.
Functions ¶
func PrivilegesFor ¶
func PrivilegesFor(method string) (jamfplatform.MethodPrivileges, bool)
PrivilegesFor returns the privilege metadata for the named SDK method and true when the method is present in the registry, or the zero value and false otherwise.
Types ¶
type ApiErrorCauseRepresentation ¶
type ApiErrorCauseRepresentation struct {
// Error-specific code that can be used to identify localization string, etc.
Code string `json:"code"`
// A general description of error for troubleshooting/debugging. Generally this text should not be
// displayed to a user; instead refer to errorCode and its localized text.
Description string `json:"description"`
// Name of the field that caused the error.
Field string `json:"field"`
// id of object with error. Optional.
ID string `json:"id"`
}
ApiErrorCauseRepresentation represents a api error cause representation.
type ApiErrorRepresentation ¶
type ApiErrorRepresentation struct {
Errors []ApiErrorCauseRepresentation `json:"errors"`
// HTTP status of the response.
HttpStatus int `json:"httpStatus"`
TraceID string `json:"traceId"`
}
ApiErrorRepresentation represents a api error representation.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides typed methods for devicegroups operations.
func New ¶
func New(base *jamfplatform.Client) *Client
New creates a devicegroups client that shares the authenticated transport of the given root client.
func (*Client) CreateDeviceGroup ¶
func (c *Client) CreateDeviceGroup(ctx context.Context, request *DeviceGroupCreateRepresentationV1) (*HrefRepresentation, error)
CreateDeviceGroup create a new device group.
Required privileges: device-groups:create.
func (*Client) DeleteDeviceGroup ¶
DeleteDeviceGroup delete a device group.
Required privileges: device-groups:delete.
Parameters:
- id: The ID of the device group, in UUID format.
func (*Client) GetDeviceGroup ¶
func (c *Client) GetDeviceGroup(ctx context.Context, id string) (*DeviceGroupReadRepresentationV1, error)
GetDeviceGroup get a device group by ID.
Required privileges: device-groups:read.
Parameters:
- id: The ID of the device group, in UUID format.
func (*Client) ListDeviceGroupMembers ¶
ListDeviceGroupMembers get group members.
Required privileges: device-groups:read.
Parameters:
- id: The ID of the device group, in UUID format.
func (*Client) ListDeviceGroups ¶
func (c *Client) ListDeviceGroups(ctx context.Context, sort []string, filter string) ([]DeviceGroupListReadRepresentationV1, error)
ListDeviceGroups get all device groups.
Required privileges: device-groups:read.
Parameters:
- sort: Fields to sort by and their orders. Fields allowed for sorting: `name`, `description`, `deviceType`, `groupType`.
- filter: Filter query in RSQL format. Includes all results, by default. Fields allowed in the query: `name`, `description`, `deviceType`, `groupType`. This param can be combined with paging. Example: `name=="*Managed*" and deviceType=="MOBILE"`.
func (*Client) ListDeviceGroupsForDevice ¶
func (c *Client) ListDeviceGroupsForDevice(ctx context.Context, deviceID string) ([]DeviceGroupMemberOfRepresentationV1, error)
ListDeviceGroupsForDevice get device groups for a device.
Required privileges: device-groups:read.
Parameters:
- deviceID: The ID of the device, in UUID format.
func (*Client) ResolveDeviceGroupByName ¶
func (c *Client) ResolveDeviceGroupByName(ctx context.Context, name string) (*DeviceGroupListReadRepresentationV1, error)
ResolveDeviceGroupByName looks up a DeviceGroup by its name field and returns the decoded resource. Shares the same HTTP call as the ID-only variant; error semantics are identical.
func (*Client) ResolveDeviceGroupIDByName ¶
ResolveDeviceGroupIDByName looks up a DeviceGroup by its name field and returns the ID. Returns *APIResponseError with HasStatus(404) when no match exists, or *AmbiguousMatchError when multiple resources share the name.
func (*Client) UpdateDeviceGroup ¶
func (c *Client) UpdateDeviceGroup(ctx context.Context, id string, request *DeviceGroupUpdateRepresentationV1) error
UpdateDeviceGroup update a device group.
Required privileges: device-groups:update.
Parameters:
- id: The ID of the device group, in UUID format.
func (*Client) UpdateDeviceGroupMembers ¶
func (c *Client) UpdateDeviceGroupMembers(ctx context.Context, id string, request *DeviceGroupMemberPatchRepresentationV1) error
UpdateDeviceGroupMembers update device group members.
Required privileges: device-groups:update.
Parameters:
- id: The ID of the device group, in UUID format.
type DeviceGroupCreateRepresentationV1 ¶
type DeviceGroupCreateRepresentationV1 struct {
// The criteria used to calculate the group's members. Can only be used if `groupType` is `SMART`.
Criteria *[]DeviceGroupCriteriaRepresentationV1 `json:"criteria,omitempty"`
// Description of the device group.
Description *string `json:"description,omitempty"`
// Type of device.
DeviceType DeviceTypeV1 `json:"deviceType"`
// Type of the device group.
GroupType GroupTypeV1 `json:"groupType"`
// The IDs of the devices to be added to the group, in UUID format. Can only be used if `groupType` is
// `STATIC`.
Members *[]string `json:"members,omitempty"`
// Name of the device group.
Name string `json:"name"`
}
DeviceGroupCreateRepresentationV1 represents a device group create representation v1.
type DeviceGroupCriteriaRepresentationV1 ¶
type DeviceGroupCriteriaRepresentationV1 struct {
// Name of the attribute used in the criteria.
AttributeName string `json:"attributeName"`
// Value of the attribute used in the criteria.
AttributeValue string `json:"attributeValue"`
// Indicates if the criteria ends with a closing parenthesis.
HasClosingParenthesis *bool `json:"hasClosingParenthesis,omitempty"`
// Indicates if the criteria starts with an opening parenthesis.
HasOpeningParenthesis *bool `json:"hasOpeningParenthesis,omitempty"`
// Type of join for criteria.
JoinType JoinTypeV1 `json:"joinType"`
// Operator used for the criteria.
Operator string `json:"operator"`
// Order of the criteria in the group. All criteria must have a unique, sequential order starting from
// 0.
Order int `json:"order"`
}
DeviceGroupCriteriaRepresentationV1 represents a device group criteria representation v1.
type DeviceGroupListReadRepresentationV1 ¶
type DeviceGroupListReadRepresentationV1 struct {
// Description of the device group.
Description string `json:"description"`
// Type of device.
DeviceType DeviceTypeV1 `json:"deviceType"`
// Type of the device group.
GroupType GroupTypeV1 `json:"groupType"`
// The ID of the device group, in UUID format.
ID string `json:"id"`
// Number of devices in the group.
MemberCount int `json:"memberCount"`
// Name of the device group.
Name string `json:"name"`
}
DeviceGroupListReadRepresentationV1 represents a device group list read representation v1.
type DeviceGroupMemberOfRepresentationV1 ¶
type DeviceGroupMemberOfRepresentationV1 struct {
// The ID of the device group, in UUID format.
GroupID string `json:"groupId"`
// Name of the device group.
GroupName string `json:"groupName"`
}
DeviceGroupMemberOfRepresentationV1 represents a device group member of representation v1.
type DeviceGroupMemberPatchRepresentationV1 ¶
type DeviceGroupMemberPatchRepresentationV1 struct {
// List of device IDs to be added to the group, in UUID format.
Added *[]string `json:"added,omitempty"`
// List of device IDs to be removed from the group, in UUID format.
Removed *[]string `json:"removed,omitempty"`
}
DeviceGroupMemberPatchRepresentationV1 represents a device group member patch representation v1.
type DeviceGroupReadRepresentationV1 ¶
type DeviceGroupReadRepresentationV1 struct {
// Criteria used to calculate the group's members, if applicable.
Criteria *[]DeviceGroupCriteriaRepresentationV1 `json:"criteria,omitempty"`
// Description of the device group.
Description string `json:"description"`
// Type of device.
DeviceType DeviceTypeV1 `json:"deviceType"`
// Type of the device group.
GroupType GroupTypeV1 `json:"groupType"`
// The ID of the device group, in UUID format.
ID string `json:"id"`
// Number of devices in the group.
MemberCount int `json:"memberCount"`
// Name of the device group.
Name string `json:"name"`
}
DeviceGroupReadRepresentationV1 represents a device group read representation v1.
type DeviceGroupUpdateRepresentationV1 ¶
type DeviceGroupUpdateRepresentationV1 struct {
// The criteria used to calculate the group's members. Can only be used if `groupType` is `SMART`.
Criteria *[]DeviceGroupCriteriaRepresentationV1 `json:"criteria,omitempty"`
// Description of the device group.
Description *string `json:"description,omitempty"`
// Name of the device group.
Name *string `json:"name,omitempty"`
}
DeviceGroupUpdateRepresentationV1 represents a device group update representation v1.
type DeviceTypeV1 ¶
type DeviceTypeV1 = string
DeviceTypeV1 represents a device type v1 value.
const ( DeviceTypeV1Computer DeviceTypeV1 = "COMPUTER" DeviceTypeV1Mobile DeviceTypeV1 = "MOBILE" )
DeviceTypeV1 values accepted by the Jamf API. The alias above is a string, so these constants pass to any parameter or field declared as a plain string.
func DeviceTypeV1Values ¶
func DeviceTypeV1Values() []DeviceTypeV1
DeviceTypeV1Values returns every value the Jamf API accepts for DeviceTypeV1, in the order the spec declares them. Returns a fresh slice per call, so no caller can corrupt the set for the rest of the process — which a package level var would allow. Suits attribute validation (Terraform's stringvalidator.OneOf, say) and anything that needs to enumerate the set rather than name one member.
type GroupTypeV1 ¶
type GroupTypeV1 = string
GroupTypeV1 represents a group type v1 value.
const ( GroupTypeV1Smart GroupTypeV1 = "SMART" GroupTypeV1Static GroupTypeV1 = "STATIC" )
GroupTypeV1 values accepted by the Jamf API. The alias above is a string, so these constants pass to any parameter or field declared as a plain string.
func GroupTypeV1Values ¶
func GroupTypeV1Values() []GroupTypeV1
GroupTypeV1Values returns every value the Jamf API accepts for GroupTypeV1, in the order the spec declares them. Returns a fresh slice per call, so no caller can corrupt the set for the rest of the process — which a package level var would allow. Suits attribute validation (Terraform's stringvalidator.OneOf, say) and anything that needs to enumerate the set rather than name one member.
type HrefRepresentation ¶
type HrefRepresentation struct {
// URL of the resource.
Href string `json:"href"`
// The ID of the resource, in UUID format.
ID string `json:"id"`
}
HrefRepresentation represents a href representation.
type JoinTypeV1 ¶
type JoinTypeV1 = string
JoinTypeV1 represents a join type v1 value.
const ( JoinTypeV1And JoinTypeV1 = "AND" JoinTypeV1Or JoinTypeV1 = "OR" )
JoinTypeV1 values accepted by the Jamf API. The alias above is a string, so these constants pass to any parameter or field declared as a plain string.
func JoinTypeV1Values ¶
func JoinTypeV1Values() []JoinTypeV1
JoinTypeV1Values returns every value the Jamf API accepts for JoinTypeV1, in the order the spec declares them. Returns a fresh slice per call, so no caller can corrupt the set for the rest of the process — which a package level var would allow. Suits attribute validation (Terraform's stringvalidator.OneOf, say) and anything that needs to enumerate the set rather than name one member.
type ListDeviceGroupMemberOfResponseRepresentation ¶
type ListDeviceGroupMemberOfResponseRepresentation struct {
// List of device groups for the specified device.
Results []DeviceGroupMemberOfRepresentationV1 `json:"results"`
// Total number of results across all pages.
TotalCount int `json:"totalCount"`
}
ListDeviceGroupMemberOfResponseRepresentation represents a list device group member of response representation.
type ListDeviceGroupMemberReadRepresentation ¶
type ListDeviceGroupMemberReadRepresentation struct {
// List of device group members.
Results []string `json:"results"`
// Total number of results across all pages.
TotalCount int `json:"totalCount"`
}
ListDeviceGroupMemberReadRepresentation represents a list device group member read representation.
type ListResponseRepresentation ¶
type ListResponseRepresentation struct {
// Total number of results across all pages.
TotalCount int `json:"totalCount"`
}
ListResponseRepresentation represents a list response representation.
type PaginatedDeviceGroupResponseRepresentation ¶
type PaginatedDeviceGroupResponseRepresentation struct {
// Whether there is a next page.
HasNext bool `json:"hasNext"`
// Whether there is a previous page.
HasPrevious bool `json:"hasPrevious"`
// Current page number (0-based).
Page int `json:"page"`
// Number of items per page.
PageSize int `json:"pageSize"`
// List of device groups for the current page.
Results []DeviceGroupListReadRepresentationV1 `json:"results"`
// Total number of results across all pages.
TotalCount int `json:"totalCount"`
// Total number of pages.
TotalPages int `json:"totalPages"`
}
PaginatedDeviceGroupResponseRepresentation represents a paginated device group response representation.
type PaginatedResponseRepresentation ¶
type PaginatedResponseRepresentation struct {
// Whether there is a next page.
HasNext bool `json:"hasNext"`
// Whether there is a previous page.
HasPrevious bool `json:"hasPrevious"`
// Current page number (0-based).
Page int `json:"page"`
// Number of items per page.
PageSize int `json:"pageSize"`
// Total number of results across all pages.
TotalCount int `json:"totalCount"`
// Total number of pages.
TotalPages int `json:"totalPages"`
}
PaginatedResponseRepresentation represents a paginated response representation.