body
stringlengths 26
98.2k
| body_hash
int64 -9,222,864,604,528,158,000
9,221,803,474B
| docstring
stringlengths 1
16.8k
| path
stringlengths 5
230
| name
stringlengths 1
96
| repository_name
stringlengths 7
89
| lang
stringclasses 1
value | body_without_docstring
stringlengths 20
98.2k
|
---|---|---|---|---|---|---|---|
@property
@pulumi.getter
def request(self) -> pulumi.Output[Optional['outputs.RequestContractResponse']]:
'\n An entity containing request details.\n '
return pulumi.get(self, 'request') | 5,805,657,939,583,796,000 | An entity containing request details. | sdk/python/pulumi_azure_nextgen/apimanagement/v20200601preview/api_operation.py | request | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter
def request(self) -> pulumi.Output[Optional['outputs.RequestContractResponse']]:
'\n \n '
return pulumi.get(self, 'request') |
@property
@pulumi.getter
def responses(self) -> pulumi.Output[Optional[Sequence['outputs.ResponseContractResponse']]]:
'\n Array of Operation responses.\n '
return pulumi.get(self, 'responses') | -5,401,515,889,952,714,000 | Array of Operation responses. | sdk/python/pulumi_azure_nextgen/apimanagement/v20200601preview/api_operation.py | responses | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter
def responses(self) -> pulumi.Output[Optional[Sequence['outputs.ResponseContractResponse']]]:
'\n \n '
return pulumi.get(self, 'responses') |
@property
@pulumi.getter(name='templateParameters')
def template_parameters(self) -> pulumi.Output[Optional[Sequence['outputs.ParameterContractResponse']]]:
'\n Collection of URL template parameters.\n '
return pulumi.get(self, 'template_parameters') | -3,572,406,279,780,156,400 | Collection of URL template parameters. | sdk/python/pulumi_azure_nextgen/apimanagement/v20200601preview/api_operation.py | template_parameters | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='templateParameters')
def template_parameters(self) -> pulumi.Output[Optional[Sequence['outputs.ParameterContractResponse']]]:
'\n \n '
return pulumi.get(self, 'template_parameters') |
@property
@pulumi.getter
def type(self) -> pulumi.Output[str]:
'\n Resource type for API Management resource.\n '
return pulumi.get(self, 'type') | 7,041,064,410,841,667,000 | Resource type for API Management resource. | sdk/python/pulumi_azure_nextgen/apimanagement/v20200601preview/api_operation.py | type | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter
def type(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'type') |
@property
@pulumi.getter(name='urlTemplate')
def url_template(self) -> pulumi.Output[str]:
'\n Relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date}\n '
return pulumi.get(self, 'url_template') | 1,388,042,149,488,761,000 | Relative URL template identifying the target resource for this operation. May include parameters. Example: /customers/{cid}/orders/{oid}/?date={date} | sdk/python/pulumi_azure_nextgen/apimanagement/v20200601preview/api_operation.py | url_template | pulumi/pulumi-azure-nextgen | python | @property
@pulumi.getter(name='urlTemplate')
def url_template(self) -> pulumi.Output[str]:
'\n \n '
return pulumi.get(self, 'url_template') |
def __init__(self, **kwargs):
'\n Initializes a new JreUsage object with values from keyword arguments.\n The following keyword arguments are supported (corresponding to the getters/setters of this class):\n\n :param id:\n The value to assign to the id property of this JreUsage.\n :type id: str\n\n :param fleet_id:\n The value to assign to the fleet_id property of this JreUsage.\n :type fleet_id: str\n\n :param managed_instance_id:\n The value to assign to the managed_instance_id property of this JreUsage.\n :type managed_instance_id: str\n\n :param security_status:\n The value to assign to the security_status property of this JreUsage.\n Allowed values for this property are: "UNKNOWN", "UP_TO_DATE", "UPDATE_REQUIRED", "UPGRADE_REQUIRED", \'UNKNOWN_ENUM_VALUE\'.\n Any unrecognized values returned by a service will be mapped to \'UNKNOWN_ENUM_VALUE\'.\n :type security_status: str\n\n :param release_date:\n The value to assign to the release_date property of this JreUsage.\n :type release_date: datetime\n\n :param end_of_support_life_date:\n The value to assign to the end_of_support_life_date property of this JreUsage.\n :type end_of_support_life_date: datetime\n\n :param vendor:\n The value to assign to the vendor property of this JreUsage.\n :type vendor: str\n\n :param distribution:\n The value to assign to the distribution property of this JreUsage.\n :type distribution: str\n\n :param version:\n The value to assign to the version property of this JreUsage.\n :type version: str\n\n :param operating_systems:\n The value to assign to the operating_systems property of this JreUsage.\n :type operating_systems: list[oci.jms.models.OperatingSystem]\n\n :param approximate_installation_count:\n The value to assign to the approximate_installation_count property of this JreUsage.\n :type approximate_installation_count: int\n\n :param approximate_application_count:\n The value to assign to the approximate_application_count property of this JreUsage.\n :type approximate_application_count: int\n\n :param approximate_managed_instance_count:\n The value to assign to the approximate_managed_instance_count property of this JreUsage.\n :type approximate_managed_instance_count: int\n\n :param time_start:\n The value to assign to the time_start property of this JreUsage.\n :type time_start: datetime\n\n :param time_end:\n The value to assign to the time_end property of this JreUsage.\n :type time_end: datetime\n\n :param time_first_seen:\n The value to assign to the time_first_seen property of this JreUsage.\n :type time_first_seen: datetime\n\n :param time_last_seen:\n The value to assign to the time_last_seen property of this JreUsage.\n :type time_last_seen: datetime\n\n '
self.swagger_types = {'id': 'str', 'fleet_id': 'str', 'managed_instance_id': 'str', 'security_status': 'str', 'release_date': 'datetime', 'end_of_support_life_date': 'datetime', 'vendor': 'str', 'distribution': 'str', 'version': 'str', 'operating_systems': 'list[OperatingSystem]', 'approximate_installation_count': 'int', 'approximate_application_count': 'int', 'approximate_managed_instance_count': 'int', 'time_start': 'datetime', 'time_end': 'datetime', 'time_first_seen': 'datetime', 'time_last_seen': 'datetime'}
self.attribute_map = {'id': 'id', 'fleet_id': 'fleetId', 'managed_instance_id': 'managedInstanceId', 'security_status': 'securityStatus', 'release_date': 'releaseDate', 'end_of_support_life_date': 'endOfSupportLifeDate', 'vendor': 'vendor', 'distribution': 'distribution', 'version': 'version', 'operating_systems': 'operatingSystems', 'approximate_installation_count': 'approximateInstallationCount', 'approximate_application_count': 'approximateApplicationCount', 'approximate_managed_instance_count': 'approximateManagedInstanceCount', 'time_start': 'timeStart', 'time_end': 'timeEnd', 'time_first_seen': 'timeFirstSeen', 'time_last_seen': 'timeLastSeen'}
self._id = None
self._fleet_id = None
self._managed_instance_id = None
self._security_status = None
self._release_date = None
self._end_of_support_life_date = None
self._vendor = None
self._distribution = None
self._version = None
self._operating_systems = None
self._approximate_installation_count = None
self._approximate_application_count = None
self._approximate_managed_instance_count = None
self._time_start = None
self._time_end = None
self._time_first_seen = None
self._time_last_seen = None | -4,771,488,786,165,335,000 | Initializes a new JreUsage object with values from keyword arguments.
The following keyword arguments are supported (corresponding to the getters/setters of this class):
:param id:
The value to assign to the id property of this JreUsage.
:type id: str
:param fleet_id:
The value to assign to the fleet_id property of this JreUsage.
:type fleet_id: str
:param managed_instance_id:
The value to assign to the managed_instance_id property of this JreUsage.
:type managed_instance_id: str
:param security_status:
The value to assign to the security_status property of this JreUsage.
Allowed values for this property are: "UNKNOWN", "UP_TO_DATE", "UPDATE_REQUIRED", "UPGRADE_REQUIRED", 'UNKNOWN_ENUM_VALUE'.
Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
:type security_status: str
:param release_date:
The value to assign to the release_date property of this JreUsage.
:type release_date: datetime
:param end_of_support_life_date:
The value to assign to the end_of_support_life_date property of this JreUsage.
:type end_of_support_life_date: datetime
:param vendor:
The value to assign to the vendor property of this JreUsage.
:type vendor: str
:param distribution:
The value to assign to the distribution property of this JreUsage.
:type distribution: str
:param version:
The value to assign to the version property of this JreUsage.
:type version: str
:param operating_systems:
The value to assign to the operating_systems property of this JreUsage.
:type operating_systems: list[oci.jms.models.OperatingSystem]
:param approximate_installation_count:
The value to assign to the approximate_installation_count property of this JreUsage.
:type approximate_installation_count: int
:param approximate_application_count:
The value to assign to the approximate_application_count property of this JreUsage.
:type approximate_application_count: int
:param approximate_managed_instance_count:
The value to assign to the approximate_managed_instance_count property of this JreUsage.
:type approximate_managed_instance_count: int
:param time_start:
The value to assign to the time_start property of this JreUsage.
:type time_start: datetime
:param time_end:
The value to assign to the time_end property of this JreUsage.
:type time_end: datetime
:param time_first_seen:
The value to assign to the time_first_seen property of this JreUsage.
:type time_first_seen: datetime
:param time_last_seen:
The value to assign to the time_last_seen property of this JreUsage.
:type time_last_seen: datetime | src/oci/jms/models/jre_usage.py | __init__ | LaudateCorpus1/oci-python-sdk | python | def __init__(self, **kwargs):
'\n Initializes a new JreUsage object with values from keyword arguments.\n The following keyword arguments are supported (corresponding to the getters/setters of this class):\n\n :param id:\n The value to assign to the id property of this JreUsage.\n :type id: str\n\n :param fleet_id:\n The value to assign to the fleet_id property of this JreUsage.\n :type fleet_id: str\n\n :param managed_instance_id:\n The value to assign to the managed_instance_id property of this JreUsage.\n :type managed_instance_id: str\n\n :param security_status:\n The value to assign to the security_status property of this JreUsage.\n Allowed values for this property are: "UNKNOWN", "UP_TO_DATE", "UPDATE_REQUIRED", "UPGRADE_REQUIRED", \'UNKNOWN_ENUM_VALUE\'.\n Any unrecognized values returned by a service will be mapped to \'UNKNOWN_ENUM_VALUE\'.\n :type security_status: str\n\n :param release_date:\n The value to assign to the release_date property of this JreUsage.\n :type release_date: datetime\n\n :param end_of_support_life_date:\n The value to assign to the end_of_support_life_date property of this JreUsage.\n :type end_of_support_life_date: datetime\n\n :param vendor:\n The value to assign to the vendor property of this JreUsage.\n :type vendor: str\n\n :param distribution:\n The value to assign to the distribution property of this JreUsage.\n :type distribution: str\n\n :param version:\n The value to assign to the version property of this JreUsage.\n :type version: str\n\n :param operating_systems:\n The value to assign to the operating_systems property of this JreUsage.\n :type operating_systems: list[oci.jms.models.OperatingSystem]\n\n :param approximate_installation_count:\n The value to assign to the approximate_installation_count property of this JreUsage.\n :type approximate_installation_count: int\n\n :param approximate_application_count:\n The value to assign to the approximate_application_count property of this JreUsage.\n :type approximate_application_count: int\n\n :param approximate_managed_instance_count:\n The value to assign to the approximate_managed_instance_count property of this JreUsage.\n :type approximate_managed_instance_count: int\n\n :param time_start:\n The value to assign to the time_start property of this JreUsage.\n :type time_start: datetime\n\n :param time_end:\n The value to assign to the time_end property of this JreUsage.\n :type time_end: datetime\n\n :param time_first_seen:\n The value to assign to the time_first_seen property of this JreUsage.\n :type time_first_seen: datetime\n\n :param time_last_seen:\n The value to assign to the time_last_seen property of this JreUsage.\n :type time_last_seen: datetime\n\n '
self.swagger_types = {'id': 'str', 'fleet_id': 'str', 'managed_instance_id': 'str', 'security_status': 'str', 'release_date': 'datetime', 'end_of_support_life_date': 'datetime', 'vendor': 'str', 'distribution': 'str', 'version': 'str', 'operating_systems': 'list[OperatingSystem]', 'approximate_installation_count': 'int', 'approximate_application_count': 'int', 'approximate_managed_instance_count': 'int', 'time_start': 'datetime', 'time_end': 'datetime', 'time_first_seen': 'datetime', 'time_last_seen': 'datetime'}
self.attribute_map = {'id': 'id', 'fleet_id': 'fleetId', 'managed_instance_id': 'managedInstanceId', 'security_status': 'securityStatus', 'release_date': 'releaseDate', 'end_of_support_life_date': 'endOfSupportLifeDate', 'vendor': 'vendor', 'distribution': 'distribution', 'version': 'version', 'operating_systems': 'operatingSystems', 'approximate_installation_count': 'approximateInstallationCount', 'approximate_application_count': 'approximateApplicationCount', 'approximate_managed_instance_count': 'approximateManagedInstanceCount', 'time_start': 'timeStart', 'time_end': 'timeEnd', 'time_first_seen': 'timeFirstSeen', 'time_last_seen': 'timeLastSeen'}
self._id = None
self._fleet_id = None
self._managed_instance_id = None
self._security_status = None
self._release_date = None
self._end_of_support_life_date = None
self._vendor = None
self._distribution = None
self._version = None
self._operating_systems = None
self._approximate_installation_count = None
self._approximate_application_count = None
self._approximate_managed_instance_count = None
self._time_start = None
self._time_end = None
self._time_first_seen = None
self._time_last_seen = None |
@property
def id(self):
'\n Gets the id of this JreUsage.\n The internal identifier of the Java Runtime.\n\n\n :return: The id of this JreUsage.\n :rtype: str\n '
return self._id | 5,630,751,143,155,994,000 | Gets the id of this JreUsage.
The internal identifier of the Java Runtime.
:return: The id of this JreUsage.
:rtype: str | src/oci/jms/models/jre_usage.py | id | LaudateCorpus1/oci-python-sdk | python | @property
def id(self):
'\n Gets the id of this JreUsage.\n The internal identifier of the Java Runtime.\n\n\n :return: The id of this JreUsage.\n :rtype: str\n '
return self._id |
@id.setter
def id(self, id):
'\n Sets the id of this JreUsage.\n The internal identifier of the Java Runtime.\n\n\n :param id: The id of this JreUsage.\n :type: str\n '
self._id = id | 7,638,408,257,057,044,000 | Sets the id of this JreUsage.
The internal identifier of the Java Runtime.
:param id: The id of this JreUsage.
:type: str | src/oci/jms/models/jre_usage.py | id | LaudateCorpus1/oci-python-sdk | python | @id.setter
def id(self, id):
'\n Sets the id of this JreUsage.\n The internal identifier of the Java Runtime.\n\n\n :param id: The id of this JreUsage.\n :type: str\n '
self._id = id |
@property
def fleet_id(self):
'\n Gets the fleet_id of this JreUsage.\n The `OCID`__ of the related fleet. This property value is present only for /actions/listJreUsage.\n\n __ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm\n\n\n :return: The fleet_id of this JreUsage.\n :rtype: str\n '
return self._fleet_id | 7,184,917,475,248,173,000 | Gets the fleet_id of this JreUsage.
The `OCID`__ of the related fleet. This property value is present only for /actions/listJreUsage.
__ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm
:return: The fleet_id of this JreUsage.
:rtype: str | src/oci/jms/models/jre_usage.py | fleet_id | LaudateCorpus1/oci-python-sdk | python | @property
def fleet_id(self):
'\n Gets the fleet_id of this JreUsage.\n The `OCID`__ of the related fleet. This property value is present only for /actions/listJreUsage.\n\n __ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm\n\n\n :return: The fleet_id of this JreUsage.\n :rtype: str\n '
return self._fleet_id |
@fleet_id.setter
def fleet_id(self, fleet_id):
'\n Sets the fleet_id of this JreUsage.\n The `OCID`__ of the related fleet. This property value is present only for /actions/listJreUsage.\n\n __ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm\n\n\n :param fleet_id: The fleet_id of this JreUsage.\n :type: str\n '
self._fleet_id = fleet_id | 1,398,556,330,259,736,300 | Sets the fleet_id of this JreUsage.
The `OCID`__ of the related fleet. This property value is present only for /actions/listJreUsage.
__ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm
:param fleet_id: The fleet_id of this JreUsage.
:type: str | src/oci/jms/models/jre_usage.py | fleet_id | LaudateCorpus1/oci-python-sdk | python | @fleet_id.setter
def fleet_id(self, fleet_id):
'\n Sets the fleet_id of this JreUsage.\n The `OCID`__ of the related fleet. This property value is present only for /actions/listJreUsage.\n\n __ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm\n\n\n :param fleet_id: The fleet_id of this JreUsage.\n :type: str\n '
self._fleet_id = fleet_id |
@property
def managed_instance_id(self):
'\n Gets the managed_instance_id of this JreUsage.\n The `OCID`__ of the related managed instance. This property value is present only for /actions/listJreUsage.\n\n __ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm\n\n\n :return: The managed_instance_id of this JreUsage.\n :rtype: str\n '
return self._managed_instance_id | 1,717,166,346,176,232,200 | Gets the managed_instance_id of this JreUsage.
The `OCID`__ of the related managed instance. This property value is present only for /actions/listJreUsage.
__ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm
:return: The managed_instance_id of this JreUsage.
:rtype: str | src/oci/jms/models/jre_usage.py | managed_instance_id | LaudateCorpus1/oci-python-sdk | python | @property
def managed_instance_id(self):
'\n Gets the managed_instance_id of this JreUsage.\n The `OCID`__ of the related managed instance. This property value is present only for /actions/listJreUsage.\n\n __ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm\n\n\n :return: The managed_instance_id of this JreUsage.\n :rtype: str\n '
return self._managed_instance_id |
@managed_instance_id.setter
def managed_instance_id(self, managed_instance_id):
'\n Sets the managed_instance_id of this JreUsage.\n The `OCID`__ of the related managed instance. This property value is present only for /actions/listJreUsage.\n\n __ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm\n\n\n :param managed_instance_id: The managed_instance_id of this JreUsage.\n :type: str\n '
self._managed_instance_id = managed_instance_id | 6,974,853,842,441,627,000 | Sets the managed_instance_id of this JreUsage.
The `OCID`__ of the related managed instance. This property value is present only for /actions/listJreUsage.
__ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm
:param managed_instance_id: The managed_instance_id of this JreUsage.
:type: str | src/oci/jms/models/jre_usage.py | managed_instance_id | LaudateCorpus1/oci-python-sdk | python | @managed_instance_id.setter
def managed_instance_id(self, managed_instance_id):
'\n Sets the managed_instance_id of this JreUsage.\n The `OCID`__ of the related managed instance. This property value is present only for /actions/listJreUsage.\n\n __ https://docs.cloud.oracle.com/Content/General/Concepts/identifiers.htm\n\n\n :param managed_instance_id: The managed_instance_id of this JreUsage.\n :type: str\n '
self._managed_instance_id = managed_instance_id |
@property
def security_status(self):
'\n Gets the security_status of this JreUsage.\n The security status of the Java Runtime.\n\n Allowed values for this property are: "UNKNOWN", "UP_TO_DATE", "UPDATE_REQUIRED", "UPGRADE_REQUIRED", \'UNKNOWN_ENUM_VALUE\'.\n Any unrecognized values returned by a service will be mapped to \'UNKNOWN_ENUM_VALUE\'.\n\n\n :return: The security_status of this JreUsage.\n :rtype: str\n '
return self._security_status | -1,545,202,515,118,236,700 | Gets the security_status of this JreUsage.
The security status of the Java Runtime.
Allowed values for this property are: "UNKNOWN", "UP_TO_DATE", "UPDATE_REQUIRED", "UPGRADE_REQUIRED", 'UNKNOWN_ENUM_VALUE'.
Any unrecognized values returned by a service will be mapped to 'UNKNOWN_ENUM_VALUE'.
:return: The security_status of this JreUsage.
:rtype: str | src/oci/jms/models/jre_usage.py | security_status | LaudateCorpus1/oci-python-sdk | python | @property
def security_status(self):
'\n Gets the security_status of this JreUsage.\n The security status of the Java Runtime.\n\n Allowed values for this property are: "UNKNOWN", "UP_TO_DATE", "UPDATE_REQUIRED", "UPGRADE_REQUIRED", \'UNKNOWN_ENUM_VALUE\'.\n Any unrecognized values returned by a service will be mapped to \'UNKNOWN_ENUM_VALUE\'.\n\n\n :return: The security_status of this JreUsage.\n :rtype: str\n '
return self._security_status |
@security_status.setter
def security_status(self, security_status):
'\n Sets the security_status of this JreUsage.\n The security status of the Java Runtime.\n\n\n :param security_status: The security_status of this JreUsage.\n :type: str\n '
allowed_values = ['UNKNOWN', 'UP_TO_DATE', 'UPDATE_REQUIRED', 'UPGRADE_REQUIRED']
if (not value_allowed_none_or_none_sentinel(security_status, allowed_values)):
security_status = 'UNKNOWN_ENUM_VALUE'
self._security_status = security_status | 7,339,922,715,492,294,000 | Sets the security_status of this JreUsage.
The security status of the Java Runtime.
:param security_status: The security_status of this JreUsage.
:type: str | src/oci/jms/models/jre_usage.py | security_status | LaudateCorpus1/oci-python-sdk | python | @security_status.setter
def security_status(self, security_status):
'\n Sets the security_status of this JreUsage.\n The security status of the Java Runtime.\n\n\n :param security_status: The security_status of this JreUsage.\n :type: str\n '
allowed_values = ['UNKNOWN', 'UP_TO_DATE', 'UPDATE_REQUIRED', 'UPGRADE_REQUIRED']
if (not value_allowed_none_or_none_sentinel(security_status, allowed_values)):
security_status = 'UNKNOWN_ENUM_VALUE'
self._security_status = security_status |
@property
def release_date(self):
'\n Gets the release_date of this JreUsage.\n The release date of the Java Runtime (formatted according to `RFC3339`__).\n\n __ https://datatracker.ietf.org/doc/html/rfc3339\n\n\n :return: The release_date of this JreUsage.\n :rtype: datetime\n '
return self._release_date | 9,032,015,661,855,853,000 | Gets the release_date of this JreUsage.
The release date of the Java Runtime (formatted according to `RFC3339`__).
__ https://datatracker.ietf.org/doc/html/rfc3339
:return: The release_date of this JreUsage.
:rtype: datetime | src/oci/jms/models/jre_usage.py | release_date | LaudateCorpus1/oci-python-sdk | python | @property
def release_date(self):
'\n Gets the release_date of this JreUsage.\n The release date of the Java Runtime (formatted according to `RFC3339`__).\n\n __ https://datatracker.ietf.org/doc/html/rfc3339\n\n\n :return: The release_date of this JreUsage.\n :rtype: datetime\n '
return self._release_date |
@release_date.setter
def release_date(self, release_date):
'\n Sets the release_date of this JreUsage.\n The release date of the Java Runtime (formatted according to `RFC3339`__).\n\n __ https://datatracker.ietf.org/doc/html/rfc3339\n\n\n :param release_date: The release_date of this JreUsage.\n :type: datetime\n '
self._release_date = release_date | -3,359,336,702,401,001,000 | Sets the release_date of this JreUsage.
The release date of the Java Runtime (formatted according to `RFC3339`__).
__ https://datatracker.ietf.org/doc/html/rfc3339
:param release_date: The release_date of this JreUsage.
:type: datetime | src/oci/jms/models/jre_usage.py | release_date | LaudateCorpus1/oci-python-sdk | python | @release_date.setter
def release_date(self, release_date):
'\n Sets the release_date of this JreUsage.\n The release date of the Java Runtime (formatted according to `RFC3339`__).\n\n __ https://datatracker.ietf.org/doc/html/rfc3339\n\n\n :param release_date: The release_date of this JreUsage.\n :type: datetime\n '
self._release_date = release_date |
@property
def end_of_support_life_date(self):
'\n Gets the end_of_support_life_date of this JreUsage.\n The End of Support Life (EOSL) date of the Java Runtime (formatted according to `RFC3339`__).\n\n __ https://datatracker.ietf.org/doc/html/rfc3339\n\n\n :return: The end_of_support_life_date of this JreUsage.\n :rtype: datetime\n '
return self._end_of_support_life_date | 1,298,139,903,930,625,000 | Gets the end_of_support_life_date of this JreUsage.
The End of Support Life (EOSL) date of the Java Runtime (formatted according to `RFC3339`__).
__ https://datatracker.ietf.org/doc/html/rfc3339
:return: The end_of_support_life_date of this JreUsage.
:rtype: datetime | src/oci/jms/models/jre_usage.py | end_of_support_life_date | LaudateCorpus1/oci-python-sdk | python | @property
def end_of_support_life_date(self):
'\n Gets the end_of_support_life_date of this JreUsage.\n The End of Support Life (EOSL) date of the Java Runtime (formatted according to `RFC3339`__).\n\n __ https://datatracker.ietf.org/doc/html/rfc3339\n\n\n :return: The end_of_support_life_date of this JreUsage.\n :rtype: datetime\n '
return self._end_of_support_life_date |
@end_of_support_life_date.setter
def end_of_support_life_date(self, end_of_support_life_date):
'\n Sets the end_of_support_life_date of this JreUsage.\n The End of Support Life (EOSL) date of the Java Runtime (formatted according to `RFC3339`__).\n\n __ https://datatracker.ietf.org/doc/html/rfc3339\n\n\n :param end_of_support_life_date: The end_of_support_life_date of this JreUsage.\n :type: datetime\n '
self._end_of_support_life_date = end_of_support_life_date | -3,842,068,515,508,390,000 | Sets the end_of_support_life_date of this JreUsage.
The End of Support Life (EOSL) date of the Java Runtime (formatted according to `RFC3339`__).
__ https://datatracker.ietf.org/doc/html/rfc3339
:param end_of_support_life_date: The end_of_support_life_date of this JreUsage.
:type: datetime | src/oci/jms/models/jre_usage.py | end_of_support_life_date | LaudateCorpus1/oci-python-sdk | python | @end_of_support_life_date.setter
def end_of_support_life_date(self, end_of_support_life_date):
'\n Sets the end_of_support_life_date of this JreUsage.\n The End of Support Life (EOSL) date of the Java Runtime (formatted according to `RFC3339`__).\n\n __ https://datatracker.ietf.org/doc/html/rfc3339\n\n\n :param end_of_support_life_date: The end_of_support_life_date of this JreUsage.\n :type: datetime\n '
self._end_of_support_life_date = end_of_support_life_date |
@property
def vendor(self):
'\n **[Required]** Gets the vendor of this JreUsage.\n The vendor of the Java Runtime.\n\n\n :return: The vendor of this JreUsage.\n :rtype: str\n '
return self._vendor | 1,159,990,665,452,809,200 | **[Required]** Gets the vendor of this JreUsage.
The vendor of the Java Runtime.
:return: The vendor of this JreUsage.
:rtype: str | src/oci/jms/models/jre_usage.py | vendor | LaudateCorpus1/oci-python-sdk | python | @property
def vendor(self):
'\n **[Required]** Gets the vendor of this JreUsage.\n The vendor of the Java Runtime.\n\n\n :return: The vendor of this JreUsage.\n :rtype: str\n '
return self._vendor |
@vendor.setter
def vendor(self, vendor):
'\n Sets the vendor of this JreUsage.\n The vendor of the Java Runtime.\n\n\n :param vendor: The vendor of this JreUsage.\n :type: str\n '
self._vendor = vendor | 2,834,204,539,453,894,000 | Sets the vendor of this JreUsage.
The vendor of the Java Runtime.
:param vendor: The vendor of this JreUsage.
:type: str | src/oci/jms/models/jre_usage.py | vendor | LaudateCorpus1/oci-python-sdk | python | @vendor.setter
def vendor(self, vendor):
'\n Sets the vendor of this JreUsage.\n The vendor of the Java Runtime.\n\n\n :param vendor: The vendor of this JreUsage.\n :type: str\n '
self._vendor = vendor |
@property
def distribution(self):
'\n **[Required]** Gets the distribution of this JreUsage.\n The distribution of a Java Runtime is the name of the lineage of product to which it belongs, for example _Java(TM) SE Runtime Environment_.\n\n\n :return: The distribution of this JreUsage.\n :rtype: str\n '
return self._distribution | -5,938,406,331,772,065,000 | **[Required]** Gets the distribution of this JreUsage.
The distribution of a Java Runtime is the name of the lineage of product to which it belongs, for example _Java(TM) SE Runtime Environment_.
:return: The distribution of this JreUsage.
:rtype: str | src/oci/jms/models/jre_usage.py | distribution | LaudateCorpus1/oci-python-sdk | python | @property
def distribution(self):
'\n **[Required]** Gets the distribution of this JreUsage.\n The distribution of a Java Runtime is the name of the lineage of product to which it belongs, for example _Java(TM) SE Runtime Environment_.\n\n\n :return: The distribution of this JreUsage.\n :rtype: str\n '
return self._distribution |
@distribution.setter
def distribution(self, distribution):
'\n Sets the distribution of this JreUsage.\n The distribution of a Java Runtime is the name of the lineage of product to which it belongs, for example _Java(TM) SE Runtime Environment_.\n\n\n :param distribution: The distribution of this JreUsage.\n :type: str\n '
self._distribution = distribution | 1,276,987,730,197,622,800 | Sets the distribution of this JreUsage.
The distribution of a Java Runtime is the name of the lineage of product to which it belongs, for example _Java(TM) SE Runtime Environment_.
:param distribution: The distribution of this JreUsage.
:type: str | src/oci/jms/models/jre_usage.py | distribution | LaudateCorpus1/oci-python-sdk | python | @distribution.setter
def distribution(self, distribution):
'\n Sets the distribution of this JreUsage.\n The distribution of a Java Runtime is the name of the lineage of product to which it belongs, for example _Java(TM) SE Runtime Environment_.\n\n\n :param distribution: The distribution of this JreUsage.\n :type: str\n '
self._distribution = distribution |
@property
def version(self):
'\n **[Required]** Gets the version of this JreUsage.\n The version of the Java Runtime.\n\n\n :return: The version of this JreUsage.\n :rtype: str\n '
return self._version | 3,230,121,800,614,682,600 | **[Required]** Gets the version of this JreUsage.
The version of the Java Runtime.
:return: The version of this JreUsage.
:rtype: str | src/oci/jms/models/jre_usage.py | version | LaudateCorpus1/oci-python-sdk | python | @property
def version(self):
'\n **[Required]** Gets the version of this JreUsage.\n The version of the Java Runtime.\n\n\n :return: The version of this JreUsage.\n :rtype: str\n '
return self._version |
@version.setter
def version(self, version):
'\n Sets the version of this JreUsage.\n The version of the Java Runtime.\n\n\n :param version: The version of this JreUsage.\n :type: str\n '
self._version = version | 7,151,693,177,198,569,000 | Sets the version of this JreUsage.
The version of the Java Runtime.
:param version: The version of this JreUsage.
:type: str | src/oci/jms/models/jre_usage.py | version | LaudateCorpus1/oci-python-sdk | python | @version.setter
def version(self, version):
'\n Sets the version of this JreUsage.\n The version of the Java Runtime.\n\n\n :param version: The version of this JreUsage.\n :type: str\n '
self._version = version |
@property
def operating_systems(self):
'\n Gets the operating_systems of this JreUsage.\n The operating systems that have this Java Runtime installed.\n\n\n :return: The operating_systems of this JreUsage.\n :rtype: list[oci.jms.models.OperatingSystem]\n '
return self._operating_systems | 7,551,715,129,989,088,000 | Gets the operating_systems of this JreUsage.
The operating systems that have this Java Runtime installed.
:return: The operating_systems of this JreUsage.
:rtype: list[oci.jms.models.OperatingSystem] | src/oci/jms/models/jre_usage.py | operating_systems | LaudateCorpus1/oci-python-sdk | python | @property
def operating_systems(self):
'\n Gets the operating_systems of this JreUsage.\n The operating systems that have this Java Runtime installed.\n\n\n :return: The operating_systems of this JreUsage.\n :rtype: list[oci.jms.models.OperatingSystem]\n '
return self._operating_systems |
@operating_systems.setter
def operating_systems(self, operating_systems):
'\n Sets the operating_systems of this JreUsage.\n The operating systems that have this Java Runtime installed.\n\n\n :param operating_systems: The operating_systems of this JreUsage.\n :type: list[oci.jms.models.OperatingSystem]\n '
self._operating_systems = operating_systems | -5,383,393,604,398,982,000 | Sets the operating_systems of this JreUsage.
The operating systems that have this Java Runtime installed.
:param operating_systems: The operating_systems of this JreUsage.
:type: list[oci.jms.models.OperatingSystem] | src/oci/jms/models/jre_usage.py | operating_systems | LaudateCorpus1/oci-python-sdk | python | @operating_systems.setter
def operating_systems(self, operating_systems):
'\n Sets the operating_systems of this JreUsage.\n The operating systems that have this Java Runtime installed.\n\n\n :param operating_systems: The operating_systems of this JreUsage.\n :type: list[oci.jms.models.OperatingSystem]\n '
self._operating_systems = operating_systems |
@property
def approximate_installation_count(self):
'\n Gets the approximate_installation_count of this JreUsage.\n The approximate count of installations that are installations of this Java Runtime.\n\n\n :return: The approximate_installation_count of this JreUsage.\n :rtype: int\n '
return self._approximate_installation_count | -5,029,665,333,435,410,000 | Gets the approximate_installation_count of this JreUsage.
The approximate count of installations that are installations of this Java Runtime.
:return: The approximate_installation_count of this JreUsage.
:rtype: int | src/oci/jms/models/jre_usage.py | approximate_installation_count | LaudateCorpus1/oci-python-sdk | python | @property
def approximate_installation_count(self):
'\n Gets the approximate_installation_count of this JreUsage.\n The approximate count of installations that are installations of this Java Runtime.\n\n\n :return: The approximate_installation_count of this JreUsage.\n :rtype: int\n '
return self._approximate_installation_count |
@approximate_installation_count.setter
def approximate_installation_count(self, approximate_installation_count):
'\n Sets the approximate_installation_count of this JreUsage.\n The approximate count of installations that are installations of this Java Runtime.\n\n\n :param approximate_installation_count: The approximate_installation_count of this JreUsage.\n :type: int\n '
self._approximate_installation_count = approximate_installation_count | -8,324,893,288,931,158,000 | Sets the approximate_installation_count of this JreUsage.
The approximate count of installations that are installations of this Java Runtime.
:param approximate_installation_count: The approximate_installation_count of this JreUsage.
:type: int | src/oci/jms/models/jre_usage.py | approximate_installation_count | LaudateCorpus1/oci-python-sdk | python | @approximate_installation_count.setter
def approximate_installation_count(self, approximate_installation_count):
'\n Sets the approximate_installation_count of this JreUsage.\n The approximate count of installations that are installations of this Java Runtime.\n\n\n :param approximate_installation_count: The approximate_installation_count of this JreUsage.\n :type: int\n '
self._approximate_installation_count = approximate_installation_count |
@property
def approximate_application_count(self):
'\n Gets the approximate_application_count of this JreUsage.\n The approximate count of the applications running on this Java Runtime.\n\n\n :return: The approximate_application_count of this JreUsage.\n :rtype: int\n '
return self._approximate_application_count | -7,772,816,903,972,556,000 | Gets the approximate_application_count of this JreUsage.
The approximate count of the applications running on this Java Runtime.
:return: The approximate_application_count of this JreUsage.
:rtype: int | src/oci/jms/models/jre_usage.py | approximate_application_count | LaudateCorpus1/oci-python-sdk | python | @property
def approximate_application_count(self):
'\n Gets the approximate_application_count of this JreUsage.\n The approximate count of the applications running on this Java Runtime.\n\n\n :return: The approximate_application_count of this JreUsage.\n :rtype: int\n '
return self._approximate_application_count |
@approximate_application_count.setter
def approximate_application_count(self, approximate_application_count):
'\n Sets the approximate_application_count of this JreUsage.\n The approximate count of the applications running on this Java Runtime.\n\n\n :param approximate_application_count: The approximate_application_count of this JreUsage.\n :type: int\n '
self._approximate_application_count = approximate_application_count | -8,577,324,605,339,335,000 | Sets the approximate_application_count of this JreUsage.
The approximate count of the applications running on this Java Runtime.
:param approximate_application_count: The approximate_application_count of this JreUsage.
:type: int | src/oci/jms/models/jre_usage.py | approximate_application_count | LaudateCorpus1/oci-python-sdk | python | @approximate_application_count.setter
def approximate_application_count(self, approximate_application_count):
'\n Sets the approximate_application_count of this JreUsage.\n The approximate count of the applications running on this Java Runtime.\n\n\n :param approximate_application_count: The approximate_application_count of this JreUsage.\n :type: int\n '
self._approximate_application_count = approximate_application_count |
@property
def approximate_managed_instance_count(self):
'\n Gets the approximate_managed_instance_count of this JreUsage.\n The approximate count of the managed instances that report this Java Runtime.\n\n\n :return: The approximate_managed_instance_count of this JreUsage.\n :rtype: int\n '
return self._approximate_managed_instance_count | 3,689,925,721,804,156,400 | Gets the approximate_managed_instance_count of this JreUsage.
The approximate count of the managed instances that report this Java Runtime.
:return: The approximate_managed_instance_count of this JreUsage.
:rtype: int | src/oci/jms/models/jre_usage.py | approximate_managed_instance_count | LaudateCorpus1/oci-python-sdk | python | @property
def approximate_managed_instance_count(self):
'\n Gets the approximate_managed_instance_count of this JreUsage.\n The approximate count of the managed instances that report this Java Runtime.\n\n\n :return: The approximate_managed_instance_count of this JreUsage.\n :rtype: int\n '
return self._approximate_managed_instance_count |
@approximate_managed_instance_count.setter
def approximate_managed_instance_count(self, approximate_managed_instance_count):
'\n Sets the approximate_managed_instance_count of this JreUsage.\n The approximate count of the managed instances that report this Java Runtime.\n\n\n :param approximate_managed_instance_count: The approximate_managed_instance_count of this JreUsage.\n :type: int\n '
self._approximate_managed_instance_count = approximate_managed_instance_count | 1,534,051,995,175,308,300 | Sets the approximate_managed_instance_count of this JreUsage.
The approximate count of the managed instances that report this Java Runtime.
:param approximate_managed_instance_count: The approximate_managed_instance_count of this JreUsage.
:type: int | src/oci/jms/models/jre_usage.py | approximate_managed_instance_count | LaudateCorpus1/oci-python-sdk | python | @approximate_managed_instance_count.setter
def approximate_managed_instance_count(self, approximate_managed_instance_count):
'\n Sets the approximate_managed_instance_count of this JreUsage.\n The approximate count of the managed instances that report this Java Runtime.\n\n\n :param approximate_managed_instance_count: The approximate_managed_instance_count of this JreUsage.\n :type: int\n '
self._approximate_managed_instance_count = approximate_managed_instance_count |
@property
def time_start(self):
'\n Gets the time_start of this JreUsage.\n Lower bound of the specified time period filter. JMS provides a view of the data that is _per day_. The query uses only the date element of the parameter.\n\n\n :return: The time_start of this JreUsage.\n :rtype: datetime\n '
return self._time_start | -3,011,845,327,778,044,000 | Gets the time_start of this JreUsage.
Lower bound of the specified time period filter. JMS provides a view of the data that is _per day_. The query uses only the date element of the parameter.
:return: The time_start of this JreUsage.
:rtype: datetime | src/oci/jms/models/jre_usage.py | time_start | LaudateCorpus1/oci-python-sdk | python | @property
def time_start(self):
'\n Gets the time_start of this JreUsage.\n Lower bound of the specified time period filter. JMS provides a view of the data that is _per day_. The query uses only the date element of the parameter.\n\n\n :return: The time_start of this JreUsage.\n :rtype: datetime\n '
return self._time_start |
@time_start.setter
def time_start(self, time_start):
'\n Sets the time_start of this JreUsage.\n Lower bound of the specified time period filter. JMS provides a view of the data that is _per day_. The query uses only the date element of the parameter.\n\n\n :param time_start: The time_start of this JreUsage.\n :type: datetime\n '
self._time_start = time_start | -5,664,893,070,272,296,000 | Sets the time_start of this JreUsage.
Lower bound of the specified time period filter. JMS provides a view of the data that is _per day_. The query uses only the date element of the parameter.
:param time_start: The time_start of this JreUsage.
:type: datetime | src/oci/jms/models/jre_usage.py | time_start | LaudateCorpus1/oci-python-sdk | python | @time_start.setter
def time_start(self, time_start):
'\n Sets the time_start of this JreUsage.\n Lower bound of the specified time period filter. JMS provides a view of the data that is _per day_. The query uses only the date element of the parameter.\n\n\n :param time_start: The time_start of this JreUsage.\n :type: datetime\n '
self._time_start = time_start |
@property
def time_end(self):
'\n Gets the time_end of this JreUsage.\n Upper bound of the specified time period filter. JMS provides a view of the data that is _per day_. The query uses only the date element of the parameter.\n\n\n :return: The time_end of this JreUsage.\n :rtype: datetime\n '
return self._time_end | 7,893,600,373,673,936,000 | Gets the time_end of this JreUsage.
Upper bound of the specified time period filter. JMS provides a view of the data that is _per day_. The query uses only the date element of the parameter.
:return: The time_end of this JreUsage.
:rtype: datetime | src/oci/jms/models/jre_usage.py | time_end | LaudateCorpus1/oci-python-sdk | python | @property
def time_end(self):
'\n Gets the time_end of this JreUsage.\n Upper bound of the specified time period filter. JMS provides a view of the data that is _per day_. The query uses only the date element of the parameter.\n\n\n :return: The time_end of this JreUsage.\n :rtype: datetime\n '
return self._time_end |
@time_end.setter
def time_end(self, time_end):
'\n Sets the time_end of this JreUsage.\n Upper bound of the specified time period filter. JMS provides a view of the data that is _per day_. The query uses only the date element of the parameter.\n\n\n :param time_end: The time_end of this JreUsage.\n :type: datetime\n '
self._time_end = time_end | -7,116,143,890,525,733,000 | Sets the time_end of this JreUsage.
Upper bound of the specified time period filter. JMS provides a view of the data that is _per day_. The query uses only the date element of the parameter.
:param time_end: The time_end of this JreUsage.
:type: datetime | src/oci/jms/models/jre_usage.py | time_end | LaudateCorpus1/oci-python-sdk | python | @time_end.setter
def time_end(self, time_end):
'\n Sets the time_end of this JreUsage.\n Upper bound of the specified time period filter. JMS provides a view of the data that is _per day_. The query uses only the date element of the parameter.\n\n\n :param time_end: The time_end of this JreUsage.\n :type: datetime\n '
self._time_end = time_end |
@property
def time_first_seen(self):
'\n Gets the time_first_seen of this JreUsage.\n The date and time the resource was _first_ reported to JMS.\n This is potentially _before_ the specified time period provided by the filters.\n For example, a resource can be first reported to JMS before the start of a specified time period,\n if it is also reported during the time period.\n\n\n :return: The time_first_seen of this JreUsage.\n :rtype: datetime\n '
return self._time_first_seen | -1,339,474,913,698,415,400 | Gets the time_first_seen of this JreUsage.
The date and time the resource was _first_ reported to JMS.
This is potentially _before_ the specified time period provided by the filters.
For example, a resource can be first reported to JMS before the start of a specified time period,
if it is also reported during the time period.
:return: The time_first_seen of this JreUsage.
:rtype: datetime | src/oci/jms/models/jre_usage.py | time_first_seen | LaudateCorpus1/oci-python-sdk | python | @property
def time_first_seen(self):
'\n Gets the time_first_seen of this JreUsage.\n The date and time the resource was _first_ reported to JMS.\n This is potentially _before_ the specified time period provided by the filters.\n For example, a resource can be first reported to JMS before the start of a specified time period,\n if it is also reported during the time period.\n\n\n :return: The time_first_seen of this JreUsage.\n :rtype: datetime\n '
return self._time_first_seen |
@time_first_seen.setter
def time_first_seen(self, time_first_seen):
'\n Sets the time_first_seen of this JreUsage.\n The date and time the resource was _first_ reported to JMS.\n This is potentially _before_ the specified time period provided by the filters.\n For example, a resource can be first reported to JMS before the start of a specified time period,\n if it is also reported during the time period.\n\n\n :param time_first_seen: The time_first_seen of this JreUsage.\n :type: datetime\n '
self._time_first_seen = time_first_seen | -646,501,110,490,942,200 | Sets the time_first_seen of this JreUsage.
The date and time the resource was _first_ reported to JMS.
This is potentially _before_ the specified time period provided by the filters.
For example, a resource can be first reported to JMS before the start of a specified time period,
if it is also reported during the time period.
:param time_first_seen: The time_first_seen of this JreUsage.
:type: datetime | src/oci/jms/models/jre_usage.py | time_first_seen | LaudateCorpus1/oci-python-sdk | python | @time_first_seen.setter
def time_first_seen(self, time_first_seen):
'\n Sets the time_first_seen of this JreUsage.\n The date and time the resource was _first_ reported to JMS.\n This is potentially _before_ the specified time period provided by the filters.\n For example, a resource can be first reported to JMS before the start of a specified time period,\n if it is also reported during the time period.\n\n\n :param time_first_seen: The time_first_seen of this JreUsage.\n :type: datetime\n '
self._time_first_seen = time_first_seen |
@property
def time_last_seen(self):
'\n Gets the time_last_seen of this JreUsage.\n The date and time the resource was _last_ reported to JMS.\n This is potentially _after_ the specified time period provided by the filters.\n For example, a resource can be last reported to JMS before the start of a specified time period,\n if it is also reported during the time period.\n\n\n :return: The time_last_seen of this JreUsage.\n :rtype: datetime\n '
return self._time_last_seen | 6,214,480,000,825,810,000 | Gets the time_last_seen of this JreUsage.
The date and time the resource was _last_ reported to JMS.
This is potentially _after_ the specified time period provided by the filters.
For example, a resource can be last reported to JMS before the start of a specified time period,
if it is also reported during the time period.
:return: The time_last_seen of this JreUsage.
:rtype: datetime | src/oci/jms/models/jre_usage.py | time_last_seen | LaudateCorpus1/oci-python-sdk | python | @property
def time_last_seen(self):
'\n Gets the time_last_seen of this JreUsage.\n The date and time the resource was _last_ reported to JMS.\n This is potentially _after_ the specified time period provided by the filters.\n For example, a resource can be last reported to JMS before the start of a specified time period,\n if it is also reported during the time period.\n\n\n :return: The time_last_seen of this JreUsage.\n :rtype: datetime\n '
return self._time_last_seen |
@time_last_seen.setter
def time_last_seen(self, time_last_seen):
'\n Sets the time_last_seen of this JreUsage.\n The date and time the resource was _last_ reported to JMS.\n This is potentially _after_ the specified time period provided by the filters.\n For example, a resource can be last reported to JMS before the start of a specified time period,\n if it is also reported during the time period.\n\n\n :param time_last_seen: The time_last_seen of this JreUsage.\n :type: datetime\n '
self._time_last_seen = time_last_seen | 3,581,184,556,680,712,000 | Sets the time_last_seen of this JreUsage.
The date and time the resource was _last_ reported to JMS.
This is potentially _after_ the specified time period provided by the filters.
For example, a resource can be last reported to JMS before the start of a specified time period,
if it is also reported during the time period.
:param time_last_seen: The time_last_seen of this JreUsage.
:type: datetime | src/oci/jms/models/jre_usage.py | time_last_seen | LaudateCorpus1/oci-python-sdk | python | @time_last_seen.setter
def time_last_seen(self, time_last_seen):
'\n Sets the time_last_seen of this JreUsage.\n The date and time the resource was _last_ reported to JMS.\n This is potentially _after_ the specified time period provided by the filters.\n For example, a resource can be last reported to JMS before the start of a specified time period,\n if it is also reported during the time period.\n\n\n :param time_last_seen: The time_last_seen of this JreUsage.\n :type: datetime\n '
self._time_last_seen = time_last_seen |
def _promote_like_jnp(fun, inexact=False):
'Decorator that promotes the arguments of `fun` to `jnp.result_type(*args)`.\n\n jnp and onp have different type promotion semantics; this decorator allows\n tests make an onp reference implementation act more like an jnp\n implementation.\n '
def wrapper(*args, **kw):
flat_args = tree_util.tree_leaves(args)
if (inexact and (not any((jnp.issubdtype(jnp.result_type(x), jnp.inexact) for x in flat_args)))):
dtype = jnp.result_type(jnp.float_, *flat_args)
else:
dtype = jnp.result_type(*flat_args)
args = tree_util.tree_map((lambda a: onp.asarray(a, dtype)), args)
return fun(*args, **kw)
return wrapper | -811,865,182,682,236,200 | Decorator that promotes the arguments of `fun` to `jnp.result_type(*args)`.
jnp and onp have different type promotion semantics; this decorator allows
tests make an onp reference implementation act more like an jnp
implementation. | tests/lax_numpy_test.py | _promote_like_jnp | vballoli/jax | python | def _promote_like_jnp(fun, inexact=False):
'Decorator that promotes the arguments of `fun` to `jnp.result_type(*args)`.\n\n jnp and onp have different type promotion semantics; this decorator allows\n tests make an onp reference implementation act more like an jnp\n implementation.\n '
def wrapper(*args, **kw):
flat_args = tree_util.tree_leaves(args)
if (inexact and (not any((jnp.issubdtype(jnp.result_type(x), jnp.inexact) for x in flat_args)))):
dtype = jnp.result_type(jnp.float_, *flat_args)
else:
dtype = jnp.result_type(*flat_args)
args = tree_util.tree_map((lambda a: onp.asarray(a, dtype)), args)
return fun(*args, **kw)
return wrapper |
def testIssue1233(self):
'\n Following numpy test suite from `test_repeat` at https://github.com/numpy/numpy/blob/master/numpy/core/tests/test_multiarray.py\n '
tol = 1e-05
def test_single(m, args_maker, repeats, axis):
lax_ans = jnp.repeat(m, repeats, axis)
numpy_ans = onp.repeat(m, repeats, axis)
self.assertAllClose(lax_ans, numpy_ans, check_dtypes=True, rtol=tol, atol=tol)
jnp_fun = (lambda arg: jnp.repeat(arg, repeats=repeats, axis=axis))
self._CompileAndCheck(jnp_fun, args_maker, check_dtypes=True)
m = jnp.array([1, 2, 3, 4, 5, 6])
args_maker = (lambda : [m])
for repeats in [2, [1, 3, 2, 1, 1, 2], [1, 3, 0, 1, 1, 2], [2], jnp.array([1, 3, 2, 1, 1, 2]), jnp.array([2])]:
test_single(m, args_maker, repeats, None)
m_rect = m.reshape((2, 3))
args_maker = (lambda : [m_rect])
for repeats in [2, [2, 1], [2], jnp.array([2, 1]), jnp.array([2])]:
test_single(m_rect, args_maker, repeats, axis=0)
for repeats in [2, [1, 3, 2], [2], jnp.array([1, 3, 2]), jnp.array([2])]:
test_single(m_rect, args_maker, repeats, axis=1) | -4,407,710,489,450,920,400 | Following numpy test suite from `test_repeat` at https://github.com/numpy/numpy/blob/master/numpy/core/tests/test_multiarray.py | tests/lax_numpy_test.py | testIssue1233 | vballoli/jax | python | def testIssue1233(self):
'\n \n '
tol = 1e-05
def test_single(m, args_maker, repeats, axis):
lax_ans = jnp.repeat(m, repeats, axis)
numpy_ans = onp.repeat(m, repeats, axis)
self.assertAllClose(lax_ans, numpy_ans, check_dtypes=True, rtol=tol, atol=tol)
jnp_fun = (lambda arg: jnp.repeat(arg, repeats=repeats, axis=axis))
self._CompileAndCheck(jnp_fun, args_maker, check_dtypes=True)
m = jnp.array([1, 2, 3, 4, 5, 6])
args_maker = (lambda : [m])
for repeats in [2, [1, 3, 2, 1, 1, 2], [1, 3, 0, 1, 1, 2], [2], jnp.array([1, 3, 2, 1, 1, 2]), jnp.array([2])]:
test_single(m, args_maker, repeats, None)
m_rect = m.reshape((2, 3))
args_maker = (lambda : [m_rect])
for repeats in [2, [2, 1], [2], jnp.array([2, 1]), jnp.array([2])]:
test_single(m_rect, args_maker, repeats, axis=0)
for repeats in [2, [1, 3, 2], [2], jnp.array([1, 3, 2]), jnp.array([2])]:
test_single(m_rect, args_maker, repeats, axis=1) |
def testIssue2330(self):
'\n Make sure return value of jnp.concatenate is a jax.ndarray and is side-effect save\n '
def attempt_sideeffect(x):
x = [x]
x = jnp.concatenate(x)
x -= 1.0
return x
onp_input = onp.ones(1)
jnp_input = jnp.ones(1)
expected_onp_input_after_call = onp.ones(1)
expected_jnp_input_after_call = jnp.ones(1)
self.assertIs(type(jnp.concatenate([onp_input])), jnp.DeviceArray)
attempt_sideeffect(onp_input)
attempt_sideeffect(jnp_input)
self.assertAllClose(onp_input, expected_onp_input_after_call, check_dtypes=True)
self.assertAllClose(jnp_input, expected_jnp_input_after_call, check_dtypes=True) | 8,560,789,638,687,798,000 | Make sure return value of jnp.concatenate is a jax.ndarray and is side-effect save | tests/lax_numpy_test.py | testIssue2330 | vballoli/jax | python | def testIssue2330(self):
'\n \n '
def attempt_sideeffect(x):
x = [x]
x = jnp.concatenate(x)
x -= 1.0
return x
onp_input = onp.ones(1)
jnp_input = jnp.ones(1)
expected_onp_input_after_call = onp.ones(1)
expected_jnp_input_after_call = jnp.ones(1)
self.assertIs(type(jnp.concatenate([onp_input])), jnp.DeviceArray)
attempt_sideeffect(onp_input)
attempt_sideeffect(jnp_input)
self.assertAllClose(onp_input, expected_onp_input_after_call, check_dtypes=True)
self.assertAllClose(jnp_input, expected_jnp_input_after_call, check_dtypes=True) |
def testIssue776(self):
'Tests that the scatter-add transpose rule instantiates symbolic zeros.'
def f(u):
y = jax.ops.index_add(onp.ones(10), [2, 4, 5], u)
return lax.tie_in(y, 7.0)
self.assertAllClose(onp.zeros(3), api.grad(f)(onp.ones(3)), check_dtypes=True) | 5,785,002,306,898,334,000 | Tests that the scatter-add transpose rule instantiates symbolic zeros. | tests/lax_numpy_test.py | testIssue776 | vballoli/jax | python | def testIssue776(self):
def f(u):
y = jax.ops.index_add(onp.ones(10), [2, 4, 5], u)
return lax.tie_in(y, 7.0)
self.assertAllClose(onp.zeros(3), api.grad(f)(onp.ones(3)), check_dtypes=True) |
def args_maker():
'Test the set of inputs onp.geomspace is well-defined on.'
(start, stop) = self._GetArgsMaker(rng, [start_shape, stop_shape], [dtype, dtype])()
(start, stop) = jnp.broadcast_arrays(start, stop)
if (dtype in complex_dtypes):
return (start, stop)
start = ((start * jnp.sign(start)) * jnp.sign(stop))
return (start, stop) | -2,977,633,303,463,397,400 | Test the set of inputs onp.geomspace is well-defined on. | tests/lax_numpy_test.py | args_maker | vballoli/jax | python | def args_maker():
(start, stop) = self._GetArgsMaker(rng, [start_shape, stop_shape], [dtype, dtype])()
(start, stop) = jnp.broadcast_arrays(start, stop)
if (dtype in complex_dtypes):
return (start, stop)
start = ((start * jnp.sign(start)) * jnp.sign(stop))
return (start, stop) |
def create_action_type(name, customFields=None, tags=None, scopes=None, api_key=None, request_kwargs=None):
'Create an Action Type'
kwargs = locals()
del kwargs['request_kwargs']
api_key = kwargs.pop('api_key', None)
assertions.validate_field_specs(kwargs, field_specs)
return utils.request('POST', '/actions', data=kwargs, api_key=api_key, **(request_kwargs or {})) | 4,655,508,227,633,979,000 | Create an Action Type | src/evrythng/entities/action_types.py | create_action_type | jwpthng/evrythng-python-sdk | python | def create_action_type(name, customFields=None, tags=None, scopes=None, api_key=None, request_kwargs=None):
kwargs = locals()
del kwargs['request_kwargs']
api_key = kwargs.pop('api_key', None)
assertions.validate_field_specs(kwargs, field_specs)
return utils.request('POST', '/actions', data=kwargs, api_key=api_key, **(request_kwargs or {})) |
def delete_action_type(name, api_key=None, request_kwargs=None):
'Delete an Action Type'
assertions.datatype_str('name', name)
url = '/actions/{}'.format(name)
return utils.request('DELETE', url, api_key=api_key, **(request_kwargs or {})) | -2,366,850,480,945,707,000 | Delete an Action Type | src/evrythng/entities/action_types.py | delete_action_type | jwpthng/evrythng-python-sdk | python | def delete_action_type(name, api_key=None, request_kwargs=None):
assertions.datatype_str('name', name)
url = '/actions/{}'.format(name)
return utils.request('DELETE', url, api_key=api_key, **(request_kwargs or {})) |
def update_action_type(name, customFields=None, tags=None, scopes=None, api_key=None, request_kwargs=None):
'Update an Action Type'
kwargs = locals()
del kwargs['request_kwargs']
api_key = kwargs.pop('api_key', None)
assertions.validate_field_specs(kwargs, field_specs)
url = '/actions/{}'.format(name)
return utils.request('POST', '/actions', data=kwargs, api_key=api_key, **(request_kwargs or {})) | -2,673,745,962,895,355,400 | Update an Action Type | src/evrythng/entities/action_types.py | update_action_type | jwpthng/evrythng-python-sdk | python | def update_action_type(name, customFields=None, tags=None, scopes=None, api_key=None, request_kwargs=None):
kwargs = locals()
del kwargs['request_kwargs']
api_key = kwargs.pop('api_key', None)
assertions.validate_field_specs(kwargs, field_specs)
url = '/actions/{}'.format(name)
return utils.request('POST', '/actions', data=kwargs, api_key=api_key, **(request_kwargs or {})) |
def list_action_types(api_key=None, request_kwargs=None):
'List Action Types'
url = '/actions'
return utils.request('GET', url, api_key=api_key, **(request_kwargs or {})) | 6,257,147,385,038,400,000 | List Action Types | src/evrythng/entities/action_types.py | list_action_types | jwpthng/evrythng-python-sdk | python | def list_action_types(api_key=None, request_kwargs=None):
url = '/actions'
return utils.request('GET', url, api_key=api_key, **(request_kwargs or {})) |
def get_iana_tz(windows_tz):
' Returns a valid pytz TimeZone (Iana/Olson Timezones) from a given\n windows TimeZone\n\n :param windows_tz: windows format timezone usually returned by\n microsoft api response\n :return:\n :rtype:\n '
timezone = WIN_TO_IANA.get(windows_tz)
if (timezone is None):
timezone = WIN_TO_IANA.get((windows_tz + ' Standard Time'))
if (timezone is None):
raise pytz.UnknownTimeZoneError(("Can't find Windows TimeZone " + windows_tz))
return timezone | 6,916,282,228,415,799,000 | Returns a valid pytz TimeZone (Iana/Olson Timezones) from a given
windows TimeZone
:param windows_tz: windows format timezone usually returned by
microsoft api response
:return:
:rtype: | O365/utils/windows_tz.py | get_iana_tz | Feelixe-tin/python-o365 | python | def get_iana_tz(windows_tz):
' Returns a valid pytz TimeZone (Iana/Olson Timezones) from a given\n windows TimeZone\n\n :param windows_tz: windows format timezone usually returned by\n microsoft api response\n :return:\n :rtype:\n '
timezone = WIN_TO_IANA.get(windows_tz)
if (timezone is None):
timezone = WIN_TO_IANA.get((windows_tz + ' Standard Time'))
if (timezone is None):
raise pytz.UnknownTimeZoneError(("Can't find Windows TimeZone " + windows_tz))
return timezone |
def get_windows_tz(iana_tz):
' Returns a valid windows TimeZone from a given pytz TimeZone\n (Iana/Olson Timezones)\n Note: Windows Timezones are SHIT!... no ... really THEY ARE\n HOLY FUCKING SHIT!.\n '
timezone = IANA_TO_WIN.get((iana_tz.zone if isinstance(iana_tz, tzinfo) else iana_tz))
if (timezone is None):
raise pytz.UnknownTimeZoneError(("Can't find Iana TimeZone " + iana_tz.zone))
return timezone | 4,175,893,764,652,691,000 | Returns a valid windows TimeZone from a given pytz TimeZone
(Iana/Olson Timezones)
Note: Windows Timezones are SHIT!... no ... really THEY ARE
HOLY FUCKING SHIT!. | O365/utils/windows_tz.py | get_windows_tz | Feelixe-tin/python-o365 | python | def get_windows_tz(iana_tz):
' Returns a valid windows TimeZone from a given pytz TimeZone\n (Iana/Olson Timezones)\n Note: Windows Timezones are SHIT!... no ... really THEY ARE\n HOLY FUCKING SHIT!.\n '
timezone = IANA_TO_WIN.get((iana_tz.zone if isinstance(iana_tz, tzinfo) else iana_tz))
if (timezone is None):
raise pytz.UnknownTimeZoneError(("Can't find Iana TimeZone " + iana_tz.zone))
return timezone |
def shortDescription(self):
'Returns the description of the current test.\n\n This changes the default behavior to replace all newlines with spaces,\n allowing a test description to span lines. It should still be kept\n short, though.\n\n Returns:\n unicode:\n The descriptive text for the current unit test.\n '
doc = self._testMethodDoc
if (doc is not None):
doc = doc.split('\n\n', 1)[0]
doc = self.ws_re.sub(' ', doc).strip()
return doc | -3,308,220,217,552,141,300 | Returns the description of the current test.
This changes the default behavior to replace all newlines with spaces,
allowing a test description to span lines. It should still be kept
short, though.
Returns:
unicode:
The descriptive text for the current unit test. | rbtools/testing/testcase.py | shortDescription | jmcrawford45/rbtools | python | def shortDescription(self):
'Returns the description of the current test.\n\n This changes the default behavior to replace all newlines with spaces,\n allowing a test description to span lines. It should still be kept\n short, though.\n\n Returns:\n unicode:\n The descriptive text for the current unit test.\n '
doc = self._testMethodDoc
if (doc is not None):
doc = doc.split('\n\n', 1)[0]
doc = self.ws_re.sub(' ', doc).strip()
return doc |
def get_user_home(self):
"Return the user's current home directory.\n\n Version Added:\n 3.0\n\n Returns:\n unicode:\n The current home directory.\n "
return os.environ['HOME'] | -6,652,873,353,156,978,000 | Return the user's current home directory.
Version Added:
3.0
Returns:
unicode:
The current home directory. | rbtools/testing/testcase.py | get_user_home | jmcrawford45/rbtools | python | def get_user_home(self):
"Return the user's current home directory.\n\n Version Added:\n 3.0\n\n Returns:\n unicode:\n The current home directory.\n "
return os.environ['HOME'] |
def set_user_home(self, path):
"Set the user's current home directory.\n\n This will be unset when the unit test has finished.\n\n Version Added:\n 3.0\n\n Args:\n path (unicode):\n The new home directory.\n "
os.environ['HOME'] = path | -5,859,459,608,822,572,000 | Set the user's current home directory.
This will be unset when the unit test has finished.
Version Added:
3.0
Args:
path (unicode):
The new home directory. | rbtools/testing/testcase.py | set_user_home | jmcrawford45/rbtools | python | def set_user_home(self, path):
"Set the user's current home directory.\n\n This will be unset when the unit test has finished.\n\n Version Added:\n 3.0\n\n Args:\n path (unicode):\n The new home directory.\n "
os.environ['HOME'] = path |
def chdir_tmp(self):
'Create a temporary directory and set it as the working directory.\n\n The directory will be deleted after the test has finished.\n\n Version Added:\n 3.0\n\n Returns:\n unicode:\n The path to the temp directory.\n '
dirname = make_tempdir()
os.chdir(dirname)
return dirname | 527,320,590,366,300,350 | Create a temporary directory and set it as the working directory.
The directory will be deleted after the test has finished.
Version Added:
3.0
Returns:
unicode:
The path to the temp directory. | rbtools/testing/testcase.py | chdir_tmp | jmcrawford45/rbtools | python | def chdir_tmp(self):
'Create a temporary directory and set it as the working directory.\n\n The directory will be deleted after the test has finished.\n\n Version Added:\n 3.0\n\n Returns:\n unicode:\n The path to the temp directory.\n '
dirname = make_tempdir()
os.chdir(dirname)
return dirname |
def precreate_tempfiles(self, count):
'Pre-create a specific number of temporary files.\n\n This will call :py:func:`~rbtools.utils.filesystem.make_tempfile`\n the specified number of times, returning the list of generated temp\n file paths, and will then spy that function to return those temp\n files.\n\n Once each pre-created temp file is used up, any further calls to\n :py:func:`~rbtools.utils.filesystem.make_tempfile` will result in\n an error, failing the test.\n\n This is useful in unit tests that need to script a series of\n expected calls using :py:mod:`kgb` (such as through\n :py:class:`kgb.ops.SpyOpMatchInOrder`) that need to know the names\n of temporary filenames up-front.\n\n Unit test suites that use this must mix in :py:class:`kgb.SpyAgency`.\n\n Args:\n count (int):\n The number of temporary filenames to pre-create.\n\n Raises:\n AssertionError:\n The test suite class did not mix in :py:class:`kgb.SpyAgency`.\n '
assert hasattr(self, 'spy_on'), ('%r must mix in kgb.SpyAgency in order to call this method.' % self.__class__)
tmpfiles = [make_tempfile() for i in range(count)]
self.spy_on(make_tempfile, op=kgb.SpyOpReturnInOrder(tmpfiles))
return tmpfiles | 5,226,419,641,251,138,000 | Pre-create a specific number of temporary files.
This will call :py:func:`~rbtools.utils.filesystem.make_tempfile`
the specified number of times, returning the list of generated temp
file paths, and will then spy that function to return those temp
files.
Once each pre-created temp file is used up, any further calls to
:py:func:`~rbtools.utils.filesystem.make_tempfile` will result in
an error, failing the test.
This is useful in unit tests that need to script a series of
expected calls using :py:mod:`kgb` (such as through
:py:class:`kgb.ops.SpyOpMatchInOrder`) that need to know the names
of temporary filenames up-front.
Unit test suites that use this must mix in :py:class:`kgb.SpyAgency`.
Args:
count (int):
The number of temporary filenames to pre-create.
Raises:
AssertionError:
The test suite class did not mix in :py:class:`kgb.SpyAgency`. | rbtools/testing/testcase.py | precreate_tempfiles | jmcrawford45/rbtools | python | def precreate_tempfiles(self, count):
'Pre-create a specific number of temporary files.\n\n This will call :py:func:`~rbtools.utils.filesystem.make_tempfile`\n the specified number of times, returning the list of generated temp\n file paths, and will then spy that function to return those temp\n files.\n\n Once each pre-created temp file is used up, any further calls to\n :py:func:`~rbtools.utils.filesystem.make_tempfile` will result in\n an error, failing the test.\n\n This is useful in unit tests that need to script a series of\n expected calls using :py:mod:`kgb` (such as through\n :py:class:`kgb.ops.SpyOpMatchInOrder`) that need to know the names\n of temporary filenames up-front.\n\n Unit test suites that use this must mix in :py:class:`kgb.SpyAgency`.\n\n Args:\n count (int):\n The number of temporary filenames to pre-create.\n\n Raises:\n AssertionError:\n The test suite class did not mix in :py:class:`kgb.SpyAgency`.\n '
assert hasattr(self, 'spy_on'), ('%r must mix in kgb.SpyAgency in order to call this method.' % self.__class__)
tmpfiles = [make_tempfile() for i in range(count)]
self.spy_on(make_tempfile, op=kgb.SpyOpReturnInOrder(tmpfiles))
return tmpfiles |
def assertDiffEqual(self, diff, expected_diff):
"Assert that two diffs are equal.\n\n Args:\n diff (bytes):\n The generated diff.\n\n expected_diff (bytes):\n The expected diff.\n\n Raises:\n AssertionError:\n The diffs aren't equal or of the right type.\n "
self.assertIsInstance(diff, bytes)
self.assertIsInstance(expected_diff, bytes)
self.assertEqual(diff.splitlines(), expected_diff.splitlines()) | 741,807,008,966,203,400 | Assert that two diffs are equal.
Args:
diff (bytes):
The generated diff.
expected_diff (bytes):
The expected diff.
Raises:
AssertionError:
The diffs aren't equal or of the right type. | rbtools/testing/testcase.py | assertDiffEqual | jmcrawford45/rbtools | python | def assertDiffEqual(self, diff, expected_diff):
"Assert that two diffs are equal.\n\n Args:\n diff (bytes):\n The generated diff.\n\n expected_diff (bytes):\n The expected diff.\n\n Raises:\n AssertionError:\n The diffs aren't equal or of the right type.\n "
self.assertIsInstance(diff, bytes)
self.assertIsInstance(expected_diff, bytes)
self.assertEqual(diff.splitlines(), expected_diff.splitlines()) |
def assertRaisesMessage(self, expected_exception, expected_message):
"Assert that a call raises an exception with the given message.\n\n Args:\n expected_exception (type):\n The type of exception that's expected to be raised.\n\n expected_message (unicode):\n The expected exception message.\n\n Raises:\n AssertionError:\n The assertion failure, if the exception and message isn't\n raised.\n "
return self.assertRaisesRegexp(expected_exception, re.escape(expected_message)) | 8,049,344,310,440,984,000 | Assert that a call raises an exception with the given message.
Args:
expected_exception (type):
The type of exception that's expected to be raised.
expected_message (unicode):
The expected exception message.
Raises:
AssertionError:
The assertion failure, if the exception and message isn't
raised. | rbtools/testing/testcase.py | assertRaisesMessage | jmcrawford45/rbtools | python | def assertRaisesMessage(self, expected_exception, expected_message):
"Assert that a call raises an exception with the given message.\n\n Args:\n expected_exception (type):\n The type of exception that's expected to be raised.\n\n expected_message (unicode):\n The expected exception message.\n\n Raises:\n AssertionError:\n The assertion failure, if the exception and message isn't\n raised.\n "
return self.assertRaisesRegexp(expected_exception, re.escape(expected_message)) |
@contextmanager
def reviewboardrc(self, config, use_temp_dir=False):
'Populate a temporary .reviewboardrc file.\n\n This will create a :file:`.reviewboardrc` file, either in the current\n directory or in a new temporary directory (if ``use_temp_dir`` is set).\n The file will contain the provided configuration.\n\n Version Added:\n 3.0\n\n Args:\n config (dict):\n A dictionary of key-value pairs to write into the\n :file:`.reviewboardrc` file.\n\n A best effort attempt will be made to write each configuration\n to the file.\n\n use_temp_dir (bool, optional):\n Whether a temporary directory should be created and set as\n the current directory. If set, the file will be written there,\n and the directory will be removed after the context manager\n finishes.\n\n Context:\n The code being run will have a :file:`.reviewboardrc` in the\n current directory.\n '
if use_temp_dir:
temp_dir = tempfile.mkdtemp()
cwd = os.getcwd()
os.chdir(temp_dir)
with open('.reviewboardrc', 'w') as fp:
for (key, value) in six.iteritems(config):
fp.write(('%s = %r\n' % (key, value)))
try:
(yield)
finally:
if use_temp_dir:
os.chdir(cwd)
shutil.rmtree(temp_dir) | -879,774,627,128,168,100 | Populate a temporary .reviewboardrc file.
This will create a :file:`.reviewboardrc` file, either in the current
directory or in a new temporary directory (if ``use_temp_dir`` is set).
The file will contain the provided configuration.
Version Added:
3.0
Args:
config (dict):
A dictionary of key-value pairs to write into the
:file:`.reviewboardrc` file.
A best effort attempt will be made to write each configuration
to the file.
use_temp_dir (bool, optional):
Whether a temporary directory should be created and set as
the current directory. If set, the file will be written there,
and the directory will be removed after the context manager
finishes.
Context:
The code being run will have a :file:`.reviewboardrc` in the
current directory. | rbtools/testing/testcase.py | reviewboardrc | jmcrawford45/rbtools | python | @contextmanager
def reviewboardrc(self, config, use_temp_dir=False):
'Populate a temporary .reviewboardrc file.\n\n This will create a :file:`.reviewboardrc` file, either in the current\n directory or in a new temporary directory (if ``use_temp_dir`` is set).\n The file will contain the provided configuration.\n\n Version Added:\n 3.0\n\n Args:\n config (dict):\n A dictionary of key-value pairs to write into the\n :file:`.reviewboardrc` file.\n\n A best effort attempt will be made to write each configuration\n to the file.\n\n use_temp_dir (bool, optional):\n Whether a temporary directory should be created and set as\n the current directory. If set, the file will be written there,\n and the directory will be removed after the context manager\n finishes.\n\n Context:\n The code being run will have a :file:`.reviewboardrc` in the\n current directory.\n '
if use_temp_dir:
temp_dir = tempfile.mkdtemp()
cwd = os.getcwd()
os.chdir(temp_dir)
with open('.reviewboardrc', 'w') as fp:
for (key, value) in six.iteritems(config):
fp.write(('%s = %r\n' % (key, value)))
try:
(yield)
finally:
if use_temp_dir:
os.chdir(cwd)
shutil.rmtree(temp_dir) |
@commands.Cog.listener()
async def on_wavelink_track_end(self, player: wavelink.Player, track: wavelink.Track, reason):
'When a track ends, check if there is another one in the queue.'
(await asyncio.sleep(5))
if (not player.queue.is_empty):
next_track = player.queue.get()
(await player.play(next_track)) | -2,682,885,547,778,000,400 | When a track ends, check if there is another one in the queue. | Music/play.py | on_wavelink_track_end | Aggis15/T4NK0R | python | @commands.Cog.listener()
async def on_wavelink_track_end(self, player: wavelink.Player, track: wavelink.Track, reason):
(await asyncio.sleep(5))
if (not player.queue.is_empty):
next_track = player.queue.get()
(await player.play(next_track)) |
def handle_gcd_lcm(f, args):
'\n Return the result of gcd() or lcm(), as UnevaluatedExpr\n\n f: str - name of function ("gcd" or "lcm")\n args: List[Expr] - list of function arguments\n '
args = tuple(map(sympy.nsimplify, args))
return sympy.UnevaluatedExpr(getattr(sympy, f)(args)) | 7,975,739,934,901,042,000 | Return the result of gcd() or lcm(), as UnevaluatedExpr
f: str - name of function ("gcd" or "lcm")
args: List[Expr] - list of function arguments | latex2sympy.py | handle_gcd_lcm | ConsoleBit/latex2sympy | python | def handle_gcd_lcm(f, args):
'\n Return the result of gcd() or lcm(), as UnevaluatedExpr\n\n f: str - name of function ("gcd" or "lcm")\n args: List[Expr] - list of function arguments\n '
args = tuple(map(sympy.nsimplify, args))
return sympy.UnevaluatedExpr(getattr(sympy, f)(args)) |
def handle_floor(expr):
'\n Apply floor() then return the floored expression.\n\n expr: Expr - sympy expression as an argument to floor()\n '
return sympy.functions.floor(expr, evaluate=False) | -3,092,591,175,264,121,000 | Apply floor() then return the floored expression.
expr: Expr - sympy expression as an argument to floor() | latex2sympy.py | handle_floor | ConsoleBit/latex2sympy | python | def handle_floor(expr):
'\n Apply floor() then return the floored expression.\n\n expr: Expr - sympy expression as an argument to floor()\n '
return sympy.functions.floor(expr, evaluate=False) |
def handle_ceil(expr):
'\n Apply ceil() then return the ceil-ed expression.\n\n expr: Expr - sympy expression as an argument to ceil()\n '
return sympy.functions.ceiling(expr, evaluate=False) | -1,426,842,501,402,985,000 | Apply ceil() then return the ceil-ed expression.
expr: Expr - sympy expression as an argument to ceil() | latex2sympy.py | handle_ceil | ConsoleBit/latex2sympy | python | def handle_ceil(expr):
'\n Apply ceil() then return the ceil-ed expression.\n\n expr: Expr - sympy expression as an argument to ceil()\n '
return sympy.functions.ceiling(expr, evaluate=False) |
def list(self, filter=None, include_extended_locations=None, **kwargs):
'Gets the list of Microsoft.Compute SKUs available for your Subscription.\n\n :param filter: The filter to apply on the operation. Only **location** filter is supported\n currently.\n :type filter: str\n :param include_extended_locations: To Include Extended Locations information or not in the\n response.\n :type include_extended_locations: str\n :keyword callable cls: A custom type or function that will be passed the direct response\n :return: An iterator like instance of either ResourceSkusResult or the result of cls(response)\n :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.ResourceSkusResult]\n :raises: ~azure.core.exceptions.HttpResponseError\n '
cls = kwargs.pop('cls', None)
error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError}
error_map.update(kwargs.pop('error_map', {}))
api_version = '2021-07-01'
accept = 'application/json'
def prepare_request(next_link=None):
header_parameters = {}
header_parameters['Accept'] = self._serialize.header('accept', accept, 'str')
if (not next_link):
url = self.list.metadata['url']
path_format_arguments = {'subscriptionId': self._serialize.url('self._config.subscription_id', self._config.subscription_id, 'str')}
url = self._client.format_url(url, **path_format_arguments)
query_parameters = {}
query_parameters['api-version'] = self._serialize.query('api_version', api_version, 'str')
if (filter is not None):
query_parameters['$filter'] = self._serialize.query('filter', filter, 'str')
if (include_extended_locations is not None):
query_parameters['includeExtendedLocations'] = self._serialize.query('include_extended_locations', include_extended_locations, 'str')
request = self._client.get(url, query_parameters, header_parameters)
else:
url = next_link
query_parameters = {}
request = self._client.get(url, query_parameters, header_parameters)
return request
def extract_data(pipeline_response):
deserialized = self._deserialize('ResourceSkusResult', pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return ((deserialized.next_link or None), iter(list_of_elem))
def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if (response.status_code not in [200]):
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data) | 5,884,137,227,320,526,000 | Gets the list of Microsoft.Compute SKUs available for your Subscription.
:param filter: The filter to apply on the operation. Only **location** filter is supported
currently.
:type filter: str
:param include_extended_locations: To Include Extended Locations information or not in the
response.
:type include_extended_locations: str
:keyword callable cls: A custom type or function that will be passed the direct response
:return: An iterator like instance of either ResourceSkusResult or the result of cls(response)
:rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.ResourceSkusResult]
:raises: ~azure.core.exceptions.HttpResponseError | sdk/compute/azure-mgmt-compute/azure/mgmt/compute/v2021_07_01/operations/_resource_skus_operations.py | list | AlexGhiondea/azure-sdk-for-python | python | def list(self, filter=None, include_extended_locations=None, **kwargs):
'Gets the list of Microsoft.Compute SKUs available for your Subscription.\n\n :param filter: The filter to apply on the operation. Only **location** filter is supported\n currently.\n :type filter: str\n :param include_extended_locations: To Include Extended Locations information or not in the\n response.\n :type include_extended_locations: str\n :keyword callable cls: A custom type or function that will be passed the direct response\n :return: An iterator like instance of either ResourceSkusResult or the result of cls(response)\n :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.compute.v2021_07_01.models.ResourceSkusResult]\n :raises: ~azure.core.exceptions.HttpResponseError\n '
cls = kwargs.pop('cls', None)
error_map = {401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError}
error_map.update(kwargs.pop('error_map', {}))
api_version = '2021-07-01'
accept = 'application/json'
def prepare_request(next_link=None):
header_parameters = {}
header_parameters['Accept'] = self._serialize.header('accept', accept, 'str')
if (not next_link):
url = self.list.metadata['url']
path_format_arguments = {'subscriptionId': self._serialize.url('self._config.subscription_id', self._config.subscription_id, 'str')}
url = self._client.format_url(url, **path_format_arguments)
query_parameters = {}
query_parameters['api-version'] = self._serialize.query('api_version', api_version, 'str')
if (filter is not None):
query_parameters['$filter'] = self._serialize.query('filter', filter, 'str')
if (include_extended_locations is not None):
query_parameters['includeExtendedLocations'] = self._serialize.query('include_extended_locations', include_extended_locations, 'str')
request = self._client.get(url, query_parameters, header_parameters)
else:
url = next_link
query_parameters = {}
request = self._client.get(url, query_parameters, header_parameters)
return request
def extract_data(pipeline_response):
deserialized = self._deserialize('ResourceSkusResult', pipeline_response)
list_of_elem = deserialized.value
if cls:
list_of_elem = cls(list_of_elem)
return ((deserialized.next_link or None), iter(list_of_elem))
def get_next(next_link=None):
request = prepare_request(next_link)
pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)
response = pipeline_response.http_response
if (response.status_code not in [200]):
map_error(status_code=response.status_code, response=response, error_map=error_map)
raise HttpResponseError(response=response, error_format=ARMErrorFormat)
return pipeline_response
return ItemPaged(get_next, extract_data) |
@property
def app_id(self):
' The identifier for the app.\n This is the reversed domain name, often used for targetting resources, etc.\n\n Returns:\n The identifier as a ``str``.\n '
return self._app_id | 4,238,949,976,171,327,000 | The identifier for the app.
This is the reversed domain name, often used for targetting resources, etc.
Returns:
The identifier as a ``str``. | src/core/toga/app.py | app_id | UncleGoogle/toga | python | @property
def app_id(self):
' The identifier for the app.\n This is the reversed domain name, often used for targetting resources, etc.\n\n Returns:\n The identifier as a ``str``.\n '
return self._app_id |
@property
def id(self):
' The DOM identifier for the app. This id can be used to target CSS directives.\n\n Returns:\n The identifier for the app as a ``str``.\n '
return self._id | -8,942,227,401,891,030,000 | The DOM identifier for the app. This id can be used to target CSS directives.
Returns:
The identifier for the app as a ``str``. | src/core/toga/app.py | id | UncleGoogle/toga | python | @property
def id(self):
' The DOM identifier for the app. This id can be used to target CSS directives.\n\n Returns:\n The identifier for the app as a ``str``.\n '
return self._id |
@property
def icon(self):
' The Icon for the app. On setting, the icon is loaded automatically.\n\n Returns:\n The icon of the app ``toga.Icon``.\n '
return self._icon | 3,967,665,309,755,260,400 | The Icon for the app. On setting, the icon is loaded automatically.
Returns:
The icon of the app ``toga.Icon``. | src/core/toga/app.py | icon | UncleGoogle/toga | python | @property
def icon(self):
' The Icon for the app. On setting, the icon is loaded automatically.\n\n Returns:\n The icon of the app ``toga.Icon``.\n '
return self._icon |
@property
def main_window(self):
'The main Windows for the app.\n\n Returns:\n The main Window of the app.\n '
return self._main_window | 4,437,570,016,743,005,700 | The main Windows for the app.
Returns:
The main Window of the app. | src/core/toga/app.py | main_window | UncleGoogle/toga | python | @property
def main_window(self):
'The main Windows for the app.\n\n Returns:\n The main Window of the app.\n '
return self._main_window |
@property
def current_window(self):
'Return the currently active content window'
return self._impl.current_window().interface | -2,627,495,598,453,323,000 | Return the currently active content window | src/core/toga/app.py | current_window | UncleGoogle/toga | python | @property
def current_window(self):
return self._impl.current_window().interface |
@property
def is_full_screen(self):
'Is the app currently in full screen mode?'
return (self._full_screen_windows is not None) | 3,138,033,621,454,953,000 | Is the app currently in full screen mode? | src/core/toga/app.py | is_full_screen | UncleGoogle/toga | python | @property
def is_full_screen(self):
return (self._full_screen_windows is not None) |
def set_full_screen(self, *windows):
'Make one or more windows full screen.\n\n Full screen is not the same as "maximized"; full screen mode\n is when all window borders and other chrome is no longer\n visible.\n\n Args:\n windows: The list of windows to go full screen,\n in order of allocation to screens. If the number of\n windows exceeds the number of available displays,\n those windows will not be visible. If no windows\n are specified, the app will exit full screen mode.\n '
if (not windows):
self.exit_full_screen()
else:
self._impl.enter_full_screen(windows)
self._full_screen_windows = windows | -4,843,501,887,894,371,000 | Make one or more windows full screen.
Full screen is not the same as "maximized"; full screen mode
is when all window borders and other chrome is no longer
visible.
Args:
windows: The list of windows to go full screen,
in order of allocation to screens. If the number of
windows exceeds the number of available displays,
those windows will not be visible. If no windows
are specified, the app will exit full screen mode. | src/core/toga/app.py | set_full_screen | UncleGoogle/toga | python | def set_full_screen(self, *windows):
'Make one or more windows full screen.\n\n Full screen is not the same as "maximized"; full screen mode\n is when all window borders and other chrome is no longer\n visible.\n\n Args:\n windows: The list of windows to go full screen,\n in order of allocation to screens. If the number of\n windows exceeds the number of available displays,\n those windows will not be visible. If no windows\n are specified, the app will exit full screen mode.\n '
if (not windows):
self.exit_full_screen()
else:
self._impl.enter_full_screen(windows)
self._full_screen_windows = windows |
def exit_full_screen(self):
'Exit full screen mode.'
if self.is_full_screen:
self._impl.exit_full_screen(self._full_screen_windows)
self._full_screen_windows = None | -2,565,424,291,662,452,000 | Exit full screen mode. | src/core/toga/app.py | exit_full_screen | UncleGoogle/toga | python | def exit_full_screen(self):
if self.is_full_screen:
self._impl.exit_full_screen(self._full_screen_windows)
self._full_screen_windows = None |
def show_cursor(self):
'Show cursor.'
self._impl.show_cursor() | -1,141,088,463,801,160,000 | Show cursor. | src/core/toga/app.py | show_cursor | UncleGoogle/toga | python | def show_cursor(self):
self._impl.show_cursor() |
def hide_cursor(self):
'Hide cursor from view.'
self._impl.hide_cursor() | 6,296,678,684,678,334,000 | Hide cursor from view. | src/core/toga/app.py | hide_cursor | UncleGoogle/toga | python | def hide_cursor(self):
self._impl.hide_cursor() |
def startup(self):
' Create and show the main window for the application\n '
self.main_window = MainWindow(title=self.name, factory=self.factory)
if self._startup_method:
self.main_window.content = self._startup_method(self)
self.main_window.show() | -3,806,753,860,502,880,000 | Create and show the main window for the application | src/core/toga/app.py | startup | UncleGoogle/toga | python | def startup(self):
' \n '
self.main_window = MainWindow(title=self.name, factory=self.factory)
if self._startup_method:
self.main_window.content = self._startup_method(self)
self.main_window.show() |
def main_loop(self):
' Invoke the application to handle user input.\n This method typically only returns once the application is exiting.\n '
signal.signal(signal.SIGINT, signal.SIG_DFL)
self._impl.main_loop() | -5,792,627,453,131,729,000 | Invoke the application to handle user input.
This method typically only returns once the application is exiting. | src/core/toga/app.py | main_loop | UncleGoogle/toga | python | def main_loop(self):
' Invoke the application to handle user input.\n This method typically only returns once the application is exiting.\n '
signal.signal(signal.SIGINT, signal.SIG_DFL)
self._impl.main_loop() |
def exit(self):
' Quit the application gracefully.\n '
self._impl.exit() | -9,104,324,901,370,032,000 | Quit the application gracefully. | src/core/toga/app.py | exit | UncleGoogle/toga | python | def exit(self):
' \n '
self._impl.exit() |
@property
def on_exit(self):
'The handler to invoke before the application exits.\n\n Returns:\n The function ``callable`` that is called on application exit.\n '
return self._on_exit | 1,290,632,929,525,861,400 | The handler to invoke before the application exits.
Returns:
The function ``callable`` that is called on application exit. | src/core/toga/app.py | on_exit | UncleGoogle/toga | python | @property
def on_exit(self):
'The handler to invoke before the application exits.\n\n Returns:\n The function ``callable`` that is called on application exit.\n '
return self._on_exit |
@on_exit.setter
def on_exit(self, handler):
'Set the handler to invoke before the app exits.\n\n Args:\n handler (:obj:`callable`): The handler to invoke before the app exits.\n '
self._on_exit = wrapped_handler(self, handler)
self._impl.set_on_exit(self._on_exit) | 3,204,447,657,490,717,700 | Set the handler to invoke before the app exits.
Args:
handler (:obj:`callable`): The handler to invoke before the app exits. | src/core/toga/app.py | on_exit | UncleGoogle/toga | python | @on_exit.setter
def on_exit(self, handler):
'Set the handler to invoke before the app exits.\n\n Args:\n handler (:obj:`callable`): The handler to invoke before the app exits.\n '
self._on_exit = wrapped_handler(self, handler)
self._impl.set_on_exit(self._on_exit) |
@property
def documents(self):
' Return the list of documents associated with this app.\n\n Returns:\n A ``list`` of ``str``.\n '
return self._documents | -2,128,313,821,489,602,600 | Return the list of documents associated with this app.
Returns:
A ``list`` of ``str``. | src/core/toga/app.py | documents | UncleGoogle/toga | python | @property
def documents(self):
' Return the list of documents associated with this app.\n\n Returns:\n A ``list`` of ``str``.\n '
return self._documents |
def send_await_disconnect(self, message, timeout=30):
'Sends a message to the node and wait for disconnect.\n\n This is used when we want to send a message into the node that we expect\n will get us disconnected, eg an invalid block.'
self.send_message(message)
wait_until((lambda : (not self.is_connected)), timeout=timeout, lock=mininode_lock) | 1,247,234,817,416,419,300 | Sends a message to the node and wait for disconnect.
This is used when we want to send a message into the node that we expect
will get us disconnected, eg an invalid block. | test/functional/p2p_compactblocks.py | send_await_disconnect | 0mfq/0mfq | python | def send_await_disconnect(self, message, timeout=30):
'Sends a message to the node and wait for disconnect.\n\n This is used when we want to send a message into the node that we expect\n will get us disconnected, eg an invalid block.'
self.send_message(message)
wait_until((lambda : (not self.is_connected)), timeout=timeout, lock=mininode_lock) |
def generate_signature_key():
'\n Generate a new random signing key and return the hex-encoded bytestring\n '
signing_key = SigningKey.generate()
return signing_key.encode(encoder=Base64Encoder).decode('utf-8') | -1,283,431,587,857,217,000 | Generate a new random signing key and return the hex-encoded bytestring | register/utils.py | generate_signature_key | cds-snc/covid-alert-portal | python | def generate_signature_key():
'\n \n '
signing_key = SigningKey.generate()
return signing_key.encode(encoder=Base64Encoder).decode('utf-8') |
def load_signature_key():
'\n Load the signature key from the environment\n '
try:
key = settings.QRCODE_SIGNATURE_PRIVATE_KEY
key_bytes = key.encode('utf-8')
except AttributeError:
print('Missing QRCode signing key')
raise
try:
signing_key = SigningKey(key_bytes, encoder=Base64Encoder)
except TypeError:
print('Faulty QRCode signing key')
raise
return signing_key | -6,325,632,982,844,733,000 | Load the signature key from the environment | register/utils.py | load_signature_key | cds-snc/covid-alert-portal | python | def load_signature_key():
'\n \n '
try:
key = settings.QRCODE_SIGNATURE_PRIVATE_KEY
key_bytes = key.encode('utf-8')
except AttributeError:
print('Missing QRCode signing key')
raise
try:
signing_key = SigningKey(key_bytes, encoder=Base64Encoder)
except TypeError:
print('Faulty QRCode signing key')
raise
return signing_key |
def LicenseServerSource(vim, *args, **kwargs):
'Specify a license server reachable via IPv4 network.'
obj = vim.client.factory.create('{urn:vim25}LicenseServerSource')
if ((len(args) + len(kwargs)) < 1):
raise IndexError(('Expected at least 2 arguments got: %d' % len(args)))
required = ['licenseServer']
optional = ['dynamicProperty', 'dynamicType']
for (name, arg) in zip((required + optional), args):
setattr(obj, name, arg)
for (name, value) in kwargs.items():
if (name in (required + optional)):
setattr(obj, name, value)
else:
raise InvalidArgumentError(('Invalid argument: %s. Expected one of %s' % (name, ', '.join((required + optional)))))
return obj | 3,180,859,593,669,577,000 | Specify a license server reachable via IPv4 network. | pyvisdk/do/license_server_source.py | LicenseServerSource | Infinidat/pyvisdk | python | def LicenseServerSource(vim, *args, **kwargs):
obj = vim.client.factory.create('{urn:vim25}LicenseServerSource')
if ((len(args) + len(kwargs)) < 1):
raise IndexError(('Expected at least 2 arguments got: %d' % len(args)))
required = ['licenseServer']
optional = ['dynamicProperty', 'dynamicType']
for (name, arg) in zip((required + optional), args):
setattr(obj, name, arg)
for (name, value) in kwargs.items():
if (name in (required + optional)):
setattr(obj, name, value)
else:
raise InvalidArgumentError(('Invalid argument: %s. Expected one of %s' % (name, ', '.join((required + optional)))))
return obj |
def __init__(self, hostname=None, port=None, cert=None, key=None, ca=None, ssl_version=None, username=None, password=None, config='client'):
"\n Construct a ProxyKmipClient.\n\n Args:\n hostname (string): The host or IP address of a KMIP appliance.\n Optional, defaults to None.\n port (int): The port number used to establish a connection to a\n KMIP appliance. Usually 5696 for KMIP applications. Optional,\n defaults to None.\n cert (string): The path to the client's certificate. Optional,\n defaults to None.\n key (string): The path to the key for the client's certificate.\n Optional, defaults to None.\n ca (string): The path to the CA certificate used to verify the\n server's certificate. Optional, defaults to None.\n ssl_version (string): The name of the ssl version to use for the\n connection. Example: 'PROTOCOL_SSLv23'. Optional, defaults to\n None.\n username (string): The username of the KMIP appliance account to\n use for operations. Optional, defaults to None.\n password (string): The password of the KMIP appliance account to\n use for operations. Optional, defaults to None.\n config (string): The name of a section in the PyKMIP configuration\n file. Use to load a specific set of configuration settings from\n the configuration file, instead of specifying them manually.\n Optional, defaults to the default client section, 'client'.\n "
self.logger = logging.getLogger()
self.attribute_factory = attributes.AttributeFactory()
self.object_factory = factory.ObjectFactory()
self.proxy = KMIPProxy(host=hostname, port=port, certfile=cert, keyfile=key, ca_certs=ca, ssl_version=ssl_version, username=username, password=password, config=config)
self._is_open = False | 8,711,322,328,251,049,000 | Construct a ProxyKmipClient.
Args:
hostname (string): The host or IP address of a KMIP appliance.
Optional, defaults to None.
port (int): The port number used to establish a connection to a
KMIP appliance. Usually 5696 for KMIP applications. Optional,
defaults to None.
cert (string): The path to the client's certificate. Optional,
defaults to None.
key (string): The path to the key for the client's certificate.
Optional, defaults to None.
ca (string): The path to the CA certificate used to verify the
server's certificate. Optional, defaults to None.
ssl_version (string): The name of the ssl version to use for the
connection. Example: 'PROTOCOL_SSLv23'. Optional, defaults to
None.
username (string): The username of the KMIP appliance account to
use for operations. Optional, defaults to None.
password (string): The password of the KMIP appliance account to
use for operations. Optional, defaults to None.
config (string): The name of a section in the PyKMIP configuration
file. Use to load a specific set of configuration settings from
the configuration file, instead of specifying them manually.
Optional, defaults to the default client section, 'client'. | kmip/pie/client.py | __init__ | eniltonj/PyKMIP | python | def __init__(self, hostname=None, port=None, cert=None, key=None, ca=None, ssl_version=None, username=None, password=None, config='client'):
"\n Construct a ProxyKmipClient.\n\n Args:\n hostname (string): The host or IP address of a KMIP appliance.\n Optional, defaults to None.\n port (int): The port number used to establish a connection to a\n KMIP appliance. Usually 5696 for KMIP applications. Optional,\n defaults to None.\n cert (string): The path to the client's certificate. Optional,\n defaults to None.\n key (string): The path to the key for the client's certificate.\n Optional, defaults to None.\n ca (string): The path to the CA certificate used to verify the\n server's certificate. Optional, defaults to None.\n ssl_version (string): The name of the ssl version to use for the\n connection. Example: 'PROTOCOL_SSLv23'. Optional, defaults to\n None.\n username (string): The username of the KMIP appliance account to\n use for operations. Optional, defaults to None.\n password (string): The password of the KMIP appliance account to\n use for operations. Optional, defaults to None.\n config (string): The name of a section in the PyKMIP configuration\n file. Use to load a specific set of configuration settings from\n the configuration file, instead of specifying them manually.\n Optional, defaults to the default client section, 'client'.\n "
self.logger = logging.getLogger()
self.attribute_factory = attributes.AttributeFactory()
self.object_factory = factory.ObjectFactory()
self.proxy = KMIPProxy(host=hostname, port=port, certfile=cert, keyfile=key, ca_certs=ca, ssl_version=ssl_version, username=username, password=password, config=config)
self._is_open = False |
def open(self):
'\n Open the client connection.\n\n Raises:\n ClientConnectionFailure: if the client connection is already open\n Exception: if an error occurs while trying to open the connection\n '
if self._is_open:
raise exceptions.ClientConnectionFailure('client connection already open')
else:
try:
self.proxy.open()
self._is_open = True
except Exception as e:
self.logger.exception('could not open client connection', e)
raise e | -515,086,383,841,697,100 | Open the client connection.
Raises:
ClientConnectionFailure: if the client connection is already open
Exception: if an error occurs while trying to open the connection | kmip/pie/client.py | open | eniltonj/PyKMIP | python | def open(self):
'\n Open the client connection.\n\n Raises:\n ClientConnectionFailure: if the client connection is already open\n Exception: if an error occurs while trying to open the connection\n '
if self._is_open:
raise exceptions.ClientConnectionFailure('client connection already open')
else:
try:
self.proxy.open()
self._is_open = True
except Exception as e:
self.logger.exception('could not open client connection', e)
raise e |
def close(self):
'\n Close the client connection.\n\n Raises:\n Exception: if an error occurs while trying to close the connection\n '
if (not self._is_open):
return
else:
try:
self.proxy.close()
self._is_open = False
except Exception as e:
self.logger.exception('could not close client connection', e)
raise e | -1,265,528,005,863,974,400 | Close the client connection.
Raises:
Exception: if an error occurs while trying to close the connection | kmip/pie/client.py | close | eniltonj/PyKMIP | python | def close(self):
'\n Close the client connection.\n\n Raises:\n Exception: if an error occurs while trying to close the connection\n '
if (not self._is_open):
return
else:
try:
self.proxy.close()
self._is_open = False
except Exception as e:
self.logger.exception('could not close client connection', e)
raise e |
@is_connected
def create(self, algorithm, length, operation_policy_name=None, name=None, cryptographic_usage_mask=None):
'\n Create a symmetric key on a KMIP appliance.\n\n Args:\n algorithm (CryptographicAlgorithm): An enumeration defining the\n algorithm to use to generate the symmetric key.\n length (int): The length in bits for the symmetric key.\n operation_policy_name (string): The name of the operation policy\n to use for the new symmetric key. Optional, defaults to None\n name (string): The name to give the key. Optional, defaults to None\n cryptographic_usage_mask (list): list of enumerations of crypto\n usage mask passing to the symmetric key. Optional, defaults to\n None\n\n Returns:\n string: The uid of the newly created symmetric key.\n\n Raises:\n ClientConnectionNotOpen: if the client connection is unusable\n KmipOperationFailure: if the operation result is a failure\n TypeError: if the input arguments are invalid\n '
if (not isinstance(algorithm, enums.CryptographicAlgorithm)):
raise TypeError('algorithm must be a CryptographicAlgorithm enumeration')
elif ((not isinstance(length, six.integer_types)) or (length <= 0)):
raise TypeError('length must be a positive integer')
if (cryptographic_usage_mask is not None):
if ((not isinstance(cryptographic_usage_mask, list)) or (all((isinstance(item, enums.CryptographicUsageMask) for item in cryptographic_usage_mask)) is False)):
raise TypeError('cryptographic_usage_mask must be a list of CryptographicUsageMask enumerations')
common_attributes = self._build_common_attributes(operation_policy_name)
key_attributes = self._build_key_attributes(algorithm, length, cryptographic_usage_mask)
key_attributes.extend(common_attributes)
if name:
key_attributes.extend(self._build_name_attribute(name))
template = cobjects.TemplateAttribute(attributes=key_attributes)
result = self.proxy.create(enums.ObjectType.SYMMETRIC_KEY, template)
status = result.result_status.value
if (status == enums.ResultStatus.SUCCESS):
uid = result.uuid.value
return uid
else:
reason = result.result_reason.value
message = result.result_message.value
raise exceptions.KmipOperationFailure(status, reason, message) | -4,912,024,527,486,502,000 | Create a symmetric key on a KMIP appliance.
Args:
algorithm (CryptographicAlgorithm): An enumeration defining the
algorithm to use to generate the symmetric key.
length (int): The length in bits for the symmetric key.
operation_policy_name (string): The name of the operation policy
to use for the new symmetric key. Optional, defaults to None
name (string): The name to give the key. Optional, defaults to None
cryptographic_usage_mask (list): list of enumerations of crypto
usage mask passing to the symmetric key. Optional, defaults to
None
Returns:
string: The uid of the newly created symmetric key.
Raises:
ClientConnectionNotOpen: if the client connection is unusable
KmipOperationFailure: if the operation result is a failure
TypeError: if the input arguments are invalid | kmip/pie/client.py | create | eniltonj/PyKMIP | python | @is_connected
def create(self, algorithm, length, operation_policy_name=None, name=None, cryptographic_usage_mask=None):
'\n Create a symmetric key on a KMIP appliance.\n\n Args:\n algorithm (CryptographicAlgorithm): An enumeration defining the\n algorithm to use to generate the symmetric key.\n length (int): The length in bits for the symmetric key.\n operation_policy_name (string): The name of the operation policy\n to use for the new symmetric key. Optional, defaults to None\n name (string): The name to give the key. Optional, defaults to None\n cryptographic_usage_mask (list): list of enumerations of crypto\n usage mask passing to the symmetric key. Optional, defaults to\n None\n\n Returns:\n string: The uid of the newly created symmetric key.\n\n Raises:\n ClientConnectionNotOpen: if the client connection is unusable\n KmipOperationFailure: if the operation result is a failure\n TypeError: if the input arguments are invalid\n '
if (not isinstance(algorithm, enums.CryptographicAlgorithm)):
raise TypeError('algorithm must be a CryptographicAlgorithm enumeration')
elif ((not isinstance(length, six.integer_types)) or (length <= 0)):
raise TypeError('length must be a positive integer')
if (cryptographic_usage_mask is not None):
if ((not isinstance(cryptographic_usage_mask, list)) or (all((isinstance(item, enums.CryptographicUsageMask) for item in cryptographic_usage_mask)) is False)):
raise TypeError('cryptographic_usage_mask must be a list of CryptographicUsageMask enumerations')
common_attributes = self._build_common_attributes(operation_policy_name)
key_attributes = self._build_key_attributes(algorithm, length, cryptographic_usage_mask)
key_attributes.extend(common_attributes)
if name:
key_attributes.extend(self._build_name_attribute(name))
template = cobjects.TemplateAttribute(attributes=key_attributes)
result = self.proxy.create(enums.ObjectType.SYMMETRIC_KEY, template)
status = result.result_status.value
if (status == enums.ResultStatus.SUCCESS):
uid = result.uuid.value
return uid
else:
reason = result.result_reason.value
message = result.result_message.value
raise exceptions.KmipOperationFailure(status, reason, message) |
@is_connected
def create_key_pair(self, algorithm, length, operation_policy_name=None, public_name=None, public_usage_mask=None, private_name=None, private_usage_mask=None):
'\n Create an asymmetric key pair on a KMIP appliance.\n\n Args:\n algorithm (CryptographicAlgorithm): An enumeration defining the\n algorithm to use to generate the key pair.\n length (int): The length in bits for the key pair.\n operation_policy_name (string): The name of the operation policy\n to use for the new key pair. Optional, defaults to None.\n public_name (string): The name to give the public key.\n Optional, defaults to None.\n public_usage_mask (list): A list of CryptographicUsageMask\n enumerations indicating how the public key should be used.\n Optional, defaults to None.\n private_name (string): The name to give the public key.\n Optional, defaults to None.\n private_usage_mask (list): A list of CryptographicUsageMask\n enumerations indicating how the private key should be used.\n Optional, defaults to None.\n\n Returns:\n string: The uid of the newly created public key.\n string: The uid of the newly created private key.\n\n Raises:\n ClientConnectionNotOpen: if the client connection is unusable\n KmipOperationFailure: if the operation result is a failure\n TypeError: if the input arguments are invalid\n '
if (not isinstance(algorithm, enums.CryptographicAlgorithm)):
raise TypeError('algorithm must be a CryptographicAlgorithm enumeration')
elif ((not isinstance(length, six.integer_types)) or (length <= 0)):
raise TypeError('length must be a positive integer')
common_attributes = self._build_common_attributes(operation_policy_name)
key_attributes = self._build_key_attributes(algorithm, length)
key_attributes.extend(common_attributes)
template = cobjects.CommonTemplateAttribute(attributes=key_attributes)
public_template = None
names = None
if public_name:
names = self._build_name_attribute(name=public_name)
attrs = []
if public_usage_mask:
attrs = [self.attribute_factory.create_attribute(enums.AttributeType.CRYPTOGRAPHIC_USAGE_MASK, public_usage_mask)]
if (names or attrs):
public_template = cobjects.PublicKeyTemplateAttribute(names=names, attributes=attrs)
private_template = None
names = None
if private_name:
names = self._build_name_attribute(name=private_name)
attrs = []
if private_usage_mask:
attrs = [self.attribute_factory.create_attribute(enums.AttributeType.CRYPTOGRAPHIC_USAGE_MASK, private_usage_mask)]
if (names or attrs):
private_template = cobjects.PrivateKeyTemplateAttribute(names=names, attributes=attrs)
result = self.proxy.create_key_pair(common_template_attribute=template, private_key_template_attribute=private_template, public_key_template_attribute=public_template)
status = result.result_status.value
if (status == enums.ResultStatus.SUCCESS):
public_uid = result.public_key_uuid.value
private_uid = result.private_key_uuid.value
return (public_uid, private_uid)
else:
reason = result.result_reason.value
message = result.result_message.value
raise exceptions.KmipOperationFailure(status, reason, message) | 108,947,103,961,337,780 | Create an asymmetric key pair on a KMIP appliance.
Args:
algorithm (CryptographicAlgorithm): An enumeration defining the
algorithm to use to generate the key pair.
length (int): The length in bits for the key pair.
operation_policy_name (string): The name of the operation policy
to use for the new key pair. Optional, defaults to None.
public_name (string): The name to give the public key.
Optional, defaults to None.
public_usage_mask (list): A list of CryptographicUsageMask
enumerations indicating how the public key should be used.
Optional, defaults to None.
private_name (string): The name to give the public key.
Optional, defaults to None.
private_usage_mask (list): A list of CryptographicUsageMask
enumerations indicating how the private key should be used.
Optional, defaults to None.
Returns:
string: The uid of the newly created public key.
string: The uid of the newly created private key.
Raises:
ClientConnectionNotOpen: if the client connection is unusable
KmipOperationFailure: if the operation result is a failure
TypeError: if the input arguments are invalid | kmip/pie/client.py | create_key_pair | eniltonj/PyKMIP | python | @is_connected
def create_key_pair(self, algorithm, length, operation_policy_name=None, public_name=None, public_usage_mask=None, private_name=None, private_usage_mask=None):
'\n Create an asymmetric key pair on a KMIP appliance.\n\n Args:\n algorithm (CryptographicAlgorithm): An enumeration defining the\n algorithm to use to generate the key pair.\n length (int): The length in bits for the key pair.\n operation_policy_name (string): The name of the operation policy\n to use for the new key pair. Optional, defaults to None.\n public_name (string): The name to give the public key.\n Optional, defaults to None.\n public_usage_mask (list): A list of CryptographicUsageMask\n enumerations indicating how the public key should be used.\n Optional, defaults to None.\n private_name (string): The name to give the public key.\n Optional, defaults to None.\n private_usage_mask (list): A list of CryptographicUsageMask\n enumerations indicating how the private key should be used.\n Optional, defaults to None.\n\n Returns:\n string: The uid of the newly created public key.\n string: The uid of the newly created private key.\n\n Raises:\n ClientConnectionNotOpen: if the client connection is unusable\n KmipOperationFailure: if the operation result is a failure\n TypeError: if the input arguments are invalid\n '
if (not isinstance(algorithm, enums.CryptographicAlgorithm)):
raise TypeError('algorithm must be a CryptographicAlgorithm enumeration')
elif ((not isinstance(length, six.integer_types)) or (length <= 0)):
raise TypeError('length must be a positive integer')
common_attributes = self._build_common_attributes(operation_policy_name)
key_attributes = self._build_key_attributes(algorithm, length)
key_attributes.extend(common_attributes)
template = cobjects.CommonTemplateAttribute(attributes=key_attributes)
public_template = None
names = None
if public_name:
names = self._build_name_attribute(name=public_name)
attrs = []
if public_usage_mask:
attrs = [self.attribute_factory.create_attribute(enums.AttributeType.CRYPTOGRAPHIC_USAGE_MASK, public_usage_mask)]
if (names or attrs):
public_template = cobjects.PublicKeyTemplateAttribute(names=names, attributes=attrs)
private_template = None
names = None
if private_name:
names = self._build_name_attribute(name=private_name)
attrs = []
if private_usage_mask:
attrs = [self.attribute_factory.create_attribute(enums.AttributeType.CRYPTOGRAPHIC_USAGE_MASK, private_usage_mask)]
if (names or attrs):
private_template = cobjects.PrivateKeyTemplateAttribute(names=names, attributes=attrs)
result = self.proxy.create_key_pair(common_template_attribute=template, private_key_template_attribute=private_template, public_key_template_attribute=public_template)
status = result.result_status.value
if (status == enums.ResultStatus.SUCCESS):
public_uid = result.public_key_uuid.value
private_uid = result.private_key_uuid.value
return (public_uid, private_uid)
else:
reason = result.result_reason.value
message = result.result_message.value
raise exceptions.KmipOperationFailure(status, reason, message) |
@is_connected
def register(self, managed_object):
'\n Register a managed object with a KMIP appliance.\n\n Args:\n managed_object (ManagedObject): A managed object to register. An\n instantiatable subclass of ManagedObject from the Pie API.\n\n Returns:\n string: The uid of the newly registered managed object.\n\n Raises:\n ClientConnectionNotOpen: if the client connection is unusable\n KmipOperationFailure: if the operation result is a failure\n TypeError: if the input argument is invalid\n '
if (not isinstance(managed_object, pobjects.ManagedObject)):
raise TypeError('managed object must be a Pie ManagedObject')
object_attributes = list()
if hasattr(managed_object, 'cryptographic_usage_masks'):
if (managed_object.cryptographic_usage_masks is not None):
mask_attribute = self.attribute_factory.create_attribute(enums.AttributeType.CRYPTOGRAPHIC_USAGE_MASK, managed_object.cryptographic_usage_masks)
object_attributes.append(mask_attribute)
if hasattr(managed_object, 'operation_policy_name'):
if (managed_object.operation_policy_name is not None):
opn_attribute = self.attribute_factory.create_attribute(enums.AttributeType.OPERATION_POLICY_NAME, managed_object.operation_policy_name)
object_attributes.append(opn_attribute)
template = cobjects.TemplateAttribute(attributes=object_attributes)
object_type = managed_object.object_type
secret = self.object_factory.convert(managed_object)
result = self.proxy.register(object_type, template, secret)
status = result.result_status.value
if (status == enums.ResultStatus.SUCCESS):
uid = result.uuid.value
return uid
else:
reason = result.result_reason.value
message = result.result_message.value
raise exceptions.KmipOperationFailure(status, reason, message) | -1,602,944,163,450,911,700 | Register a managed object with a KMIP appliance.
Args:
managed_object (ManagedObject): A managed object to register. An
instantiatable subclass of ManagedObject from the Pie API.
Returns:
string: The uid of the newly registered managed object.
Raises:
ClientConnectionNotOpen: if the client connection is unusable
KmipOperationFailure: if the operation result is a failure
TypeError: if the input argument is invalid | kmip/pie/client.py | register | eniltonj/PyKMIP | python | @is_connected
def register(self, managed_object):
'\n Register a managed object with a KMIP appliance.\n\n Args:\n managed_object (ManagedObject): A managed object to register. An\n instantiatable subclass of ManagedObject from the Pie API.\n\n Returns:\n string: The uid of the newly registered managed object.\n\n Raises:\n ClientConnectionNotOpen: if the client connection is unusable\n KmipOperationFailure: if the operation result is a failure\n TypeError: if the input argument is invalid\n '
if (not isinstance(managed_object, pobjects.ManagedObject)):
raise TypeError('managed object must be a Pie ManagedObject')
object_attributes = list()
if hasattr(managed_object, 'cryptographic_usage_masks'):
if (managed_object.cryptographic_usage_masks is not None):
mask_attribute = self.attribute_factory.create_attribute(enums.AttributeType.CRYPTOGRAPHIC_USAGE_MASK, managed_object.cryptographic_usage_masks)
object_attributes.append(mask_attribute)
if hasattr(managed_object, 'operation_policy_name'):
if (managed_object.operation_policy_name is not None):
opn_attribute = self.attribute_factory.create_attribute(enums.AttributeType.OPERATION_POLICY_NAME, managed_object.operation_policy_name)
object_attributes.append(opn_attribute)
template = cobjects.TemplateAttribute(attributes=object_attributes)
object_type = managed_object.object_type
secret = self.object_factory.convert(managed_object)
result = self.proxy.register(object_type, template, secret)
status = result.result_status.value
if (status == enums.ResultStatus.SUCCESS):
uid = result.uuid.value
return uid
else:
reason = result.result_reason.value
message = result.result_message.value
raise exceptions.KmipOperationFailure(status, reason, message) |
@is_connected
def derive_key(self, object_type, unique_identifiers, derivation_method, derivation_parameters, **kwargs):
"\n Derive a new key or secret data from existing managed objects.\n\n Args:\n object_type (ObjectType): An ObjectType enumeration specifying\n what type of object to derive. Only SymmetricKeys and\n SecretData can be specified. Required.\n unique_identifiers (list): A list of strings specifying the\n unique IDs of the existing managed objects to use for\n derivation. Multiple objects can be specified to fit the\n requirements of the given derivation method. Required.\n derivation_method (DerivationMethod): A DerivationMethod\n enumeration specifying how key derivation should be done.\n Required.\n derivation_parameters (dict): A dictionary containing various\n settings for the key derivation process. See Note below.\n Required.\n **kwargs (various): A placeholder for object attributes that\n should be set on the newly derived object. Currently\n supported attributes include:\n cryptographic_algorithm (enums.CryptographicAlgorithm)\n cryptographic_length (int)\n\n Returns:\n string: The unique ID of the newly derived object.\n\n Raises:\n ClientConnectionNotOpen: if the client connection is unusable\n KmipOperationFailure: if the operation result is a failure\n TypeError: if the input arguments are invalid\n\n Notes:\n The derivation_parameters argument is a dictionary that can\n contain the following key/value pairs:\n\n Key | Value\n ---------------------------|---------------------------------------\n 'cryptographic_parameters' | A dictionary containing additional\n | cryptographic settings. See the\n | decrypt method for more information.\n 'initialization_vector' | Bytes to be used to initialize the key\n | derivation function, if needed.\n 'derivation_data' | Bytes to be used as the basis for the\n | key derivation process (e.g., the\n | bytes to be encrypted, hashed, etc).\n 'salt' | Bytes to used as a salt value for the\n | key derivation function, if needed.\n | Usually used with PBKDF2.\n 'iteration_count' | An integer defining how many\n | iterations should be used with the key\n | derivation function, if needed.\n | Usually used with PBKDF2.\n "
if (not isinstance(object_type, enums.ObjectType)):
raise TypeError('Object type must be an ObjectType enumeration.')
if (not isinstance(unique_identifiers, list)):
raise TypeError('Unique identifiers must be a list of strings.')
else:
for unique_identifier in unique_identifiers:
if (not isinstance(unique_identifier, six.string_types)):
raise TypeError('Unique identifiers must be a list of strings.')
if (not isinstance(derivation_method, enums.DerivationMethod)):
raise TypeError('Derivation method must be a DerivationMethod enumeration.')
if (not isinstance(derivation_parameters, dict)):
raise TypeError('Derivation parameters must be a dictionary.')
derivation_parameters = DerivationParameters(cryptographic_parameters=self._build_cryptographic_parameters(derivation_parameters.get('cryptographic_parameters')), initialization_vector=derivation_parameters.get('initialization_vector'), derivation_data=derivation_parameters.get('derivation_data'), salt=derivation_parameters.get('salt'), iteration_count=derivation_parameters.get('iteration_count'))
attributes = []
if kwargs.get('cryptographic_length'):
attributes.append(self.attribute_factory.create_attribute(enums.AttributeType.CRYPTOGRAPHIC_LENGTH, kwargs.get('cryptographic_length')))
if kwargs.get('cryptographic_algorithm'):
attributes.append(self.attribute_factory.create_attribute(enums.AttributeType.CRYPTOGRAPHIC_ALGORITHM, kwargs.get('cryptographic_algorithm')))
template_attribute = cobjects.TemplateAttribute(attributes=attributes)
result = self.proxy.derive_key(object_type, unique_identifiers, derivation_method, derivation_parameters, template_attribute)
status = result.get('result_status')
if (status == enums.ResultStatus.SUCCESS):
return result.get('unique_identifier')
else:
raise exceptions.KmipOperationFailure(status, result.get('result_reason'), result.get('result_message')) | 170,984,117,655,668,960 | Derive a new key or secret data from existing managed objects.
Args:
object_type (ObjectType): An ObjectType enumeration specifying
what type of object to derive. Only SymmetricKeys and
SecretData can be specified. Required.
unique_identifiers (list): A list of strings specifying the
unique IDs of the existing managed objects to use for
derivation. Multiple objects can be specified to fit the
requirements of the given derivation method. Required.
derivation_method (DerivationMethod): A DerivationMethod
enumeration specifying how key derivation should be done.
Required.
derivation_parameters (dict): A dictionary containing various
settings for the key derivation process. See Note below.
Required.
**kwargs (various): A placeholder for object attributes that
should be set on the newly derived object. Currently
supported attributes include:
cryptographic_algorithm (enums.CryptographicAlgorithm)
cryptographic_length (int)
Returns:
string: The unique ID of the newly derived object.
Raises:
ClientConnectionNotOpen: if the client connection is unusable
KmipOperationFailure: if the operation result is a failure
TypeError: if the input arguments are invalid
Notes:
The derivation_parameters argument is a dictionary that can
contain the following key/value pairs:
Key | Value
---------------------------|---------------------------------------
'cryptographic_parameters' | A dictionary containing additional
| cryptographic settings. See the
| decrypt method for more information.
'initialization_vector' | Bytes to be used to initialize the key
| derivation function, if needed.
'derivation_data' | Bytes to be used as the basis for the
| key derivation process (e.g., the
| bytes to be encrypted, hashed, etc).
'salt' | Bytes to used as a salt value for the
| key derivation function, if needed.
| Usually used with PBKDF2.
'iteration_count' | An integer defining how many
| iterations should be used with the key
| derivation function, if needed.
| Usually used with PBKDF2. | kmip/pie/client.py | derive_key | eniltonj/PyKMIP | python | @is_connected
def derive_key(self, object_type, unique_identifiers, derivation_method, derivation_parameters, **kwargs):
"\n Derive a new key or secret data from existing managed objects.\n\n Args:\n object_type (ObjectType): An ObjectType enumeration specifying\n what type of object to derive. Only SymmetricKeys and\n SecretData can be specified. Required.\n unique_identifiers (list): A list of strings specifying the\n unique IDs of the existing managed objects to use for\n derivation. Multiple objects can be specified to fit the\n requirements of the given derivation method. Required.\n derivation_method (DerivationMethod): A DerivationMethod\n enumeration specifying how key derivation should be done.\n Required.\n derivation_parameters (dict): A dictionary containing various\n settings for the key derivation process. See Note below.\n Required.\n **kwargs (various): A placeholder for object attributes that\n should be set on the newly derived object. Currently\n supported attributes include:\n cryptographic_algorithm (enums.CryptographicAlgorithm)\n cryptographic_length (int)\n\n Returns:\n string: The unique ID of the newly derived object.\n\n Raises:\n ClientConnectionNotOpen: if the client connection is unusable\n KmipOperationFailure: if the operation result is a failure\n TypeError: if the input arguments are invalid\n\n Notes:\n The derivation_parameters argument is a dictionary that can\n contain the following key/value pairs:\n\n Key | Value\n ---------------------------|---------------------------------------\n 'cryptographic_parameters' | A dictionary containing additional\n | cryptographic settings. See the\n | decrypt method for more information.\n 'initialization_vector' | Bytes to be used to initialize the key\n | derivation function, if needed.\n 'derivation_data' | Bytes to be used as the basis for the\n | key derivation process (e.g., the\n | bytes to be encrypted, hashed, etc).\n 'salt' | Bytes to used as a salt value for the\n | key derivation function, if needed.\n | Usually used with PBKDF2.\n 'iteration_count' | An integer defining how many\n | iterations should be used with the key\n | derivation function, if needed.\n | Usually used with PBKDF2.\n "
if (not isinstance(object_type, enums.ObjectType)):
raise TypeError('Object type must be an ObjectType enumeration.')
if (not isinstance(unique_identifiers, list)):
raise TypeError('Unique identifiers must be a list of strings.')
else:
for unique_identifier in unique_identifiers:
if (not isinstance(unique_identifier, six.string_types)):
raise TypeError('Unique identifiers must be a list of strings.')
if (not isinstance(derivation_method, enums.DerivationMethod)):
raise TypeError('Derivation method must be a DerivationMethod enumeration.')
if (not isinstance(derivation_parameters, dict)):
raise TypeError('Derivation parameters must be a dictionary.')
derivation_parameters = DerivationParameters(cryptographic_parameters=self._build_cryptographic_parameters(derivation_parameters.get('cryptographic_parameters')), initialization_vector=derivation_parameters.get('initialization_vector'), derivation_data=derivation_parameters.get('derivation_data'), salt=derivation_parameters.get('salt'), iteration_count=derivation_parameters.get('iteration_count'))
attributes = []
if kwargs.get('cryptographic_length'):
attributes.append(self.attribute_factory.create_attribute(enums.AttributeType.CRYPTOGRAPHIC_LENGTH, kwargs.get('cryptographic_length')))
if kwargs.get('cryptographic_algorithm'):
attributes.append(self.attribute_factory.create_attribute(enums.AttributeType.CRYPTOGRAPHIC_ALGORITHM, kwargs.get('cryptographic_algorithm')))
template_attribute = cobjects.TemplateAttribute(attributes=attributes)
result = self.proxy.derive_key(object_type, unique_identifiers, derivation_method, derivation_parameters, template_attribute)
status = result.get('result_status')
if (status == enums.ResultStatus.SUCCESS):
return result.get('unique_identifier')
else:
raise exceptions.KmipOperationFailure(status, result.get('result_reason'), result.get('result_message')) |
@is_connected
def locate(self, maximum_items=None, storage_status_mask=None, object_group_member=None, attributes=None):
'\n Search for managed objects, depending on the attributes specified in\n the request.\n\n Args:\n maximum_items (integer): Maximum number of object identifiers the\n server MAY return.\n storage_status_mask (integer): A bit mask that indicates whether\n on-line or archived objects are to be searched.\n object_group_member (ObjectGroupMember): An enumeration that\n indicates the object group member type.\n attributes (list): Attributes the are REQUIRED to match those in a\n candidate object.\n\n Returns:\n list: The Unique Identifiers of the located objects\n\n Raises:\n ClientConnectionNotOpen: if the client connection is unusable\n KmipOperationFailure: if the operation result is a failure\n TypeError: if the input arguments are invalid\n '
if (maximum_items is not None):
if (not isinstance(maximum_items, six.integer_types)):
raise TypeError('maximum_items must be an integer')
if (storage_status_mask is not None):
if (not isinstance(storage_status_mask, six.integer_types)):
raise TypeError('storage_status_mask must be an integer')
if (object_group_member is not None):
if (not isinstance(object_group_member, enums.ObjectGroupMember)):
raise TypeError('object_group_member must be a ObjectGroupMemberenumeration')
if (attributes is not None):
if ((not isinstance(attributes, list)) or (all((isinstance(item, cobjects.Attribute) for item in attributes)) is False)):
raise TypeError('attributes must be a list of attributes')
result = self.proxy.locate(maximum_items, storage_status_mask, object_group_member, attributes)
status = result.result_status.value
if (status == enums.ResultStatus.SUCCESS):
uids = [uuid.value for uuid in result.uuids]
return uids
else:
reason = result.result_reason.value
message = result.result_message.value
raise exceptions.KmipOperationFailure(status, reason, message) | -6,395,868,063,487,537,000 | Search for managed objects, depending on the attributes specified in
the request.
Args:
maximum_items (integer): Maximum number of object identifiers the
server MAY return.
storage_status_mask (integer): A bit mask that indicates whether
on-line or archived objects are to be searched.
object_group_member (ObjectGroupMember): An enumeration that
indicates the object group member type.
attributes (list): Attributes the are REQUIRED to match those in a
candidate object.
Returns:
list: The Unique Identifiers of the located objects
Raises:
ClientConnectionNotOpen: if the client connection is unusable
KmipOperationFailure: if the operation result is a failure
TypeError: if the input arguments are invalid | kmip/pie/client.py | locate | eniltonj/PyKMIP | python | @is_connected
def locate(self, maximum_items=None, storage_status_mask=None, object_group_member=None, attributes=None):
'\n Search for managed objects, depending on the attributes specified in\n the request.\n\n Args:\n maximum_items (integer): Maximum number of object identifiers the\n server MAY return.\n storage_status_mask (integer): A bit mask that indicates whether\n on-line or archived objects are to be searched.\n object_group_member (ObjectGroupMember): An enumeration that\n indicates the object group member type.\n attributes (list): Attributes the are REQUIRED to match those in a\n candidate object.\n\n Returns:\n list: The Unique Identifiers of the located objects\n\n Raises:\n ClientConnectionNotOpen: if the client connection is unusable\n KmipOperationFailure: if the operation result is a failure\n TypeError: if the input arguments are invalid\n '
if (maximum_items is not None):
if (not isinstance(maximum_items, six.integer_types)):
raise TypeError('maximum_items must be an integer')
if (storage_status_mask is not None):
if (not isinstance(storage_status_mask, six.integer_types)):
raise TypeError('storage_status_mask must be an integer')
if (object_group_member is not None):
if (not isinstance(object_group_member, enums.ObjectGroupMember)):
raise TypeError('object_group_member must be a ObjectGroupMemberenumeration')
if (attributes is not None):
if ((not isinstance(attributes, list)) or (all((isinstance(item, cobjects.Attribute) for item in attributes)) is False)):
raise TypeError('attributes must be a list of attributes')
result = self.proxy.locate(maximum_items, storage_status_mask, object_group_member, attributes)
status = result.result_status.value
if (status == enums.ResultStatus.SUCCESS):
uids = [uuid.value for uuid in result.uuids]
return uids
else:
reason = result.result_reason.value
message = result.result_message.value
raise exceptions.KmipOperationFailure(status, reason, message) |
@is_connected
def get(self, uid=None, key_wrapping_specification=None):
"\n Get a managed object from a KMIP appliance.\n\n Args:\n uid (string): The unique ID of the managed object to retrieve.\n key_wrapping_specification (dict): A dictionary containing various\n settings to be used when wrapping the key during retrieval.\n See Note below. Optional, defaults to None.\n\n Returns:\n ManagedObject: The retrieved managed object object.\n\n Raises:\n ClientConnectionNotOpen: if the client connection is unusable\n KmipOperationFailure: if the operation result is a failure\n TypeError: if the input argument is invalid\n\n Notes:\n The derivation_parameters argument is a dictionary that can\n contain the following key/value pairs:\n\n Key | Value\n --------------------------------|---------------------------------\n 'wrapping_method' | A WrappingMethod enumeration\n | that specifies how the object\n | should be wrapped.\n 'encryption_key_information' | A dictionary containing the ID\n | of the wrapping key and\n | associated cryptographic\n | parameters.\n 'mac_signature_key_information' | A dictionary containing the ID\n | of the wrapping key and\n | associated cryptographic\n | parameters.\n 'attribute_names' | A list of strings representing\n | the names of attributes that\n | should be included with the\n | wrapped object.\n 'encoding_option' | An EncodingOption enumeration\n | that specifies the encoding of\n | the object before it is wrapped.\n "
if (uid is not None):
if (not isinstance(uid, six.string_types)):
raise TypeError('uid must be a string')
if (key_wrapping_specification is not None):
if (not isinstance(key_wrapping_specification, dict)):
raise TypeError('Key wrapping specification must be a dictionary.')
spec = self._build_key_wrapping_specification(key_wrapping_specification)
result = self.proxy.get(uid, key_wrapping_specification=spec)
status = result.result_status.value
if (status == enums.ResultStatus.SUCCESS):
managed_object = self.object_factory.convert(result.secret)
return managed_object
else:
reason = result.result_reason.value
message = result.result_message.value
raise exceptions.KmipOperationFailure(status, reason, message) | -7,047,877,112,567,075,000 | Get a managed object from a KMIP appliance.
Args:
uid (string): The unique ID of the managed object to retrieve.
key_wrapping_specification (dict): A dictionary containing various
settings to be used when wrapping the key during retrieval.
See Note below. Optional, defaults to None.
Returns:
ManagedObject: The retrieved managed object object.
Raises:
ClientConnectionNotOpen: if the client connection is unusable
KmipOperationFailure: if the operation result is a failure
TypeError: if the input argument is invalid
Notes:
The derivation_parameters argument is a dictionary that can
contain the following key/value pairs:
Key | Value
--------------------------------|---------------------------------
'wrapping_method' | A WrappingMethod enumeration
| that specifies how the object
| should be wrapped.
'encryption_key_information' | A dictionary containing the ID
| of the wrapping key and
| associated cryptographic
| parameters.
'mac_signature_key_information' | A dictionary containing the ID
| of the wrapping key and
| associated cryptographic
| parameters.
'attribute_names' | A list of strings representing
| the names of attributes that
| should be included with the
| wrapped object.
'encoding_option' | An EncodingOption enumeration
| that specifies the encoding of
| the object before it is wrapped. | kmip/pie/client.py | get | eniltonj/PyKMIP | python | @is_connected
def get(self, uid=None, key_wrapping_specification=None):
"\n Get a managed object from a KMIP appliance.\n\n Args:\n uid (string): The unique ID of the managed object to retrieve.\n key_wrapping_specification (dict): A dictionary containing various\n settings to be used when wrapping the key during retrieval.\n See Note below. Optional, defaults to None.\n\n Returns:\n ManagedObject: The retrieved managed object object.\n\n Raises:\n ClientConnectionNotOpen: if the client connection is unusable\n KmipOperationFailure: if the operation result is a failure\n TypeError: if the input argument is invalid\n\n Notes:\n The derivation_parameters argument is a dictionary that can\n contain the following key/value pairs:\n\n Key | Value\n --------------------------------|---------------------------------\n 'wrapping_method' | A WrappingMethod enumeration\n | that specifies how the object\n | should be wrapped.\n 'encryption_key_information' | A dictionary containing the ID\n | of the wrapping key and\n | associated cryptographic\n | parameters.\n 'mac_signature_key_information' | A dictionary containing the ID\n | of the wrapping key and\n | associated cryptographic\n | parameters.\n 'attribute_names' | A list of strings representing\n | the names of attributes that\n | should be included with the\n | wrapped object.\n 'encoding_option' | An EncodingOption enumeration\n | that specifies the encoding of\n | the object before it is wrapped.\n "
if (uid is not None):
if (not isinstance(uid, six.string_types)):
raise TypeError('uid must be a string')
if (key_wrapping_specification is not None):
if (not isinstance(key_wrapping_specification, dict)):
raise TypeError('Key wrapping specification must be a dictionary.')
spec = self._build_key_wrapping_specification(key_wrapping_specification)
result = self.proxy.get(uid, key_wrapping_specification=spec)
status = result.result_status.value
if (status == enums.ResultStatus.SUCCESS):
managed_object = self.object_factory.convert(result.secret)
return managed_object
else:
reason = result.result_reason.value
message = result.result_message.value
raise exceptions.KmipOperationFailure(status, reason, message) |
@is_connected
def get_attributes(self, uid=None, attribute_names=None):
'\n Get the attributes associated with a managed object.\n\n If the uid is not specified, the appliance will use the ID placeholder\n by default.\n\n If the attribute_names list is not specified, the appliance will\n return all viable attributes for the managed object.\n\n Args:\n uid (string): The unique ID of the managed object with which the\n retrieved attributes should be associated. Optional, defaults\n to None.\n attribute_names (list): A list of string attribute names\n indicating which attributes should be retrieved. Optional,\n defaults to None.\n '
if (uid is not None):
if (not isinstance(uid, six.string_types)):
raise TypeError('uid must be a string')
if (attribute_names is not None):
if (not isinstance(attribute_names, list)):
raise TypeError('attribute_names must be a list of strings')
else:
for attribute_name in attribute_names:
if (not isinstance(attribute_name, six.string_types)):
raise TypeError('attribute_names must be a list of strings')
result = self.proxy.get_attributes(uid, attribute_names)
status = result.result_status.value
if (status == enums.ResultStatus.SUCCESS):
return (result.uuid, result.attributes)
else:
reason = result.result_reason.value
message = result.result_message.value
raise exceptions.KmipOperationFailure(status, reason, message) | -3,033,190,417,900,958,700 | Get the attributes associated with a managed object.
If the uid is not specified, the appliance will use the ID placeholder
by default.
If the attribute_names list is not specified, the appliance will
return all viable attributes for the managed object.
Args:
uid (string): The unique ID of the managed object with which the
retrieved attributes should be associated. Optional, defaults
to None.
attribute_names (list): A list of string attribute names
indicating which attributes should be retrieved. Optional,
defaults to None. | kmip/pie/client.py | get_attributes | eniltonj/PyKMIP | python | @is_connected
def get_attributes(self, uid=None, attribute_names=None):
'\n Get the attributes associated with a managed object.\n\n If the uid is not specified, the appliance will use the ID placeholder\n by default.\n\n If the attribute_names list is not specified, the appliance will\n return all viable attributes for the managed object.\n\n Args:\n uid (string): The unique ID of the managed object with which the\n retrieved attributes should be associated. Optional, defaults\n to None.\n attribute_names (list): A list of string attribute names\n indicating which attributes should be retrieved. Optional,\n defaults to None.\n '
if (uid is not None):
if (not isinstance(uid, six.string_types)):
raise TypeError('uid must be a string')
if (attribute_names is not None):
if (not isinstance(attribute_names, list)):
raise TypeError('attribute_names must be a list of strings')
else:
for attribute_name in attribute_names:
if (not isinstance(attribute_name, six.string_types)):
raise TypeError('attribute_names must be a list of strings')
result = self.proxy.get_attributes(uid, attribute_names)
status = result.result_status.value
if (status == enums.ResultStatus.SUCCESS):
return (result.uuid, result.attributes)
else:
reason = result.result_reason.value
message = result.result_message.value
raise exceptions.KmipOperationFailure(status, reason, message) |
@is_connected
def get_attribute_list(self, uid=None):
'\n Get the names of the attributes associated with a managed object.\n\n If the uid is not specified, the appliance will use the ID placeholder\n by default.\n\n Args:\n uid (string): The unique ID of the managed object with which the\n retrieved attribute names should be associated. Optional,\n defaults to None.\n '
if (uid is not None):
if (not isinstance(uid, six.string_types)):
raise TypeError('uid must be a string')
result = self.proxy.get_attribute_list(uid)
status = result.result_status.value
if (status == enums.ResultStatus.SUCCESS):
attribute_names = sorted(result.names)
return attribute_names
else:
reason = result.result_reason.value
message = result.result_message.value
raise exceptions.KmipOperationFailure(status, reason, message) | 7,626,496,395,859,217,000 | Get the names of the attributes associated with a managed object.
If the uid is not specified, the appliance will use the ID placeholder
by default.
Args:
uid (string): The unique ID of the managed object with which the
retrieved attribute names should be associated. Optional,
defaults to None. | kmip/pie/client.py | get_attribute_list | eniltonj/PyKMIP | python | @is_connected
def get_attribute_list(self, uid=None):
'\n Get the names of the attributes associated with a managed object.\n\n If the uid is not specified, the appliance will use the ID placeholder\n by default.\n\n Args:\n uid (string): The unique ID of the managed object with which the\n retrieved attribute names should be associated. Optional,\n defaults to None.\n '
if (uid is not None):
if (not isinstance(uid, six.string_types)):
raise TypeError('uid must be a string')
result = self.proxy.get_attribute_list(uid)
status = result.result_status.value
if (status == enums.ResultStatus.SUCCESS):
attribute_names = sorted(result.names)
return attribute_names
else:
reason = result.result_reason.value
message = result.result_message.value
raise exceptions.KmipOperationFailure(status, reason, message) |
@is_connected
def activate(self, uid=None):
'\n Activate a managed object stored by a KMIP appliance.\n\n Args:\n uid (string): The unique ID of the managed object to activate.\n Optional, defaults to None.\n\n Returns:\n None\n\n Raises:\n ClientConnectionNotOpen: if the client connection is unusable\n KmipOperationFailure: if the operation result is a failure\n TypeError: if the input argument is invalid\n '
if (uid is not None):
if (not isinstance(uid, six.string_types)):
raise TypeError('uid must be a string')
result = self.proxy.activate(uid)
status = result.result_status.value
if (status == enums.ResultStatus.SUCCESS):
return
else:
reason = result.result_reason.value
message = result.result_message.value
raise exceptions.KmipOperationFailure(status, reason, message) | -1,231,783,864,637,755,100 | Activate a managed object stored by a KMIP appliance.
Args:
uid (string): The unique ID of the managed object to activate.
Optional, defaults to None.
Returns:
None
Raises:
ClientConnectionNotOpen: if the client connection is unusable
KmipOperationFailure: if the operation result is a failure
TypeError: if the input argument is invalid | kmip/pie/client.py | activate | eniltonj/PyKMIP | python | @is_connected
def activate(self, uid=None):
'\n Activate a managed object stored by a KMIP appliance.\n\n Args:\n uid (string): The unique ID of the managed object to activate.\n Optional, defaults to None.\n\n Returns:\n None\n\n Raises:\n ClientConnectionNotOpen: if the client connection is unusable\n KmipOperationFailure: if the operation result is a failure\n TypeError: if the input argument is invalid\n '
if (uid is not None):
if (not isinstance(uid, six.string_types)):
raise TypeError('uid must be a string')
result = self.proxy.activate(uid)
status = result.result_status.value
if (status == enums.ResultStatus.SUCCESS):
return
else:
reason = result.result_reason.value
message = result.result_message.value
raise exceptions.KmipOperationFailure(status, reason, message) |
@is_connected
def revoke(self, revocation_reason, uid=None, revocation_message=None, compromise_occurrence_date=None):
'\n Revoke a managed object stored by a KMIP appliance.\n\n Args:\n revocation_reason (RevocationReasonCode): An enumeration indicating\n the revocation reason.\n uid (string): The unique ID of the managed object to revoke.\n Optional, defaults to None.\n revocation_message (string): A message regarding the revocation.\n Optional, defaults to None.\n compromise_occurrence_date (int): An integer, the number of seconds\n since the epoch, which will be converted to the Datetime when\n the managed object was first believed to be compromised.\n Optional, defaults to None.\n\n Returns:\n None\n\n Raises:\n ClientConnectionNotOpen: if the client connection is unusable\n KmipOperationFailure: if the operation result is a failure\n TypeError: if the input argument is invalid\n '
if (not isinstance(revocation_reason, enums.RevocationReasonCode)):
raise TypeError('revocation_reason must be a RevocationReasonCode enumeration')
if (uid is not None):
if (not isinstance(uid, six.string_types)):
raise TypeError('uid must be a string')
if (revocation_message is not None):
if (not isinstance(revocation_message, six.string_types)):
raise TypeError('revocation_message must be a string')
if (compromise_occurrence_date is not None):
if (not isinstance(compromise_occurrence_date, six.integer_types)):
raise TypeError('compromise_occurrence_date must be an integer')
compromise_occurrence_date = primitives.DateTime(compromise_occurrence_date, enums.Tags.COMPROMISE_OCCURRENCE_DATE)
result = self.proxy.revoke(revocation_reason, uid, revocation_message, compromise_occurrence_date)
status = result.result_status.value
if (status == enums.ResultStatus.SUCCESS):
return
else:
reason = result.result_reason.value
message = result.result_message.value
raise exceptions.KmipOperationFailure(status, reason, message) | -6,414,313,652,252,729,000 | Revoke a managed object stored by a KMIP appliance.
Args:
revocation_reason (RevocationReasonCode): An enumeration indicating
the revocation reason.
uid (string): The unique ID of the managed object to revoke.
Optional, defaults to None.
revocation_message (string): A message regarding the revocation.
Optional, defaults to None.
compromise_occurrence_date (int): An integer, the number of seconds
since the epoch, which will be converted to the Datetime when
the managed object was first believed to be compromised.
Optional, defaults to None.
Returns:
None
Raises:
ClientConnectionNotOpen: if the client connection is unusable
KmipOperationFailure: if the operation result is a failure
TypeError: if the input argument is invalid | kmip/pie/client.py | revoke | eniltonj/PyKMIP | python | @is_connected
def revoke(self, revocation_reason, uid=None, revocation_message=None, compromise_occurrence_date=None):
'\n Revoke a managed object stored by a KMIP appliance.\n\n Args:\n revocation_reason (RevocationReasonCode): An enumeration indicating\n the revocation reason.\n uid (string): The unique ID of the managed object to revoke.\n Optional, defaults to None.\n revocation_message (string): A message regarding the revocation.\n Optional, defaults to None.\n compromise_occurrence_date (int): An integer, the number of seconds\n since the epoch, which will be converted to the Datetime when\n the managed object was first believed to be compromised.\n Optional, defaults to None.\n\n Returns:\n None\n\n Raises:\n ClientConnectionNotOpen: if the client connection is unusable\n KmipOperationFailure: if the operation result is a failure\n TypeError: if the input argument is invalid\n '
if (not isinstance(revocation_reason, enums.RevocationReasonCode)):
raise TypeError('revocation_reason must be a RevocationReasonCode enumeration')
if (uid is not None):
if (not isinstance(uid, six.string_types)):
raise TypeError('uid must be a string')
if (revocation_message is not None):
if (not isinstance(revocation_message, six.string_types)):
raise TypeError('revocation_message must be a string')
if (compromise_occurrence_date is not None):
if (not isinstance(compromise_occurrence_date, six.integer_types)):
raise TypeError('compromise_occurrence_date must be an integer')
compromise_occurrence_date = primitives.DateTime(compromise_occurrence_date, enums.Tags.COMPROMISE_OCCURRENCE_DATE)
result = self.proxy.revoke(revocation_reason, uid, revocation_message, compromise_occurrence_date)
status = result.result_status.value
if (status == enums.ResultStatus.SUCCESS):
return
else:
reason = result.result_reason.value
message = result.result_message.value
raise exceptions.KmipOperationFailure(status, reason, message) |
@is_connected
def destroy(self, uid=None):
'\n Destroy a managed object stored by a KMIP appliance.\n\n Args:\n uid (string): The unique ID of the managed object to destroy.\n\n Returns:\n None\n\n Raises:\n ClientConnectionNotOpen: if the client connection is unusable\n KmipOperationFailure: if the operation result is a failure\n TypeError: if the input argument is invalid\n '
if (uid is not None):
if (not isinstance(uid, six.string_types)):
raise TypeError('uid must be a string')
result = self.proxy.destroy(uid)
status = result.result_status.value
if (status == enums.ResultStatus.SUCCESS):
return
else:
reason = result.result_reason.value
message = result.result_message.value
raise exceptions.KmipOperationFailure(status, reason, message) | 7,172,419,791,563,416,000 | Destroy a managed object stored by a KMIP appliance.
Args:
uid (string): The unique ID of the managed object to destroy.
Returns:
None
Raises:
ClientConnectionNotOpen: if the client connection is unusable
KmipOperationFailure: if the operation result is a failure
TypeError: if the input argument is invalid | kmip/pie/client.py | destroy | eniltonj/PyKMIP | python | @is_connected
def destroy(self, uid=None):
'\n Destroy a managed object stored by a KMIP appliance.\n\n Args:\n uid (string): The unique ID of the managed object to destroy.\n\n Returns:\n None\n\n Raises:\n ClientConnectionNotOpen: if the client connection is unusable\n KmipOperationFailure: if the operation result is a failure\n TypeError: if the input argument is invalid\n '
if (uid is not None):
if (not isinstance(uid, six.string_types)):
raise TypeError('uid must be a string')
result = self.proxy.destroy(uid)
status = result.result_status.value
if (status == enums.ResultStatus.SUCCESS):
return
else:
reason = result.result_reason.value
message = result.result_message.value
raise exceptions.KmipOperationFailure(status, reason, message) |
@is_connected
def encrypt(self, data, uid=None, cryptographic_parameters=None, iv_counter_nonce=None):
"\n Encrypt data using the specified encryption key and parameters.\n\n Args:\n data (bytes): The bytes to encrypt. Required.\n uid (string): The unique ID of the encryption key to use.\n Optional, defaults to None.\n cryptographic_parameters (dict): A dictionary containing various\n cryptographic settings to be used for the encryption.\n Optional, defaults to None.\n iv_counter_nonce (bytes): The bytes to use for the IV/counter/\n nonce, if needed by the encryption algorithm and/or cipher\n mode. Optional, defaults to None.\n\n Returns:\n bytes: The encrypted data.\n bytes: The IV/counter/nonce used with the encryption algorithm,\n only if it was autogenerated by the server.\n\n Raises:\n ClientConnectionNotOpen: if the client connection is unusable\n KmipOperationFailure: if the operation result is a failure\n TypeError: if the input arguments are invalid\n\n Notes:\n The cryptographic_parameters argument is a dictionary that can\n contain the following key/value pairs:\n\n Keys | Value\n ------------------------------|-----------------------------------\n 'block_cipher_mode' | A BlockCipherMode enumeration\n | indicating the cipher mode to use\n | with the encryption algorithm.\n 'padding_method' | A PaddingMethod enumeration\n | indicating which padding method to\n | use with the encryption algorithm.\n 'hashing_algorithm' | A HashingAlgorithm enumeration\n | indicating which hashing algorithm\n | to use.\n 'key_role_type' | A KeyRoleType enumeration\n | indicating the intended use of the\n | associated cryptographic key.\n 'digital_signature_algorithm' | A DigitalSignatureAlgorithm\n | enumeration indicating which\n | digital signature algorithm to\n | use.\n 'cryptographic_algorithm' | A CryptographicAlgorithm\n | enumeration indicating which\n | encryption algorithm to use.\n 'random_iv' | A boolean indicating whether the\n | server should autogenerate an IV.\n 'iv_length' | An integer representing the length\n | of the initialization vector (IV)\n | in bits.\n 'tag_length' | An integer representing the length\n | of the authenticator tag in bytes.\n 'fixed_field_length' | An integer representing the length\n | of the fixed field portion of the\n | IV in bits.\n 'invocation_field_length' | An integer representing the length\n | of the invocation field portion of\n | the IV in bits.\n 'counter_length' | An integer representing the length\n | of the coutner portion of the IV\n | in bits.\n 'initial_counter_value' | An integer representing the\n | starting counter value for CTR\n | mode (typically 1).\n "
if (not isinstance(data, six.binary_type)):
raise TypeError('data must be bytes')
if (uid is not None):
if (not isinstance(uid, six.string_types)):
raise TypeError('uid must be a string')
if (cryptographic_parameters is not None):
if (not isinstance(cryptographic_parameters, dict)):
raise TypeError('cryptographic_parameters must be a dict')
if (iv_counter_nonce is not None):
if (not isinstance(iv_counter_nonce, six.binary_type)):
raise TypeError('iv_counter_nonce must be bytes')
cryptographic_parameters = self._build_cryptographic_parameters(cryptographic_parameters)
result = self.proxy.encrypt(data, uid, cryptographic_parameters, iv_counter_nonce)
status = result.get('result_status')
if (status == enums.ResultStatus.SUCCESS):
return (result.get('data'), result.get('iv_counter_nonce'))
else:
raise exceptions.KmipOperationFailure(status, result.get('result_reason'), result.get('result_message')) | 8,079,006,038,061,169,000 | Encrypt data using the specified encryption key and parameters.
Args:
data (bytes): The bytes to encrypt. Required.
uid (string): The unique ID of the encryption key to use.
Optional, defaults to None.
cryptographic_parameters (dict): A dictionary containing various
cryptographic settings to be used for the encryption.
Optional, defaults to None.
iv_counter_nonce (bytes): The bytes to use for the IV/counter/
nonce, if needed by the encryption algorithm and/or cipher
mode. Optional, defaults to None.
Returns:
bytes: The encrypted data.
bytes: The IV/counter/nonce used with the encryption algorithm,
only if it was autogenerated by the server.
Raises:
ClientConnectionNotOpen: if the client connection is unusable
KmipOperationFailure: if the operation result is a failure
TypeError: if the input arguments are invalid
Notes:
The cryptographic_parameters argument is a dictionary that can
contain the following key/value pairs:
Keys | Value
------------------------------|-----------------------------------
'block_cipher_mode' | A BlockCipherMode enumeration
| indicating the cipher mode to use
| with the encryption algorithm.
'padding_method' | A PaddingMethod enumeration
| indicating which padding method to
| use with the encryption algorithm.
'hashing_algorithm' | A HashingAlgorithm enumeration
| indicating which hashing algorithm
| to use.
'key_role_type' | A KeyRoleType enumeration
| indicating the intended use of the
| associated cryptographic key.
'digital_signature_algorithm' | A DigitalSignatureAlgorithm
| enumeration indicating which
| digital signature algorithm to
| use.
'cryptographic_algorithm' | A CryptographicAlgorithm
| enumeration indicating which
| encryption algorithm to use.
'random_iv' | A boolean indicating whether the
| server should autogenerate an IV.
'iv_length' | An integer representing the length
| of the initialization vector (IV)
| in bits.
'tag_length' | An integer representing the length
| of the authenticator tag in bytes.
'fixed_field_length' | An integer representing the length
| of the fixed field portion of the
| IV in bits.
'invocation_field_length' | An integer representing the length
| of the invocation field portion of
| the IV in bits.
'counter_length' | An integer representing the length
| of the coutner portion of the IV
| in bits.
'initial_counter_value' | An integer representing the
| starting counter value for CTR
| mode (typically 1). | kmip/pie/client.py | encrypt | eniltonj/PyKMIP | python | @is_connected
def encrypt(self, data, uid=None, cryptographic_parameters=None, iv_counter_nonce=None):
"\n Encrypt data using the specified encryption key and parameters.\n\n Args:\n data (bytes): The bytes to encrypt. Required.\n uid (string): The unique ID of the encryption key to use.\n Optional, defaults to None.\n cryptographic_parameters (dict): A dictionary containing various\n cryptographic settings to be used for the encryption.\n Optional, defaults to None.\n iv_counter_nonce (bytes): The bytes to use for the IV/counter/\n nonce, if needed by the encryption algorithm and/or cipher\n mode. Optional, defaults to None.\n\n Returns:\n bytes: The encrypted data.\n bytes: The IV/counter/nonce used with the encryption algorithm,\n only if it was autogenerated by the server.\n\n Raises:\n ClientConnectionNotOpen: if the client connection is unusable\n KmipOperationFailure: if the operation result is a failure\n TypeError: if the input arguments are invalid\n\n Notes:\n The cryptographic_parameters argument is a dictionary that can\n contain the following key/value pairs:\n\n Keys | Value\n ------------------------------|-----------------------------------\n 'block_cipher_mode' | A BlockCipherMode enumeration\n | indicating the cipher mode to use\n | with the encryption algorithm.\n 'padding_method' | A PaddingMethod enumeration\n | indicating which padding method to\n | use with the encryption algorithm.\n 'hashing_algorithm' | A HashingAlgorithm enumeration\n | indicating which hashing algorithm\n | to use.\n 'key_role_type' | A KeyRoleType enumeration\n | indicating the intended use of the\n | associated cryptographic key.\n 'digital_signature_algorithm' | A DigitalSignatureAlgorithm\n | enumeration indicating which\n | digital signature algorithm to\n | use.\n 'cryptographic_algorithm' | A CryptographicAlgorithm\n | enumeration indicating which\n | encryption algorithm to use.\n 'random_iv' | A boolean indicating whether the\n | server should autogenerate an IV.\n 'iv_length' | An integer representing the length\n | of the initialization vector (IV)\n | in bits.\n 'tag_length' | An integer representing the length\n | of the authenticator tag in bytes.\n 'fixed_field_length' | An integer representing the length\n | of the fixed field portion of the\n | IV in bits.\n 'invocation_field_length' | An integer representing the length\n | of the invocation field portion of\n | the IV in bits.\n 'counter_length' | An integer representing the length\n | of the coutner portion of the IV\n | in bits.\n 'initial_counter_value' | An integer representing the\n | starting counter value for CTR\n | mode (typically 1).\n "
if (not isinstance(data, six.binary_type)):
raise TypeError('data must be bytes')
if (uid is not None):
if (not isinstance(uid, six.string_types)):
raise TypeError('uid must be a string')
if (cryptographic_parameters is not None):
if (not isinstance(cryptographic_parameters, dict)):
raise TypeError('cryptographic_parameters must be a dict')
if (iv_counter_nonce is not None):
if (not isinstance(iv_counter_nonce, six.binary_type)):
raise TypeError('iv_counter_nonce must be bytes')
cryptographic_parameters = self._build_cryptographic_parameters(cryptographic_parameters)
result = self.proxy.encrypt(data, uid, cryptographic_parameters, iv_counter_nonce)
status = result.get('result_status')
if (status == enums.ResultStatus.SUCCESS):
return (result.get('data'), result.get('iv_counter_nonce'))
else:
raise exceptions.KmipOperationFailure(status, result.get('result_reason'), result.get('result_message')) |
@is_connected
def decrypt(self, data, uid=None, cryptographic_parameters=None, iv_counter_nonce=None):
"\n Decrypt data using the specified decryption key and parameters.\n\n Args:\n data (bytes): The bytes to decrypt. Required.\n uid (string): The unique ID of the decryption key to use.\n Optional, defaults to None.\n cryptographic_parameters (dict): A dictionary containing various\n cryptographic settings to be used for the decryption.\n Optional, defaults to None.\n iv_counter_nonce (bytes): The bytes to use for the IV/counter/\n nonce, if needed by the decryption algorithm and/or cipher\n mode. Optional, defaults to None.\n\n Returns:\n bytes: The decrypted data.\n\n Raises:\n ClientConnectionNotOpen: if the client connection is unusable\n KmipOperationFailure: if the operation result is a failure\n TypeError: if the input arguments are invalid\n\n Notes:\n The cryptographic_parameters argument is a dictionary that can\n contain the following key/value pairs:\n\n Keys | Value\n ------------------------------|-----------------------------------\n 'block_cipher_mode' | A BlockCipherMode enumeration\n | indicating the cipher mode to use\n | with the decryption algorithm.\n 'padding_method' | A PaddingMethod enumeration\n | indicating which padding method to\n | use with the decryption algorithm.\n 'hashing_algorithm' | A HashingAlgorithm enumeration\n | indicating which hashing algorithm\n | to use.\n 'key_role_type' | A KeyRoleType enumeration\n | indicating the intended use of the\n | associated cryptographic key.\n 'digital_signature_algorithm' | A DigitalSignatureAlgorithm\n | enumeration indicating which\n | digital signature algorithm to\n | use.\n 'cryptographic_algorithm' | A CryptographicAlgorithm\n | enumeration indicating which\n | decryption algorithm to use.\n 'random_iv' | A boolean indicating whether the\n | server should autogenerate an IV.\n 'iv_length' | An integer representing the length\n | of the initialization vector (IV)\n | in bits.\n 'tag_length' | An integer representing the length\n | of the authenticator tag in bytes.\n 'fixed_field_length' | An integer representing the length\n | of the fixed field portion of the\n | IV in bits.\n 'invocation_field_length' | An integer representing the length\n | of the invocation field portion of\n | the IV in bits.\n 'counter_length' | An integer representing the length\n | of the counter portion of the IV\n | in bits.\n 'initial_counter_value' | An integer representing the\n | starting counter value for CTR\n | mode (typically 1).\n "
if (not isinstance(data, six.binary_type)):
raise TypeError('data must be bytes')
if (uid is not None):
if (not isinstance(uid, six.string_types)):
raise TypeError('uid must be a string')
if (cryptographic_parameters is not None):
if (not isinstance(cryptographic_parameters, dict)):
raise TypeError('cryptographic_parameters must be a dict')
if (iv_counter_nonce is not None):
if (not isinstance(iv_counter_nonce, six.binary_type)):
raise TypeError('iv_counter_nonce must be bytes')
cryptographic_parameters = self._build_cryptographic_parameters(cryptographic_parameters)
result = self.proxy.decrypt(data, uid, cryptographic_parameters, iv_counter_nonce)
status = result.get('result_status')
if (status == enums.ResultStatus.SUCCESS):
return result.get('data')
else:
raise exceptions.KmipOperationFailure(status, result.get('result_reason'), result.get('result_message')) | -9,105,479,562,208,374,000 | Decrypt data using the specified decryption key and parameters.
Args:
data (bytes): The bytes to decrypt. Required.
uid (string): The unique ID of the decryption key to use.
Optional, defaults to None.
cryptographic_parameters (dict): A dictionary containing various
cryptographic settings to be used for the decryption.
Optional, defaults to None.
iv_counter_nonce (bytes): The bytes to use for the IV/counter/
nonce, if needed by the decryption algorithm and/or cipher
mode. Optional, defaults to None.
Returns:
bytes: The decrypted data.
Raises:
ClientConnectionNotOpen: if the client connection is unusable
KmipOperationFailure: if the operation result is a failure
TypeError: if the input arguments are invalid
Notes:
The cryptographic_parameters argument is a dictionary that can
contain the following key/value pairs:
Keys | Value
------------------------------|-----------------------------------
'block_cipher_mode' | A BlockCipherMode enumeration
| indicating the cipher mode to use
| with the decryption algorithm.
'padding_method' | A PaddingMethod enumeration
| indicating which padding method to
| use with the decryption algorithm.
'hashing_algorithm' | A HashingAlgorithm enumeration
| indicating which hashing algorithm
| to use.
'key_role_type' | A KeyRoleType enumeration
| indicating the intended use of the
| associated cryptographic key.
'digital_signature_algorithm' | A DigitalSignatureAlgorithm
| enumeration indicating which
| digital signature algorithm to
| use.
'cryptographic_algorithm' | A CryptographicAlgorithm
| enumeration indicating which
| decryption algorithm to use.
'random_iv' | A boolean indicating whether the
| server should autogenerate an IV.
'iv_length' | An integer representing the length
| of the initialization vector (IV)
| in bits.
'tag_length' | An integer representing the length
| of the authenticator tag in bytes.
'fixed_field_length' | An integer representing the length
| of the fixed field portion of the
| IV in bits.
'invocation_field_length' | An integer representing the length
| of the invocation field portion of
| the IV in bits.
'counter_length' | An integer representing the length
| of the counter portion of the IV
| in bits.
'initial_counter_value' | An integer representing the
| starting counter value for CTR
| mode (typically 1). | kmip/pie/client.py | decrypt | eniltonj/PyKMIP | python | @is_connected
def decrypt(self, data, uid=None, cryptographic_parameters=None, iv_counter_nonce=None):
"\n Decrypt data using the specified decryption key and parameters.\n\n Args:\n data (bytes): The bytes to decrypt. Required.\n uid (string): The unique ID of the decryption key to use.\n Optional, defaults to None.\n cryptographic_parameters (dict): A dictionary containing various\n cryptographic settings to be used for the decryption.\n Optional, defaults to None.\n iv_counter_nonce (bytes): The bytes to use for the IV/counter/\n nonce, if needed by the decryption algorithm and/or cipher\n mode. Optional, defaults to None.\n\n Returns:\n bytes: The decrypted data.\n\n Raises:\n ClientConnectionNotOpen: if the client connection is unusable\n KmipOperationFailure: if the operation result is a failure\n TypeError: if the input arguments are invalid\n\n Notes:\n The cryptographic_parameters argument is a dictionary that can\n contain the following key/value pairs:\n\n Keys | Value\n ------------------------------|-----------------------------------\n 'block_cipher_mode' | A BlockCipherMode enumeration\n | indicating the cipher mode to use\n | with the decryption algorithm.\n 'padding_method' | A PaddingMethod enumeration\n | indicating which padding method to\n | use with the decryption algorithm.\n 'hashing_algorithm' | A HashingAlgorithm enumeration\n | indicating which hashing algorithm\n | to use.\n 'key_role_type' | A KeyRoleType enumeration\n | indicating the intended use of the\n | associated cryptographic key.\n 'digital_signature_algorithm' | A DigitalSignatureAlgorithm\n | enumeration indicating which\n | digital signature algorithm to\n | use.\n 'cryptographic_algorithm' | A CryptographicAlgorithm\n | enumeration indicating which\n | decryption algorithm to use.\n 'random_iv' | A boolean indicating whether the\n | server should autogenerate an IV.\n 'iv_length' | An integer representing the length\n | of the initialization vector (IV)\n | in bits.\n 'tag_length' | An integer representing the length\n | of the authenticator tag in bytes.\n 'fixed_field_length' | An integer representing the length\n | of the fixed field portion of the\n | IV in bits.\n 'invocation_field_length' | An integer representing the length\n | of the invocation field portion of\n | the IV in bits.\n 'counter_length' | An integer representing the length\n | of the counter portion of the IV\n | in bits.\n 'initial_counter_value' | An integer representing the\n | starting counter value for CTR\n | mode (typically 1).\n "
if (not isinstance(data, six.binary_type)):
raise TypeError('data must be bytes')
if (uid is not None):
if (not isinstance(uid, six.string_types)):
raise TypeError('uid must be a string')
if (cryptographic_parameters is not None):
if (not isinstance(cryptographic_parameters, dict)):
raise TypeError('cryptographic_parameters must be a dict')
if (iv_counter_nonce is not None):
if (not isinstance(iv_counter_nonce, six.binary_type)):
raise TypeError('iv_counter_nonce must be bytes')
cryptographic_parameters = self._build_cryptographic_parameters(cryptographic_parameters)
result = self.proxy.decrypt(data, uid, cryptographic_parameters, iv_counter_nonce)
status = result.get('result_status')
if (status == enums.ResultStatus.SUCCESS):
return result.get('data')
else:
raise exceptions.KmipOperationFailure(status, result.get('result_reason'), result.get('result_message')) |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.