cloudvision.api package
Subpackages
- cloudvision.api.arista package
- Subpackages
- cloudvision.api.arista.action package
- cloudvision.api.arista.alert package
- cloudvision.api.arista.arista_portal package
- cloudvision.api.arista.asset_manager package
- cloudvision.api.arista.auditlog package
- cloudvision.api.arista.bugexposure package
- cloudvision.api.arista.changecontrol package
- cloudvision.api.arista.configlet package
- cloudvision.api.arista.configstatus package
- cloudvision.api.arista.connectivitymonitor package
- cloudvision.api.arista.dashboard package
- cloudvision.api.arista.endpointlocation package
- cloudvision.api.arista.event package
- cloudvision.api.arista.identityprovider package
- cloudvision.api.arista.imagestatus package
- cloudvision.api.arista.inventory package
- cloudvision.api.arista.license package
- cloudvision.api.arista.lifecycle package
- cloudvision.api.arista.redirector package
- cloudvision.api.arista.serviceaccount package
- cloudvision.api.arista.softwaremanagement package
- cloudvision.api.arista.studio package
- cloudvision.api.arista.studio_topology package
- cloudvision.api.arista.subscriptions package
- cloudvision.api.arista.syslog package
- cloudvision.api.arista.tag package
- cloudvision.api.arista.time package
- cloudvision.api.arista.workspace package
- Module contents
- Subpackages
- cloudvision.api.fmp package
- Module contents
DeleteErrorIPv4AddressIPv4PrefixIPv6AddressIPv6PrefixIpAddressIpPrefixMacAddressMapBoolBoolMapBoolBytesMapBoolDoubleMapBoolFloatMapBoolInt32MapBoolInt64MapBoolStringMapBoolUInt32MapBoolUInt64MapInt32BoolMapInt32BytesMapInt32DoubleMapInt32FloatMapInt32Int32MapInt32Int64MapInt32StringMapInt32UInt32MapInt32UInt64MapInt64BoolMapInt64BytesMapInt64DoubleMapInt64FloatMapInt64Int32MapInt64Int64MapInt64StringMapInt64UInt32MapInt64UInt64MapStringBoolMapStringBytesMapStringDoubleMapStringFloatMapStringInt32MapStringInt64MapStringStringMapStringUInt32MapStringUInt64MapUInt32BoolMapUInt32BytesMapUInt32DoubleMapUInt32FloatMapUInt32Int32MapUInt32Int64MapUInt32StringMapUInt32UInt32MapUInt32UInt64MapUInt64BoolMapUInt64BytesMapUInt64DoubleMapUInt64FloatMapUInt64Int32MapUInt64Int64MapUInt64StringMapUInt64UInt32MapUInt64UInt64PortRepeatedBoolRepeatedBytesRepeatedDoubleRepeatedFloatRepeatedIPv4AddressRepeatedIPv6AddressRepeatedInt32RepeatedInt64RepeatedIpAddressRepeatedMacAddressRepeatedStringRepeatedUInt32RepeatedUInt64SortDirection
- Module contents
Submodules
cloudvision.api.client module
- class cloudvision.api.client.AsyncCVClient(token, ssl_context, host, port=443, username=None)[source]
Bases:
objectThis class enables access to CloudVision GRPC API using grpclib stubs.
Use one of classmethods
from_token()from_user_credentials()to intantialize the client, and use it with stubs fromcloudvision.api.aristaIt is implemented as contextmanager, that provides instance of grpclib.client.Channel. See example below
Added in version 1.26.1.
import asyncio from cloudvision.api.client import AsyncCVClient from cloudvision.api.arista.inventory.v1 import DeviceServiceStub, DeviceStreamRequest async def get_devices(): client = AsyncCVClient.from_token('<your service account token>', 'your-cvp.io') # get channel with client as channel: # pass it to the stub service = DeviceServiceStub(channel) # execute one of stub's methods async for item in service.get_all(DeviceStreamRequest()): print(item) asyncio.run(get_devices())
Note
If for some reason multiple context managers with the same client are used, each will produce a new channel that would be closed accordingly (see below)
client = AsyncCVCClient(...) with client as channel1: # channel1 is open with client as channel2: ... # both channel1 and channel2 are open # channel2 is closed while channel 1 is still open # channel1 is closed
- classmethod from_token(token, host, port=443, username=None, insecure=False, cacert=None)[source]
If you would like to use service accounts, you can create them in CloudVision UI https://my-cloudvision-instance.io/cv/setting/aaa-service-accounts
Generate a token for service account and pass it to this method to get an instance of the client.
Note
With default parameters, it would assume that the host has a self-signed certificate and it will fetch it and verify hostname and expiry. It is recommended that you use CA signed certificate in your CloudVision deployment, so you’d either add this CA to the list of trusted CAs, or provide it’s certificate via cacert parameter
Danger
Avoid setting insecure=True as this would disable certificate check
Changed in version 1.27.2: Added insecure and cacert parameters
- Parameters:
host – CloudVision hostname
insecure – skip certificate verification
cacert (
pathlib.Pathor str) – path to CA certificate to use for verifying the host’s certificate
- Return type:
- classmethod from_user_credentials(username, password, host, port=443, insecure=False, cacert=None)[source]
Use usename and password to authenticate in CloudVision
Note
With default parameters, it would assume that the host has a self-signed certificate and it will fetch it and verify hostname and expiry. It is recommended that you use CA signed certificate in your CloudVision deployment, so you’d either add this CA to the list of trusted CAs, or provide it’s certificate via cacert parameter
Danger
Avoid setting insecure=True as this would disable certificate check
Changed in version 1.27.2: Added insecure and cacert parameters
- Parameters:
host – CloudVision hostname
insecure – skip certificate verification
cacert (
pathlib.Pathor str) – path to CA certificate to use for verifying the host’s certificate
- Return type:
- Raises: