Skip to content

vm

ArkUAPSIAVMAccessPolicy

Bases: ArkUAPSIACommonAccessPolicy

Source code in ark_sdk_python/models/services/uap/sia/vm/ark_uap_sia_vm_access_policy.py
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
class ArkUAPSIAVMAccessPolicy(ArkUAPSIACommonAccessPolicy):
    targets: Annotated[ArkUAPSIAVMPlatformTargets, Field(description='The targets of the vm access policy')]
    behavior: Annotated[ArkUAPSSIAVMBehavior, Field(description='Defines the behavior of a connection to the VM')]

    def serialize_model(self, *args, **kwargs) -> Dict[str, Any]:
        """
        Serializes the model to a dictionary, including the behavior of the VM access policy.
        """
        data = super().model_dump(*args, **kwargs)
        if self.metadata.policy_entitlement.location_type == ArkWorkspaceType.AWS and self.targets.aws_resource:
            data['targets'] = {
                'AWS': self.targets.aws_resource.model_dump(*args, **kwargs),
            }
        elif self.metadata.policy_entitlement.location_type == ArkWorkspaceType.AZURE and self.targets.azure_resource:
            data['targets'] = {
                'Azure': self.targets.azure_resource.model_dump(*args, **kwargs),
            }
        elif self.metadata.policy_entitlement.location_type == ArkWorkspaceType.GCP and self.targets.gcp_resource:
            data['targets'] = {
                'GCP': self.targets.gcp_resource.model_dump(*args, **kwargs),
            }
        elif self.metadata.policy_entitlement.location_type == ArkWorkspaceType.FQDN_IP and self.targets.fqdnip_resource:
            data['targets'] = {
                'FQDN/IP': self.targets.fqdnip_resource.model_dump(*args, **kwargs),
            }
        else:
            raise ValueError('Unsupported workspace type')
        data['behavior'] = {'connectAs': {}}
        if self.behavior.ssh_profile:
            data['behavior']['connectAs']['ssh'] = self.behavior.ssh_profile.model_dump(*args, **kwargs)
        if self.behavior.rdp_profile:
            data['behavior']['connectAs']['rdp'] = self.behavior.rdp_profile.model_dump(*args, **kwargs)
        return data

    @staticmethod
    def deserialize_model(data: Dict[str, Any], *args, **kwargs) -> 'ArkUAPSIAVMAccessPolicy':
        policy = ArkUAPSIAVMAccessPolicy.model_validate(data, *args, **kwargs)
        if 'targets' in data:
            policy.targets = ArkUAPSIAVMPlatformTargets()
            if policy.metadata.policy_entitlement.location_type == ArkWorkspaceType.AWS and 'AWS' in data['targets']:
                policy.targets.aws_resource = ArkUAPSIAVMAWSResource.model_validate(data['targets']['AWS'])
            elif policy.metadata.policy_entitlement.location_type == ArkWorkspaceType.AZURE and 'Azure' in data['targets']:
                policy.targets.azure_resource = ArkUAPSIAVMAzureResource.model_validate(data['targets']['Azure'])
            elif policy.metadata.policy_entitlement.location_type == ArkWorkspaceType.GCP and 'GCP' in data['targets']:
                policy.targets.gcp_resource = ArkUAPSIAVMGCPResource.model_validate(data['targets']['GCP'])
            elif policy.metadata.policy_entitlement.location_type == ArkWorkspaceType.FQDN_IP and 'FQDN/IP' in data['targets']:
                policy.targets.fqdnip_resource = ArkUAPSIAVMFQDNIPResource.model_validate(data['targets']['FQDN/IP'])
            else:
                raise ValueError('Workspace type not found')
        if 'behavior' in data:
            policy.behavior = ArkUAPSSIAVMBehavior()
            if 'connectAs' in data['behavior']:
                if 'ssh' in data['behavior']['connectAs']:
                    policy.behavior.ssh_profile = ArkUAPSSIAVMSSHProfile.model_validate(data['behavior']['connectAs']['ssh'])
                if 'rdp' in data['behavior']['connectAs']:
                    policy.behavior.rdp_profile = ArkUAPSSIAVMRDPProfile.model_validate(data['behavior']['connectAs']['rdp'])
        return policy

serialize_model(*args, **kwargs)

Serializes the model to a dictionary, including the behavior of the VM access policy.

