Load an existing Scope Group by name and service group id into a high level Scope Group object

        :param str name: Name of an existing Scope Group
        :param int service_group_id: id of the service group the Scope group is associated with
357083
def loadScopeGroupbyName(self, name, service_group_id, callback=None, errback=None):
        
        import ns1.ipam
        scope_group = ns1.ipam.Scopegroup(self.config, name=name, service_group_id=service_group_id)
        return scope_group.load(callback=callback, errback=errback)
1304669
def add_group(self, groupname):
        
        url = self._options['server'] + '/rest/api/latest/group'

        # implementation based on
        # https://docs.atlassian.com/jira/REST/ondemand/#d2e5173

        x = OrderedDict()

        x['name'] = groupname

        payload = json.dumps(x)

        self._session.post(url, data=payload)

        return True
4072
def get_service(self, service_name):
        
        service = self.services.get(service_name)
        if not service:
            raise KeyError('Service not registered: %s' % service_name)
        return service
155476
public static servicegroup_servicegroupmember_binding[] get(nitro_service service, String servicegroupname) throws Exception{
		servicegroup_servicegroupmember_binding obj = new servicegroup_servicegroupmember_binding();
		obj.set_servicegroupname(servicegroupname);
		servicegroup_servicegroupmember_binding response[] = (servicegroup_servicegroupmember_binding[]) obj.get_resources(service);
		return response;
	}
1181577
def service_name_from_scope_name(scope_name):
    

    def replace_char(match):
        c = match.group(0)
        return '-' if c in '. _' else "u{:04d}".format(ord(c))

    service_name = re.sub(r'[^a-z0-9\-]', replace_char, scope_name.lower())
    return service_name[0:230]
671275
def servicegroup_server_add(sg_name, s_name, s_port, **connection_args):
    '''
    
    '''
    # Nitro will throw an error if the server is already present
    ret = True
    server = _servicegroup_get_server(sg_name, s_name, s_port, **connection_args)
    if server is not None:
        return False
    nitro = _connect(**connection_args)
    if nitro is None:
        return False
    sgsb = NSServiceGroupServerBinding()
    sgsb.set_servicegroupname(sg_name)
    sgsb.set_servername(s_name)
    sgsb.set_port(s_port)
    try:
        NSServiceGroupServerBinding.add(nitro, sgsb)
    except NSNitroError as error:
        log.debug('netscaler module error - NSServiceGroupServerBinding() failed: %s', error)
        ret = False
    _disconnect(nitro)
    return ret
229897
def show_group(self, group_id):
        
        res = self.post('loadGroups', {'groupId': group_id})
        if isinstance(res, list):
            return _fix_group(res[0])
        else:
            return _fix_group(res)
99389
def read_identities_by_scope(self, scope_id, query_membership=None, properties=None):
        
        query_parameters = {}
        if scope_id is not None:
            query_parameters['scopeId'] = self._serialize.query('scope_id', scope_id, 'str')
        if query_membership is not None:
            query_parameters['queryMembership'] = self._serialize.query('query_membership', query_membership, 'str')
        if properties is not None:
            query_parameters['properties'] = self._serialize.query('properties', properties, 'str')
        response = self._send(http_method='GET',
                              location_id='28010c54-d0c0-4c89-a5b0-1c9e188b9fb7',
                              version='5.0',
                              query_parameters=query_parameters)
        return self._deserialize('[Identity]', self._unwrap_collection(response))
1115668
def linkify_s_by_sg(self, servicegroups):
        
        for serv in self:
            new_servicegroups = []
            if hasattr(serv, 'servicegroups') and serv.servicegroups != '':
                for sg_name in serv.servicegroups:
                    sg_name = sg_name.strip()
                    servicegroup = servicegroups.find_by_name(sg_name)
                    if servicegroup is not None:
                        new_servicegroups.append(servicegroup.uuid)
                    else:
                        err = "Error: the servicegroup '%s' of the service '%s' is unknown" %\
                              (sg_name, serv.get_dbg_name())
                        serv.add_error(err)
            serv.servicegroups = new_servicegroups
1272228
def get_scope_by_name(self, scope_name):
        
        query_parameters = {}
        if scope_name is not None:
            query_parameters['scopeName'] = self._serialize.query('scope_name', scope_name, 'str')
        response = self._send(http_method='GET',
                              location_id='4e11e2bf-1e79-4eb5-8f34-a6337bd0de38',
                              version='5.0-preview.2',
                              query_parameters=query_parameters)
        return self._deserialize('IdentityScope', response)
1058223
def servicegroup_server_up(sg_name, s_name, s_port, **connection_args):
    '''
    
    '''
    server = _servicegroup_get_server(sg_name, s_name, s_port, **connection_args)
    return server is not None and server.get_svrstate() == 'UP'
1287652
def get_scope_by_id(self, scope_id):
        
        route_values = {}
        if scope_id is not None:
            route_values['scopeId'] = self._serialize.url('scope_id', scope_id, 'str')
        response = self._send(http_method='GET',
                              location_id='4e11e2bf-1e79-4eb5-8f34-a6337bd0de38',
                              version='5.0-preview.2',
                              route_values=route_values)
        return self._deserialize('IdentityScope', response)
1041966
def add_parameter_to_group(self, parameter, group_name):
        
        groups = self.metadata \
            .setdefault("AWS::CloudFormation::Interface", {}) \
            .setdefault("ParameterGroups", [])

        if isinstance(parameter, BaseAWSObject):
            parameter = parameter.title

        # Check if group_name already exists
        existing_group = None
        for group in groups:
            if group["Label"]["default"] == group_name:
                existing_group = group
                break

        if existing_group is None:
            existing_group = {
                "Label": {"default": group_name},
                "Parameters": [],
            }
            groups.append(existing_group)

        existing_group["Parameters"].append(parameter)

        return group_name
3868
def bind(self, flask_app, service, group=None):
        """"""
        if group not in self.services[service]:
            raise RuntimeError(
                'API group {} does not exist in service {}'.format(
                    group, service)
            )
        for name, api in self.services[service][group].items():
            # only bind APIs that have views associated with them
            if api.view_fn is None:
                continue
            if name not in flask_app.view_functions:
                flask_app.add_url_rule(
                    api.url, name, view_func=api.view_fn, **api.options)
848697
def _sg_name_dict(self, sg_id, rules):
        """"""
        related_ids = set([sg_id])
        related_ids |= set(filter(None, [r['remote_group_id'] for r in rules]))
        related_sgs = self.client.list_security_groups(id=related_ids,
                                                       fields=['id', 'name'])
        related_sgs = related_sgs.get('security_groups')
        return dict((sg['id'], sg['name']) for sg in related_sgs)
1086980
def create_group(self, name):
        
        self.project_service.set_auth(self._token_project)
        return self.project_service.create_group(name)
1336724
def get(self, sg_id):
        
        secgroup = self.client.show_security_group(sg_id).get('security_group')
        sg_dict = self._sg_name_dict(sg_id, secgroup['security_group_rules'])
        return SecurityGroup(secgroup, sg_dict)