VGCS UPLINK GRANT Section 9.1.49
424233
def vgcsUplinkGrant():
    """"""
    a = TpPd(pd=0x6)
    b = MessageType(mesType=0x9)  # 00001001
    c = RrCause()
    d = RequestReference()
    e = TimingAdvance()
    packet = a / b / c / d / e
    return packet
527910
public void createGatewayLink(
    VirtualLinkDefinition vld,
    String uuid) throws SIResourceException, SIMPDestinationAlreadyExistsException, SIIncorrectCallException, SIException 
  {
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.entry(tc, "createGatewayLink", new Object[] {vld, uuid});
    
    checkStarted();
      
    destinationManager.createLinkLocalization(vld);
    
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled())
      SibTr.exit(tc, "createGatewayLink");
  }
1168056
def granted(self, lock):
        ''''''
        unit = hookenv.local_unit()
        ts = self.requests[unit].get(lock)
        if ts and self.grants.get(unit, {}).get(lock) == ts:
            return True
        return False
574617
def grant(perm, group_list = [])
      validate_usergroup_list(group_list)
      api.post(['grant', perm].uri_concat, group_list, 'application/json')
    end
540896
def grant_user_to_vswitch(self, vswitch_name, userid):
        """"""
        smt_userid = zvmutils.get_smt_userid()
        requestData = ' '.join((
            'SMAPI %s API Virtual_Network_Vswitch_Set_Extended' % smt_userid,
            "--operands",
            "-k switch_name=%s" % vswitch_name,
            "-k grant_userid=%s" % userid,
            "-k persist=YES"))

        try:
            self._request(requestData)
        except exception.SDKSMTRequestFailed as err:
            LOG.error("Failed to grant user %s to vswitch %s, error: %s"
                      % (userid, vswitch_name, err.format_message()))
            self._set_vswitch_exception(err, vswitch_name)
732507
private void initializeDelegationTokenSupport(Configuration config, URI path) throws IOException {
    logger.atFine().log("GHFS.initializeDelegationTokenSupport");
    // Load delegation token binding, if support is configured
    GcsDelegationTokens dts = new GcsDelegationTokens();
    Text service = new Text(getScheme() + "://" + path.getAuthority());
    dts.bindToFileSystem(this, service);
    try {
      dts.init(config);
      delegationTokens = dts;
      if (delegationTokens.isBoundToDT()) {
        logger.atFine().log(
            "GHFS.initializeDelegationTokenSupport: Using existing delegation token.");
      }
    } catch (IllegalStateException e) {
      logger.atInfo().log("GHFS.initializeDelegationTokenSupport: %s", e.getMessage());
    }
  }
717559
def user_grants(user,
                host='localhost', **connection_args):
    '''
    
    '''
    if not user_exists(user, host, **connection_args):
        log.info('User \'%s\'@\'%s\' does not exist', user, host)
        return False

    dbc = _connect(**connection_args)
    if dbc is None:
        return False
    cur = dbc.cursor()
    qry = 'SHOW GRANTS FOR %(user)s@%(host)s'
    args = {}
    args['user'] = user
    args['host'] = host
    try:
        _execute(cur, qry, args)
    except MySQLdb.OperationalError as exc:
        err = 'MySQL Error {0}: {1}'.format(*exc.args)
        __context__['mysql.error'] = err
        log.error(err)
        return False

    ret = []
    results = salt.utils.data.decode(cur.fetchall())
    for grant in results:
        tmp = grant[0].split(' IDENTIFIED BY')[0]
        if 'WITH GRANT OPTION' in grant[0] and 'WITH GRANT OPTION' not in tmp:
            tmp = '{0} WITH GRANT OPTION'.format(tmp)
        ret.append(tmp)
    log.debug(ret)
    return ret
1365112
def _attach(cls, iface_id, vm_id):
        
        oper = cls.call('hosting.vm.iface_attach', vm_id, iface_id)
        return oper
1359816
function ContactsGroupsPermissionsUpdate(options, groupId, username) {
    ActionAbstract.call(this, options);
    this._groupId = groupId;
    this._username = username;
}
398611
def request(self, verb, subpath, data=''):
        
        if not self.api_key or not self.api_secret:
            raise Exception("Vingd authentication credentials undefined.")
        
        endpoint = urlparse(self.api_endpoint)
        if endpoint.scheme != 'https':
            raise Exception("Invalid Vingd endpoint URL (non-https).")
        
        host = endpoint.netloc.split(':')[0]
        port = 443
        path = urljoin(endpoint.path+'/', subpath)
        
        creds = "%s:%s" % (self.api_key, self.api_secret)
        headers = {
            'Authorization': b'Basic ' + base64.b64encode(creds.encode('ascii')),
            'User-Agent': self.USER_AGENT
        }
        try:
            conn = httplib.HTTPSConnection(host, port)
            conn.request(verb.upper(), quote(path), data, headers)
            r = conn.getresponse()
            content = r.read().decode('ascii')
            code = r.status
            conn.close()
        except httplib.HTTPException as e:
            raise InternalError('HTTP request failed! (Network error? Installation error?)')
        
        try:
            content = json.loads(content)
        except:
            raise GeneralException(content, 'Non-JSON server response', code)
        
        if 200 <= code <= 299:
            try:
                return content['data']
            except:
                raise InvalidData('Invalid server DATA response format!')
        
        try:
            message = content['message']
            context = content['context']
        except:
            raise InvalidData('Invalid server ERROR response format!')
        
        if code == Codes.BAD_REQUEST:
            raise InvalidData(message, context)
        elif code == Codes.FORBIDDEN:
            raise Forbidden(message, context)
        elif code == Codes.NOT_FOUND:
            raise NotFound(message, context)
        elif code == Codes.INTERNAL_SERVER_ERROR:
            raise InternalError(message, context)
        elif code == Codes.CONFLICT:
            raise GeneralException(message, context)
        
        raise GeneralException(message, context, code)
223946
def grant_client(self, client_id, publish=False, subscribe=False, publish_protocol=None, publish_topics=None,
                     subscribe_topics=None, scope_prefix='predix-event-hub', **kwargs):
        
        scopes = ['openid']
        authorities = ['uaa.resource']

        zone_id = self.get_zone_id()
        # always must be part of base user scope
        scopes.append('%s.zones.%s.user' % (scope_prefix, zone_id))
        authorities.append('%s.zones.%s.user' % (scope_prefix, zone_id))

        if publish_topics is not None or subscribe_topics is not None:
            raise Exception("multiple topics are not currently available in preidx-py")

        if publish_topics is None:
            publish_topics = ['topic']

        if subscribe_topics is None:
            subscribe_topics = ['topic']

        if publish:
            # we are granting just the default topic
            if publish_protocol is None:
                scopes.append('%s.zones.%s.grpc.publish' % (scope_prefix, zone_id))
                authorities.append('%s.zones.%s.grpc.publish' % (scope_prefix, zone_id))
                scopes.append('%s.zones.%s.wss.publish' % (scope_prefix, zone_id))
                authorities.append('%s.zones.%s.wss.publish' % (scope_prefix, zone_id))

            else:
                scopes.append('%s.zones.%s.%s.publish' % (scope_prefix, zone_id, publish_protocol))
                authorities.append('%s.zones.%s.%s.publish' % (scope_prefix, zone_id, publish_protocol))

            # we are requesting multiple topics
            for topic in publish_topics:
                if publish_protocol is None:
                    scopes.append('%s.zones.%s.%s.grpc.publish' % (scope_prefix, zone_id, topic))
                    scopes.append('%s.zones.%s.%s.wss.publish' % (scope_prefix, zone_id, topic))
                    scopes.append('%s.zones.%s.%s.user' % (scope_prefix, zone_id, topic))
                    authorities.append('%s.zones.%s.%s.grpc.publish' % (scope_prefix, zone_id, topic))
                    authorities.append('%s.zones.%s.%s.wss.publish' % (scope_prefix, zone_id, topic))
                    authorities.append('%s.zones.%s.%s.user' % (scope_prefix, zone_id, topic))
                else:
                    scopes.append('%s.zones.%s.%s.%s.publish' % (scope_prefix, zone_id, topic, publish_protocol))
                    authorities.append('%s.zones.%s.%s.%s.publish' % (scope_prefix, zone_id, topic, publish_protocol))
        if subscribe:
            # we are granting just the default topic
            scopes.append('%s.zones.%s.grpc.subscribe' % (scope_prefix, zone_id))
            authorities.append('%s.zones.%s.grpc.subscribe' % (scope_prefix, zone_id))

            # we are requesting multiple topics
            for topic in subscribe_topics:
                scopes.append('%s.zones.%s.%s.grpc.subscribe' % (scope_prefix, zone_id, topic))
                authorities.append('%s.zones.%s.%s.grpc.subscribe' % (scope_prefix, zone_id, topic))

        self.service.uaa.uaac.update_client_grants(client_id, scope=scopes,
                                                   authorities=authorities)

        return self.service.uaa.uaac.get_client(client_id)
