codecraftai-restclient-azure 1.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,11 @@
1
+ """
2
+ .. package:: ccai.restclient.azure
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: A pure-Python client for Azure Resource Manager.
5
+
6
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
7
+ """
8
+
9
+ __author__ = "Myron Walker"
10
+ __copyright__ = "Copyright 2026, Code Craft AI LLC"
11
+ __credits__ = []
@@ -0,0 +1,12 @@
1
+ """
2
+ .. package:: ccai.restclient.azure.apigroups
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: ARM resource collections, named to match the azure-mgmt-*
5
+ operation groups.
6
+
7
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
8
+ """
9
+
10
+ __author__ = "Myron Walker"
11
+ __copyright__ = "Copyright 2026, Code Craft AI LLC"
12
+ __credits__ = []
@@ -0,0 +1,135 @@
1
+ """
2
+ .. module:: armcollection
3
+ :platform: Darwin, Linux, Unix, Windows
4
+ :synopsis: :class:`ArmCollection` — the shared behaviour of an ARM
5
+ resource collection.
6
+
7
+ Every ARM resource type is addressed the same way, so the path building,
8
+ listing and mutation logic lives here and each concrete collection only
9
+ declares its provider namespace, type segment and api-version — plus the
10
+ keyword names its consumers already use, which differ per collection and
11
+ are therefore spelled out rather than generated.
12
+
13
+ .. moduleauthor:: Myron Walker <myron.walker@gmail.com>
14
+ """
15
+
16
+ __author__ = "Myron Walker"
17
+ __copyright__ = "Copyright 2026, Code Craft AI LLC"
18
+ __credits__ = []
19
+
20
+
21
+ from typing import Any, Dict, List, Optional
22
+
23
+ from ccai.restclient.azure.azureobject import AzureObject
24
+
25
+
26
+ class ArmCollection:
27
+ """
28
+ Shared behaviour for an ARM resource collection.
29
+
30
+ :cvar PROVIDER: The resource provider, e.g. ``Microsoft.Network``.
31
+ :cvar RESOURCE_TYPE: The type segment, e.g. ``virtualNetworks``.
32
+ :cvar API_VERSION: The api-version this type requires.
33
+ """
34
+
35
+ PROVIDER: str = ""
36
+ RESOURCE_TYPE: str = ""
37
+ API_VERSION: str = ""
38
+
39
+ def __init__(self, *, client: Any) -> None:
40
+ """
41
+ Construct a collection bound to a transport.
42
+
43
+ :param client: The owning :class:`AzureArmClient`.
44
+ """
45
+ self._client = client
46
+ return
47
+
48
+ def _group_path(self, *, resource_group_name: str) -> str:
49
+ """
50
+ Build the collection path inside a resource group.
51
+
52
+ :param resource_group_name: The resource group.
53
+
54
+ :returns: The collection path.
55
+ """
56
+ rtnval = self._client.subscription_path(
57
+ tail="/resourceGroups/{}/providers/{}/{}".format(
58
+ resource_group_name, self.PROVIDER, self.RESOURCE_TYPE))
59
+ return rtnval
60
+
61
+ def _item_path(self, *, resource_group_name: str, name: str) -> str:
62
+ """
63
+ Build one resource's path.
64
+
65
+ :param resource_group_name: The resource group.
66
+ :param name: The resource name.
67
+
68
+ :returns: The item path.
69
+ """
70
+ rtnval = "{}/{}".format(
71
+ self._group_path(resource_group_name=resource_group_name), name)
72
+ return rtnval
73
+
74
+ def _list(self, *, resource_group_name: str) -> List[AzureObject]:
75
+ """
76
+ List the collection inside a resource group.
77
+
78
+ :param resource_group_name: The resource group.
79
+
80
+ :returns: The resources.
81
+ """
82
+ rtnval = self._client.paginate(
83
+ path=self._group_path(resource_group_name=resource_group_name),
84
+ api_version=self.API_VERSION)
85
+ return rtnval
86
+
87
+ def _get(self, *, resource_group_name: str, name: str) -> AzureObject:
88
+ """
89
+ Fetch one resource.
90
+
91
+ :param resource_group_name: The resource group.
92
+ :param name: The resource name.
93
+
94
+ :returns: The resource.
95
+ """
96
+ rtnval = self._client.request(
97
+ method="GET",
98
+ path=self._item_path(resource_group_name=resource_group_name,
99
+ name=name),
100
+ api_version=self.API_VERSION)
101
+ return rtnval
102
+
103
+ def _put(self, *, resource_group_name: str, name: str,
104
+ parameters: Optional[Dict[str, Any]]) -> Any:
105
+ """
106
+ Create or replace one resource, returning a poller.
107
+
108
+ :param resource_group_name: The resource group.
109
+ :param name: The resource name.
110
+ :param parameters: The resource body.
111
+
112
+ :returns: An :class:`LroPoller`.
113
+ """
114
+ rtnval = self._client.begin(
115
+ method="PUT",
116
+ path=self._item_path(resource_group_name=resource_group_name,
117
+ name=name),
118
+ api_version=self.API_VERSION, body=parameters)
119
+ return rtnval
120
+
121
+ def _delete(self, *, resource_group_name: str, name: str) -> Any:
122
+ """
123
+ Delete one resource, returning a poller.
124
+
125
+ :param resource_group_name: The resource group.
126
+ :param name: The resource name.
127
+
128
+ :returns: An :class:`LroPoller`.
129
+ """
130
+ rtnval = self._client.begin(
131
+ method="DELETE",
132
+ path=self._item_path(resource_group_name=resource_group_name,
133
+ name=name),
134
+ api_version=self.API_VERSION)
135
+ return rtnval