.. versionadded:: 2015.8.0

    Get Operation Status, based on a request ID

    CLI Example:

    .. code-block:: bash

        salt-cloud -f get_operation_status my-azure id=0123456789abcdef0123456789abcdef
7905
def get_operation_status(kwargs=None, conn=None, call=None):
    '''
    
    '''
    if call != 'function':
        raise SaltCloudSystemExit(
            'The show_instance function must be called with -f or --function.'
        )

    if kwargs is None:
        kwargs = {}

    if 'id' not in kwargs:
        raise SaltCloudSystemExit('A request ID must be specified as "id"')

    if not conn:
        conn = get_conn()

    data = conn.get_operation_status(kwargs['id'])
    ret = {
        'http_status_code': data.http_status_code,
        'id': kwargs['id'],
        'status': data.status
    }
    if hasattr(data.error, 'code'):
        ret['error'] = {
            'code': data.error.code,
            'message': data.error.message,
        }

    return ret
1167897
def rpc_get_blockstack_ops_at(self, block_id, offset, count, **con_info):
        
        if not check_block(block_id):
            return {'error': 'Invalid block height', 'http_status': 400}

        if not check_offset(offset):
            return {'error': 'Invalid offset', 'http_status': 400}

        if not check_count(count, 10):
            return {'error': 'Invalid count', 'http_status': 400}

        db = get_db_state(self.working_dir)
        nameops = db.get_all_blockstack_ops_at(block_id, offset=offset, count=count)
        db.close()

        log.debug("{} name operations at block {}, offset {}, count {}".format(len(nameops), block_id, offset, count))
        ret = []
        
        for nameop in nameops:
            assert 'opcode' in nameop, 'BUG: missing opcode in {}'.format(json.dumps(nameop, sort_keys=True))
            canonical_op = self.sanitize_rec(nameop)
            ret.append(canonical_op)
        
        return self.success_response({'nameops': ret})
86280
def get_project_id():
    
    if os.name == 'nt':
        command = _CLOUD_SDK_WINDOWS_COMMAND
    else:
        command = _CLOUD_SDK_POSIX_COMMAND

    try:
        output = subprocess.check_output(
            (command,) + _CLOUD_SDK_CONFIG_COMMAND,
            stderr=subprocess.STDOUT)
    except (subprocess.CalledProcessError, OSError, IOError):
        return None

    try:
        configuration = json.loads(output.decode('utf-8'))
    except ValueError:
        return None

    try:
        return configuration['configuration']['properties']['core']['project']
    except KeyError:
        return None
1237366
public FlowStatus getFlowStatus(FlowStatusId flowStatusId)
      throws RemoteInvocationException {
    LOG.debug("getFlowConfig with groupName " + flowStatusId.getFlowGroup() + " flowName " +
        flowStatusId.getFlowName());

    GetRequest<FlowStatus> getRequest = _flowstatusesRequestBuilders.get()
        .id(new ComplexResourceKey<>(flowStatusId, new EmptyRecord())).build();

    Response<FlowStatus> response =
        _restClient.get().sendRequest(getRequest).getResponse();
    return response.getEntity();
  }
505800
def status(self):
        
        orig_dict = self._get(self._service_url('status'))
        orig_dict['implementation_version'] = orig_dict.pop('Implementation-Version')
        orig_dict['built_from_git_sha1'] = orig_dict.pop('Built-From-Git-SHA1')
        return Status(orig_dict)
809901
def get_status_from_async(self, response):
        
        self._raise_if_bad_http_status_and_method(response)
        if self._is_empty(response):
            raise BadResponse('The response from long running operation '
                              'does not contain a body.')

        self.status = self._get_async_status(response)
        if not self.status:
            raise BadResponse("No status found in body")

        # Status can contains information, see ARM spec:
        # https://github.com/Azure/azure-resource-manager-rpc/blob/master/v1.0/Addendum.md#operation-resource-format
        # "properties": {
        # /\* The resource provider can choose the values here, but it should only be
        #   returned on a successful operation (status being "Succeeded"). \*/
        #},
        # So try to parse it
        try:
            self.resource = self._deserialize(response)
        except Exception:
            self.resource = None
435237
def status(self, reference_id, **params):
        
        return self.get(VOICE_STATUS_RESOURCE.format(reference_id=reference_id),
                        **params)
631823
def status(self, job_id):
        
        check_jobid(job_id)

        queue = self._get_queue()
        if queue is None:
            raise QueueDoesntExist

        ret, output = self._call('%s %s' % (
                                 shell_escape(queue / 'commands/status'),
                                 job_id),
                                 True)
        if ret == 0:
            directory, result = output.splitlines()
            result = result.decode('utf-8')
            return RemoteQueue.JOB_DONE, PosixPath(directory), result
        elif ret == 2:
            directory = output.splitlines()[0]
            return RemoteQueue.JOB_RUNNING, PosixPath(directory), None
        elif ret == 3:
            raise JobNotFound
        else:
            raise RemoteCommandFailure(command="commands/status",
                                       ret=ret)
988142
def _get_svc(rcd, service_status):
    '''
    
    '''
    ena = None
    lines = __salt__['cmd.run']('{0} rcvar'.format(rcd)).splitlines()
    for rcvar in lines:
        if rcvar.startswith('$') and '={0}'.format(service_status) in rcvar:
            ena = 'yes'
        elif rcvar.startswith('#'):
            svc = rcvar.split(' ', 1)[1]
        else:
            continue

    if ena and svc:
        return svc
    return None
371625
def get_connection_status(self, connection_id):
        
        with self._connections_lock:
            try:
                connection_info = self._connections[connection_id]
                return connection_info.status
            except KeyError:
                return None
429862
def get_status(self):
        

        status = yield from self._hypervisor.send('vm get_status "{name}"'.format(name=self._name))
        if len(status) == 0:
            raise DynamipsError("Can't get vm {name} status".format(name=self._name))
        return self._status[int(status[0])]
701308
def check_number_status(self, number_id):
        
        number_status = self.wapi_functions.checkNumberStatus(number_id)
        return NumberStatus(number_status, self)
98498
def _get_current_deployment_id(self):
        '''
        
        '''
        deploymentId = ''
        stage = __salt__['boto_apigateway.describe_api_stage'](restApiId=self.restApiId,
                                                               stageName=self._stage_name,
                                                               **self._common_aws_args).get('stage')
        if stage:
            deploymentId = stage.get('deploymentId')
        return deploymentId
447995
def status(self, status_id, raise_exception_on_failure=False):
        """"""
        query = {"output": "json", "user_credentials": self.api_key}

        resp = requests.get(
            "%sstatus/%s" % (self._url, status_id), params=query, timeout=self._timeout
        )

        if raise_exception_on_failure and resp.status_code != 200:
            raise DocumentStatusFailure(resp.content, resp.status_code)

        if resp.status_code == 200:
            as_json = json.loads(resp.content)
            if as_json["status"] == "completed":
                as_json["download_key"] = _get_download_key(as_json["download_url"])
            return as_json
        return resp
412822
def get_status(self, statusid):

        

        response = self._req('/user/statuses/{}'.format(statusid))

        s = Status()
        s.from_dict(response)

        return s
199795
def _get_desired_deployment_id(self):
        '''
        
        '''
        deployments = __salt__['boto_apigateway.describe_api_deployments'](restApiId=self.restApiId,
                                                                           **self._common_aws_args).get('deployments')
        if deployments:
            for deployment in deployments:
                if deployment.get('description') == self.deployment_label_json:
                    return deployment.get('id')
        return ''
1356026
@Override
  public OperationStatus getOperationStatus(OperationHandle opHandle)
      throws HiveSQLException {
    Operation operation = sessionManager.getOperationManager().getOperation(opHandle);
    /**
     * If this is a background operation run asynchronously,
     * we block for a configured duration, before we return
     * (duration: HIVE_SERVER2_LONG_POLLING_TIMEOUT).
     * However, if the background operation is complete, we return immediately.
     */
    if (operation.shouldRunAsync()) {
      HiveConf conf = operation.getParentSession().getHiveConf();
      long timeout = HiveConf.getTimeVar(conf,
          HiveConf.ConfVars.HIVE_SERVER2_LONG_POLLING_TIMEOUT, TimeUnit.MILLISECONDS);
      try {
        operation.getBackgroundHandle().get(timeout, TimeUnit.MILLISECONDS);
      } catch (TimeoutException e) {
        // No Op, return to the caller since long polling timeout has expired
        LOG.trace(opHandle + ": Long polling timed out");
      } catch (CancellationException e) {
        // The background operation thread was cancelled
        LOG.trace(opHandle + ": The background operation was cancelled", e);
      } catch (ExecutionException e) {
        // The background operation thread was aborted
        LOG.warn(opHandle + ": The background operation was aborted", e);
      } catch (InterruptedException e) {
        // No op, this thread was interrupted
        // In this case, the call might return sooner than long polling timeout
      }
    }
    OperationStatus opStatus = operation.getStatus();
    LOG.debug(opHandle + ": getOperationStatus()");
    return opStatus;
  }