Forum Discussion

david78's avatar
david78
Icon for Nimbostratus rankNimbostratus
Feb 27, 2014

Update an internal Data-group

hi, i would like update a group. What's the better way : iControl or iControlREST ? Someone have an example to read and modify an internal Data-group with perl ?

 

thank you.

 

6 Replies

  • I chose iControlREST, and write a PERL script. I can read a data-group internal, but i can't add a new value.

    I have an error with 'Records'. someone can help me ?

    my %payload;
    $payload{'name'} = $datagroup;
    $payload{'type'} = 'string';
    $payload{'records'} = { 'name' => 'test-rest1', 'data' => 'test-data-rest1' };
    
    my $json = encode_json \%payload;
    
    $bigip->PUT('ltm/data-group/internal/', $json);
    
  • hello,

    now, i can update the Datagroup, but i can't add some data.

    sub modif_datagroup {
        my ($bigip, $datagroup) = @_;
        my $json = '{"name":"test1","records":"test1"}';
    
        $bigip->PATCH('ltm/data-group/internal/~Common~'. $datagroup, $json);
    }
    
    When i list the all properties, i have this :
    
    (tmos) list ltm data-group internal my-datagroup all-properties 
        ltm data-group internal my-datagroup {
            app-service none
            description none
            partition Common
            records {
                test1 {
                    data none
                }
            }
            type string
        }
    

    Someone can explain me how i can add a data in datagroup ?

  • i found ! This code works for add some data in Datagroup :

     

     Modif datagroup
    sub modif_datagroup {
        my ($bigip, $datagroup) = @_;
        my $json = '{"records":[{"name":'.$name1.',"data":'.$data1.'},{"name":'.$name2.',"data":'.$data2.'},{"name":'.$name3.',"data":'.$data3.'}]}';
    
        $bigip->PATCH('ltm/data-group/internal/~Common~'. $datagroup, $json);
    }
  • hi david, another customer is looking for help on this with perl, would you mind uploading your completed data-group perl script to the codeshare, or email it to me at rahm -at- f5 -dot- com and I'll take care of it? Thanks!

     

  • Hi, there is really no way to add or edit a single entry in a Datagroup?