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
31unsafe impl NSObjectProtocol for VZMacOSRestoreImage {}
32
33impl VZMacOSRestoreImage {
34    extern_methods!(
35        #[unsafe(method(new))]
36        #[unsafe(method_family = new)]
37        pub unsafe fn new() -> Retained<Self>;
38
39        #[unsafe(method(init))]
40        #[unsafe(method_family = init)]
41        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
42
43        #[cfg(feature = "block2")]
44        /// Load a restore image from a file on the local file system.
45        ///
46        /// Parameter `fileURL`: A file URL indicating the macOS restore image to load.
47        ///
48        /// Parameter `completionHandler`: Block called after the restore image has successfully loaded or has failed to load.
49        /// The error parameter passed to the block is nil if the restore image was loaded successfully.
50        /// The completion handler will be invoked on an arbitrary thread.
51        ///
52        /// VZMacOSRestoreImage can load IPSW installation media from a local file. If the fileURL parameter does not refer to
53        /// a local file, an exception will be raised.
54        #[unsafe(method(loadFileURL:completionHandler:))]
55        #[unsafe(method_family = none)]
56        pub unsafe fn loadFileURL_completionHandler(
57            file_url: &NSURL,
58            completion_handler: &block2::Block<dyn Fn(*mut VZMacOSRestoreImage, *mut NSError)>,
59        );
60
61        #[cfg(feature = "block2")]
62        /// Fetch the latest restore image supported by this host from the network.
63        ///
64        /// Parameter `completionHandler`: Block called after the restore image fetch has succeeded or failed.
65        /// The error parameter passed to the block is nil if the restore image was fetched successfully.
66        /// The completion handler will be invoked on an arbitrary thread.
67        ///
68        /// A VZMacOSInstaller object must be constructed with a VZMacOSRestoreImage loaded from a file on the local
69        /// filesystem. A VZMacOSRestoreImage fetched with the fetchLatestSupportedWithCompletionHandler method
70        /// will have a URL property referring to a restore image on the network. To use such a restore image, the
71        /// file referred to by the URL property should be downloaded locally (using NSURLSession or similar API). After
72        /// the restore image has been downloaded, a VZMacOSInstaller can be initialized using a URL referring to the
73        /// local file.
74        #[unsafe(method(fetchLatestSupportedWithCompletionHandler:))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn fetchLatestSupportedWithCompletionHandler(
77            completion_handler: &block2::Block<dyn Fn(*mut VZMacOSRestoreImage, *mut NSError)>,
78        );
79
80        /// Whether this restore image is supported on the current host.
81        #[unsafe(method(isSupported))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn isSupported(&self) -> bool;
84
85        /// The URL of this restore image.
86        ///
87        /// If the restore image was loaded using +[VZMacOSRestoreImage loadFileURL:completionHandler:], the value of this property will be a file URL.
88        /// If the restore image was fetched using +[VZMacOSRestoreImage fetchLatestSupportedWithCompletionHandler:],
89        /// the value of this property will be a network URL referring to an installation media file.
90        #[unsafe(method(URL))]
91        #[unsafe(method_family = none)]
92        pub unsafe fn URL(&self) -> Retained<NSURL>;
93
94        /// The build version this restore image contains.
95        #[unsafe(method(buildVersion))]
96        #[unsafe(method_family = none)]
97        pub unsafe fn buildVersion(&self) -> Retained<NSString>;
98
99        /// The operating system version this restore image contains.
100        #[unsafe(method(operatingSystemVersion))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn operatingSystemVersion(&self) -> NSOperatingSystemVersion;
103
104        #[cfg(feature = "VZMacOSConfigurationRequirements")]
105        /// The configuration requirements for the most featureful configuration supported by the current host and by this restore image.
106        ///
107        /// A VZMacOSRestoreImage can contain installation media for multiple Mac hardware models (VZMacHardwareModel). Some of these
108        /// hardware models may not be supported by the current host. The mostFeaturefulSupportedConfiguration property can be used to
109        /// determine the hardware model and configuration requirements that will provide the most complete feature set on the current
110        /// host. If none of the hardware models are supported on the current host, this property is nil.
111        #[unsafe(method(mostFeaturefulSupportedConfiguration))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn mostFeaturefulSupportedConfiguration(
114            &self,
115        ) -> Option<Retained<VZMacOSConfigurationRequirements>>;
116    );
117}