Skip to main content

azure_lite_rs/types/
functions.rs

1//! Types for the Azure Functions API (v1).
2//!
3//! Auto-generated from the Azure ARM REST Specification.
4//! **Do not edit manually** — modify the manifest and re-run codegen.
5
6use serde::{Deserialize, Serialize};
7use std::collections::HashMap;
8
9/// Configuration for an Azure Function App.
10///
11/// **Azure API**: `functions.v1.FunctionAppSiteConfig`
12/// **Reference**: <https://learn.microsoft.com/en-us/rest/api/appservice//FunctionAppSiteConfig>
13#[derive(Debug, Clone, Default, Serialize, Deserialize)]
14#[serde(rename_all = "camelCase")]
15pub struct FunctionAppSiteConfig {
16    /// Number of workers
17    #[serde(skip_serializing_if = "Option::is_none")]
18    pub number_of_workers: Option<i32>,
19
20    /// .NET Framework version
21    #[serde(skip_serializing_if = "Option::is_none")]
22    pub net_framework_version: Option<String>,
23
24    /// Linux app framework and version (e.g. PYTHON|3.11)
25    #[serde(skip_serializing_if = "Option::is_none")]
26    pub linux_fx_version: Option<String>,
27
28    /// App command line to launch
29    #[serde(skip_serializing_if = "Option::is_none")]
30    pub app_command_line: Option<String>,
31}
32
33impl FunctionAppSiteConfig {
34    #[cfg(any(test, feature = "test-support"))]
35    /// Create a fixture instance for testing.
36    pub fn fixture() -> Self {
37        Self {
38            number_of_workers: Some(100),
39            net_framework_version: Some("test-net_framework_version".into()),
40            linux_fx_version: Some("test-linux_fx_version".into()),
41            app_command_line: Some("test-app_command_line".into()),
42        }
43    }
44}
45
46/// Properties of a Function App site resource.
47///
48/// **Azure API**: `functions.v1.FunctionAppProperties`
49/// **Reference**: <https://learn.microsoft.com/en-us/rest/api/appservice//FunctionAppProperties>
50#[derive(Debug, Clone, Default, Serialize, Deserialize)]
51#[serde(rename_all = "camelCase")]
52pub struct FunctionAppProperties {
53    /// Current state of the app (Running, Stopped, etc.)
54    #[serde(skip_serializing_if = "Option::is_none")]
55    pub state: Option<String>,
56
57    /// Hostnames associated with the app
58    #[serde(default)]
59    #[serde(skip_serializing_if = "Vec::is_empty")]
60    pub host_names: Vec<String>,
61
62    /// Default hostname of the app
63    #[serde(skip_serializing_if = "Option::is_none")]
64    pub default_host_name: Option<String>,
65
66    /// Kind of resource (functionapp, linux)
67    #[serde(skip_serializing_if = "Option::is_none")]
68    pub kind: Option<String>,
69
70    /// Resource group the app belongs to
71    #[serde(skip_serializing_if = "Option::is_none")]
72    pub resource_group: Option<String>,
73
74    /// Resource ID of the hosting plan
75    #[serde(skip_serializing_if = "Option::is_none")]
76    pub server_farm_id: Option<String>,
77
78    /// Configuration of the app
79    #[serde(skip_serializing_if = "Option::is_none")]
80    pub site_config: Option<FunctionAppSiteConfig>,
81}
82
83impl FunctionAppProperties {
84    #[cfg(any(test, feature = "test-support"))]
85    /// Create a fixture instance for testing.
86    pub fn fixture() -> Self {
87        Self {
88            state: Some("test-state".into()),
89            host_names: vec![],
90            default_host_name: Some("test-default_host_name".into()),
91            kind: Some("test-kind".into()),
92            resource_group: Some("test-resource_group".into()),
93            server_farm_id: Some("test-server_farm_id".into()),
94            site_config: Some(FunctionAppSiteConfig::fixture()),
95        }
96    }
97}
98
99/// A Function App resource (Azure Web Sites Site).
100///
101/// **Azure API**: `functions.v1.FunctionApp`
102/// **Reference**: <https://learn.microsoft.com/en-us/rest/api/appservice//FunctionApp>
103#[derive(Debug, Clone, Default, Serialize, Deserialize)]
104#[serde(rename_all = "camelCase")]
105pub struct FunctionApp {
106    /// Fully qualified resource ID
107    #[serde(skip_serializing_if = "Option::is_none")]
108    pub id: Option<String>,
109
110    /// The name of the resource
111    #[serde(skip_serializing_if = "Option::is_none")]
112    pub name: Option<String>,
113
114    /// The type of the resource
115    #[serde(rename = "type")]
116    #[serde(skip_serializing_if = "Option::is_none")]
117    pub r#type: Option<String>,
118
119    /// Resource location
120    #[serde(skip_serializing_if = "Option::is_none")]
121    pub location: Option<String>,
122
123    /// Resource tags
124    #[serde(default)]
125    #[serde(skip_serializing_if = "HashMap::is_empty")]
126    pub tags: HashMap<String, String>,
127
128    /// Kind of resource
129    #[serde(skip_serializing_if = "Option::is_none")]
130    pub kind: Option<String>,
131
132    /// Function App properties
133    #[serde(skip_serializing_if = "Option::is_none")]
134    pub properties: Option<FunctionAppProperties>,
135}
136
137impl FunctionApp {
138    #[cfg(any(test, feature = "test-support"))]
139    /// Create a fixture instance for testing.
140    pub fn fixture() -> Self {
141        Self {
142            id: Some("test-id".into()),
143            name: Some("test-function_app".into()),
144            r#type: Some("test-type".into()),
145            location: Some("test-location".into()),
146            tags: Default::default(),
147            kind: Some("test-kind".into()),
148            properties: Some(FunctionAppProperties::fixture()),
149        }
150    }
151}
152
153/// Result of a list Function Apps operation.
154///
155/// **Azure API**: `functions.v1.FunctionAppListResult`
156/// **Reference**: <https://learn.microsoft.com/en-us/rest/api/appservice//FunctionAppListResult>
157#[derive(Debug, Clone, Default, Serialize, Deserialize)]
158#[serde(rename_all = "camelCase")]
159pub struct FunctionAppListResult {
160    /// List of Function Apps
161    #[serde(default)]
162    #[serde(skip_serializing_if = "Vec::is_empty")]
163    pub value: Vec<FunctionApp>,
164
165    /// Link to next page of results
166    #[serde(skip_serializing_if = "Option::is_none")]
167    pub next_link: Option<String>,
168}
169
170impl FunctionAppListResult {
171    #[cfg(any(test, feature = "test-support"))]
172    /// Create a fixture instance for testing.
173    pub fn fixture() -> Self {
174        Self {
175            value: vec![],
176            next_link: Some("test-next_link".into()),
177        }
178    }
179}
180
181/// Properties for creating or updating a Function App.
182///
183/// **Azure API**: `functions.v1.FunctionAppCreateOrUpdateProperties`
184/// **Reference**: <https://learn.microsoft.com/en-us/rest/api/appservice//FunctionAppCreateOrUpdateProperties>
185#[derive(Debug, Clone, Default, Serialize, Deserialize)]
186#[serde(rename_all = "camelCase")]
187pub struct FunctionAppCreateOrUpdateProperties {
188    /// Resource ID of the App Service Plan (hosting plan)
189    #[serde(skip_serializing_if = "Option::is_none")]
190    pub server_farm_id: Option<String>,
191
192    /// Configuration of the app
193    #[serde(skip_serializing_if = "Option::is_none")]
194    pub site_config: Option<FunctionAppSiteConfig>,
195}
196
197impl FunctionAppCreateOrUpdateProperties {
198    #[cfg(any(test, feature = "test-support"))]
199    /// Create a fixture instance for testing.
200    pub fn fixture() -> Self {
201        Self {
202            server_farm_id: Some("test-server_farm_id".into()),
203            site_config: Some(FunctionAppSiteConfig::fixture()),
204        }
205    }
206}
207
208/// Request body for creating or updating a Function App.
209///
210/// **Azure API**: `functions.v1.FunctionAppCreateRequest`
211/// **Reference**: <https://learn.microsoft.com/en-us/rest/api/appservice//FunctionAppCreateRequest>
212#[derive(Debug, Clone, Default, Serialize, Deserialize)]
213#[serde(rename_all = "camelCase")]
214pub struct FunctionAppCreateRequest {
215    /// Resource location
216    pub location: String,
217
218    /// Resource tags
219    #[serde(default)]
220    #[serde(skip_serializing_if = "HashMap::is_empty")]
221    pub tags: HashMap<String, String>,
222
223    /// Kind of app (functionapp, functionapp,linux)
224    #[serde(skip_serializing_if = "Option::is_none")]
225    pub kind: Option<String>,
226
227    /// Function App create/update properties
228    #[serde(skip_serializing_if = "Option::is_none")]
229    pub properties: Option<FunctionAppCreateOrUpdateProperties>,
230}
231
232impl FunctionAppCreateRequest {
233    #[cfg(any(test, feature = "test-support"))]
234    /// Create a fixture instance for testing.
235    pub fn fixture() -> Self {
236        Self {
237            location: "test-location".into(),
238            tags: Default::default(),
239            kind: Some("test-kind".into()),
240            properties: Some(FunctionAppCreateOrUpdateProperties::fixture()),
241        }
242    }
243}
244
245/// Properties of an individual Azure Function.
246///
247/// **Azure API**: `functions.v1.FunctionProperties`
248/// **Reference**: <https://learn.microsoft.com/en-us/rest/api/appservice//FunctionProperties>
249#[derive(Debug, Clone, Default, Serialize, Deserialize)]
250#[serde(rename_all = "camelCase")]
251pub struct FunctionProperties {
252    /// Name of the function
253    #[serde(skip_serializing_if = "Option::is_none")]
254    pub name: Option<String>,
255
256    /// Function App ID
257    #[serde(skip_serializing_if = "Option::is_none")]
258    pub function_app_id: Option<String>,
259
260    /// Script root path href
261    #[serde(skip_serializing_if = "Option::is_none")]
262    pub script_root_path_href: Option<String>,
263
264    /// Script href
265    #[serde(skip_serializing_if = "Option::is_none")]
266    pub script_href: Option<String>,
267
268    /// Config href
269    #[serde(skip_serializing_if = "Option::is_none")]
270    pub config_href: Option<String>,
271
272    /// Whether the function is disabled
273    #[serde(skip_serializing_if = "Option::is_none")]
274    pub is_disabled: Option<bool>,
275}
276
277impl FunctionProperties {
278    #[cfg(any(test, feature = "test-support"))]
279    /// Create a fixture instance for testing.
280    pub fn fixture() -> Self {
281        Self {
282            name: Some("test-function_properties".into()),
283            function_app_id: Some("test-function_app_id".into()),
284            script_root_path_href: Some("test-script_root_path_href".into()),
285            script_href: Some("test-script_href".into()),
286            config_href: Some("test-config_href".into()),
287            is_disabled: Some(false),
288        }
289    }
290}
291
292/// An individual Azure Function within a Function App.
293///
294/// **Azure API**: `functions.v1.Function`
295/// **Reference**: <https://learn.microsoft.com/en-us/rest/api/appservice//Function>
296#[derive(Debug, Clone, Default, Serialize, Deserialize)]
297#[serde(rename_all = "camelCase")]
298pub struct Function {
299    /// Fully qualified resource ID
300    #[serde(skip_serializing_if = "Option::is_none")]
301    pub id: Option<String>,
302
303    /// The name of the function
304    #[serde(skip_serializing_if = "Option::is_none")]
305    pub name: Option<String>,
306
307    /// The type of the resource
308    #[serde(rename = "type")]
309    #[serde(skip_serializing_if = "Option::is_none")]
310    pub r#type: Option<String>,
311
312    /// Function properties
313    #[serde(skip_serializing_if = "Option::is_none")]
314    pub properties: Option<FunctionProperties>,
315}
316
317impl Function {
318    #[cfg(any(test, feature = "test-support"))]
319    /// Create a fixture instance for testing.
320    pub fn fixture() -> Self {
321        Self {
322            id: Some("test-id".into()),
323            name: Some("test-function".into()),
324            r#type: Some("test-type".into()),
325            properties: Some(FunctionProperties::fixture()),
326        }
327    }
328}
329
330/// Result of a list Functions operation.
331///
332/// **Azure API**: `functions.v1.FunctionListResult`
333/// **Reference**: <https://learn.microsoft.com/en-us/rest/api/appservice//FunctionListResult>
334#[derive(Debug, Clone, Default, Serialize, Deserialize)]
335#[serde(rename_all = "camelCase")]
336pub struct FunctionListResult {
337    /// List of Functions
338    #[serde(default)]
339    #[serde(skip_serializing_if = "Vec::is_empty")]
340    pub value: Vec<Function>,
341
342    /// Link to next page of results
343    #[serde(skip_serializing_if = "Option::is_none")]
344    pub next_link: Option<String>,
345}
346
347impl FunctionListResult {
348    #[cfg(any(test, feature = "test-support"))]
349    /// Create a fixture instance for testing.
350    pub fn fixture() -> Self {
351        Self {
352            value: vec![],
353            next_link: Some("test-next_link".into()),
354        }
355    }
356}
357
358/// Result of listing application settings.
359///
360/// **Azure API**: `functions.v1.AppSettingsResult`
361/// **Reference**: <https://learn.microsoft.com/en-us/rest/api/appservice//AppSettingsResult>
362#[derive(Debug, Clone, Default, Serialize, Deserialize)]
363#[serde(rename_all = "camelCase")]
364pub struct AppSettingsResult {
365    /// Resource ID
366    #[serde(skip_serializing_if = "Option::is_none")]
367    pub id: Option<String>,
368
369    /// Resource name
370    #[serde(skip_serializing_if = "Option::is_none")]
371    pub name: Option<String>,
372
373    /// Resource type
374    #[serde(rename = "type")]
375    #[serde(skip_serializing_if = "Option::is_none")]
376    pub r#type: Option<String>,
377
378    /// Application settings key-value pairs
379    #[serde(default)]
380    #[serde(skip_serializing_if = "HashMap::is_empty")]
381    pub properties: HashMap<String, String>,
382}
383
384impl AppSettingsResult {
385    #[cfg(any(test, feature = "test-support"))]
386    /// Create a fixture instance for testing.
387    pub fn fixture() -> Self {
388        Self {
389            id: Some("test-id".into()),
390            name: Some("test-app_settings_result".into()),
391            r#type: Some("test-type".into()),
392            properties: Default::default(),
393        }
394    }
395}
396
397/// Request body for updating application settings.
398///
399/// **Azure API**: `functions.v1.AppSettingsUpdateRequest`
400/// **Reference**: <https://learn.microsoft.com/en-us/rest/api/appservice//AppSettingsUpdateRequest>
401#[derive(Debug, Clone, Default, Serialize, Deserialize)]
402#[serde(rename_all = "camelCase")]
403pub struct AppSettingsUpdateRequest {
404    /// Application settings key-value pairs
405    #[serde(default)]
406    #[serde(skip_serializing_if = "HashMap::is_empty")]
407    pub properties: HashMap<String, String>,
408}
409
410impl AppSettingsUpdateRequest {
411    #[cfg(any(test, feature = "test-support"))]
412    /// Create a fixture instance for testing.
413    pub fn fixture() -> Self {
414        Self {
415            properties: Default::default(),
416        }
417    }
418}