cloudvision.api package
Subpackages
- cloudvision.api.arista package
- Subpackages
- cloudvision.api.arista.action package
- cloudvision.api.arista.alert package
- cloudvision.api.arista.auditlog package
- cloudvision.api.arista.bugexposure package
- cloudvision.api.arista.changecontrol package
- cloudvision.api.arista.configlet 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.inventory package
- cloudvision.api.arista.lifecycle package
- cloudvision.api.arista.serviceaccount package
- cloudvision.api.arista.softwaremanagement package
- cloudvision.api.arista.subscriptions package
- cloudvision.api.arista.syslog package
- cloudvision.api.arista.tag package
- cloudvision.api.arista.time 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
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)[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.
- Return type: