Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] SALTO-7103 add JAMF disk encryption configuration support #6976

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/jamf-adapter/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ export const RESULTS = 'results'
export const OS_X_CONFIGURATION_PROFILE_TYPE_NAME = 'os_x_configuration_profile'
export const MOBILE_DEVICE_CONFIGURATION_PROFILE_TYPE_NAME = 'mobile_device_configuration_profile'
export const MAC_APPLICATION_TYPE_NAME = 'mac_application'
export const DISK_ENCRYPTION_CONFIGURATION_TYPE_NAME = 'disk_encryption_configuration'
6 changes: 6 additions & 0 deletions packages/jamf-adapter/src/definitions/deploy/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
CATEGORY_TYPE_NAME,
CLASS_TYPE_NAME,
DEPARTMENT_TYPE_NAME,
DISK_ENCRYPTION_CONFIGURATION_TYPE_NAME,
MAC_APPLICATION_TYPE_NAME,
MOBILE_DEVICE_CONFIGURATION_PROFILE_TYPE_NAME,
OS_X_CONFIGURATION_PROFILE_TYPE_NAME,
Expand Down Expand Up @@ -45,6 +46,11 @@ const createCustomizations = (userConfig: UserConfig): Record<string, InstanceDe
add: adjustPolicyOnDeploy,
modify: adjustPolicyOnDeploy,
}),
[DISK_ENCRYPTION_CONFIGURATION_TYPE_NAME]: createClassicApiDefinitionsForType(
userConfig,
DISK_ENCRYPTION_CONFIGURATION_TYPE_NAME,
'diskencryptionconfigurations',
),
[OS_X_CONFIGURATION_PROFILE_TYPE_NAME]: createClassicApiDefinitionsForType(
userConfig,
OS_X_CONFIGURATION_PROFILE_TYPE_NAME,
Expand Down
62 changes: 62 additions & 0 deletions packages/jamf-adapter/src/definitions/fetch/fetch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import {
OS_X_CONFIGURATION_PROFILE_TYPE_NAME,
MOBILE_DEVICE_CONFIGURATION_PROFILE_TYPE_NAME,
MAC_APPLICATION_TYPE_NAME,
DISK_ENCRYPTION_CONFIGURATION_TYPE_NAME,
} from '../../constants'
import * as transforms from './transforms'

Expand Down Expand Up @@ -63,6 +64,67 @@ const createCustomizations = (
},
},
},
[`${DISK_ENCRYPTION_CONFIGURATION_TYPE_NAME}_single`]: {
requests: [
{
endpoint: {
path: '/JSSResource/diskencryptionconfigurations/id/{id}',
client: 'classicApi',
},
transformation: {
root: 'disk_encryption_configuration',
},
},
],
},

[DISK_ENCRYPTION_CONFIGURATION_TYPE_NAME]: {
requests: [
{
endpoint: {
path: '/JSSResource/diskencryptionconfigurations',
// TODON need to enter into /JSSResource/diskencryptionconfigurations/id/{id} + see how to point to them
client: 'classicApi',
},
transformation: {
root: 'disk_encryption_configurations',
},
},
],
resource: {
directFetch: true,
recurseInto: {
full: {
context: {
args: {
id: {
root: 'id',
},
},
},
typeName: `${DISK_ENCRYPTION_CONFIGURATION_TYPE_NAME}_single`,
},
},
mergeAndTransform: {
root: 'full',
},
},
element: {
topLevel: {
isTopLevel: true,
elemID: { parts: DEFAULT_ID_PARTS },
serviceUrl: {
baseUrl,
path: '/diskEncryptions.html?id={id}',
},
},
fieldCustomizations: {
id: {
hide: true,
},
},
},
},
[DEPARTMENT_TYPE_NAME]: {
requests: [
{
Expand Down
6 changes: 6 additions & 0 deletions packages/jamf-adapter/src/definitions/references.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { ReferenceContextStrategies, CustomReferenceSerializationStrategyName, O
import {
CATEGORY_TYPE_NAME,
CLASS_TYPE_NAME,
DISK_ENCRYPTION_CONFIGURATION_TYPE_NAME,
MAC_APPLICATION_TYPE_NAME,
MOBILE_DEVICE_CONFIGURATION_PROFILE_TYPE_NAME,
OS_X_CONFIGURATION_PROFILE_TYPE_NAME,
Expand All @@ -30,6 +31,11 @@ const REFERENCE_RULES: referenceUtils.FieldReferenceDefinition<
serializationStrategy: 'id',
target: { type: CATEGORY_TYPE_NAME },
},
{
src: { field: 'disk_encryption_configuration_id', parentTypes: ['policy__disk_encryption'] },
serializationStrategy: 'id',
target: { type: DISK_ENCRYPTION_CONFIGURATION_TYPE_NAME },
},
// idAndNameObject must come before id strategy, we need idAndNameObject for resolution
{
src: {
Expand Down
1 change: 1 addition & 0 deletions packages/jamf-adapter/test/adapter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ describe('adapter', () => {
'jamf.department',
'jamf.department.instance.farkash_first_department2@s',
'jamf.department.instance.farkash_first_department@s',
'jamf.disk_encryption_configuration',
'jamf.mac_application',
'jamf.mobile_device_configuration_profile',
'jamf.os_x_configuration_profile',
Expand Down