82242
public void setGrants(java.util.Collection<GrantListEntry> grants) {
        if (grants == null) {
            this.grants = null;
            return;
        }

        this.grants = new com.ibm.cloud.objectstorage.internal.SdkInternalList<GrantListEntry>(grants);
    }
618532
def grant_user(userid, vswitch_name):
    
    print("\nGranting user %s ..." % userid)
    user_grant_info = client.send_request('vswitch_grant_user', vswitch_name, userid)

    if user_grant_info['overallRC']:
        raise RuntimeError("Failed to grant user %s!" %userid)
    else:
        print("Succeeded to grant user %s!" % userid)
211630
def _setup_call_false(vrn_file, rm_bed, base_dir, data, call_type):
    
    out_file = os.path.join(base_dir, "%s.vcf.gz" % call_type)
    if not utils.file_exists(out_file):
        with file_transaction(data, out_file) as tx_out_file:
            if not vrn_file.endswith(".gz"):
                vrn_file = vcfutils.bgzip_and_index(vrn_file, out_dir=os.path.dirname(tx_out_file))
            cmd = ("bcftools view -R {rm_bed} -f 'PASS,.' {vrn_file} -O z -o {tx_out_file}")
            do.run(cmd.format(**locals()), "Prepare %s with empty reference" % call_type, data)
    return {call_type: out_file}
1116042
function getSubmissionStatus(params, cb) {
  var resourcePath = config.addURIParams("/appforms/submissions/:id/status", params);
  var method = "GET";
  var data = {};

  params.resourcePath = resourcePath;
  params.method = method;
  params.data = data;

  //Flagging This Request As A File Request
  params.fileRequest = true;

  mbaasRequest.app(params, cb);
}
1020620
public void grantResource(ResourceRequestInfo req, ResourceGrant grant) {
    if (deleted) {
      throw new RuntimeException("Session: " +
          sessionId + " has been deleted");
    }

    removePendingRequest(req);
    idToGrant.put(req.getId(), grant);
    addGrantedRequest(req);

    // Handle the first wait metrics
    synchronized (typeToFirstWait) {
      if (!typeToFirstWait.containsKey(req.getType())) {
        throw new IllegalStateException(
            "Impossible to get a grant prior to requesting a resource.");
      }
      Long firstWait = typeToFirstWait.get(req.getType());
      if (firstWait == null) {
        firstWait = new Long(ClusterManager.clock.getTime() - startTime);
        typeToFirstWait.put(req.getType(), firstWait);
      }
    }
  }
873446
public void setPropagatingVgws(java.util.Collection<PropagatingVgw> propagatingVgws) {
        if (propagatingVgws == null) {
            this.propagatingVgws = null;
            return;
        }

        this.propagatingVgws = new com.amazonaws.internal.SdkInternalList<PropagatingVgw>(propagatingVgws);
    }