qontract-reconcile 0.10.2.dev504__py3-none-any.whl → 0.10.2.dev506__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.
Files changed (29) hide show
  1. {qontract_reconcile-0.10.2.dev504.dist-info → qontract_reconcile-0.10.2.dev506.dist-info}/METADATA +1 -4
  2. {qontract_reconcile-0.10.2.dev504.dist-info → qontract_reconcile-0.10.2.dev506.dist-info}/RECORD +11 -29
  3. reconcile/cli.py +0 -108
  4. reconcile/gql_definitions/integrations/integrations.py +1 -31
  5. reconcile/gql_definitions/introspection.json +530 -2107
  6. reconcile/integrations_manager.py +0 -2
  7. reconcile/utils/external_resource_spec.py +1 -2
  8. reconcile/utils/runtime/sharding.py +0 -80
  9. tools/cli_commands/systems_and_tools.py +0 -23
  10. reconcile/gql_definitions/terraform_cloudflare_dns/__init__.py +0 -0
  11. reconcile/gql_definitions/terraform_cloudflare_dns/app_interface_cloudflare_dns_settings.py +0 -62
  12. reconcile/gql_definitions/terraform_cloudflare_dns/terraform_cloudflare_zones.py +0 -193
  13. reconcile/gql_definitions/terraform_cloudflare_resources/__init__.py +0 -0
  14. reconcile/gql_definitions/terraform_cloudflare_resources/terraform_cloudflare_accounts.py +0 -127
  15. reconcile/gql_definitions/terraform_cloudflare_resources/terraform_cloudflare_resources.py +0 -359
  16. reconcile/gql_definitions/terraform_cloudflare_users/__init__.py +0 -0
  17. reconcile/gql_definitions/terraform_cloudflare_users/app_interface_setting_cloudflare_and_vault.py +0 -62
  18. reconcile/gql_definitions/terraform_cloudflare_users/terraform_cloudflare_roles.py +0 -139
  19. reconcile/terraform_cloudflare_dns.py +0 -379
  20. reconcile/terraform_cloudflare_resources.py +0 -445
  21. reconcile/terraform_cloudflare_users.py +0 -374
  22. reconcile/typed_queries/cloudflare.py +0 -10
  23. reconcile/utils/terrascript/__init__.py +0 -0
  24. reconcile/utils/terrascript/cloudflare_client.py +0 -310
  25. reconcile/utils/terrascript/cloudflare_resources.py +0 -432
  26. reconcile/utils/terrascript/models.py +0 -26
  27. reconcile/utils/terrascript/resources.py +0 -43
  28. {qontract_reconcile-0.10.2.dev504.dist-info → qontract_reconcile-0.10.2.dev506.dist-info}/WHEEL +0 -0
  29. {qontract_reconcile-0.10.2.dev504.dist-info → qontract_reconcile-0.10.2.dev506.dist-info}/entry_points.txt +0 -0
