objc2_virtualization/generated/
VZMacOSRestoreImage.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_class!(
11    /// VZMacOSRestoreImage describes a version of macOS to be installed to a virtual machine.
12    ///
13    /// A VZMacOSRestoreImage object can be created by loading an installation media file. A VZMacOSInstaller
14    /// object must be initialized with this VZMacOSRestoreImage object in order to install the operating
15    /// system onto a virtual machine.
16    ///
17    /// Loading a restore image requires the app to have the "com.apple.security.virtualization" entitlement.
18    ///
19    /// See also: VZMacHardwareModel
20    ///
21    /// See also: VZMacOSInstaller
22    ///
23    /// See also: VZMacOSConfigurationRequirements
24    ///
25    /// See also [Apple's documentation](https://developer.apple.com/documentation/virtualization/vzmacosrestoreimage?language=objc)
26    #[unsafe(super(NSObject))]
27    #[derive(Debug, PartialEq, Eq, Hash)]
28    pub struct VZMacOSRestoreImage;
29);
30
31extern_conformance!(
32    unsafe impl NSObjectProtocol for VZMacOSRestoreImage {}
33);
34
35impl VZMacOSRestoreImage {
36    extern_methods!(
37        #[unsafe(method(new))]
38        #[unsafe(method_family = new)]
39        pub unsafe fn new() -> Retained<Self>;
40
41        #[unsafe(method(init))]
42        #[unsafe(method_family = init)]
43        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
44
45        #[cfg(feature = "block2")]
46        /// Load a restore image from a file on the local file system.
47        ///
48        /// Parameter `fileURL`: A file URL indicating the macOS restore image to load.
49        ///
50        /// Parameter `completionHandler`: Block called after the restore image has successfully loaded or has failed to load.
51        /// The error parameter passed to the block is nil if the restore image was loaded successfully.
52        /// The completion handler will be invoked on an arbitrary thread.
53        ///
54        /// VZMacOSRestoreImage can load IPSW installation media from a local file. If the fileURL parameter does not refer to
55        /// a local file, an exception will be raised.
56        #[unsafe(method(loadFileURL:completionHandler:))]
57        #[unsafe(method_family = none)]
58        pub unsafe fn loadFileURL_completionHandler(
59            file_url: &NSURL,
60            completion_handler: &block2::DynBlock<dyn Fn(*mut VZMacOSRestoreImage, *mut NSError)>,
61        );
62
63        #[cfg(feature = "block2")]
64        /// Fetch the latest restore image supported by this host from the network.
65        ///
66        /// Parameter `completionHandler`: Block called after the restore image fetch has succeeded or failed.
67        /// The error parameter passed to the block is nil if the restore image was fetched successfully.
68        /// The completion handler will be invoked on an arbitrary thread.
69        ///
70        /// A VZMacOSInstaller object must be constructed with a VZMacOSRestoreImage loaded from a file on the local
71        /// filesystem. A VZMacOSRestoreImage fetched with the fetchLatestSupportedWithCompletionHandler method
72        /// will have a URL property referring to a restore image on the network. To use such a restore image, the
73        /// file referred to by the URL property should be downloaded locally (using NSURLSession or similar API). After
74        /// the restore image has been downloaded, a VZMacOSInstaller can be initialized using a URL referring to the
75        /// local file.
76        #[unsafe(method(fetchLatestSupportedWithCompletionHandler:))]
77        #[unsafe(method_family = none)]
78        pub unsafe fn fetchLatestSupportedWithCompletionHandler(
79            completion_handler: &block2::DynBlock<dyn Fn(*mut VZMacOSRestoreImage, *mut NSError)>,
80        );
81
82        /// Whether this restore image is supported on the current host.
83        #[unsafe(method(isSupported))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn isSupported(&self) -> bool;
86
87        /// The URL of this restore image.
88        ///
89        /// If the restore image was loaded using +[VZMacOSRestoreImage loadFileURL:completionHandler:], the value of this property will be a file URL.
90        /// If the restore image was fetched using +[VZMacOSRestoreImage fetchLatestSupportedWithCompletionHandler:],
91        /// the value of this property will be a network URL referring to an installation media file.
92        #[unsafe(method(URL))]
93        #[unsafe(method_family = none)]
94        pub unsafe fn URL(&self) -> Retained<NSURL>;
95
96        /// The build version this restore image contains.
97        #[unsafe(method(buildVersion))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn buildVersion(&self) -> Retained<NSString>;
100
101        /// The operating system version this restore image contains.
102        #[unsafe(method(operatingSystemVersion))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn operatingSystemVersion(&self) -> NSOperatingSystemVersion;
105
106        #[cfg(feature = "VZMacOSConfigurationRequirements")]
107        /// The configuration requirements for the most featureful configuration supported by the current host and by this restore image.
108        ///
109        /// A VZMacOSRestoreImage can contain installation media for multiple Mac hardware models (VZMacHardwareModel). Some of these
110        /// hardware models may not be supported by the current host. The mostFeaturefulSupportedConfiguration property can be used to
111        /// determine the hardware model and configuration requirements that will provide the most complete feature set on the current
112        /// host. If none of the hardware models are supported on the current host, this property is nil.
113        #[unsafe(method(mostFeaturefulSupportedConfiguration))]
114        #[unsafe(method_family = none)]
115        pub unsafe fn mostFeaturefulSupportedConfiguration(
116            &self,
117        ) -> Option<Retained<VZMacOSConfigurationRequirements>>;
118    );
119}