text
stringlengths 0
828
|
|---|
This method makes a synchronous HTTP request by default. To make an
|
asynchronous HTTP request, please pass async=True
|
>>> thread = api.replace_states_geo_zone_by_id(states_geo_zone_id, states_geo_zone, async=True)
|
>>> result = thread.get()
|
:param async bool
|
:param str states_geo_zone_id: ID of statesGeoZone to replace (required)
|
:param StatesGeoZone states_geo_zone: Attributes of statesGeoZone to replace (required)
|
:return: StatesGeoZone
|
If the method is called asynchronously,
|
returns the request thread.
|
""""""
|
kwargs['_return_http_data_only'] = True
|
if kwargs.get('async'):
|
return cls._replace_states_geo_zone_by_id_with_http_info(states_geo_zone_id, states_geo_zone, **kwargs)
|
else:
|
(data) = cls._replace_states_geo_zone_by_id_with_http_info(states_geo_zone_id, states_geo_zone, **kwargs)
|
return data"
|
4512,"def update_states_geo_zone_by_id(cls, states_geo_zone_id, states_geo_zone, **kwargs):
|
""""""Update StatesGeoZone
|
Update attributes of StatesGeoZone
|
This method makes a synchronous HTTP request by default. To make an
|
asynchronous HTTP request, please pass async=True
|
>>> thread = api.update_states_geo_zone_by_id(states_geo_zone_id, states_geo_zone, async=True)
|
>>> result = thread.get()
|
:param async bool
|
:param str states_geo_zone_id: ID of statesGeoZone to update. (required)
|
:param StatesGeoZone states_geo_zone: Attributes of statesGeoZone to update. (required)
|
:return: StatesGeoZone
|
If the method is called asynchronously,
|
returns the request thread.
|
""""""
|
kwargs['_return_http_data_only'] = True
|
if kwargs.get('async'):
|
return cls._update_states_geo_zone_by_id_with_http_info(states_geo_zone_id, states_geo_zone, **kwargs)
|
else:
|
(data) = cls._update_states_geo_zone_by_id_with_http_info(states_geo_zone_id, states_geo_zone, **kwargs)
|
return data"
|
4513,"def compaction(self, request_compaction=False):
|
""""""Retrieve a report on, or request compaction for this instance.
|
:param bool request_compaction: A boolean indicating whether or not to request compaction.
|
""""""
|
url = self._service_url + 'compaction/'
|
if request_compaction:
|
response = requests.post(url, **self._instances._default_request_kwargs)
|
else:
|
response = requests.get(url, **self._instances._default_request_kwargs)
|
return response.json()"
|
4514,"def get_authenticated_connection(self, user, passwd, db='admin', ssl=True):
|
""""""Get an authenticated connection to this instance.
|
:param str user: The username to use for authentication.
|
:param str passwd: The password to use for authentication.
|
:param str db: The name of the database to authenticate against. Defaults to ``'Admin'``.
|
:param bool ssl: Use SSL/TLS if available for this instance. Defaults to ``True``.
|
:raises: :py:class:`pymongo.errors.OperationFailure` if authentication fails.
|
""""""
|
# Attempt to establish an authenticated connection.
|
try:
|
connection = self.get_connection(ssl=ssl)
|
connection[db].authenticate(user, passwd)
|
return connection
|
# Catch exception here for logging, then just re-raise.
|
except pymongo.errors.OperationFailure as ex:
|
logger.exception(ex)
|
raise"
|
4515,"def shards(self, add_shard=False):
|
""""""Get a list of shards belonging to this instance.
|
:param bool add_shard: A boolean indicating whether to add a new shard to the specified
|
instance.
|
""""""
|
url = self._service_url + 'shards/'
|
if add_shard:
|
response = requests.post(url, **self._instances._default_request_kwargs)
|
else:
|
response = requests.get(url, **self._instances._default_request_kwargs)
|
return response.json()"
|
4516,"def new_relic_stats(self):
|
""""""
|
Get stats for this instance.
|
""""""
|
if self._new_relic_stats is None:
|
# if this is a sharded instance, fetch shard stats in parallel
|
if self.type == 'mongodb_sharded':
|
shards = [Shard(self.name, self._service_url + 'shards/',
|
self._client, shard_doc)
|
for shard_doc in self.shards().get('data')]
|
fs = []
|
with futures.ThreadPoolExecutor(len(shards)) as executor:
|
for shard in shards:
|
fs.append(executor.submit(shard.get_shard_stats))
|
futures.wait(fs, timeout=None, return_when=futures.ALL_COMPLETED)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.