Software Development Kit (SDK) and API Discussions

snapvault-primary-set-snapshot-schedule with API

gabor_attila_horvath
3,331 Views

Hello,

i probed set the primary snavaul snap sched with Perl API, but in can't make a children for 'schedule' element. Perl Dumper Output:

bless( {

        'content' => '',

        'name' => 'snapvault-primary-set-snapshot-schedule',

        'children' => [

                        bless( {

                                 'content' => 6,

                                 'name' => 'retention-count',

                                 'children' => [],

                                 'attrvals' => [],

                                 'attrkeys' => []

                               }, 'NaElement' ),

                        bless( {

                                 'content' => 'sv_hourly',

                                 'name' => 'schedule-name',

                                 'children' => [],

                                 'attrvals' => [],

                                 'attrkeys' => []

                               }, 'NaElement' ),

                        bless( {

                                 'content' => 'asp_test',

                                 'name' => 'volume_name',

                                 'children' => [],

                                 'attrvals' => [],

                                 'attrkeys' => []

                               }, 'NaElement' ),

                        bless( {

                                 'content' => 'snapvault-schedule-info',

                                 'name' => 'schedule',

                                 'children' => [],

                                 'attrvals' => [],

                                 'attrkeys' => []

                               }, 'NaElement' ),

                        bless( {

                                 'content' => '0-23',

                                 'name' => 'hours-of-day',

                                 'children' => [],

                                 'attrvals' => [],

                                 'attrkeys' => []

                               }, 'NaElement' )

                      ],

        'attrvals' => [],

        'attrkeys' => []

      }, 'NaElement' )

I will the following result to achieve:

bless( {

        'content' => '',

        'name' => 'snapvault-primary-snapshot-schedule-info',

        'children' => [

                        bless( {

                                 'content' => 'vgm110',

                                 'name' => 'volume-name',

                                 'children' => [],

                                 'attrvals' => [],

                                 'attrkeys' => []

                               }, 'NaElement' ),

                        bless( {

                                 'content' => 'sv_weekly',

                                 'name' => 'schedule-name',

                                 'children' => [],

                                 'attrvals' => [],

                                 'attrkeys' => []

                               }, 'NaElement' ),

                        bless( {

                                 'content' => '6',

                                 'name' => 'retention-count',

                                 'children' => [],

                                 'attrvals' => [],

                                 'attrkeys' => []

                               }, 'NaElement' ),

                        bless( {

                                 'content' => '',

                                 'name' => 'schedule',

                                 'children' => [

                                                 bless( {

                                                          'content' => '',

                                                          'name' => 'snapvault-schedule-info',

                                                          'children' => [

                                                                          bless( {

                                                                                   'content' => 'sun',

                                                                                   'name' => 'days-of-week',

                                                                                   'children' => [],

                                                                                   'attrvals' => [],

                                                                                   'attrkeys' => []

                                                                                 }, 'NaElement' ),

                                                                          bless( {

                                                                                   'content' => '1',

                                                                                   'name' => 'hours-of-day',

                                                                                   'children' => [],

                                                                                   'attrvals' => [],

                                                                                   'attrkeys' => []

                                                                                 }, 'NaElement' )

                                                                        ],

                                                          'attrvals' => [],

                                                          'attrkeys' => []

                                                        }, 'NaElement' )

                                               ],

                                 'attrvals' => [],

                                 'attrkeys' => []

                               }, 'NaElement' )

                      ],

        'attrvals' => [],

        'attrkeys' => []

      }, 'NaElement' )

Can you help, how to use the functions? My code look like this:

my $in = NaElement->new("snapvault-primary-set-snapshot-schedule");

$in->child_add_string("retention-count", 6);

$in->child_add_string("schedule-name", "sv_hourly");

$in->child_add_string("volume_name", "asp_test");

$in->child_add_string("schedule","snapvault-schedule-info");

$in->child_add_string("hours-of-day", "0-23");

#my $result = $s->invoke($in);

print Dumper($in);

1 ACCEPTED SOLUTION

gabor_attila_horvath
3,331 Views

I find out the good structurce!

my $pre = NaElement->new("snapvault-primary-set-snapshot-schedule");

my $pre2 = NaElement->new("snapshot-schedule");

my $in = NaElement->new("snapvault-primary-snapshot-schedule-info");

$in->child_add_string("volume-name", "asp_test");

$in->child_add_string("schedule-name", "sv_weekly");

$in->child_add_string("retention-count", '2');

my $child = NaElement->new("schedule");

     my $child_child = NaElement->new("snapvault-schedule-info");

     $child_child->child_add_string("days-of-week", "sun");

     $child_child->child_add_string("hours-of-day", "1");

     $child->child_add($child_child);

$in->child_add($child);

$pre2->child_add($in);

$pre->child_add($pre2);

my $result = $s->invoke_elem($pre);

And the good structure:

