src/sasctl/_services/model_publish.py
def publish_model(cls,
                      model,
                      destination,
                      name=None,
                      code=None,
                      notes=None):
        """Publish a model to an existing publishing destination.

        Parameters
        ----------
        model : str or dict
            The name or id of the model, or a dictionary representation of
            the model.
        destination : str or dict
            The name or id of the publishing destination, or a dictionary
            representation of the destination
        name : str, optional
            Name of the published model.  Defaults to the model name.
        code : str, optional
            The code to be published.
        notes

        Returns
        -------

        """
        code_types = {
            'ds2package': 'ds2',
            'datastep': 'datastep',
            '': ''
        }

        model = cls._model_repository.get_model(model)
        model_uri = cls._model_repository.get_model_link(model, 'cls')

        # Get score code from registry if no code specified
        if code is None:
            code_link = cls._model_repository.get_model_link(model,
                                                             'scoreCode',
                                                             True)
            if code_link:
                code = cls.get(code_link['href'])

        request = dict(
            name=name or model.get('name'),
            notes=notes,
            destinationName=destination,
        )

        modelContents = {
            'modelName': model.get('name'),
            'modelId': model.get('id'),
            'sourceUri': model_uri.get('href'),
            'publishLevel': 'model',        # ?? What are the options?
            'codeType': code_types[model.get('scoreCodeType', '').lower()],
            'codeUri': '',          # ??  Not needed if code is specified?
            'code': code
        }

        request['modelContents'] = [modelContents]
        return cls.post('/models', json=request, headers={
            'Content-Type':
                'application/vnd.sas.models.publishing.request+json'})
Publish a model to an existing publishing destination.

        Parameters
        ----------
        model : str or dict
            The name or id of the model, or a dictionary representation of
            the model.
        destination : str or dict
            The name or id of the publishing destination, or a dictionary
            representation of the destination
        name : str, optional
            Name of the published model.  Defaults to the model name.
        code : str, optional
            The code to be published.
        notes

        Returns
        -------

        
Publish a model to an existing publishing destination.
Parameters

model : str or dict
The name or id of the model, or a dictionary representation of
the model.
destination : str or dict
The name or id of the publishing destination, or a dictionary
representation of the destination
name : str, optional
Name of the published model.  Defaults to the model name.
code : str, optional
The code to be published.
notes

Returns
Publish a model to an existing publishing destination . Parameters model : str or dict The name or id of the model or a dictionary representation of the model . destination : str or dict The name or id of the publishing destination or a dictionary representation of the destination name : str optional Name of the published model . Defaults to the model name . code : str optional The code to be published . notes Returns
def publish_model(cls,
                      model,
                      destination,
                      name=None,
                      code=None,
                      notes=None):
        code_types = {
            'ds2package': 'ds2',
            'datastep': 'datastep',
            '': ''
        }
        model = cls._model_repository.get_model(model)
        model_uri = cls._model_repository.get_model_link(model, 'cls')
        if code is None:
            code_link = cls._model_repository.get_model_link(model,
                                                             'scoreCode',
                                                             True)
            if code_link:
                code = cls.get(code_link['href'])
        request = dict(
            name=name or model.get('name'),
            notes=notes,
            destinationName=destination,
        )
        modelContents = {
            'modelName': model.get('name'),
            'modelId': model.get('id'),
            'sourceUri': model_uri.get('href'),
            'publishLevel': 'model',        
            'codeType': code_types[model.get('scoreCodeType', '').lower()],
            'codeUri': '',          
            'code': code
        }
        request['modelContents'] = [modelContents]
        return cls.post('/models', json=request, headers={
            'Content-Type':
                'application/vnd.sas.models.publishing.request+json'})
def publish_model ( cls , model , destination , name = None , code = None , notes = None ) : code_types = { 'ds2package' : 'ds2' , 'datastep' : 'datastep' , '' : '' } model = cls . _model_repository . get_model ( model ) model_uri = cls . _model_repository . get_model_link ( model , 'cls' ) if code is None : code_link = cls . _model_repository . get_model_link ( model , 'scoreCode' , True ) if code_link : code = cls . get ( code_link [ 'href' ] ) request = dict ( name = name or model . get ( 'name' ) , notes = notes , destinationName = destination , ) modelContents = { 'modelName' : model . get ( 'name' ) , 'modelId' : model . get ( 'id' ) , 'sourceUri' : model_uri . get ( 'href' ) , 'publishLevel' : 'model' , 'codeType' : code_types [ model . get ( 'scoreCodeType' , '' ) . lower ( ) ] , 'codeUri' : '' , 'code' : code } request [ 'modelContents' ] = [ modelContents ] return cls . post ( '/models' , json = request , headers = { 'Content-Type' : 'application/vnd.sas.models.publishing.request+json' } )
Publish a model to an existing publishing destination.
Publish a model to an existing publishing destination .
"""Publish a model to an existing publishing destination.

        Parameters
        ----------
        model : str or dict
            The name or id of the model, or a dictionary representation of
            the model.
        destination : str or dict
            The name or id of the publishing destination, or a dictionary
            representation of the destination
        name : str, optional
            Name of the published model.  Defaults to the model name.
        code : str, optional
            The code to be published.
        notes

        Returns
        -------

        """ # Get score code from registry if no code specified # ?? What are the options? # ??  Not needed if code is specified?
cls
model
destination
name
code
notes