@@ -41,7 +41,6 @@ from reconcile.utils.openshift_resource import (
41
41
  from reconcile.utils.runtime.meta import IntegrationMeta
42
42
  from reconcile.utils.runtime.sharding import (
43
43
  AWSAccountShardingStrategy,
44
- CloudflareDnsZoneShardingStrategy,
45
44
  IntegrationShardManager,
46
45
  OCMOrganizationShardingStrategy,
47
46
  OpenshiftClusterShardingStrategy,
@@ -257,7 +256,6 @@ def run(
257
256
  StaticShardingStrategy.IDENTIFIER: StaticShardingStrategy(),
258
257
  AWSAccountShardingStrategy.IDENTIFIER: AWSAccountShardingStrategy(),
259
258
  OpenshiftClusterShardingStrategy.IDENTIFIER: OpenshiftClusterShardingStrategy(),
260
- CloudflareDnsZoneShardingStrategy.IDENTIFIER: CloudflareDnsZoneShardingStrategy(),
261
259
  OCMOrganizationShardingStrategy.IDENTIFIER: OCMOrganizationShardingStrategy(),
262
260
  },
263
261
  integration_runtime_meta=integration_runtime_meta,
@@ -125,8 +125,7 @@ class ExternalResourceSpec:
125
125
  def output_prefix(self) -> str:
126
126
  # Adhere to DNS-1123 subdomain names spec. It's reasonable to have provider
127
127
  # names that have underscores, but without replacing them with hyphens we run
128
- # into issues. Alternatively, we could change Cloudflare worker_script to
129
- # worker-script and prevent the use of underscores going forward.
128
+ # into issues.
130
129
  #
131
130
  # More info can be found at:
132
131
  # https://kubernetes.io/docs/concepts/overview/working-with-objects/names/.
@@ -14,8 +14,6 @@ from reconcile.gql_definitions.fragments.minimal_ocm_organization import (
14
14
  from reconcile.gql_definitions.integrations.integrations import (
15
15
  AWSAccountShardingV1,
16
16
  AWSAccountShardSpecOverrideV1,
17
- CloudflareDNSZoneShardingV1,
18
- CloudflareDNSZoneShardSpecOverrideV1,
19
17
  IntegrationManagedV1,
20
18
  IntegrationShardingV1,
21
19
  IntegrationSpecV1,
@@ -31,12 +29,6 @@ from reconcile.gql_definitions.sharding import aws_accounts as sharding_aws_acco
31
29
  from reconcile.gql_definitions.sharding import (
32
30
  ocm_organization as sharding_ocm_organization,
33
31
  )
34
- from reconcile.gql_definitions.terraform_cloudflare_dns import (
35
- terraform_cloudflare_zones,
36
- )
37
- from reconcile.gql_definitions.terraform_cloudflare_dns.terraform_cloudflare_zones import (
38
- CloudflareDnsZoneV1,
39
- )
40
32
  from reconcile.typed_queries.clusters_minimal import get_clusters_minimal
41
33
  from reconcile.utils import gql
42
34
  from reconcile.utils.runtime.meta import IntegrationMeta
@@ -49,7 +41,6 @@ class ShardSpec(BaseModel):
49
41
  shard_spec_overrides: (
50
42
  AWSAccountShardSpecOverrideV1
51
43
  | OpenshiftClusterShardSpecOverrideV1
52
- | CloudflareDNSZoneShardSpecOverrideV1
53
44
  | OCMOrganizationShardSpecOverrideV1
54
45
  | None
55
46
  ) = None
@@ -363,77 +354,6 @@ class OpenshiftClusterShardingStrategy:
363
354
  return shards
364
355
 
365
356
 
366
- class CloudflareDnsZoneShardingStrategy:
367
- """
368
- This provides a new sharding strategy that each shard is targeting a Cloudflare zone.
369
- It uses the combination of the Cloudflare account name and the zone's identifier as the unique sharding key.
370
- """
371
-
372
- IDENTIFIER = "per-cloudflare-dns-zone"
373
-
374
- def __init__(self, cloudflare_zones: Iterable[CloudflareDnsZoneV1] | None = None):
375
- if not cloudflare_zones:
376
- self.cloudflare_zones = (
377
- terraform_cloudflare_zones.query(query_func=gql.get_api().query).zones
378
- or []
379
- )
380
- else:
381
- self.cloudflare_zones = list(cloudflare_zones)
382
-
383
- def _get_shard_key(self, dns_zone: CloudflareDnsZoneV1) -> str:
384
- return f"{dns_zone.account.name}-{dns_zone.identifier}"
385
-
386
- def get_shard_spec_overrides(
387
- self, sharding: IntegrationShardingV1 | None
388
- ) -> dict[str, CloudflareDNSZoneShardSpecOverrideV1]:
389
- spos: dict[str, CloudflareDNSZoneShardSpecOverrideV1] = {}
390
-
391
- if (
392
- isinstance(sharding, CloudflareDNSZoneShardingV1)
393
- and sharding.shard_spec_overrides
394
- ):
395
- for override in sharding.shard_spec_overrides:
396
- key = f"{override.shard.zone}-{override.shard.identifier}"
397
- spos[key] = override
398
- return spos
399
-
400
- def check_integration_sharding_params(self, meta: IntegrationMeta) -> None:
401
- if "--zone-name" not in meta.args:
402
- raise ValueError(
403
- f"integration {meta.name} does not support the provided argument. "
404
- f"--zone-name is required by the '{self.IDENTIFIER}' sharding "
405
- "strategy."
406
- )
407
-
408
- def build_shard_spec(
409
- self,
410
- dns_zone: CloudflareDnsZoneV1,
411
- integration_spec: IntegrationSpecV1,
412
- spo: CloudflareDNSZoneShardSpecOverrideV1 | None,
413
- ) -> ShardSpec:
414
- return ShardSpec(
415
- shard_key=self._get_shard_key(dns_zone),
416
- shard_name_suffix=f"-{self._get_shard_key(dns_zone)}",
417
- extra_args=(integration_spec.extra_args or "")
418
- + f" --zone-name {dns_zone.identifier}",
419
- shard_spec_overrides=spo,
420
- )
421
-
422
- def build_integration_shards(
423
- self,
424
- integration_meta: IntegrationMeta,
425
- integration_managed: IntegrationManagedV1,
426
- ) -> list[ShardSpec]:
427
- self.check_integration_sharding_params(integration_meta)
428
- spos = self.get_shard_spec_overrides(integration_managed.sharding)
429
- shards = []
430
- for zone in self.cloudflare_zones or []:
431
- spo = spos.get(self._get_shard_key(zone))
432
- base_shard = self.build_shard_spec(zone, integration_managed.spec, spo)
433
- shards.append(base_shard)
434
- return shards
435
-
436
-
437
357
  @dataclass
438
358
  class IntegrationShardManager:
439
359
  strategies: dict[str, ShardingStrategy]
@@ -85,12 +85,6 @@ from reconcile.gql_definitions.statuspage.statuspages import (
85
85
  from reconcile.gql_definitions.statuspage.statuspages import (
86
86
  StatusPageV1,
87
87
  )
88
- from reconcile.gql_definitions.terraform_cloudflare_resources.terraform_cloudflare_accounts import (
89
- DEFINITION as CLOUDFLARE_ACCOUNTS_DEFINITION,
90
- )
91
- from reconcile.gql_definitions.terraform_cloudflare_resources.terraform_cloudflare_accounts import (
92
- CloudflareAccountV1,
93
- )
94
88
  from reconcile.gql_definitions.terraform_tgw_attachments.aws_accounts import (
95
89
  DEFINITION as AWS_ACCOUNTS_DEFINITION,
96
90
  )
@@ -110,7 +104,6 @@ from reconcile.gql_definitions.vault_instances.vault_instances import (
110
104
  VaultInstanceV1,
111
105
  )
112
106
  from reconcile.statuspage.integration import get_status_pages
113
- from reconcile.typed_queries.cloudflare import get_cloudflare_accounts
114
107
  from reconcile.typed_queries.clusters import get_clusters
115
108
  from reconcile.typed_queries.dynatrace import get_dynatrace_environments
116
109
  from reconcile.typed_queries.gitlab_instances import (
@@ -180,8 +173,6 @@ class SystemTool(BaseModel):
180
173
  return cls.init_from_unleash_instance(model, enumeration)
181
174
  case VaultInstanceV1():
182
175
  return cls.init_from_vault_instance(model, enumeration)
183
- case CloudflareAccountV1():
184
- return cls.init_from_cloudflare_account(model, enumeration)
185
176
  case AppCodeComponentsV1():
186
177
  return cls.init_from_code_component(model, enumeration)
187
178
  case _:
@@ -368,19 +359,6 @@ class SystemTool(BaseModel):
368
359
  enumeration=enumeration,
369
360
  )
370
361
 
371
- @classmethod
372
- def init_from_cloudflare_account(
373
- cls, a: CloudflareAccountV1, enumeration: Any
374
- ) -> Self:
375
- return cls(
376
- system_type="cloudflare",
377
- system_id=a.name,
378
- name=a.name,
379
- url="https://dash.cloudflare.com/",
380
- description=a.description,
381
- enumeration=enumeration,
382
- )
383
-
384
362
  @classmethod
385
363
  def init_from_code_component(cls, c: AppCodeComponentsV1, enumeration: Any) -> Self:
386
364
  return cls(
@@ -469,7 +447,6 @@ def get_systems_and_tools_inventory() -> SystemToolInventory:
469
447
  inventory.update(get_status_pages(), STATUS_PAGES_DEFINITION)
470
448
  inventory.update(get_unleash_instances(), UNLEASH_INSTANCES_DEFINITION)
471
449
  inventory.update(get_vault_instances(), VAULT_INSTANCES_DEFINITION)
472
- inventory.update(get_cloudflare_accounts(), CLOUDFLARE_ACCOUNTS_DEFINITION)
473
450
  inventory.update(
474
451
  [
475
452
  c
@@ -1,62 +0,0 @@
1
- """
2
- Generated by qenerate plugin=pydantic_v2. DO NOT MODIFY MANUALLY!
3
- """
4
- from collections.abc import Callable # noqa: F401 # pylint: disable=W0611
5
- from datetime import datetime # noqa: F401 # pylint: disable=W0611
6
- from enum import Enum # noqa: F401 # pylint: disable=W0611
7
- from typing import ( # noqa: F401 # pylint: disable=W0611
8
- Any,
9
- Optional,
10
- Union,
11
- )
12
-
13
- from pydantic import ( # noqa: F401 # pylint: disable=W0611
14
- BaseModel,
15
- ConfigDict,
16
- Field,
17
- Json,
18
- )
19
-
20
-
21
- DEFINITION = """
22
- query AppInterfaceSettingCloudflareDNS {
23
- settings: app_interface_settings_v1 {
24
- cloudflareDNSZoneMaxRecords
25
- vault
26
- }
27
- }
28
- """
29
-
30
-
31
- class ConfiguredBaseModel(BaseModel):
32
- model_config = ConfigDict(
33
- extra='forbid'
34
- )
35
-
36
-
37
- class AppInterfaceSettingsV1(ConfiguredBaseModel):
38
- cloudflare_dns_zone_max_records: Optional[int] = Field(..., alias="cloudflareDNSZoneMaxRecords")
39
- vault: bool = Field(..., alias="vault")
40
-
41
-
42
- class AppInterfaceSettingCloudflareDNSQueryData(ConfiguredBaseModel):
43
- settings: Optional[list[AppInterfaceSettingsV1]] = Field(..., alias="settings")
44
-
45
-
46
- def query(query_func: Callable, **kwargs: Any) -> AppInterfaceSettingCloudflareDNSQueryData:
47
- """
48
- This is a convenience function which queries and parses the data into
49
- concrete types. It should be compatible with most GQL clients.
50
- You do not have to use it to consume the generated data classes.
51
- Alternatively, you can also mime and alternate the behavior
52
- of this function in the caller.
53
-
54
- Parameters:
55
- query_func (Callable): Function which queries your GQL Server
56
- kwargs: optional arguments that will be passed to the query function
57
-
58
- Returns:
59
- AppInterfaceSettingCloudflareDNSQueryData: queried data parsed into generated classes
60
- """
61
- raw_data: dict[Any, Any] = query_func(DEFINITION, **kwargs)
62
- return AppInterfaceSettingCloudflareDNSQueryData(**raw_data)
@@ -1,193 +0,0 @@
1
- """
2
- Generated by qenerate plugin=pydantic_v2. DO NOT MODIFY MANUALLY!
3
- """
4
- from collections.abc import Callable # noqa: F401 # pylint: disable=W0611
5
- from datetime import datetime # noqa: F401 # pylint: disable=W0611
6
- from enum import Enum # noqa: F401 # pylint: disable=W0611
7
- from typing import ( # noqa: F401 # pylint: disable=W0611
8
- Any,
9
- Optional,
10
- Union,
11
- )
12
-
13
- from pydantic import ( # noqa: F401 # pylint: disable=W0611
14
- BaseModel,
15
- ConfigDict,
16
- Field,
17
- Json,
18
- )
19
-
20
- from reconcile.gql_definitions.fragments.vault_secret import VaultSecret
21
-
22
-
23
- DEFINITION = """
24
- fragment VaultSecret on VaultSecret_v1 {
25
- path
26
- field
27
- version
28
- format
29
- }
30
-
31
- query CloudflareDnsZone {
32
- zones: cloudflare_dns_zone_v1 {
33
- identifier
34
- zone
35
- account {
36
- name
37
- type
38
- description
39
- providerVersion
40
- enforceTwofactor
41
- apiCredentials {
42
- ...VaultSecret
43
- }
44
- terraformStateAccount {
45
- name
46
- consoleUrl
47
- terraformUsername
48
- automationToken {
49
- ...VaultSecret
50
- }
51
- terraformState {
52
- provider
53
- bucket
54
- region
55
- integrations {
56
- integration
57
- key
58
- }
59
- }
60
- }
61
- deletionApprovals {
62
- expiration
63
- name
64
- type
65
- }
66
- }
67
- records {
68
- identifier
69
- name
70
- type
71
- ttl
72
- value
73
- priority
74
- proxied
75
- data {
76
- algorithm
77
- protocol
78
- public_key
79
- digest_type
80
- digest
81
- key_tag
82
- flags
83
- tag
84
- value
85
- }
86
- }
87
- type
88
- plan
89
- max_records
90
- delete
91
- }
92
- }
93
- """
94
-
95
-
96
- class ConfiguredBaseModel(BaseModel):
97
- model_config = ConfigDict(
98
- extra='forbid'
99
- )
100
-
101
-
102
- class AWSTerraformStateIntegrationsV1(ConfiguredBaseModel):
103
- integration: str = Field(..., alias="integration")
104
- key: str = Field(..., alias="key")
105
-
106
-
107
- class TerraformStateAWSV1(ConfiguredBaseModel):
108
- provider: str = Field(..., alias="provider")
109
- bucket: str = Field(..., alias="bucket")
110
- region: str = Field(..., alias="region")
111
- integrations: list[AWSTerraformStateIntegrationsV1] = Field(..., alias="integrations")
112
-
113
-
114
- class AWSAccountV1(ConfiguredBaseModel):
115
- name: str = Field(..., alias="name")
116
- console_url: str = Field(..., alias="consoleUrl")
117
- terraform_username: Optional[str] = Field(..., alias="terraformUsername")
118
- automation_token: VaultSecret = Field(..., alias="automationToken")
119
- terraform_state: Optional[TerraformStateAWSV1] = Field(..., alias="terraformState")
120
-
121
-
122
- class DeletionApprovalV1(ConfiguredBaseModel):
123
- expiration: str = Field(..., alias="expiration")
124
- name: str = Field(..., alias="name")
125
- q_type: str = Field(..., alias="type")
126
-
127
-
128
- class CloudflareAccountV1(ConfiguredBaseModel):
129
- name: str = Field(..., alias="name")
130
- q_type: Optional[str] = Field(..., alias="type")
131
- description: Optional[str] = Field(..., alias="description")
132
- provider_version: str = Field(..., alias="providerVersion")
133
- enforce_twofactor: Optional[bool] = Field(..., alias="enforceTwofactor")
134
- api_credentials: VaultSecret = Field(..., alias="apiCredentials")
135
- terraform_state_account: AWSAccountV1 = Field(..., alias="terraformStateAccount")
136
- deletion_approvals: Optional[list[DeletionApprovalV1]] = Field(..., alias="deletionApprovals")
137
-
138
-
139
- class CloudflareDnsRecordDataSettingsV1(ConfiguredBaseModel):
140
- algorithm: Optional[int] = Field(..., alias="algorithm")
141
- protocol: Optional[int] = Field(..., alias="protocol")
142
- public_key: Optional[str] = Field(..., alias="public_key")
143
- digest_type: Optional[int] = Field(..., alias="digest_type")
144
- digest: Optional[str] = Field(..., alias="digest")
145
- key_tag: Optional[int] = Field(..., alias="key_tag")
146
- flags: Optional[int] = Field(..., alias="flags")
147
- tag: Optional[str] = Field(..., alias="tag")
148
- value: Optional[str] = Field(..., alias="value")
149
-
150
-
151
- class CloudflareDnsRecordV1(ConfiguredBaseModel):
152
- identifier: str = Field(..., alias="identifier")
153
- name: str = Field(..., alias="name")
154
- q_type: str = Field(..., alias="type")
155
- ttl: int = Field(..., alias="ttl")
156
- value: Optional[str] = Field(..., alias="value")
157
- priority: Optional[int] = Field(..., alias="priority")
158
- proxied: Optional[bool] = Field(..., alias="proxied")
159
- data: Optional[CloudflareDnsRecordDataSettingsV1] = Field(..., alias="data")
160
-
161
-
162
- class CloudflareDnsZoneV1(ConfiguredBaseModel):
163
- identifier: str = Field(..., alias="identifier")
164
- zone: str = Field(..., alias="zone")
165
- account: CloudflareAccountV1 = Field(..., alias="account")
166
- records: Optional[list[CloudflareDnsRecordV1]] = Field(..., alias="records")
167
- q_type: Optional[str] = Field(..., alias="type")
168
- plan: Optional[str] = Field(..., alias="plan")
169
- max_records: Optional[int] = Field(..., alias="max_records")
170
- delete: Optional[bool] = Field(..., alias="delete")
171
-
172
-
173
- class CloudflareDnsZoneQueryData(ConfiguredBaseModel):
174
- zones: Optional[list[CloudflareDnsZoneV1]] = Field(..., alias="zones")
175
-
176
-
177
- def query(query_func: Callable, **kwargs: Any) -> CloudflareDnsZoneQueryData:
178
- """
179
- This is a convenience function which queries and parses the data into
180
- concrete types. It should be compatible with most GQL clients.
181
- You do not have to use it to consume the generated data classes.
182
- Alternatively, you can also mime and alternate the behavior
183
- of this function in the caller.
184
-
185
- Parameters:
186
- query_func (Callable): Function which queries your GQL Server
187
- kwargs: optional arguments that will be passed to the query function
188
-
189
- Returns:
190
- CloudflareDnsZoneQueryData: queried data parsed into generated classes
191
- """
192
- raw_data: dict[Any, Any] = query_func(DEFINITION, **kwargs)
193
- return CloudflareDnsZoneQueryData(**raw_data)
@@ -1,127 +0,0 @@
1
- """
2
- Generated by qenerate plugin=pydantic_v2. DO NOT MODIFY MANUALLY!
3
- """
4
- from collections.abc import Callable # noqa: F401 # pylint: disable=W0611
5
- from datetime import datetime # noqa: F401 # pylint: disable=W0611
6
- from enum import Enum # noqa: F401 # pylint: disable=W0611
7
- from typing import ( # noqa: F401 # pylint: disable=W0611
8
- Any,
9
- Optional,
10
- Union,
11
- )
12
-
13
- from pydantic import ( # noqa: F401 # pylint: disable=W0611
14
- BaseModel,
15
- ConfigDict,
16
- Field,
17
- Json,
18
- )
19
-
20
- from reconcile.gql_definitions.fragments.vault_secret import VaultSecret
21
-
22
-
23
- DEFINITION = """
24
- fragment VaultSecret on VaultSecret_v1 {
25
- path
26
- field
27
- version
28
- format
29
- }
30
-
31
- query TerraformCloudflareAccounts {
32
- accounts: cloudflare_accounts_v1 {
33
- name
34
- description
35
- providerVersion
36
- apiCredentials {
37
- ...VaultSecret
38
- }
39
- terraformStateAccount {
40
- name
41
- automationToken {
42
- ...VaultSecret
43
- }
44
- terraformState {
45
- provider
46
- bucket
47
- region
48
- integrations {
49
- integration
50
- key
51
- }
52
- }
53
- }
54
- deletionApprovals {
55
- expiration
56
- name
57
- type
58
- }
59
- enforceTwofactor
60
- type
61
- }
62
- }
63
- """
64
-
65
-
66
- class ConfiguredBaseModel(BaseModel):
67
- model_config = ConfigDict(
68
- extra='forbid'
69
- )
70
-
71
-
72
- class AWSTerraformStateIntegrationsV1(ConfiguredBaseModel):
73
- integration: str = Field(..., alias="integration")
74
- key: str = Field(..., alias="key")
75
-
76
-
77
- class TerraformStateAWSV1(ConfiguredBaseModel):
78
- provider: str = Field(..., alias="provider")
79
- bucket: str = Field(..., alias="bucket")
80
- region: str = Field(..., alias="region")
81
- integrations: list[AWSTerraformStateIntegrationsV1] = Field(..., alias="integrations")
82
-
83
-
84
- class AWSAccountV1(ConfiguredBaseModel):
85
- name: str = Field(..., alias="name")
86
- automation_token: VaultSecret = Field(..., alias="automationToken")
87
- terraform_state: Optional[TerraformStateAWSV1] = Field(..., alias="terraformState")
88
-
89
-
90
- class DeletionApprovalV1(ConfiguredBaseModel):
91
- expiration: str = Field(..., alias="expiration")
92
- name: str = Field(..., alias="name")
93
- q_type: str = Field(..., alias="type")
94
-
95
-
96
- class CloudflareAccountV1(ConfiguredBaseModel):
97
- name: str = Field(..., alias="name")
98
- description: Optional[str] = Field(..., alias="description")
99
- provider_version: str = Field(..., alias="providerVersion")
100
- api_credentials: VaultSecret = Field(..., alias="apiCredentials")
101
- terraform_state_account: AWSAccountV1 = Field(..., alias="terraformStateAccount")
102
- deletion_approvals: Optional[list[DeletionApprovalV1]] = Field(..., alias="deletionApprovals")
103
- enforce_twofactor: Optional[bool] = Field(..., alias="enforceTwofactor")
104
- q_type: Optional[str] = Field(..., alias="type")
105
-
106
-
107
- class TerraformCloudflareAccountsQueryData(ConfiguredBaseModel):
108
- accounts: Optional[list[CloudflareAccountV1]] = Field(..., alias="accounts")
109
-
110
-
111
- def query(query_func: Callable, **kwargs: Any) -> TerraformCloudflareAccountsQueryData:
112
- """
113
- This is a convenience function which queries and parses the data into
114
- concrete types. It should be compatible with most GQL clients.
115
- You do not have to use it to consume the generated data classes.
116
- Alternatively, you can also mime and alternate the behavior
117
- of this function in the caller.
118
-
119
- Parameters:
120
- query_func (Callable): Function which queries your GQL Server
121
- kwargs: optional arguments that will be passed to the query function
122
-
123
- Returns:
124
- TerraformCloudflareAccountsQueryData: queried data parsed into generated classes
125
- """
126
- raw_data: dict[Any, Any] = query_func(DEFINITION, **kwargs)
127
- return TerraformCloudflareAccountsQueryData(**raw_data)