yandexcloud 0.285.0__py3-none-any.whl → 0.287.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.
Potentially problematic release.
This version of yandexcloud might be problematic. Click here for more details.
- yandexcloud/__init__.py +1 -0
- yandexcloud/_auth_fabric.py +12 -5
- yandexcloud/_channels.py +59 -23
- yandexcloud/_sdk.py +8 -5
- yandexcloud/auth.py +3 -1
- yandexcloud-0.287.0.dist-info/METADATA +203 -0
- {yandexcloud-0.285.0.dist-info → yandexcloud-0.287.0.dist-info}/RECORD +11 -11
- yandexcloud-0.285.0.dist-info/METADATA +0 -110
- {yandexcloud-0.285.0.dist-info → yandexcloud-0.287.0.dist-info}/AUTHORS +0 -0
- {yandexcloud-0.285.0.dist-info → yandexcloud-0.287.0.dist-info}/LICENSE +0 -0
- {yandexcloud-0.285.0.dist-info → yandexcloud-0.287.0.dist-info}/WHEEL +0 -0
- {yandexcloud-0.285.0.dist-info → yandexcloud-0.287.0.dist-info}/top_level.txt +0 -0
yandexcloud/__init__.py
CHANGED
yandexcloud/_auth_fabric.py
CHANGED
|
@@ -19,6 +19,13 @@ _MDS_TIMEOUT = (1.0, 1.0) # 1sec connect, 1sec read
|
|
|
19
19
|
YC_API_ENDPOINT = "api.cloud.yandex.net"
|
|
20
20
|
|
|
21
21
|
|
|
22
|
+
def set_up_yc_api_endpoint(endpoint: str) -> str:
|
|
23
|
+
# pylint: disable-next=global-statement
|
|
24
|
+
global YC_API_ENDPOINT
|
|
25
|
+
YC_API_ENDPOINT = endpoint
|
|
26
|
+
return YC_API_ENDPOINT
|
|
27
|
+
|
|
28
|
+
|
|
22
29
|
def __validate_service_account_key(sa_key):
|
|
23
30
|
if not isinstance(sa_key, dict):
|
|
24
31
|
raise RuntimeError("Invalid Service Account Key: expecting dictionary, actually got {}".format(type(sa_key)))
|
|
@@ -46,9 +53,9 @@ def __validate_service_account_key(sa_key):
|
|
|
46
53
|
raise RuntimeError(error_message)
|
|
47
54
|
|
|
48
55
|
|
|
49
|
-
def get_auth_token_requester(
|
|
50
|
-
|
|
51
|
-
|
|
56
|
+
def get_auth_token_requester(token=None, service_account_key=None, iam_token=None, metadata_addr=None, endpoint=None):
|
|
57
|
+
if endpoint is None:
|
|
58
|
+
endpoint = YC_API_ENDPOINT
|
|
52
59
|
auth_methods = [("token", token), ("service_account_key", service_account_key), ("iam_token", iam_token)]
|
|
53
60
|
auth_methods = [(auth_type, value) for auth_type, value in auth_methods if value is not None]
|
|
54
61
|
|
|
@@ -97,9 +104,9 @@ class TokenAuth:
|
|
|
97
104
|
class ServiceAccountAuth:
|
|
98
105
|
__SECONDS_IN_HOUR = 60.0 * 60.0
|
|
99
106
|
|
|
100
|
-
def __init__(self, sa_key, endpoint=
|
|
107
|
+
def __init__(self, sa_key, endpoint=None):
|
|
101
108
|
self.__sa_key = sa_key
|
|
102
|
-
self._endpoint = endpoint
|
|
109
|
+
self._endpoint = endpoint if endpoint is not None else YC_API_ENDPOINT
|
|
103
110
|
|
|
104
111
|
def get_token_request(self):
|
|
105
112
|
return CreateIamTokenRequest(jwt=self.__prepare_request(self._endpoint))
|
yandexcloud/_channels.py
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import logging
|
|
1
2
|
from importlib.metadata import PackageNotFoundError, version
|
|
3
|
+
from typing import Dict, Optional
|
|
2
4
|
|
|
3
5
|
import grpc
|
|
4
6
|
|
|
@@ -13,10 +15,11 @@ except PackageNotFoundError:
|
|
|
13
15
|
VERSION = "0.0.0"
|
|
14
16
|
|
|
15
17
|
SDK_USER_AGENT = "yandex-cloud-python-sdk/{version}".format(version=VERSION)
|
|
18
|
+
logger = logging.getLogger(__name__)
|
|
16
19
|
|
|
17
20
|
|
|
18
|
-
class Channels
|
|
19
|
-
def __init__(self, client_user_agent=None, **kwargs):
|
|
21
|
+
class Channels:
|
|
22
|
+
def __init__(self, client_user_agent=None, endpoints: Optional[Dict[str, str]] = None, **kwargs):
|
|
20
23
|
self._channel_creds = grpc.ssl_channel_credentials(
|
|
21
24
|
root_certificates=kwargs.get("root_certificates"),
|
|
22
25
|
private_key=kwargs.get("private_key"),
|
|
@@ -30,35 +33,68 @@ class Channels(object):
|
|
|
30
33
|
endpoint=self._endpoint,
|
|
31
34
|
)
|
|
32
35
|
|
|
33
|
-
self._unauthenticated_channel = None
|
|
34
|
-
self._channels = None
|
|
35
36
|
self._client_user_agent = client_user_agent
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
37
|
+
self._config_endpoints = endpoints if endpoints is not None else {}
|
|
38
|
+
self._endpoints = None
|
|
39
|
+
self.channel_options = tuple(
|
|
39
40
|
("grpc.primary_user_agent", user_agent)
|
|
40
41
|
for user_agent in [self._client_user_agent, SDK_USER_AGENT]
|
|
41
42
|
if user_agent is not None
|
|
42
43
|
)
|
|
43
44
|
|
|
44
|
-
def channel(self, endpoint):
|
|
45
|
-
if
|
|
46
|
-
|
|
47
|
-
|
|
45
|
+
def channel(self, service: str, endpoint: Optional[str] = None, insecure: bool = False) -> grpc.Channel:
|
|
46
|
+
if endpoint:
|
|
47
|
+
logger.info("Using provided service %s endpoint %s", service, endpoint)
|
|
48
|
+
if insecure:
|
|
49
|
+
logger.info("Insecure option is ON, no IAM endpoint used for verification")
|
|
50
|
+
return grpc.insecure_channel(endpoint, options=self.channel_options)
|
|
51
|
+
logger.info("Insecure option is OFF,IAM endpoint %s used for verification")
|
|
52
|
+
creds = self._get_creds(self.endpoints["iam"])
|
|
53
|
+
return grpc.secure_channel(endpoint, creds, options=self.channel_options)
|
|
54
|
+
if service not in self._config_endpoints and insecure:
|
|
55
|
+
logger.warning(
|
|
56
|
+
"Unable to use insecure option for default {%s} service endpoint.\n"
|
|
57
|
+
"Option is ignored. To enable it override endpoint.",
|
|
58
|
+
service,
|
|
48
59
|
)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
endpoints =
|
|
60
|
+
elif insecure:
|
|
61
|
+
logger.info("Insecure option is ON, no IAM endpoint used for verification")
|
|
62
|
+
return grpc.insecure_channel(self.endpoints[service], options=self.channel_options)
|
|
63
|
+
|
|
64
|
+
logger.info(
|
|
65
|
+
"Using endpoints from configuration, IAM %s, %s %s",
|
|
66
|
+
self.endpoints["iam"],
|
|
67
|
+
service,
|
|
68
|
+
self.endpoints[service],
|
|
69
|
+
)
|
|
52
70
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
71
|
+
creds = self._get_creds(self.endpoints["iam"])
|
|
72
|
+
if service not in self.endpoints:
|
|
73
|
+
raise RuntimeError(f"Unknown service: {service}")
|
|
74
|
+
return grpc.secure_channel(self.endpoints[service], creds, options=self.channel_options)
|
|
56
75
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
76
|
+
@property
|
|
77
|
+
def endpoints(self) -> Optional[dict]:
|
|
78
|
+
if self._endpoints is None:
|
|
79
|
+
self._endpoints = self._get_endpoints()
|
|
80
|
+
for id_, address in self._config_endpoints.items():
|
|
81
|
+
logger.debug("Override service %s, endpoint %s", id_, address)
|
|
82
|
+
if id_ == "iam":
|
|
83
|
+
logger.warning(
|
|
84
|
+
"Be aware `iam` service endpoint is overridden. "
|
|
85
|
+
"That can produce unexpected results in SDK calls."
|
|
86
|
+
)
|
|
87
|
+
self._endpoints[id_] = address
|
|
88
|
+
return self._endpoints
|
|
60
89
|
|
|
61
|
-
|
|
62
|
-
|
|
90
|
+
def _get_endpoints(self) -> Dict[str, str]:
|
|
91
|
+
unauthenticated_channel = grpc.secure_channel(self._endpoint, self._channel_creds, options=self.channel_options)
|
|
92
|
+
endpoint_service = ApiEndpointServiceStub(unauthenticated_channel)
|
|
93
|
+
resp = endpoint_service.List(ListApiEndpointsRequest())
|
|
94
|
+
return {endpoint.id: endpoint.address for endpoint in resp.endpoints}
|
|
63
95
|
|
|
64
|
-
|
|
96
|
+
def _get_creds(self, iam_endpoint: str) -> grpc.ChannelCredentials:
|
|
97
|
+
plugin = _auth_plugin.Credentials(self._token_requester, lambda: iam_endpoint)
|
|
98
|
+
call_creds = grpc.metadata_call_credentials(plugin)
|
|
99
|
+
creds = grpc.composite_channel_credentials(self._channel_creds, call_creds)
|
|
100
|
+
return creds
|
yandexcloud/_sdk.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import inspect
|
|
2
|
+
from typing import Dict, Optional
|
|
2
3
|
|
|
3
4
|
import grpc
|
|
4
5
|
|
|
@@ -8,8 +9,8 @@ from yandexcloud._retry_interceptor import RetryInterceptor
|
|
|
8
9
|
from yandexcloud._wrappers import Wrappers
|
|
9
10
|
|
|
10
11
|
|
|
11
|
-
class SDK
|
|
12
|
-
def __init__(self, interceptor=None, user_agent=None, **kwargs):
|
|
12
|
+
class SDK:
|
|
13
|
+
def __init__(self, interceptor=None, user_agent=None, endpoints: Optional[Dict[str, str]] = None, **kwargs):
|
|
13
14
|
"""
|
|
14
15
|
API entry-point object.
|
|
15
16
|
|
|
@@ -22,8 +23,10 @@ class SDK(object):
|
|
|
22
23
|
]
|
|
23
24
|
:param user_agent: String to prepend User-Agent metadata header for all GRPC requests made via SDK object
|
|
24
25
|
:type user_agent: Optional[str]
|
|
26
|
+
:param endpoints: Dict with services endpoints overrides. Example: {'vpc': 'new.vpc.endpoint:443'}
|
|
27
|
+
|
|
25
28
|
"""
|
|
26
|
-
self._channels = _channels.Channels(client_user_agent=user_agent, **kwargs)
|
|
29
|
+
self._channels = _channels.Channels(client_user_agent=user_agent, endpoints=endpoints, **kwargs)
|
|
27
30
|
if interceptor is None:
|
|
28
31
|
interceptor = RetryInterceptor(
|
|
29
32
|
max_retry_count=5,
|
|
@@ -37,9 +40,9 @@ class SDK(object):
|
|
|
37
40
|
def set_interceptor(self, interceptor):
|
|
38
41
|
self._default_interceptor = interceptor
|
|
39
42
|
|
|
40
|
-
def client(self, stub_ctor, interceptor=None):
|
|
43
|
+
def client(self, stub_ctor, interceptor=None, endpoint: Optional[str] = None, insecure: bool = False):
|
|
41
44
|
service = _service_for_ctor(stub_ctor)
|
|
42
|
-
channel = self._channels.channel(service)
|
|
45
|
+
channel = self._channels.channel(service, endpoint, insecure)
|
|
43
46
|
if interceptor is not None:
|
|
44
47
|
channel = grpc.intercept_channel(channel, interceptor)
|
|
45
48
|
elif self._default_interceptor is not None:
|
yandexcloud/auth.py
CHANGED
|
@@ -8,7 +8,9 @@ from yandexcloud._auth_fabric import (
|
|
|
8
8
|
)
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
def get_auth_token(token=None, service_account_key=None, iam_token=None, metadata_addr=None, endpoint=
|
|
11
|
+
def get_auth_token(token=None, service_account_key=None, iam_token=None, metadata_addr=None, endpoint=None):
|
|
12
|
+
if endpoint is None:
|
|
13
|
+
endpoint = YC_API_ENDPOINT
|
|
12
14
|
requester = get_auth_token_requester(
|
|
13
15
|
token=token,
|
|
14
16
|
service_account_key=service_account_key,
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
Metadata-Version: 2.1
|
|
2
|
+
Name: yandexcloud
|
|
3
|
+
Version: 0.287.0
|
|
4
|
+
Summary: The Yandex.Cloud official SDK
|
|
5
|
+
Home-page: https://github.com/yandex-cloud/python-sdk
|
|
6
|
+
Author: Yandex LLC
|
|
7
|
+
Author-email: cloud@support.yandex.ru
|
|
8
|
+
License: MIT
|
|
9
|
+
Classifier: Programming Language :: Python
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
+
Description-Content-Type: text/markdown
|
|
17
|
+
License-File: LICENSE
|
|
18
|
+
License-File: AUTHORS
|
|
19
|
+
Requires-Dist: cryptography >=2.8
|
|
20
|
+
Requires-Dist: grpcio >=1.59.3
|
|
21
|
+
Requires-Dist: protobuf >=4.23.4
|
|
22
|
+
Requires-Dist: googleapis-common-protos >=1.59.1
|
|
23
|
+
Requires-Dist: pyjwt >=1.7.1
|
|
24
|
+
Requires-Dist: requests >=2.22.0
|
|
25
|
+
Requires-Dist: six >=1.14.0
|
|
26
|
+
|
|
27
|
+
[![PyPI Version][pypi-image]][pypi-url]
|
|
28
|
+
[![Build Status][build-image]][build-url]
|
|
29
|
+
[![License][license-image]][license-url]
|
|
30
|
+
|
|
31
|
+
<!-- Badges -->
|
|
32
|
+
|
|
33
|
+
[pypi-image]: https://img.shields.io/pypi/v/yandexcloud
|
|
34
|
+
[pypi-url]: https://pypi.org/project/yandexcloud/
|
|
35
|
+
[build-image]: https://github.com/yandex-cloud/python-sdk/actions/workflows/run-tests.yml/badge.svg
|
|
36
|
+
[build-url]: https://github.com/yandex-cloud/python-sdk/actions/workflows/run-tests.yml
|
|
37
|
+
[license-image]: https://img.shields.io/github/license/yandex-cloud/python-sdk.svg
|
|
38
|
+
[license-url]: https://github.com/yandex-cloud/python-sdk/blob/master/LICENSE
|
|
39
|
+
|
|
40
|
+
# Yandex.Cloud SDK (Python)
|
|
41
|
+
|
|
42
|
+
Need to automate your infrastructure or use services provided by Yandex.Cloud? We've got you covered.
|
|
43
|
+
|
|
44
|
+
Installation:
|
|
45
|
+
|
|
46
|
+
pip install yandexcloud
|
|
47
|
+
|
|
48
|
+
## Getting started
|
|
49
|
+
|
|
50
|
+
There are several options for authorization your requests - OAuth Token,
|
|
51
|
+
Metadata Service (if you're executing your code inside VMs or Cloud Functions
|
|
52
|
+
running in Yandex.Cloud), Service Account Keys, and externally created IAM tokens.
|
|
53
|
+
|
|
54
|
+
### OAuth Token
|
|
55
|
+
|
|
56
|
+
```python
|
|
57
|
+
sdk = yandexcloud.SDK(token='AQAD-.....')
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
### Metadata Service
|
|
61
|
+
|
|
62
|
+
Don't forget to assign Service Account for your Instance or Function and grant required roles.
|
|
63
|
+
|
|
64
|
+
```python
|
|
65
|
+
sdk = yandexcloud.SDK()
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
### Service Account Keys
|
|
69
|
+
|
|
70
|
+
```python
|
|
71
|
+
# you can store and read it from JSON file
|
|
72
|
+
sa_key = {
|
|
73
|
+
"id": "...",
|
|
74
|
+
"service_account_id": "...",
|
|
75
|
+
"private_key": "..."
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
sdk = yandexcloud.SDK(service_account_key=sa_key)
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### IAM tokens
|
|
82
|
+
|
|
83
|
+
```python
|
|
84
|
+
sdk = yandexcloud.SDK(iam_token="t1.9eu...")
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Check `examples` directory for more examples.
|
|
88
|
+
|
|
89
|
+
### Override service endpoint
|
|
90
|
+
|
|
91
|
+
#### Supported services
|
|
92
|
+
|
|
93
|
+
| Service Name | Alias |
|
|
94
|
+
|------------------------------------------------------------------------|--------------------------|
|
|
95
|
+
| yandex.cloud.ai.foundation_models | ai-foundation-models |
|
|
96
|
+
| yandex.cloud.ai.llm | ai-llm |
|
|
97
|
+
| yandex.cloud.ai.stt | ai-stt |
|
|
98
|
+
| yandex.cloud.ai.translate | ai-translate |
|
|
99
|
+
| yandex.cloud.ai.tts | ai-speechkit |
|
|
100
|
+
| yandex.cloud.ai.vision | ai-vision |
|
|
101
|
+
| yandex.cloud.apploadbalancer | alb |
|
|
102
|
+
| yandex.cloud.billing | billing |
|
|
103
|
+
| yandex.cloud.cdn | cdn |
|
|
104
|
+
| yandex.cloud.certificatemanager.v1.certificate_content_service | certificate-manager-data |
|
|
105
|
+
| yandex.cloud.certificatemanager | certificate-manager |
|
|
106
|
+
| yandex.cloud.compute | compute |
|
|
107
|
+
| yandex.cloud.containerregistry | container-registry |
|
|
108
|
+
| yandex.cloud.dataproc.manager | dataproc-manager |
|
|
109
|
+
| yandex.cloud.dataproc | dataproc |
|
|
110
|
+
| yandex.cloud.datatransfer | datatransfer |
|
|
111
|
+
| yandex.cloud.dns | dns |
|
|
112
|
+
| yandex.cloud.endpoint | endpoint |
|
|
113
|
+
| yandex.cloud.iam | iam |
|
|
114
|
+
| yandex.cloud.iot.devices | iot-devices |
|
|
115
|
+
| yandex.cloud.k8s | managed-kubernetes |
|
|
116
|
+
| yandex.cloud.kms | kms |
|
|
117
|
+
| yandex.cloud.kms.v1.symmetric_crypto_service | kms-crypto |
|
|
118
|
+
| yandex.cloud.loadbalancer | load-balancer |
|
|
119
|
+
| yandex.cloud.loadtesting | loadtesting |
|
|
120
|
+
| yandex.cloud.lockbox.v1.payload_service | lockbox-payload |
|
|
121
|
+
| yandex.cloud.lockbox | lockbox |
|
|
122
|
+
| yandex.cloud.logging.v1.log_ingestion_service | log-ingestion |
|
|
123
|
+
| yandex.cloud.logging.v1.log_reading_service | log-reading |
|
|
124
|
+
| yandex.cloud.logging | logging |
|
|
125
|
+
| yandex.cloud.marketplace | marketplace |
|
|
126
|
+
| yandex.cloud.mdb.clickhouse | managed-clickhouse |
|
|
127
|
+
| yandex.cloud.mdb.elasticsearch | managed-elasticsearch |
|
|
128
|
+
| yandex.cloud.mdb.greenplum | managed-greenplum |
|
|
129
|
+
| yandex.cloud.mdb.kafka | managed-kafka |
|
|
130
|
+
| yandex.cloud.mdb.mongodb | managed-mongodb |
|
|
131
|
+
| yandex.cloud.mdb.mysql | managed-mysql |
|
|
132
|
+
| yandex.cloud.mdb.opensearch | managed-opensearch |
|
|
133
|
+
| yandex.cloud.mdb.postgresql | managed-postgresql |
|
|
134
|
+
| yandex.cloud.mdb.redis | managed-redis |
|
|
135
|
+
| yandex.cloud.mdb.sqlserver | managed-sqlserver |
|
|
136
|
+
| yandex.cloud.operation | operation |
|
|
137
|
+
| yandex.cloud.organizationmanager | organization-manager |
|
|
138
|
+
| yandex.cloud.resourcemanager | resource-manager |
|
|
139
|
+
| yandex.cloud.serverless.apigateway | serverless-apigateway |
|
|
140
|
+
| yandex.cloud.serverless.apigateway.websocket | apigateway-connections |
|
|
141
|
+
| yandex.cloud.serverless.containers | serverless-containers |
|
|
142
|
+
| yandex.cloud.serverless.functions | serverless-functions |
|
|
143
|
+
| yandex.cloud.serverless.triggers | serverless-triggers |
|
|
144
|
+
| yandex.cloud.storage | storage-api |
|
|
145
|
+
| yandex.cloud.vpc | vpc |
|
|
146
|
+
| yandex.cloud.ydb | ydb |
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
#### Override in client
|
|
150
|
+
```python
|
|
151
|
+
from yandex.cloud.vpc.v1.network_service_pb2_grpc import NetworkServiceStub
|
|
152
|
+
from yandexcloud import SDK
|
|
153
|
+
|
|
154
|
+
sdk = SDK(iam_token="t1.9eu...")
|
|
155
|
+
new_network_client_endpoint = "example.new.vpc.very.new.yandex:50051"
|
|
156
|
+
insecure = False # by default is False, but if server does not support verification can be set to True
|
|
157
|
+
network_client = sdk.client(NetworkServiceStub, endpoint=new_network_client_endpoint, insecure=False)
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
#### Override in sdk config
|
|
161
|
+
To override endpoints provide dict in format {alias : new-endpoint}
|
|
162
|
+
```python
|
|
163
|
+
from yandex.cloud.vpc.v1.network_service_pb2_grpc import NetworkServiceStub
|
|
164
|
+
from yandexcloud import SDK
|
|
165
|
+
new_network_client_endpoint = "example.new.vpc.very.new.yandex:50051"
|
|
166
|
+
sdk = SDK(iam_token="t1.9eu...", endpoints={"vpc": new_network_client_endpoint})
|
|
167
|
+
insecure = False # by default is False, but if server does not support verification can be set to True
|
|
168
|
+
network_client = sdk.client(NetworkServiceStub, insecure=False)
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
Notice: if both overrides are used for same endpoint, override by client has priority
|
|
172
|
+
|
|
173
|
+
#### Switch SDK region
|
|
174
|
+
```python
|
|
175
|
+
from yandexcloud import SDK, set_up_yc_api_endpoint
|
|
176
|
+
kz_region_endpoint = "api.yandexcloud.kz"
|
|
177
|
+
# this will make SDK list endpoints from KZ yc installation
|
|
178
|
+
sdk = SDK(iam_token="t1.9eu...", endpoint="api.yandexcloud.kz")
|
|
179
|
+
# or you can use global function
|
|
180
|
+
set_up_yc_api_endpoint(kz_region_endpoint)
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Contributing
|
|
184
|
+
### Dependencies
|
|
185
|
+
Use `make deps` command to install library, its production and development dependencies.
|
|
186
|
+
|
|
187
|
+
### Formatting
|
|
188
|
+
Use `make format` to autoformat code with black tool.
|
|
189
|
+
|
|
190
|
+
### Tests
|
|
191
|
+
- `make test` to run tests for current python version
|
|
192
|
+
- `make lint` to run only linters for current python version
|
|
193
|
+
- `make tox-current` to run all checks (tests + code style checks + linters + format check) for current python version
|
|
194
|
+
- `make tox` to run all checks for all supported (installed in your system) python versions
|
|
195
|
+
- `make test-all-versions` to run all checks for all supported python versions in docker container
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
### Maintaining
|
|
199
|
+
If pull request consists of several meaningful commits, that should be preserved,
|
|
200
|
+
then use "Rebase and merge" option. Otherwise use "Squash and merge".
|
|
201
|
+
|
|
202
|
+
New release (changelog, tag and pypi upload) will be automatically created
|
|
203
|
+
on each push to master via Github Actions workflow.
|
|
@@ -1235,22 +1235,22 @@ yandex/cloud/ydb/v1/storage_type_pb2.py,sha256=Y7KzpsgrWOmo2TlW2aluwRg0Xw2i3Jy-s
|
|
|
1235
1235
|
yandex/cloud/ydb/v1/storage_type_pb2_grpc.py,sha256=1oboBPFxaTEXt9Aw7EAj8gXHDCNMhZD2VXqocC9l_gk,159
|
|
1236
1236
|
yandex/cloud/ydb/v1/storage_type_service_pb2.py,sha256=cTajsoT_mKDO5p_4HQOgvjTdz7XqRdjtWi3xK9eY6tI,3723
|
|
1237
1237
|
yandex/cloud/ydb/v1/storage_type_service_pb2_grpc.py,sha256=3156bynSw7aG4iU-Wbjuwt8ivF41QoiLNyOslnX_TKo,4791
|
|
1238
|
-
yandexcloud/__init__.py,sha256=
|
|
1239
|
-
yandexcloud/_auth_fabric.py,sha256=
|
|
1238
|
+
yandexcloud/__init__.py,sha256=NQG4NAbBlUJGEt15OlUA3RZbW2wD9vjkwhp1Hu-DRUU,360
|
|
1239
|
+
yandexcloud/_auth_fabric.py,sha256=o5Rrk0O7cNaLZRHk0Xc2aMj4DcUdUwmCReRWKpR3ZaU,4717
|
|
1240
1240
|
yandexcloud/_auth_plugin.py,sha256=DHYliuD3PYPfONOcmTpJoDNFKfgwsQbe0z3N7d44A6A,2709
|
|
1241
1241
|
yandexcloud/_backoff.py,sha256=ptd32-4wNNlZBexi34GIbI2DKxQILHWq_mVSgTdO_3I,956
|
|
1242
|
-
yandexcloud/_channels.py,sha256=
|
|
1242
|
+
yandexcloud/_channels.py,sha256=nf6Y64RhW0gb_7fg_HLzIafbRnkpQrQF3Lp2egA5BIA,4588
|
|
1243
1243
|
yandexcloud/_helpers.py,sha256=wtkkvklZYnFSTl9ge16ryR-e9kyeWOlSFCBpoL-f3-g,3388
|
|
1244
1244
|
yandexcloud/_operation_waiter.py,sha256=Fg2BRdOpVZwD5QQDUTlWTseclsjkwcEn3fyAH7bezDo,4160
|
|
1245
1245
|
yandexcloud/_retry_interceptor.py,sha256=W7JVatSB8bGwinUH4Bq2URbticG2atVuYhceivuUJwc,6518
|
|
1246
|
-
yandexcloud/_sdk.py,sha256=
|
|
1247
|
-
yandexcloud/auth.py,sha256=
|
|
1246
|
+
yandexcloud/_sdk.py,sha256=vlYJFETnma6dTImt72GNuzADMPLhE495WjnB5ck9bNo,6118
|
|
1247
|
+
yandexcloud/auth.py,sha256=klB0yFOImdZKcHpAwIxNJib7CsSpTN0eC2r9kLkf7C0,842
|
|
1248
1248
|
yandexcloud/operations.py,sha256=ajTQtALe76_77uYVCUPQ2KAkRRhdmjqbt-jFIVKNULg,448
|
|
1249
1249
|
yandexcloud/_wrappers/__init__.py,sha256=_GdM0-eMpcQCmyNHlnqTHpLzN0riBLaq-ACVavLNSrM,251
|
|
1250
1250
|
yandexcloud/_wrappers/dataproc/__init__.py,sha256=3YXJfktefML0KRNMtTFXncbswIdd9yBlqQkhDqclang,33215
|
|
1251
|
-
yandexcloud-0.
|
|
1252
|
-
yandexcloud-0.
|
|
1253
|
-
yandexcloud-0.
|
|
1254
|
-
yandexcloud-0.
|
|
1255
|
-
yandexcloud-0.
|
|
1256
|
-
yandexcloud-0.
|
|
1251
|
+
yandexcloud-0.287.0.dist-info/AUTHORS,sha256=BYzvivX5Y67xcqFAJhmqcKy5UwHCngxlnDt4i_PhNO4,264
|
|
1252
|
+
yandexcloud-0.287.0.dist-info/LICENSE,sha256=AFcOYhNOyuBQP89lObqyipdScN2KUUS-OuWoUlVo6yE,1077
|
|
1253
|
+
yandexcloud-0.287.0.dist-info/METADATA,sha256=m9uoa1Rh6JeQdV1UooG_jNbfcqKBDr0QDEHkSDbgza8,10394
|
|
1254
|
+
yandexcloud-0.287.0.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
|
|
1255
|
+
yandexcloud-0.287.0.dist-info/top_level.txt,sha256=p6aBMPGD526A1jM2WVnAneI2qO4kGDWeJi6uwYApDqg,19
|
|
1256
|
+
yandexcloud-0.287.0.dist-info/RECORD,,
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
Metadata-Version: 2.1
|
|
2
|
-
Name: yandexcloud
|
|
3
|
-
Version: 0.285.0
|
|
4
|
-
Summary: The Yandex.Cloud official SDK
|
|
5
|
-
Home-page: https://github.com/yandex-cloud/python-sdk
|
|
6
|
-
Author: Yandex LLC
|
|
7
|
-
Author-email: cloud@support.yandex.ru
|
|
8
|
-
License: MIT
|
|
9
|
-
Classifier: Programming Language :: Python
|
|
10
|
-
Classifier: Programming Language :: Python :: 3
|
|
11
|
-
Classifier: Programming Language :: Python :: 3.8
|
|
12
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
13
|
-
Classifier: Programming Language :: Python :: 3.10
|
|
14
|
-
Classifier: Programming Language :: Python :: 3.11
|
|
15
|
-
Classifier: Programming Language :: Python :: 3.12
|
|
16
|
-
Description-Content-Type: text/markdown
|
|
17
|
-
License-File: LICENSE
|
|
18
|
-
License-File: AUTHORS
|
|
19
|
-
Requires-Dist: cryptography >=2.8
|
|
20
|
-
Requires-Dist: grpcio >=1.59.3
|
|
21
|
-
Requires-Dist: protobuf >=4.23.4
|
|
22
|
-
Requires-Dist: googleapis-common-protos >=1.59.1
|
|
23
|
-
Requires-Dist: pyjwt >=1.7.1
|
|
24
|
-
Requires-Dist: requests >=2.22.0
|
|
25
|
-
Requires-Dist: six >=1.14.0
|
|
26
|
-
|
|
27
|
-
[![PyPI Version][pypi-image]][pypi-url]
|
|
28
|
-
[![Build Status][build-image]][build-url]
|
|
29
|
-
[![License][license-image]][license-url]
|
|
30
|
-
|
|
31
|
-
<!-- Badges -->
|
|
32
|
-
|
|
33
|
-
[pypi-image]: https://img.shields.io/pypi/v/yandexcloud
|
|
34
|
-
[pypi-url]: https://pypi.org/project/yandexcloud/
|
|
35
|
-
[build-image]: https://github.com/yandex-cloud/python-sdk/actions/workflows/run-tests.yml/badge.svg
|
|
36
|
-
[build-url]: https://github.com/yandex-cloud/python-sdk/actions/workflows/run-tests.yml
|
|
37
|
-
[license-image]: https://img.shields.io/github/license/yandex-cloud/python-sdk.svg
|
|
38
|
-
[license-url]: https://github.com/yandex-cloud/python-sdk/blob/master/LICENSE
|
|
39
|
-
|
|
40
|
-
# Yandex.Cloud SDK (Python)
|
|
41
|
-
|
|
42
|
-
Need to automate your infrastructure or use services provided by Yandex.Cloud? We've got you covered.
|
|
43
|
-
|
|
44
|
-
Installation:
|
|
45
|
-
|
|
46
|
-
pip install yandexcloud
|
|
47
|
-
|
|
48
|
-
## Getting started
|
|
49
|
-
|
|
50
|
-
There are several options for authorization your requests - OAuth Token,
|
|
51
|
-
Metadata Service (if you're executing your code inside VMs or Cloud Functions
|
|
52
|
-
running in Yandex.Cloud), Service Account Keys, and externally created IAM tokens.
|
|
53
|
-
|
|
54
|
-
### OAuth Token
|
|
55
|
-
|
|
56
|
-
```python
|
|
57
|
-
sdk = yandexcloud.SDK(token='AQAD-.....')
|
|
58
|
-
```
|
|
59
|
-
|
|
60
|
-
### Metadata Service
|
|
61
|
-
|
|
62
|
-
Don't forget to assign Service Account for your Instance or Function and grant required roles.
|
|
63
|
-
|
|
64
|
-
```python
|
|
65
|
-
sdk = yandexcloud.SDK()
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
### Service Account Keys
|
|
69
|
-
|
|
70
|
-
```python
|
|
71
|
-
# you can store and read it from JSON file
|
|
72
|
-
sa_key = {
|
|
73
|
-
"id": "...",
|
|
74
|
-
"service_account_id": "...",
|
|
75
|
-
"private_key": "..."
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
sdk = yandexcloud.SDK(service_account_key=sa_key)
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
### IAM tokens
|
|
82
|
-
|
|
83
|
-
```python
|
|
84
|
-
sdk = yandexcloud.SDK(iam_token="t1.9eu...")
|
|
85
|
-
```
|
|
86
|
-
|
|
87
|
-
Check `examples` directory for more examples.
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
## Contributing
|
|
91
|
-
### Dependencies
|
|
92
|
-
Use `make deps` command to install library, its production and development dependencies.
|
|
93
|
-
|
|
94
|
-
### Formatting
|
|
95
|
-
Use `make format` to autoformat code with black tool.
|
|
96
|
-
|
|
97
|
-
### Tests
|
|
98
|
-
- `make test` to run tests for current python version
|
|
99
|
-
- `make lint` to run only linters for current python version
|
|
100
|
-
- `make tox-current` to run all checks (tests + code style checks + linters + format check) for current python version
|
|
101
|
-
- `make tox` to run all checks for all supported (installed in your system) python versions
|
|
102
|
-
- `make test-all-versions` to run all checks for all supported python versions in docker container
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
### Maintaining
|
|
106
|
-
If pull request consists of several meaningful commits, that should be preserved,
|
|
107
|
-
then use "Rebase and merge" option. Otherwise use "Squash and merge".
|
|
108
|
-
|
|
109
|
-
New release (changelog, tag and pypi upload) will be automatically created
|
|
110
|
-
on each push to master via Github Actions workflow.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|