| 1 | package Net::Cisco::ISE::InternalUser; | ||
| 2 | use strict; | ||
| 3 | use Moose; | ||
| 4 | |||
| 5 | BEGIN { | ||
| 6 | use Exporter (); | ||
| 7 | use vars qw($VERSION @ISA @EXPORT @EXPORT_OK %EXPORT_TAGS %actions); | ||
| 8 | $VERSION = '0.01'; | ||
| 9 | @ISA = qw(Exporter); | ||
| 10 | @EXPORT = qw(); | ||
| 11 | @EXPORT_OK = qw(); | ||
| 12 | %EXPORT_TAGS = (); | ||
| 13 | }; | ||
| 14 | |||
| 15 | %actions = ( "query" => "/ers/config/internaluser/", | ||
| 16 | "create" => "/ers/config/internaluser/", | ||
| 17 | "update" => "/ers/config/internaluser/", | ||
| 18 | "getById" => "/ers/config/internaluser/", | ||
| 19 | ); | ||
| 20 | |||
| 21 | # MOOSE! | ||
| 22 | |||
| 23 | has 'email' => ( | ||
| 24 | is => 'rw', | ||
| 25 | isa => 'Any', | ||
| 26 | ); | ||
| 27 | |||
| 28 | has 'firstName' => ( | ||
| 29 | is => 'rw', | ||
| 30 | isa => 'Str', | ||
| 31 | ); | ||
| 32 | |||
| 33 | has 'lastName' => ( | ||
| 34 | is => 'rw', | ||
| 35 | isa => 'Str', | ||
| 36 | ); | ||
| 37 | |||
| 38 | has 'id' => ( | ||
| 39 | is => 'rw', | ||
| 40 | isa => 'Str', | ||
| 41 | ); | ||
| 42 | |||
| 43 | has 'identityGroups' => ( | ||
| 44 | is => 'rw', | ||
| 45 | isa => 'Str', | ||
| 46 | ); | ||
| 47 | |||
| 48 | has 'name' => ( | ||
| 49 | is => 'rw', | ||
| 50 | isa => 'Str', | ||
| 51 | ); | ||
| 52 | |||
| 53 | has 'changePassword' => ( | ||
| 54 | is => 'ro', | ||
| 55 | isa => 'Str', | ||
| 56 | ); | ||
| 57 | |||
| 58 | #has 'customAttributes' => ( | ||
| 59 | # is => 'ro', | ||
| 60 | # isa => 'ArrayRef', | ||
| 61 | # auto_deref => '1', | ||
| 62 | # ); | ||
| 63 | |||
| 64 | has 'expiryDateEnabled' => ( | ||
| 65 | is => 'rw', | ||
| 66 | isa => 'Str', | ||
| 67 | ); | ||
| 68 | |||
| 69 | has 'expiryDate' => ( | ||
| 70 | is => 'rw', | ||
| 71 | isa => 'Str', | ||
| 72 | ); | ||
| 73 | |||
| 74 | has 'enablePassword' => ( | ||
| 75 | is => 'rw', | ||
| 76 | isa => 'Str', | ||
| 77 | ); | ||
| 78 | |||
| 79 | has 'enabled' => ( | ||
| 80 | is => 'rw', | ||
| 81 | isa => 'Str', | ||
| 82 | ); | ||
| 83 | |||
| 84 | has 'password' => ( | ||
| 85 | is => 'rw', | ||
| 86 | isa => 'Str', | ||
| 87 | ); | ||
| 88 | |||
| 89 | has 'passwordIDStore' => ( | ||
| 90 | is => 'rw', | ||
| 91 | isa => 'Str', | ||
| 92 | ); | ||
| 93 | |||
| 94 | # No Moose | ||
| 95 | |||
| 96 | sub toXML | ||
| 97 | { my $self = shift; | ||
| 98 | my $id = $self->id; | ||
| 99 | my $identitygroups = $self->identityGroups || ""; | ||
| 100 | my $name = $self->name || ""; | ||
| 101 | my $changepassword = $self->changePassword || "false"; | ||
| 102 | my $enabled = $self->enabled || "true"; | ||
| 103 | my $password = $self->password || ""; | ||
| 104 | my $passwordidstore = $self->passwordIDStore || "Internal Users"; | ||
| 105 | my $enablepassword = $self->enablePassword || ""; | ||
| 106 | my $expirydate = $self->expiryDate || ""; | ||
| 107 | my $expirydateenabled = $self->expiryDateEnabled || "false"; | ||
| 108 | my $lastname = $self->lastName || ""; | ||
| 109 | my $firstname = $self->firstName || ""; | ||
| 110 | my $email = $self->email || ""; | ||
| 111 | my $result = ""; | ||
| 112 | |||
| 113 | # <expiryDateEnabled>$expirydateenabled</expiryDateEnabled> | ||
| 114 | # <expiryDate>$expirydate</expiryDate> | ||
| 115 | # <passwordIDStore>$passwordidstore</passwordIDStore> | ||
| 116 | |||
| 117 | #<name>$name</name> | ||
| 118 | |||
| 119 | #if ($id) { $result = " <id>$id</id>\n"; } | ||
| 120 | $result .= <<XML; | ||
| 121 | <changePassword>$changepassword</changePassword> | ||
| 122 | <customAttributes/> | ||
| 123 | <email>$email</email> | ||
| 124 | <enabled>$enabled</enabled> | ||
| 125 | <firstName>$firstname</firstName> | ||
| 126 | <identityGroups>$identitygroups</identityGroups> | ||
| 127 | <lastName>$lastname</lastName> | ||
| 128 | <password>$password</password> | ||
| 129 | XML | ||
| 130 | |||
| 131 | return $result; | ||
| 132 | } | ||
| 133 | |||
| 134 | sub header | ||
| 135 | { my $self = shift; | ||
| 136 | my $data = shift; | ||
| 137 | my $record = shift; | ||
| 138 | my $name = " name=\"".$record->name."\"" if $record->name; | ||
| 139 | my $id = " id=\"".$record->id."\"" if $record->id; | ||
| 140 | $id ||= ""; | ||
| 141 | my $description = " description=\"".$record->firstName." ".$record->lastName."\""; | ||
| 142 | |||
| 143 | return qq{<?xml version="1.0" encoding="UTF-8" standalone="yes"?><ns3:internaluser$description$name$id xmlns:ns2="ers.ise.cisco.com" xmlns:ns3="identity.ers.ise.cisco.com">$data</ns3:internaluser>}; | ||
| 144 | |||
| 145 | } | ||
| 146 | |||
| 147 | #################### main pod documentation end ################### | ||
| 148 | __PACKAGE__->meta->make_immutable(); | ||
| 149 | |||
| 150 | 1; | ||
| 151 | # The preceding line will help the module return a true value | ||
| 152 |