Try PubSub+
If you haven't already, check out our new Developer Portal! You'll find useful information about Solace PubSub+ as well as handy resources to get you started.

Can the SEMP – REST API work with a READ-ONLY user? If so, how do you create one?

We want to delegate monitoring capability to another team, but we don’t want to give them the ability to change the configuration.

Thanks in advance!

Best Answer

Answers

  • surya kumarsurya kumar Member Posts: 4

    Hi, Could you please provide some examples for legacy semp .
    Am trying to create scripts from jenkins pipeline to create/delete destinations/bridges,VPN etc..
    Thanks,
    Surya | 9082961373

  • brendabrenda Member, Employee Posts: 2

    Example:
    Legacy SEMP to create a queue

    platform: Solace PubSub+ Enterprise Version 9.2.0.14

    We want to do the following CLI commands over SEMP:

    enable > configure > message-spool message-vpn default > create queue Q1
    enable > configure > message-spool message-vpn default > queue Q1 > access-type exclusive
    enable > configure > message-spool message-vpn default > queue Q1 > permission all delete
    enable > configure > message-spool message-vpn default > queue Q1 > subscription topic a/>
    enable > configure > message-spool message-vpn default > queue Q1 > no shutdown
    

    So we issue the following legacy SEMP messages (illustrated with curl)

    curl -u admin:admin -d '<rpc semp-version="soltr/9_2_0VMR">
        <message-spool>
            <vpn-name>default</vpn-name>
            <create>
                <queue>
                    <name>Q1</name>
                </queue>
            </create>
        </message-spool>
    </rpc>' http://192.168.133.77:8080/SEMP
    
    curl -u admin:admin -d '<rpc semp-version="soltr/9_2_0VMR">
        <message-spool>
            <vpn-name>default</vpn-name>
            <queue>
                <name>Q1</name>
                <access-type>
                    <exclusive></exclusive>
                </access-type>
            </queue>
        </message-spool>
    </rpc>' http://192.168.133.77:8080/SEMP
    
    
    curl -u admin:admin -d '<rpc semp-version="soltr/9_2_0VMR">
        <message-spool>
            <vpn-name>default</vpn-name>
            <queue>
                <name>Q1</name>
                <permission>
                    <all></all>
                    <delete></delete>
                </permission>
            </queue>
        </message-spool>
    </rpc>' http://192.168.133.77:8080/SEMP
    
    curl -u admin:admin -d '<rpc semp-version="soltr/9_2_0VMR">
        <message-spool>
            <vpn-name>default</vpn-name>
            <queue>
                <name>Q1</name>
                <subscription>
                    <topic>a/&gt;</topic>
                </subscription>
            </queue>
        </message-spool>
    </rpc>' http://192.168.133.77:8080/SEMP
    
    curl -u admin:admin -d '<rpc semp-version="soltr/9_2_0VMR">
        <message-spool>
            <vpn-name>default</vpn-name>
            <queue>
                <name>Q1</name>
                <no>
                   <shutdown></shutdown>
                </no>
            </queue>
        </message-spool>
    </rpc>' http://192.168.133.77:8080/SEMP
    

    Of course, you will need a management username with more than read-only permission for this. I have illustrated using the admin user.

    To find the xml syntax to use, there is a "cli-to-semp" utility on the broker. If you ssh to the broker and get a shell in the application container (eg by running solacectl shell) you will be able to run cli-to-semp. Here is an example:

    [[email protected] ~]$ cli-to-semp 'enable configure message-spool message-vpn default queue Q1 access-type exclusive'
    SEMP Request:
    <rpc semp-version="soltr/9_2_0VMR">
        <message-spool>
            <vpn-name>default</vpn-name>
            <queue>
                <name>Q1</name>
                <access-type>
                    <exclusive></exclusive>
                </access-type>
            </queue>
        </message-spool>
    </rpc>
    
Sign In or Register to comment.