Skip to content

Commit b97863c

Browse files
authored
Release 1.70.0 (#187)
1 parent 1a46022 commit b97863c

File tree

726 files changed

+191394
-203
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

726 files changed

+191394
-203
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "py-pure-client"
3-
version = "1.69.0"
3+
version = "1.70.0"
44
description = "Pure Storage Python clients for FlashArray, FlashBlade, and Pure1 APIs"
55
authors = [
66
{ name = "Pure Storage", email = "[email protected]" }

pypureclient/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
__name__ = 'py-pure-client'
2-
__version__ = '1.69.0'
2+
__version__ = '1.70.0'
33
__default_user_agent__ = 'pure/{}/{}'.format(__name__, __version__)

pypureclient/flashblade/FB_2_0/client.py

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
import urllib3
55
import uuid
66
import warnings
7+
import os
8+
import re
9+
import tempfile
710

811
from typing import Any, Dict, List, Optional, Tuple, Union
912
from pydantic import Field, StrictBool, StrictFloat, StrictInt, StrictStr, conint, conlist, constr, validator
@@ -83,10 +86,10 @@ def __init__(self, target, id_token=None, private_key_file=None, private_key_pas
8386
PureError: If it could not create an ID or access token
8487
"""
8588
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
86-
config = Configuration()
87-
config.verify_ssl = resolve_ssl_validation(verify_ssl)
88-
config.ssl_ca_cert = ssl_cert
89-
config.host = self._get_base_url(target)
89+
self.config = Configuration()
90+
self.config.verify_ssl = resolve_ssl_validation(verify_ssl)
91+
self.config.ssl_ca_cert = ssl_cert
92+
self.config.host = self._get_base_url(target)
9093

9194
effective_user_agent = user_agent or self.USER_AGENT
9295

@@ -101,7 +104,7 @@ def __init__(self, target, id_token=None, private_key_file=None, private_key_pas
101104
self._token_man = APITokenManager(
102105
api_token_auth_endpoint,
103106
api_token,
104-
verify_ssl=config.verify_ssl,
107+
verify_ssl=self.config.verify_ssl,
105108
token_dispose_endpoint=api_token_dispose_endpoint,
106109
user_agent=effective_user_agent,
107110
timeout=timeout
@@ -117,10 +120,10 @@ def __init__(self, target, id_token=None, private_key_file=None, private_key_pas
117120
'sub': username,
118121
}
119122
self._token_man = TokenManager(auth_endpoint, id_token, private_key_file, private_key_password,
120-
payload=payload, headers=headers, verify_ssl=config.verify_ssl,
123+
payload=payload, headers=headers, verify_ssl=self.config.verify_ssl,
121124
timeout=timeout)
122125

123-
self._api_client = ApiClient(configuration=config)
126+
self._api_client = ApiClient(configuration=self.config)
124127
self._api_client.user_agent = effective_user_agent
125128
self._set_agent_header()
126129
self._set_auth_header()
@@ -16890,7 +16893,10 @@ def _create_valid_response(self, response: ApiResponse, endpoint, kwargs):
1689016893
Returns:
1689116894
ValidResponse
1689216895
"""
16893-
body = response.data
16896+
if response.headers and "content-type" in response.headers.keys() and response.headers["content-type"] in ["application/octet-stream", "text/plain"]:
16897+
body = self._create_file(response)
16898+
else:
16899+
body = response.data
1689416900
headers = response.headers
1689516901

1689616902
continuation_token = getattr(body, "continuation_token", None)
@@ -16910,6 +16916,19 @@ def _create_valid_response(self, response: ApiResponse, endpoint, kwargs):
1691016916
return ValidResponse(response.status_code, continuation_token, total_item_count,
1691116917
items, headers, total, more_items_remaining)
1691216918

16919+
def _create_file(self, response):
16920+
path = tempfile.mkdtemp(dir=self.config.temp_folder_path)
16921+
16922+
content_disposition = response.headers["Content-Disposition"]
16923+
if content_disposition:
16924+
filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?',
16925+
content_disposition).group(1)
16926+
path = os.path.join(os.path.dirname(path), filename)
16927+
16928+
with open(path, "wb") as f:
16929+
f.write(response.data)
16930+
16931+
return path
1691316932

1691416933
def _create_api_versions_response(self, response: ApiResponse, endpoint, kwargs):
1691516934
"""

pypureclient/flashblade/FB_2_1/client.py

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
import urllib3
55
import uuid
66
import warnings
7+
import os
8+
import re
9+
import tempfile
710

811
from typing import Any, Dict, List, Optional, Tuple, Union
912
from pydantic import Field, StrictBool, StrictFloat, StrictInt, StrictStr, conint, conlist, constr, validator
@@ -83,10 +86,10 @@ def __init__(self, target, id_token=None, private_key_file=None, private_key_pas
8386
PureError: If it could not create an ID or access token
8487
"""
8588
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
86-
config = Configuration()
87-
config.verify_ssl = resolve_ssl_validation(verify_ssl)
88-
config.ssl_ca_cert = ssl_cert
89-
config.host = self._get_base_url(target)
89+
self.config = Configuration()
90+
self.config.verify_ssl = resolve_ssl_validation(verify_ssl)
91+
self.config.ssl_ca_cert = ssl_cert
92+
self.config.host = self._get_base_url(target)
9093

9194
effective_user_agent = user_agent or self.USER_AGENT
9295

@@ -101,7 +104,7 @@ def __init__(self, target, id_token=None, private_key_file=None, private_key_pas
101104
self._token_man = APITokenManager(
102105
api_token_auth_endpoint,
103106
api_token,
104-
verify_ssl=config.verify_ssl,
107+
verify_ssl=self.config.verify_ssl,
105108
token_dispose_endpoint=api_token_dispose_endpoint,
106109
user_agent=effective_user_agent,
107110
timeout=timeout
@@ -117,10 +120,10 @@ def __init__(self, target, id_token=None, private_key_file=None, private_key_pas
117120
'sub': username,
118121
}
119122
self._token_man = TokenManager(auth_endpoint, id_token, private_key_file, private_key_password,
120-
payload=payload, headers=headers, verify_ssl=config.verify_ssl,
123+
payload=payload, headers=headers, verify_ssl=self.config.verify_ssl,
121124
timeout=timeout)
122125

123-
self._api_client = ApiClient(configuration=config)
126+
self._api_client = ApiClient(configuration=self.config)
124127
self._api_client.user_agent = effective_user_agent
125128
self._set_agent_header()
126129
self._set_auth_header()
@@ -17613,7 +17616,10 @@ def _create_valid_response(self, response: ApiResponse, endpoint, kwargs):
1761317616
Returns:
1761417617
ValidResponse
1761517618
"""
17616-
body = response.data
17619+
if response.headers and "content-type" in response.headers.keys() and response.headers["content-type"] in ["application/octet-stream", "text/plain"]:
17620+
body = self._create_file(response)
17621+
else:
17622+
body = response.data
1761717623
headers = response.headers
1761817624

1761917625
continuation_token = getattr(body, "continuation_token", None)
@@ -17633,6 +17639,19 @@ def _create_valid_response(self, response: ApiResponse, endpoint, kwargs):
1763317639
return ValidResponse(response.status_code, continuation_token, total_item_count,
1763417640
items, headers, total, more_items_remaining)
1763517641

17642+
def _create_file(self, response):
17643+
path = tempfile.mkdtemp(dir=self.config.temp_folder_path)
17644+
17645+
content_disposition = response.headers["Content-Disposition"]
17646+
if content_disposition:
17647+
filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?',
17648+
content_disposition).group(1)
17649+
path = os.path.join(os.path.dirname(path), filename)
17650+
17651+
with open(path, "wb") as f:
17652+
f.write(response.data)
17653+
17654+
return path
1763617655

1763717656
def _create_api_versions_response(self, response: ApiResponse, endpoint, kwargs):
1763817657
"""

pypureclient/flashblade/FB_2_10/client.py

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
import urllib3
55
import uuid
66
import warnings
7+
import os
8+
import re
9+
import tempfile
710

811
from typing import Any, Dict, List, Optional, Tuple, Union
912
from pydantic import Field, StrictBool, StrictFloat, StrictInt, StrictStr, conint, conlist, constr, validator
@@ -83,10 +86,10 @@ def __init__(self, target, id_token=None, private_key_file=None, private_key_pas
8386
PureError: If it could not create an ID or access token
8487
"""
8588
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
86-
config = Configuration()
87-
config.verify_ssl = resolve_ssl_validation(verify_ssl)
88-
config.ssl_ca_cert = ssl_cert
89-
config.host = self._get_base_url(target)
89+
self.config = Configuration()
90+
self.config.verify_ssl = resolve_ssl_validation(verify_ssl)
91+
self.config.ssl_ca_cert = ssl_cert
92+
self.config.host = self._get_base_url(target)
9093

9194
effective_user_agent = user_agent or self.USER_AGENT
9295

@@ -101,7 +104,7 @@ def __init__(self, target, id_token=None, private_key_file=None, private_key_pas
101104
self._token_man = APITokenManager(
102105
api_token_auth_endpoint,
103106
api_token,
104-
verify_ssl=config.verify_ssl,
107+
verify_ssl=self.config.verify_ssl,
105108
token_dispose_endpoint=api_token_dispose_endpoint,
106109
user_agent=effective_user_agent,
107110
timeout=timeout
@@ -117,10 +120,10 @@ def __init__(self, target, id_token=None, private_key_file=None, private_key_pas
117120
'sub': username,
118121
}
119122
self._token_man = TokenManager(auth_endpoint, id_token, private_key_file, private_key_password,
120-
payload=payload, headers=headers, verify_ssl=config.verify_ssl,
123+
payload=payload, headers=headers, verify_ssl=self.config.verify_ssl,
121124
timeout=timeout)
122125

123-
self._api_client = ApiClient(configuration=config)
126+
self._api_client = ApiClient(configuration=self.config)
124127
self._api_client.user_agent = effective_user_agent
125128
self._set_agent_header()
126129
self._set_auth_header()
@@ -22137,7 +22140,10 @@ def _create_valid_response(self, response: ApiResponse, endpoint, kwargs):
2213722140
Returns:
2213822141
ValidResponse
2213922142
"""
22140-
body = response.data
22143+
if response.headers and "content-type" in response.headers.keys() and response.headers["content-type"] in ["application/octet-stream", "text/plain"]:
22144+
body = self._create_file(response)
22145+
else:
22146+
body = response.data
2214122147
headers = response.headers
2214222148

2214322149
continuation_token = getattr(body, "continuation_token", None)
@@ -22157,6 +22163,19 @@ def _create_valid_response(self, response: ApiResponse, endpoint, kwargs):
2215722163
return ValidResponse(response.status_code, continuation_token, total_item_count,
2215822164
items, headers, total, more_items_remaining)
2215922165

22166+
def _create_file(self, response):
22167+
path = tempfile.mkdtemp(dir=self.config.temp_folder_path)
22168+
22169+
content_disposition = response.headers["Content-Disposition"]
22170+
if content_disposition:
22171+
filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?',
22172+
content_disposition).group(1)
22173+
path = os.path.join(os.path.dirname(path), filename)
22174+
22175+
with open(path, "wb") as f:
22176+
f.write(response.data)
22177+
22178+
return path
2216022179

2216122180
def _create_api_versions_response(self, response: ApiResponse, endpoint, kwargs):
2216222181
"""

pypureclient/flashblade/FB_2_10/models/logs_async.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
from typing import List, Optional, Union
2222
from pydantic import BaseModel, Field, StrictBool, StrictFloat, StrictInt, StrictStr, conint, conlist
2323
from pypureclient.flashblade.FB_2_10.models.file_info import FileInfo
24-
from pypureclient.flashblade.FB_2_10.models.fixed_reference import FixedReference
24+
from pypureclient.flashblade.FB_2_10.models.reference import Reference
2525

2626

2727
class LogsAsync(BaseModel):
@@ -32,7 +32,7 @@ class LogsAsync(BaseModel):
3232
name: Optional[StrictStr] = Field(default=None, description="Name of the object (e.g., a file system or snapshot).")
3333
available_files: Optional[conlist(FileInfo)] = Field(default=None, description="All of the available files ready for download.")
3434
end_time: Optional[conint(strict=True, ge=0)] = Field(default=None, description="When the time window ends (in milliseconds since epoch). start_time and end_time determine the number of hours for which the logs are prepared for. At most 6 hours of logs can be prepared in one request. start_time and end_time are truncated to hour boundaries.")
35-
hardware_components: Optional[conlist(FixedReference)] = Field(default=None, description="All of the hardware components for which logs are being processed.")
35+
hardware_components: Optional[conlist(Reference)] = Field(default=None, description="All of the hardware components for which logs are being processed.")
3636
last_request_time: Optional[conint(strict=True, ge=0)] = Field(default=None, description="The last time log preparation was requested (in milliseconds since epoch).")
3737
processing: Optional[StrictBool] = Field(default=None, description="Returns a value of `true` if the logs are being prepared.")
3838
progress: Optional[Union[StrictFloat, StrictInt]] = Field(default=None, description="A representation of log preparation progress. Ranges from 0 to 1.0.")
@@ -130,7 +130,7 @@ def from_dict(cls, obj: dict) -> LogsAsync:
130130
"name": obj.get("name"),
131131
"available_files": [FileInfo.from_dict(_item) for _item in obj.get("available_files")] if obj.get("available_files") is not None else None,
132132
"end_time": obj.get("end_time"),
133-
"hardware_components": [FixedReference.from_dict(_item) for _item in obj.get("hardware_components")] if obj.get("hardware_components") is not None else None,
133+
"hardware_components": [Reference.from_dict(_item) for _item in obj.get("hardware_components")] if obj.get("hardware_components") is not None else None,
134134
"last_request_time": obj.get("last_request_time"),
135135
"processing": obj.get("processing"),
136136
"progress": obj.get("progress"),

pypureclient/flashblade/FB_2_10/models/smb_share_policy_rule.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ def to_dict(self, include_readonly: bool=True) -> Dict[str, Any]:
6060
excluded_fields.update([
6161
"id",
6262
"name",
63-
"principal",
6463
])
6564
none_fields: Set[str] = set()
6665
for _field in self.__fields__.keys():

pypureclient/flashblade/FB_2_11/client.py

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
import urllib3
55
import uuid
66
import warnings
7+
import os
8+
import re
9+
import tempfile
710

811
from typing import Any, Dict, List, Optional, Tuple, Union
912
from pydantic import Field, StrictBool, StrictFloat, StrictInt, StrictStr, conint, conlist, constr, validator
@@ -83,10 +86,10 @@ def __init__(self, target, id_token=None, private_key_file=None, private_key_pas
8386
PureError: If it could not create an ID or access token
8487
"""
8588
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
86-
config = Configuration()
87-
config.verify_ssl = resolve_ssl_validation(verify_ssl)
88-
config.ssl_ca_cert = ssl_cert
89-
config.host = self._get_base_url(target)
89+
self.config = Configuration()
90+
self.config.verify_ssl = resolve_ssl_validation(verify_ssl)
91+
self.config.ssl_ca_cert = ssl_cert
92+
self.config.host = self._get_base_url(target)
9093

9194
effective_user_agent = user_agent or self.USER_AGENT
9295

@@ -101,7 +104,7 @@ def __init__(self, target, id_token=None, private_key_file=None, private_key_pas
101104
self._token_man = APITokenManager(
102105
api_token_auth_endpoint,
103106
api_token,
104-
verify_ssl=config.verify_ssl,
107+
verify_ssl=self.config.verify_ssl,
105108
token_dispose_endpoint=api_token_dispose_endpoint,
106109
user_agent=effective_user_agent,
107110
timeout=timeout
@@ -117,10 +120,10 @@ def __init__(self, target, id_token=None, private_key_file=None, private_key_pas
117120
'sub': username,
118121
}
119122
self._token_man = TokenManager(auth_endpoint, id_token, private_key_file, private_key_password,
120-
payload=payload, headers=headers, verify_ssl=config.verify_ssl,
123+
payload=payload, headers=headers, verify_ssl=self.config.verify_ssl,
121124
timeout=timeout)
122125

123-
self._api_client = ApiClient(configuration=config)
126+
self._api_client = ApiClient(configuration=self.config)
124127
self._api_client.user_agent = effective_user_agent
125128
self._set_agent_header()
126129
self._set_auth_header()
@@ -22143,7 +22146,10 @@ def _create_valid_response(self, response: ApiResponse, endpoint, kwargs):
2214322146
Returns:
2214422147
ValidResponse
2214522148
"""
22146-
body = response.data
22149+
if response.headers and "content-type" in response.headers.keys() and response.headers["content-type"] in ["application/octet-stream", "text/plain"]:
22150+
body = self._create_file(response)
22151+
else:
22152+
body = response.data
2214722153
headers = response.headers
2214822154

2214922155
continuation_token = getattr(body, "continuation_token", None)
@@ -22163,6 +22169,19 @@ def _create_valid_response(self, response: ApiResponse, endpoint, kwargs):
2216322169
return ValidResponse(response.status_code, continuation_token, total_item_count,
2216422170
items, headers, total, more_items_remaining)
2216522171

22172+
def _create_file(self, response):
22173+
path = tempfile.mkdtemp(dir=self.config.temp_folder_path)
22174+
22175+
content_disposition = response.headers["Content-Disposition"]
22176+
if content_disposition:
22177+
filename = re.search(r'filename=[\'"]?([^\'"\s]+)[\'"]?',
22178+
content_disposition).group(1)
22179+
path = os.path.join(os.path.dirname(path), filename)
22180+
22181+
with open(path, "wb") as f:
22182+
f.write(response.data)
22183+
22184+
return path
2216622185

2216722186
def _create_api_versions_response(self, response: ApiResponse, endpoint, kwargs):
2216822187
"""

0 commit comments

Comments
 (0)