bless( {

                 'content' => '',

                 'name' => 'snapvault-primary-set-snapshot-schedule',

                 'children' => [

                                 bless( {

                                          'content' => '',

                                          'name' => 'snapshot-schedule',

                                          'children' => [

                                                          bless( {

                                                                   'content' => '',

                                                                   'name' => 'snapvault-primary-snapshot-schedule-info',

                                                                   'children' => [

                                                                                   bless( {

                                                                                            'content' => 'asp_test',

                                                                                            'name' => 'volume-name',

                                                                                            'children' => [],

                                                                                            'attrvals' => [],

                                                                                            'attrkeys' => []

                                                                                          }, 'NaElement' ),

                                                                                   bless( {

                                                                                            'content' => 'sv_weekly',

                                                                                            'name' => 'schedule-name',

                                                                                            'children' => [],

                                                                                            'attrvals' => [],

                                                                                            'attrkeys' => []

                                                                                          }, 'NaElement' ),

                                                                                   bless( {

                                                                                            'content' => '2',

                                                                                            'name' => 'retention-count',

                                                                                            'children' => [],

                                                                                            'attrvals' => [],

                                                                                            'attrkeys' => []

                                                                                          }, 'NaElement' ),

                                                                                   bless( {

                                                                                            'content' => '',

                                                                                            'name' => 'schedule',

                                                                                            'children' => [

                                                                                                            bless( {

                                                                                                                     'content' => '',

                                                                                                                     'name' => 'snapvault-schedule-info',

                                                                                                                     'children' => [

                                                                                                                                     bless( {

                                                                                                                                              'content' => 'sun',

                                                                                                                                              'name' => 'days-of-week',

                                                                                                                                              'children' => [],

                                                                                                                                              'attrvals' => [],

                                                                                                                                              'attrkeys' => []

                                                                                                                                            }, 'NaElement' ),

                                                                                                                                     bless( {

                                                                                                                                              'content' => '1',

                                                                                                                                              'name' => 'hours-of-day',

                                                                                                                                              'children' => [],

                                                                                                                                              'attrvals' => [],

                                                                                                                                              'attrkeys' => []

                                                                                                                                            }, 'NaElement' )

                                                                                                                                   ],

                                                                                                                     'attrvals' => [],

                                                                                                                     'attrkeys' => []

                                                                                                                   }, 'NaElement' )

                                                                                                          ],

                                                                                            'attrvals' => [],

                                                                                            'attrkeys' => []

                                                                                          }, 'NaElement' )

                                                                                 ],

                                                                   'attrvals' => [],

                                                                   'attrkeys' => []

                                                                 }, 'NaElement' )

                                                        ],

                                          'attrvals' => [],

                                          'attrkeys' => []

                                        }, 'NaElement' )

                               ],

                 'attrvals' => [],

                 'attrkeys' => []

               }, 'NaElement' );

View solution in original post

1 REPLY 1

gabor_attila_horvath
3,332 Views

I find out the good structurce!

my $pre = NaElement->new("snapvault-primary-set-snapshot-schedule");

my $pre2 = NaElement->new("snapshot-schedule");

my $in = NaElement->new("snapvault-primary-snapshot-schedule-info");

$in->child_add_string("volume-name", "asp_test");

$in->child_add_string("schedule-name", "sv_weekly");

$in->child_add_string("retention-count", '2');

my $child = NaElement->new("schedule");

     my $child_child = NaElement->new("snapvault-schedule-info");

     $child_child->child_add_string("days-of-week", "sun");

     $child_child->child_add_string("hours-of-day", "1");

     $child->child_add($child_child);

$in->child_add($child);

$pre2->child_add($in);

$pre->child_add($pre2);

my $result = $s->invoke_elem($pre);

And the good structure:

bless( {

                 'content' => '',

                 'name' => 'snapvault-primary-set-snapshot-schedule',

                 'children' => [

                                 bless( {

                                          'content' => '',

                                          'name' => 'snapshot-schedule',

                                          'children' => [

                                                          bless( {

                                                                   'content' => '',

                                                                   'name' => 'snapvault-primary-snapshot-schedule-info',

                                                                   'children' => [

                                                                                   bless( {

                                                                                            'content' => 'asp_test',

                                                                                            'name' => 'volume-name',

                                                                                            'children' => [],

                                                                                            'attrvals' => [],

                                                                                            'attrkeys' => []

                                                                                          }, 'NaElement' ),

                                                                                   bless( {

                                                                                            'content' => 'sv_weekly',

                                                                                            'name' => 'schedule-name',

                                                                                            'children' => [],

                                                                                            'attrvals' => [],

                                                                                            'attrkeys' => []

                                                                                          }, 'NaElement' ),

                                                                                   bless( {

                                                                                            'content' => '2',

                                                                                            'name' => 'retention-count',

                                                                                            'children' => [],

                                                                                            'attrvals' => [],

                                                                                            'attrkeys' => []

                                                                                          }, 'NaElement' ),

                                                                                   bless( {

                                                                                            'content' => '',

                                                                                            'name' => 'schedule',

                                                                                            'children' => [

                                                                                                            bless( {

                                                                                                                     'content' => '',

                                                                                                                     'name' => 'snapvault-schedule-info',

                                                                                                                     'children' => [

                                                                                                                                     bless( {

                                                                                                                                              'content' => 'sun',

                                                                                                                                              'name' => 'days-of-week',

                                                                                                                                              'children' => [],

                                                                                                                                              'attrvals' => [],

                                                                                                                                              'attrkeys' => []

                                                                                                                                            }, 'NaElement' ),

                                                                                                                                     bless( {

                                                                                                                                              'content' => '1',

                                                                                                                                              'name' => 'hours-of-day',

                                                                                                                                              'children' => [],

                                                                                                                                              'attrvals' => [],

                                                                                                                                              'attrkeys' => []

                                                                                                                                            }, 'NaElement' )

                                                                                                                                   ],

                                                                                                                     'attrvals' => [],

                                                                                                                     'attrkeys' => []

                                                                                                                   }, 'NaElement' )

                                                                                                          ],

                                                                                            'attrvals' => [],

                                                                                            'attrkeys' => []

                                                                                          }, 'NaElement' )

                                                                                 ],

                                                                   'attrvals' => [],

                                                                   'attrkeys' => []

                                                                 }, 'NaElement' )

                                                        ],

                                          'attrvals' => [],

                                          'attrkeys' => []

                                        }, 'NaElement' )

                               ],

                 'attrvals' => [],

                 'attrkeys' => []

               }, 'NaElement' );

Public