|
| 1 | +# coding=utf-8 |
| 2 | +# -------------------------------------------------------------------------- |
| 3 | +# Copyright (c) Microsoft Corporation. All rights reserved. |
| 4 | +# Licensed under the MIT License. See License.txt in the project root for license information. |
| 5 | +# Code generated by Microsoft (R) AutoRest Code Generator. |
| 6 | +# Changes may cause incorrect behavior and will be lost if the code is regenerated. |
| 7 | +# -------------------------------------------------------------------------- |
| 8 | + |
| 9 | +from copy import deepcopy |
| 10 | +from typing import Any, TYPE_CHECKING |
| 11 | + |
| 12 | +from azure.core.rest import HttpRequest, HttpResponse |
| 13 | +from azure.mgmt.core import ARMPipelineClient |
| 14 | + |
| 15 | +from . import models as _models |
| 16 | +from ._configuration import PaloAltoNetworksNgfwMgmtClientConfiguration |
| 17 | +from ._serialization import Deserializer, Serializer |
| 18 | +from .operations import ( |
| 19 | + CertificateObjectGlobalRulestackOperations, |
| 20 | + CertificateObjectLocalRulestackOperations, |
| 21 | + FirewallsOperations, |
| 22 | + FqdnListGlobalRulestackOperations, |
| 23 | + FqdnListLocalRulestackOperations, |
| 24 | + GlobalRulestackOperations, |
| 25 | + LocalRulesOperations, |
| 26 | + LocalRulestacksOperations, |
| 27 | + Operations, |
| 28 | + PostRulesOperations, |
| 29 | + PreRulesOperations, |
| 30 | + PrefixListGlobalRulestackOperations, |
| 31 | + PrefixListLocalRulestackOperations, |
| 32 | +) |
| 33 | + |
| 34 | +if TYPE_CHECKING: |
| 35 | + # pylint: disable=unused-import,ungrouped-imports |
| 36 | + from azure.core.credentials import TokenCredential |
| 37 | + |
| 38 | + |
| 39 | +class PaloAltoNetworksNgfwMgmtClient: # pylint: disable=client-accepts-api-version-keyword,too-many-instance-attributes |
| 40 | + """PaloAltoNetworksNgfwMgmtClient. |
| 41 | +
|
| 42 | + :ivar global_rulestack: GlobalRulestackOperations operations |
| 43 | + :vartype global_rulestack: azure.mgmt.paloaltonetworks.operations.GlobalRulestackOperations |
| 44 | + :ivar certificate_object_global_rulestack: CertificateObjectGlobalRulestackOperations |
| 45 | + operations |
| 46 | + :vartype certificate_object_global_rulestack: |
| 47 | + azure.mgmt.paloaltonetworks.operations.CertificateObjectGlobalRulestackOperations |
| 48 | + :ivar fqdn_list_global_rulestack: FqdnListGlobalRulestackOperations operations |
| 49 | + :vartype fqdn_list_global_rulestack: |
| 50 | + azure.mgmt.paloaltonetworks.operations.FqdnListGlobalRulestackOperations |
| 51 | + :ivar post_rules: PostRulesOperations operations |
| 52 | + :vartype post_rules: azure.mgmt.paloaltonetworks.operations.PostRulesOperations |
| 53 | + :ivar prefix_list_global_rulestack: PrefixListGlobalRulestackOperations operations |
| 54 | + :vartype prefix_list_global_rulestack: |
| 55 | + azure.mgmt.paloaltonetworks.operations.PrefixListGlobalRulestackOperations |
| 56 | + :ivar pre_rules: PreRulesOperations operations |
| 57 | + :vartype pre_rules: azure.mgmt.paloaltonetworks.operations.PreRulesOperations |
| 58 | + :ivar operations: Operations operations |
| 59 | + :vartype operations: azure.mgmt.paloaltonetworks.operations.Operations |
| 60 | + :ivar firewalls: FirewallsOperations operations |
| 61 | + :vartype firewalls: azure.mgmt.paloaltonetworks.operations.FirewallsOperations |
| 62 | + :ivar local_rulestacks: LocalRulestacksOperations operations |
| 63 | + :vartype local_rulestacks: azure.mgmt.paloaltonetworks.operations.LocalRulestacksOperations |
| 64 | + :ivar certificate_object_local_rulestack: CertificateObjectLocalRulestackOperations operations |
| 65 | + :vartype certificate_object_local_rulestack: |
| 66 | + azure.mgmt.paloaltonetworks.operations.CertificateObjectLocalRulestackOperations |
| 67 | + :ivar fqdn_list_local_rulestack: FqdnListLocalRulestackOperations operations |
| 68 | + :vartype fqdn_list_local_rulestack: |
| 69 | + azure.mgmt.paloaltonetworks.operations.FqdnListLocalRulestackOperations |
| 70 | + :ivar local_rules: LocalRulesOperations operations |
| 71 | + :vartype local_rules: azure.mgmt.paloaltonetworks.operations.LocalRulesOperations |
| 72 | + :ivar prefix_list_local_rulestack: PrefixListLocalRulestackOperations operations |
| 73 | + :vartype prefix_list_local_rulestack: |
| 74 | + azure.mgmt.paloaltonetworks.operations.PrefixListLocalRulestackOperations |
| 75 | + :param credential: Credential needed for the client to connect to Azure. Required. |
| 76 | + :type credential: ~azure.core.credentials.TokenCredential |
| 77 | + :param subscription_id: The ID of the target subscription. Required. |
| 78 | + :type subscription_id: str |
| 79 | + :param base_url: Service URL. Default value is "https://management.azure.com". |
| 80 | + :type base_url: str |
| 81 | + :keyword api_version: Api Version. Default value is "2022-08-29-preview". Note that overriding |
| 82 | + this default value may result in unsupported behavior. |
| 83 | + :paramtype api_version: str |
| 84 | + :keyword int polling_interval: Default waiting time between two polls for LRO operations if no |
| 85 | + Retry-After header is present. |
| 86 | + """ |
| 87 | + |
| 88 | + def __init__( |
| 89 | + self, |
| 90 | + credential: "TokenCredential", |
| 91 | + subscription_id: str, |
| 92 | + base_url: str = "https://management.azure.com", |
| 93 | + **kwargs: Any |
| 94 | + ) -> None: |
| 95 | + self._config = PaloAltoNetworksNgfwMgmtClientConfiguration( |
| 96 | + credential=credential, subscription_id=subscription_id, **kwargs |
| 97 | + ) |
| 98 | + self._client: ARMPipelineClient = ARMPipelineClient(base_url=base_url, config=self._config, **kwargs) |
| 99 | + |
| 100 | + client_models = {k: v for k, v in _models.__dict__.items() if isinstance(v, type)} |
| 101 | + self._serialize = Serializer(client_models) |
| 102 | + self._deserialize = Deserializer(client_models) |
| 103 | + self._serialize.client_side_validation = False |
| 104 | + self.global_rulestack = GlobalRulestackOperations( |
| 105 | + self._client, self._config, self._serialize, self._deserialize |
| 106 | + ) |
| 107 | + self.certificate_object_global_rulestack = CertificateObjectGlobalRulestackOperations( |
| 108 | + self._client, self._config, self._serialize, self._deserialize |
| 109 | + ) |
| 110 | + self.fqdn_list_global_rulestack = FqdnListGlobalRulestackOperations( |
| 111 | + self._client, self._config, self._serialize, self._deserialize |
| 112 | + ) |
| 113 | + self.post_rules = PostRulesOperations(self._client, self._config, self._serialize, self._deserialize) |
| 114 | + self.prefix_list_global_rulestack = PrefixListGlobalRulestackOperations( |
| 115 | + self._client, self._config, self._serialize, self._deserialize |
| 116 | + ) |
| 117 | + self.pre_rules = PreRulesOperations(self._client, self._config, self._serialize, self._deserialize) |
| 118 | + self.operations = Operations(self._client, self._config, self._serialize, self._deserialize) |
| 119 | + self.firewalls = FirewallsOperations(self._client, self._config, self._serialize, self._deserialize) |
| 120 | + self.local_rulestacks = LocalRulestacksOperations( |
| 121 | + self._client, self._config, self._serialize, self._deserialize |
| 122 | + ) |
| 123 | + self.certificate_object_local_rulestack = CertificateObjectLocalRulestackOperations( |
| 124 | + self._client, self._config, self._serialize, self._deserialize |
| 125 | + ) |
| 126 | + self.fqdn_list_local_rulestack = FqdnListLocalRulestackOperations( |
| 127 | + self._client, self._config, self._serialize, self._deserialize |
| 128 | + ) |
| 129 | + self.local_rules = LocalRulesOperations(self._client, self._config, self._serialize, self._deserialize) |
| 130 | + self.prefix_list_local_rulestack = PrefixListLocalRulestackOperations( |
| 131 | + self._client, self._config, self._serialize, self._deserialize |
| 132 | + ) |
| 133 | + |
| 134 | + def _send_request(self, request: HttpRequest, **kwargs: Any) -> HttpResponse: |
| 135 | + """Runs the network request through the client's chained policies. |
| 136 | +
|
| 137 | + >>> from azure.core.rest import HttpRequest |
| 138 | + >>> request = HttpRequest("GET", "https://www.example.org/") |
| 139 | + <HttpRequest [GET], url: 'https://www.example.org/'> |
| 140 | + >>> response = client._send_request(request) |
| 141 | + <HttpResponse: 200 OK> |
| 142 | +
|
| 143 | + For more information on this code flow, see https://aka.ms/azsdk/dpcodegen/python/send_request |
| 144 | +
|
| 145 | + :param request: The network request you want to make. Required. |
| 146 | + :type request: ~azure.core.rest.HttpRequest |
| 147 | + :keyword bool stream: Whether the response payload will be streamed. Defaults to False. |
| 148 | + :return: The response of your network call. Does not do error handling on your response. |
| 149 | + :rtype: ~azure.core.rest.HttpResponse |
| 150 | + """ |
| 151 | + |
| 152 | + request_copy = deepcopy(request) |
| 153 | + request_copy.url = self._client.format_url(request_copy.url) |
| 154 | + return self._client.send_request(request_copy, **kwargs) |
| 155 | + |
| 156 | + def close(self) -> None: |
| 157 | + self._client.close() |
| 158 | + |
| 159 | + def __enter__(self) -> "PaloAltoNetworksNgfwMgmtClient": |
| 160 | + self._client.__enter__() |
| 161 | + return self |
| 162 | + |
| 163 | + def __exit__(self, *exc_details: Any) -> None: |
| 164 | + self._client.__exit__(*exc_details) |
0 commit comments