Source code in ark_sdk_python/models/services/uap/sia/vm/ark_uap_sia_vm_access_policy.py
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
def serialize_model(self, *args, **kwargs) -> Dict[str, Any]:
    """
    Serializes the model to a dictionary, including the behavior of the VM access policy.
    """
    data = super().model_dump(*args, **kwargs)
    if self.metadata.policy_entitlement.location_type == ArkWorkspaceType.AWS and self.targets.aws_resource:
        data['targets'] = {
            'AWS': self.targets.aws_resource.model_dump(*args, **kwargs),
        }
    elif self.metadata.policy_entitlement.location_type == ArkWorkspaceType.AZURE and self.targets.azure_resource:
        data['targets'] = {
            'Azure': self.targets.azure_resource.model_dump(*args, **kwargs),
        }
    elif self.metadata.policy_entitlement.location_type == ArkWorkspaceType.GCP and self.targets.gcp_resource:
        data['targets'] = {
            'GCP': self.targets.gcp_resource.model_dump(*args, **kwargs),
        }
    elif self.metadata.policy_entitlement.location_type == ArkWorkspaceType.FQDN_IP and self.targets.fqdnip_resource:
        data['targets'] = {
            'FQDN/IP': self.targets.fqdnip_resource.model_dump(*args, **kwargs),
        }
    else:
        raise ValueError('Unsupported workspace type')
    data['behavior'] = {'connectAs': {}}
    if self.behavior.ssh_profile:
        data['behavior']['connectAs']['ssh'] = self.behavior.ssh_profile.model_dump(*args, **kwargs)
    if self.behavior.rdp_profile:
        data['behavior']['connectAs']['rdp'] = self.behavior.rdp_profile.model_dump(*args, **kwargs)
    return data

ArkUAPSIAVMFilters

Bases: ArkUAPFilters

This module defines filters specific to the SIA VM policies within the UAP (Unified Access Policies) service.

You can set the following fields:

  • policy_type: Optional[List[ArkUAPPolicyType]] A list of policy types to filter the policies by.

  • policy_tags: Optional[List[str]] A list of policy tags to filter the policies by.

  • identities: Optional[List[str]] A list of identities to filter the policies by.

  • status: Optional[List[ArkUAPStatusType]] A list of policy statuses to filter the policies by.

  • text_search: Optional[str] A text value to apply as a search filter across policies.

  • show_editable_policies: Optional[bool] Whether to show only policies that are editable by the current user.

Source code in ark_sdk_python/models/services/uap/sia/vm/ark_uap_sia_vm_filters.py
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
class ArkUAPSIAVMFilters(ArkUAPFilters):
    """
    This module defines filters specific to the SIA VM policies
    within the UAP (Unified Access Policies) service.

    You can set the following fields:

    - policy_type: Optional[List[ArkUAPPolicyType]]
        A list of policy types to filter the policies by.

    - policy_tags: Optional[List[str]]
        A list of policy tags to filter the policies by.

    - identities: Optional[List[str]]
        A list of identities to filter the policies by.

    - status: Optional[List[ArkUAPStatusType]]
        A list of policy statuses to filter the policies by.

    - text_search: Optional[str]
        A text value to apply as a search filter across policies.

    - show_editable_policies: Optional[bool]
        Whether to show only policies that are editable by the current user.
    """

    target_category: List[ArkCategoryType] = Field(default=[ArkCategoryType.VM], description="Target category is fixed to SIA VM")

    def __setattr__(self, name: str, value: List[ArkCategoryType]) -> None:
        if name == 'target_category' and value != [ArkCategoryType.VM]:
            raise ValueError('target_category is final and cannot be modified.')
        super().__setattr__(name, value)

ArkUAPSIAVMPlatformTargets

Bases: ArkCamelizedModel

Represents the targets for a virtual machine access policy, which can include AWS, Azure, GCP, or fqdn/ip resources.

Source code in ark_sdk_python/models/services/uap/sia/vm/ark_uap_sia_vm_targets.py
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
class ArkUAPSIAVMPlatformTargets(ArkCamelizedModel):
    """
    Represents the targets for a virtual machine access policy, which can include AWS, Azure, GCP, or fqdn/ip resources.
    """

    aws_resource: Annotated[
        Optional[ArkUAPSIAVMAWSResource], Field(description='The AWS resource for this virtual machine access policy')
    ] = None
    azure_resource: Annotated[
        Optional[ArkUAPSIAVMAzureResource], Field(description='The Azure resource for this virtual machine access policy')
    ] = None
    gcp_resource: Annotated[
        Optional[ArkUAPSIAVMGCPResource], Field(description='The GCP resource for this virtual machine access policy')
    ] = None
    fqdnip_resource: Annotated[
        Optional[ArkUAPSIAVMFQDNIPResource], Field(description='The FQDN/IP resource for this virtual machine access policy')
    ] = None

ArkUAPSSIAVMBehavior

Bases: ArkCamelizedModel

Defines the behavior of a virtual machine access policy, including SSH and RDP profiles.

Source code in ark_sdk_python/models/services/uap/sia/vm/ark_uap_sia_vm_behavior.py
54
55
56
57
58
59
60
61
62
63
64
class ArkUAPSSIAVMBehavior(ArkCamelizedModel):
    """
    Defines the behavior of a virtual machine access policy, including SSH and RDP profiles.
    """

    ssh_profile: Annotated[
        Optional[ArkUAPSSIAVMSSHProfile], Field(description='The SSH profile for this virtual machine access policy')
    ] = None
    rdp_profile: Annotated[
        Optional[ArkUAPSSIAVMRDPProfile], Field(description='The RDP profile for this virtual machine access policy')
    ] = None